How to set load and unload time of Task Executers through code

How to set load and unload time of Task Executers through code

sudheer_r
Not applicable
67 Views
3 Replies
Message 1 of 4

How to set load and unload time of Task Executers through code

sudheer_r
Not applicable

[ FlexSim 19.1.2 ]

I am trying to set Load and Unload times of Task Executers through code. How could I achieve that. I am attaching my model for refernce.

acquireresource.fsm

0 Likes
Accepted solutions (1)
68 Views
3 Replies
Replies (3)
Message 2 of 4

mischa_spelt
Advisor
Advisor
Accepted solution

I'll assume that you want to set the load and unload times through process flow. Attached is your model with a load and unload time sampled in Process Flow.

The sampled value is written to a label on the task executer itself:

22935-sampleloadunloadtimes.png

(Of course you can use any custom code you want, instead of the uniform distribution).

I then changed the properties of the 3D object to read the sampled values from the label:

22936-useloadunloadtime.png

The reason for doing it like this, is that the Process Flow is aware of the task executer (through the Acquire Resource), but the opposite is not true -- the task executer does not know that there is a Process Flow. So by pushing the relevant information down to the object you can access it both from the 3D model (using current.labelname) as well as the Process Flow (using token.resource.labelname).

And here is the model itself: 22932-acquireresource-ms.fsm

0 Likes
Message 3 of 4

sudheer_r
Not applicable

@Mischa Spelt

Thanks for the answer it helps me.

But I have one follow on question for the following image, so if I have 20 Task Excuters then for every Task Executer I have to go to Load Time and Unlaod Time tab and should I have to write current.LoadTime and current.UnlaodTime.

22940-22936-useloadunloadtime.png

0 Likes
Message 4 of 4

mischa_spelt
Advisor
Advisor

Yes, but if all task executers are the same, I would recommend not using a Group Resource, but having FlexSim create them:

* Remove all Task Executers except one

* In the Resource, use the Sample button to select it.

* Set the number of resources you want

* Reset the model

22942-resourcewithcount.png

If the "base" task executer is in a Group, all copies created by Process Flow will also be in the group so you can still easily create charts for them.

If you want to change settings, set the Count to 1, reset the model, update the properties and set the count back to what it should be.

0 Likes