question

CHRISTIAN B3 avatar image
0 Likes"
CHRISTIAN B3 asked Jeanette F commented

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

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

FlexSim 22.0.1
asrsasrs vehicle behaviourtask executers queue
· 5
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 ·

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/Dispatcher.html#Property-taskSequences

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 0 ·
CHRISTIAN B3 avatar image CHRISTIAN B3 Joerg Vogel commented ·

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 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ CHRISTIAN B3 commented ·
You need
token.traslo.as(Dispatcher).taskSequences.length
1 Like 1 ·
Show more comments
Jeanette F avatar image Jeanette F ♦♦ commented ·

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

0 Answers