How can I make reference to an ASRS task queue lenght in a decide ?

How can I make reference to an ASRS task queue lenght in a decide ?

christian_b3
Not applicable
17 Views
5 Replies
Message 1 of 6

How can I make reference to an ASRS task queue lenght in a decide ?

christian_b3
Not applicable

[ FlexSim 22.0.1 ]

I need to know how many jobs it has in its queue and take a decision based on this

0 Likes
Replies (5)
Message 2 of 6

joerg_vogel_HsH
Mentor
Mentor

I assume you have a model with classic 3D logic: input and output connections, edges for center ports and so on. Your model hasn’t got a dispatcher to distribute tasksequences (transport jobs). Then you need to get a property on a variable node in the object tree of your Taskexecuter called tasksequencequeue.

please refer to the example of dispatcher subclass of Taskexecuter class api in manual.

https://docs.flexsim.com/en/22.0/Reference/CodingInFlexSim/FlexScriptAPIReference/TaskExecuter/Dispa...

The feature of a dispatcher is inherited for every taskexecuter in FlexSim.

obj(dispatcher).taskSequences.length 

obj(dispatcher) is in this case a reference to your Taskexecuter.

if my assumptions aren’t applying to your model, then please be so kind and attach your model or better an example model of your matter in your question. Thanks!

0 Likes
Message 3 of 6

christian_b3
Not applicable

thanks for your prompt reply !

I have several ASRS in the model so I stored the reference into "token.traslo". when I write: "int numTaskSequences = token.traslo.taskSequences.length;" it gives this exception: "FlexScript exception: Label property taskSequences retrieved on /ASRSvehicle1. Label does not exist".

I have also tried this one w/o success: "int numTaskSequences = token.traslo.as(Object).taskSequences.length;"

Could this code also achieve the same purpose: "int numTaskSequences = token.traslo.subnodes.length;" ? it does not give exception but so far it gave me always a zero outcome, I don't know if this is for it considers the only task it has, as already completed, or it is a reference to something else. Thank you, your comment is really appreciated !

0 Likes
Message 4 of 6

joerg_vogel_HsH
Mentor
Mentor
It is time to attach a model! We aren’t able to identify your setup just by a textual description.
0 Likes
Message 5 of 6

jason_lightfootVL7B4
Autodesk
Autodesk
You need
token.traslo.as(Dispatcher).taskSequences.length
Message 6 of 6

Jeanette_Fullmer
Community Manager
Community Manager

Hi @CHRISTIAN B3,

We haven't heard back from you. Were you able to solve your problem? If so, please add and accept an answer to let others know the solution. Or please respond to the previous comment so that we can continue to help you.

If we don't hear back in the next 3 business days, we'll assume you were able to solve your problem and we'll close this case in our tracker. You can always comment back at any time to reopen your question, or you can contact your local FlexSim distributor for phone or email help.

0 Likes