question

Kathryn McNeal avatar image
0 Likes"
Kathryn McNeal asked Adrian Haws edited

Referencing the current operator in a processor's code

What is the syntax to reference the current operator that is serving a processor within the processor's code? We are building a model where each operator has a "Proficiency" label, and are trying to figure out how to access the operator's label in the process time code for the processor.

Choose One
operatorlabelscode
5 |100000

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

Jeff Nordgren avatar image
2 Likes"
Jeff Nordgren answered Adrian Haws edited

@Kathryn McNeal

Kathryn,

Attached is a sample model of how I would do that.

I created two User Commands. One called "CallOperator" that is called from the OnEntry trigger of each processor. The Other is "SaveTE" which is called from the OnMessage trigger of each processor.

When a flowitem enters a processor, the CallOperator User Command is called. This command stops the processor, waits for an operator to arrive, starts the processor again, sends a message to the processor (will NULL as the second parameter which defaults to the calling object, which will be the TE). Then in the OnMessage trigger, the SaveTE User Command is called that will save the TE working on that processor to a label "TEid". This will all be done before the process time trigger so you should have access to the TE via the label.

Take a look at the model and see if something like this would work for you. The reason I use the User Commands is so that the code is easily replicated in each processor without having to write processor specific code.

If you have any questions, please let us know.

kathryn-sample1-jn1fsm.fsm


· 4
5 |100000

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

Regan Blackett avatar image
2 Likes"
Regan Blackett answered Kathryn McNeal commented

If you are using a single known operator to work with the machine everytime, you can reference it pretty easily by connecting the oprator to the processor using a center port connection and using the expression centerobject(current, x) where x is the center port number through which the operator and processor are connected.

The problem you may end up having with this using the standard Processor, however is that if you are using a team of operators and the assigned operator isn't the same each time the processor goes to process is that the above expression won't work, because the event that assigns an operator doesn't happen until after the Process Time field is evaluated.

The alternative then is use a Process Flow approach to be able to Acquire an operator in such a way that we know which operator the processor has before figuring out how long to delay. I've included a sample model that uses Process Flow to get what I hope you want; using an Instance Template object from the Process Flow Menu in the Toolbox called "Process Flow > Fixed Resource > Processor with Operator" this creates a reusable object and Process Flow set of logic that mimics the standard processor behavior when using an operator with a Process Flow logical backbone.

Note in the Object library that addition of a new Object; this is created automatically when using one of th eProcess Flow template objects:

Give the model a look and let us know if this is what you had in mind.

instance-processor-proficiency-label.fsm


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

Matt Long avatar image
1 Like"
Matt Long answered

You could have the operator who receives the task sequence to work on the machine set a label on the processor. You may need to look at all the different types of task sequences the operator receives, but the following code works just fine for the standard Call Operators task sequence. I placed this code in the operator's OnReceiveTaskSequence, but keep in mind that this code will be called for EVERY task sequence he receives, regardless of when he receives it, which may not be desired.

  1. if (gettasktype(ts, 4) == TASKTYPE_UTILIZE) {
  2. treenode processor = gettaskinvolved(ts, 4, 2);
  3. setlabel(processor, "operator", current);
  4. }
5 |100000

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