question

Maryam H2 avatar image
0 Likes"
Maryam H2 asked Maryam H2 commented

Read Percenatge and Time from a Global Table

Hi there,

How can I retrieve the percentage and processing times for a specific process from the global table? In other words, I have a particular process that, for X% of the time, it takes TR (1,3,2), and for Y% of the time, it takes TR (10,13,11), and so on. I want the process to access the global table, read the percentage and time split, and execute accordingly.

Thanks

FlexSim 23.1.2
global tableprocesstimeprocess
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Natalie White avatar image Natalie White commented ·

Hi @Maryam H2,

It's hard to know how to help without looking at your model. To receive a more accurate solution, please post your model or a sample model that demonstrates your question.

Proprietary models can be posted as a private question visible only to FlexSim U.S. support staff. You can also contact your local FlexSim distributor for phone or email help.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Maryam H2 commented

Format the table to have on column contain the percentage chance that the respective row is used. And another columns is set to contain a FlexScript function that returns a value from the given dsitribution (RightClick -> Assign Data -> Assign FlexScript Data).

1686212407188.png

Note that for the fourth parameter, where you would normally see something like getstream(activity), we use param(1). The random number stream will later be passed into the function when we call it from the Patient Flow.

Getting the time value is a two step process. First determine which row to use by using the By Percentage option in the assign labels activity. Now that the row number is known we use Table().cell() to access the node where the cell value is stored rather than the value itself. Since the node contains FlexScript code, it can be executed by using evaluate(), passing in the random number stream belonging to the current activity.

1686212675457.png

distribution-by-percentage-fm.fsm

Alternatively you could also store the Min, Max, Mode values in separate columns and then pass those into the distribution once the row is known.

1686212834369.png


· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Maryam H2 avatar image Maryam H2 commented ·
Got it, thanks! @Felix Möhlmann
0 Likes 0 ·