question

Shawn Murty avatar image
0 Likes"
Shawn Murty asked Joerg Vogel edited

Labels from operator

How do I get a label from an operator (which uses a dispatcher to be assigned work) to be put onto the processor?

I currently has a specific title to each operator. I want to have the processor grab that information (operator's label) of who worked at the station last. I would then transfer that information to the flow item ( I already know to make this occur).

labels
5 |100000

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

1 Answer

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Joerg Vogel edited

This is a typical situation to use the TASKTYPE_SENDMESSAGE in the tasksequence the operator is doing. Every task in the tasksequence contains 2 node references. These references are in the sendmessage task the receiving object and the transmitting object. If the first reference is set to NULL the operator will this reference exchange to a reference of himself. If the 2nd reference is set to NULL the operator (or any other task executer) replaces the reference by his own reference.

You can insert a sendmessage task when you create your own tasksequence starting from the Task Sequence Example_1 . Or you can insert the task later whenever the tasksequence is received. This happens when the operator gets a tasksequence. The tasksequence contains the data which object receives the unloading item and the item. This data is in the standard transport task sequence in the 5th task. The first involved reference is the reference of the item, the 2nd is the receiving object or unload station.

This means you can extract data when the operator receives a task sequence and use this data to insert a sendmessage task. If you insert a task it will be always at the end of the sequence. Then you can change the rank of the inserted task in the sequence. The processor should know which operators is coming until the item is loaded into the processor. The last possible rank is the 5th.

Object involveditem = gettaskinvolved( ts,5,1);

The 5th task is of the type TASKTYPE_UNLOAD.

Object unloadstation = gettaskinvolved(ts,5,2);
inserttask(ts,TASKTYPE_SENDMESSAGE,unloadstation,NULL);

When an Object receives a message it contains the transmitter. You get access to him by the command msgsendingobject().

Object operator = msgsendingobject();

You can add further numerical data into the message if you place them as parameters [1..3]. If your data is of the type node or object you convert it by the command tonum( obj node) and back after receiving tonode( num value of node).

You want to get data of the operator to the processor. Then you send a message out of the tasksequence to the operator and from the OnMessage trigger of the operator a message again to the processor. The message out of the tasksequence can already contain the reference of the processor wether as converted numerical data or as the 2nd involved reference in the sendmessage task. The message must not be realistic. But be ware of such unrealistic variants, if you are looking for an error in the model the obvious methods won't work then.

5 |100000

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