question

Jonathan avatar image
0 Likes"
Jonathan asked Jonathan commented

How to I change the 'processdispatcher' variable of a processor with code?

I have a Separator. I want to change the process operator on a trigger, then back on another trigger. I see that 'processdispatcher' is the variable in the tree I need to change.How do I do that?


Reason: In my model, my operator uses downtime behaviour to go on bathroom and lunch breaks. During that time I have a Utility Operator that I want to take over and run the machines.

Is there a better way?

FlexSim 22.0.1
operator
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

Hi @Jonathan, was one of Joerg Vogel's or Regan Blackett's answers helpful? If so, please click the "Accept" button at the bottom of the one that best answers your question. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·
Regan Blackett avatar image
0 Likes"
Regan Blackett answered Jonathan commented

If you are using center port connections for the primary task executer an easy approach would be to have a label on the separator with a default value of 1 to represent needing the primary operator. Then in your trigger set the value of that label to say 2 to represent needing the utility operator. Then set the expression for using an operator to current.centerObjects[current.YourLabelName]. Then make sure your primary operator is connected to the first center port and the utility operator to the second center port.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jonathan avatar image Jonathan commented ·
Thank you. See my reply to Joerg on how I got your method to work while using process flow and Down Behaviors.
0 Likes 0 ·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Jonathan commented

If you connect your operator to his replacement by an object connection “a” type, he becomes himself a dispatcher. And when he is going to lunch by an preempting tasksequence his previous interrupted tasksequence will be dispatched by him to his replacement. Standard functionality of FlexSim.

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·
But that by default has the secondary operator take all jobs that the primary can't when the primary is just normally busy - not only when they go on a break. If the secondary has another dispatcher to service then you wouldn't want to close its inputs either, which otherwise could be an answer.
1 Like 1 ·
Jonathan avatar image Jonathan commented ·

That didn't work for me. I had to connect both to center ports on the machine, then dynamically change which center port was the current operator.

I have a label called 'whichOperator' that reads either 1 or 2 and is set by the Down Behaviors 'On Down' and 'On Resume' code.

In my machine 'Operator' box I put:

current.centerObjects[current.whichOperator]

This method reliably works.changeoperatorcode.png

0 Likes 0 ·