question

Larissa Moraes avatar image
0 Likes"
Larissa Moraes asked Larissa Moraes commented

Statistics Collector for a daily collection of states

I would like to know how to use Statistics Collector to obtain a daily collection of the states of an equipment group and with this data, generate a global table to analyze the collected results.

Generate the data as this example:

1623869565116.png


FlexSim 21.1.4
flexsim 21.1.4statisctis collector
1623869565116.png (15.4 KiB)
5 |100000

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

1 Answer

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Larissa Moraes commented

I build a small sample model with a Statistics Collector that does this.

Daily_States_StatsCollector.fsm

There are two versions of the Collector, differing only in the triggering event. One is triggered by a timer event every 24 hours. In this case every object you want to track needs its own timer event, with the object being passed in as an additional label.

statevent1.png

In the second version, the Collector listens to all objects in a group entering the "Scheduled Down" state (default state for down time in time table) and adds a new row every time this happens. Which state is listened to can of course be changed in the "Condition" option. Alternatively you could also listen to a message you send to the objects each time you want the stats to be collected.
Again the triggering object is added as an additional label, but only so the rest of the Collector can remain unchanged from the first version.

statevent2.png

In the "Columns" tab there are columns for the time, the object and each state you want to track. (For this example I added only four). The value for the states is determined with the following command (where STATE_IDLE is exchanged for the respective state that should be measured):

data.Object.stats.state(0).getTotalTimeAt(STATE_IDLE) - data.Object.LastDayTimes[STATE_IDLE+1]

This determines the total time the object has spend in the state and subtracts the time it had spend in the state during the last measuring. This number is stored in an array-label called (LastDayTimes) on each tracked object. This array has to have space for all possible states the object can enter (max. 52) and has zeros in every entry as reset values.

statcolumns.png

Note that in the sample model there are two array-labels on the processors, one for each of the two Collector versions, so they don't interfere with one another. If you decide to use one of the versions, make sure that the label name in the trigger and state value code has the right label name.

In the "Triggers" tab of the Statistics Collectors I wrote some custom code to update this array once a new row was added.
stattriggercode.pngstattableexample.pngI hope this is what you were looking for.

Kind regards


· 3
5 |100000

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

Larissa Moraes avatar image Larissa Moraes commented ·

Thanks for the reply, helped a lot!

Is it possible to use only one time interval to collect states daily without associating the equipment states as a condition?

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Larissa Moraes commented ·

If you want more control over when the measurement takes place, you could also have the Statistics Collector listen to messages to the group objects. These could be send by via Process Flow to all objects in the group in a chosen interval.

listentomessage.png

sendmessagespf.png

daily-states-statscollector-bymessage.fsm

0 Likes 0 ·
Larissa Moraes avatar image Larissa Moraes Felix Möhlmann commented ·

Thanks for the reply.

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.