question

Oscar C13 avatar image
0 Likes"
Oscar C13 asked José Antonio MD commented

Write a usage time in a table

I wanted to be able to write in a table, the time that a processor has been used, but I don´t know what code I have to use in the table to be able to refer to the processing time.

I did this but I don´t know if there is a better way.
ProcessTimeTable.fsm

FlexSim 21.2.2
global tableprocess time
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
0 Likes"
Joerg Vogel answered Joerg Vogel commented

I have two solutions added. I evaluate the staytime twice: first in Processfinish trigger, second by Process Flow:

Model.time-getentrytime(item) // Trigger value for a new row
Model.time-getentrytime(token.item) // Process Flow for a new row value 

Second solution: a label at processor sets a process time

I read this label value. I need a reference to involved processor which I assign in previous event driven source activity to a token label: token.Processor

token.Processor.myCurrentProcessTime // read label value for a new row

You will choose a template in a trigger or in Process Flow for a Custom Code activity

addrowandvalueglobaltable.jpg

getStaytimeProcessor.fsm


· 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.

Joerg Vogel avatar image Joerg Vogel commented ·
In Global Table Quick Properties you can add a behavior what happens On Reset. I have chosen "delete all rows".
0 Likes 0 ·
José Antonio MD avatar image
0 Likes"
José Antonio MD answered José Antonio MD commented

Hello @Oscar C13,


You can use the code "getTotalTimeAt". For example:

Object P=Model.find("Processor1");
return P.stats.state().getTotalTimeAt(2);

You can find more examples in the forum: How to get the collecting time of a process flow Sink from its tree ? - FlexSim Community .

I hope I have been helpful.

· 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.

Oscar C13 avatar image Oscar C13 commented ·

Thanks, I understand,
but if I put this code in the "Code Editor" it doesn´t work well.

ProcessTimeTable.fsm

0 Likes 0 ·
José Antonio MD avatar image José Antonio MD Oscar C13 commented ·

This codeI posted is the same used by statistic collector. However, you don't use the same code I sent to you (P.stats.state().getTotalTimeAt(2) ), you use P.stats.state().getTotalTimeAt("2") . You use a text, that is the reason why your model does not work.

0 Likes 0 ·