Write a usage time in a table

Write a usage time in a table

oscar_c13
Not applicable
257 Views
5 Replies
Message 1 of 6

Write a usage time in a table

oscar_c13
Not applicable

[ FlexSim 21.2.2 ]

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

0 Likes
Accepted solutions (1)
258 Views
5 Replies
Replies (5)
Message 2 of 6

jose_antonio_mad
Not applicable

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.

0 Likes
Message 3 of 6

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

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

0 Likes
Message 4 of 6

oscar_c13
Not applicable

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

ProcessTimeTable.fsm

0 Likes
Message 5 of 6

joerg_vogel_HsH
Mentor
Mentor
In Global Table Quick Properties you can add a behavior what happens On Reset. I have chosen "delete all rows".
0 Likes
Message 6 of 6

jose_antonio_mad
Not applicable

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