Lenny C avatar image
Lenny C asked Lenny C commented

Column capturing label of token on stats collector


I would like to have an additional column on my zone's (Track WT) stats collector to capture the step value (token label) of my patients. May i know how i can go about doing it? thank you!


FlexSim 20.1.3
labelscustomstats collector
training-model.fsm (86.8 KiB)
· 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.

Ryan Clark avatar image Ryan Clark commented ·

Hi @Lenny C, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
Felix Möhlmann answered Lenny C commented

The "OnStayTimeChange" event does not hold any information about the token/object that caused the change. (As far as I know, because the staytime is implemented as a tracked variable, whose change might not be tied to any object at all.)

You will have to use a different event to determine the timings. A simple solution would be to listen to the "OnEntry" and "OnExit" events of the "EnterZone" and "ExitZone" activities respectively.

I added to example collectors to your model. In the first (StayTime_OnExit_WithLabel), I only listen to tokens exiting the zone. The entry time is written to a token label right before they pass into the zone and later used to calculate the staytime.

The second (StayTime_FromEntryToExit) listens to both entry and exit. On entry the "StayTime" column gets used to store the entry time. When the tokens exits, this value is then used together with the current model time to calculate the staytime. In this case a "rowValue" is necessary to know which exit event belongs to which entry. I use the token reference from the events for this. Also note how the "Finish involved rows after this event" is unchecked for the entry event, because the row will need to be updated later.

In both cases, because the events possess a reference to the token, the "step" label can be easily accessed and assigned to a column value.

Apart from the first one needing an extra process flow activity, the difference between these two options is in what order the rows will be generated. In the first case, the rows will be ordered by the time the tokens exit the zone. In the second, by the entry time.


training-model-fm.fsm (981.3 KiB)
· 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.

Lenny C avatar image Lenny C commented ·
Thank you!

0 Likes 0 ·