question

shanice.c avatar image
0 Likes"
shanice.c asked Connor A commented

How to use statistics collector to record token label value in onEntry activity?

I have written model.time to two different token labels, and I hope I could write down the token label value when token on entry each activity, at the same time calculate the time between start and ends in third column. I test another example from this forum, I found that there's no problem if the value I'm recording in statistics collector is a label value. Now I try to record the time information, then there's red triangle on left top of a cell, may I ask what this means?

test collect token time.fsm

FlexSim 21.2.0
statistics collector
· 2
5 |100000

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

Joerg Vogel avatar image Joerg Vogel commented ·
Maybe you can start with data collecting tutorial 2.6
0 Likes 0 ·
Connor A avatar image Connor A commented ·

Hi @Fiona 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
0 Likes"
Felix Möhlmann answered Felix Möhlmann commented

The data you are trying to read doesn't exist (yet), that's why you are seeing empty cells with the red mark in the corner. Because you listen to the entry event of the assign activities, the labels you are creating in them don't exist yet, when the statistics collector is triggered.

Instead of assigning the time to label values, you can get the current model time with "Model.time" and assign that value to the cell in the collector.

You also probably want to use a "Row Value". By defining "data.token" as row value, the collector will first check whether a row already exists for that value (the token). If that's the case, no new row will get created, instead the existing one will get updated.

test-collect-token-time_1.fsm


· 2
5 |100000

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

shanice.c avatar image shanice.c commented ·

@Felix Möhlmann Thank you for the example, May I ask how does it know it is the timing to record time if it doesn't check "specify which columns to update" in "starttime"?

is it defaulted to update every columns if not checking anything? In your model, the on second on entry event has checked last two columns(offtime, flowtime), so it seems these 2 columns update at the same time.

1636371795094.png




I also like to ask how to write down the label value using enumerate, if I have several task executers, I want to write down labels value of each TE every time the value has changed. If still using listen to object event, the column is updated instead of keeping add new rows. I went through the manual, it could write data.token.labelname in the "Row Add Value". What's the mistake I make so that the doesn't exist.

1636376408804.png

test-collect-token-time_2.fsm

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann shanice.c commented ·

The first event "Assign start - On Entry" doesn't update any values. It creates the row and sets the values of the first two columns to the values specified in "Row Add Value". The last two columns are then later filled in by the second event. These are marked to be updated in that event. When a value is "updated" the "Event Value" field is used rather than the "Row Add Value" field.

The "Enumerate" event creates a row for each listed object on model reset. Since the selected objects are task executers it has nothing to do with any tokens, so "data.token" doesn't lead anywhere. Where in the manual was this used?

When using enumerated rows you can only access them from events that occur on that same object, so in this case the task executers.

Attached is an example where I listen to the load and unload triggers of the TEs. As such I assign the count label to the TEs (current), not the tokens.

Also, in your model you use both a dispatcher and an instanced process flow to control the task executers. I'd highly advise against mixing 3D- and process flow logic like this. In this case it leads to an error very early, when both task executers try to transport the same item.

test-collect-token-time-2_1.fsm

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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