question

Kuilin S avatar image
0 Likes"
Kuilin S asked Felix Möhlmann commented

How can I get the "Object item" to complete my tasksequence?

Now I want to carry the pallet ahead of processing time. So I send a message when processing and write a tasksequence in the "Queue2".But I could not get the proper parameter for the "Object item". Now it carries the whole processer up. Please help me with that.help-with-the-item.pngdemo_findObject.fsm

FlexSim 22.0.4
tasksequenceitemsend message
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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Felix Möhlmann commented

The 'fromObject' parameter can be set when sending the message. At the moment it is set to 'current'. In just about all triggers/fields, this is a reference to the owner object of the event, so in this case the processor. So fromObject thus shows which object send the message.

The pallets are subnodes of the queue, so you can access them through 'current.subnodes[rank]'. The issue with using a fixed rank will be though, that if a second message arrives before the first pallet was loaded, both task sequences will reference/move the same pallet.

What you could do to circumvent this, is to use a list. Pallets would be pushed to the list when they enter the queue. When a message is received, a pallet is pulled from the list ('List.pull()'), automatically giving a reference to the pulled item, which can be used to construct the task sequence, as well as removing it from the list, so it can't be used twice.

Another way would be to create a label on the queue that shows the rank of the pallet that should be transported next. So whenever a task sequence is created, the label value is increased by one (first pallet is pending -> use second, for example) and decreased again when a pallet leaves the queue (first pallet has left the queue -> can use rank 1 again).

The second suggestion is demonstrated in the attached model.

demo-findobject_1.fsm


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

Kuilin S avatar image Kuilin S commented ·

Thank you for your suggestion. I have tried so many times today, 1hour ago I tried to add "Object item = current.find("Pallet");"to the script and it works all right. Is this another way to fix my problem? hh

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Kuilin S commented ·
Yes, 'current.find("Pallet")' will return the first object inside the queue with the name 'pallet'. This method would be equivalent to using the first subnode via 'current.first' or 'current.subnodes[1]'. So it also has the potential issue that two task sequences could reference the same pallet, if the second was created before the first got to load the pallet.

I don't know how the timing will work out in your model. If you think that this could be a problem I would suggest to use the solution above instead, to make sure every task sequence will take a different pallet.

0 Likes 0 ·