dispather

dispather

3250716938
Enthusiast Enthusiast
197 Views
6 Replies
Message 1 of 7

dispather

3250716938
Enthusiast
Enthusiast

[ FlexSim 22.2.1 ]

1671070871369.png

hi, I want have judgement according to source1 outputport when the dispatcher1 dispatched task execute.

eg: taskExecuter1 transport item to Queue1

taskExecuter2 transport item to Queue2

source1 output setting: random port.

how can I do to achieve that logic. thanks guys.

0 Likes
Accepted solutions (1)
198 Views
6 Replies
Replies (6)
Message 2 of 7

jason_lightfootVL7B4
Autodesk
Autodesk

There are many ways to do this - some don't involve a dispatcher - are you tied to having it?

0 Likes
Message 3 of 7

3250716938
Enthusiast
Enthusiast

I get you ideal, but when numbers of task excuter have so many, we must use dispatcher, hence I what to know that did do it or not.

0 Likes
Message 4 of 7

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

You must collect data to make a decision. The source of this data is a tasksequence which you pass to a task executer. Pass To is a functional edit field in your dispatcher.

What you want to do is not standard anymore. You will do some coding to extract data of the tasksequence and decide on that which output port number you return in this function.
You need the references of the unload object, referred sometimes also as destination in tutorials.

This reference is a property in two tasks of a standard tasksequence which is created automatically, if you mark an option “Use Transport“.

You can get this reference from the property involved1 of the 4th task, which Task Type is Travel. And you can get this from the 5th task by involved2 property, too, this Task Type is Unload.
If you have extracted this data you decide in a comparison which output port number you return in your code.

Please try it on you own to extract data of a task of the tasks array from a Task Sequence by task order number and property. And add a filter of conditions to return a correct output port number.
You find in manual needed properties in:

https://docs.flexsim.com/en/22.2/Reference/CodingInFlexSim/FlexScriptAPIReference/TaskExecuter/TaskS...

https://docs.flexsim.com/en/22.2/Reference/CodingInFlexSim/FlexScriptAPIReference/TaskExecuter/TaskS...

https://docs.flexsim.com/en/22.2/Reference/CodingInFlexSim/WritingLogic/WritingLogic.html#if

Sometimes it looks a little bit easier to compare names instead of treenode reference also called pointers, too. Then you can get a name of a treenode by property .name.
https://docs.flexsim.com/en/22.2/Reference/CodingInFlexSim/FlexScriptAPIReference/Tree/treenode.html...

Another filter structure is switch by case:

https://docs.flexsim.com/en/22.2/Reference/CodingInFlexSim/WritingLogic/WritingLogic.html#switch

0 Likes
Message 5 of 7

jason_lightfootVL7B4
Autodesk
Autodesk
Why? You just need a reference to the te that should do the job. That could be on the destination object.
0 Likes
Message 6 of 7

jason_lightfootVL7B4
Autodesk
Autodesk

I think a cleaner approach is to detect and override the return value of the transport dispatcher using an event triggered source, or in the transport dispatcher push the transport job directly to a list - both of these then tell you where the item needs to go. From that information the decision of which TE to use can be based on maps, lists, groups, and/or labels on the destination objects. It saves the user from code that tries to determine the destination from interpreting a sequence of tasks.

Transport dispatcher override example in this post.

0 Likes
Message 7 of 7

andrew_o2
Not applicable

Hi @Murphy, was Joerg Vogel's answer helpful? If so, please click the "Accept" button at the bottom of their answer. 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