question

eduardo-m avatar image
0 Likes"
eduardo-m asked Felix Möhlmann answered

create a trackable tag that performs one mathematical operation based on another

I want to know if it is possible to perform a mathematical operation based on a label that I am using to record the behavior over time of said function. I attach the model where I implement the logic that I want to carry out, the processor label is "time" when the processor is in the state that I chose, it registers it and accumulates, the formula that I want to apply is in the image

1725748293493.png

Times.fsm

FlexSim 23.2.1
global tabletrackedvariablefuncion
1725748293493.png (4.0 KiB)
times.fsm (37.8 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

You don't really need the TR label. The total time spent in a state can be read directly from the state profile. You could create a FlexScript label that returns the value of the function.

Object current = ownerobject(c);
double idleTime = current.stats.state(0).getTotalTimeAt(STATE_IDLE);
return Math.exp(-Math.pow(idleTime/500, 3));

A Statistics Collector could regularly read the value to store values from which to draw a graph.

times_1.fsm


times-1.fsm (38.1 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.