question

Enrique Elizaga avatar image
1 Like"
Enrique Elizaga asked Ben Wilson commented

What is the command to wait for a tasksequence to be completed?

Hi, I am working with a tasksequence in my process flow. To keep it compact I have included all my task sequence activities in one custom code activty as shown below. (Create, travel, load, finish and dispatch). I am encountering a problem though... the token doesn't wait for the tasksequence to be completed and moves on to the next activities. I have solved this by adding a separate dispatch activity that allows me to chose "Wait Until Complete". How can I add that option to my code to avoid that additional DISPATCH ACTIVITY? I attach the model also. Thanks!

Dispatch.fsm

FlexSim 20.1.1
flexsim 20.1.1process flow tasksequencedispatch
1594134363327.png (401.5 KiB)
dispatch.fsm (1.2 MiB)
· 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.

Ben Wilson avatar image Ben Wilson ♦♦ commented ·

Hi @enrique.elizaga, was mischa.spelt's or tanner.p's answer helpful? If so, please click the red "Accept" button on one of their answers. Or if you still have questions, add a comment and we'll continue the conversation.

0 Likes 0 ·
Mischa Spelt avatar image
1 Like"
Mischa Spelt answered

Code executes "instantaneously". More precisely, while code is running the model time cannot advance. What you can do, if you insist on creating task sequences manually, is insert a callback task (e.g. TASKTYPE_NODEFUNCTION) that will execute a specific node when that task is reached.

But since you seem to be using ProcessFlow already, I agree with @tanner.p that you should probably just create the whole task sequence using the activities especially designed for that, and they tend to have a "Wait for completion" checkbox that does exactly what you want.

5 |100000

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

tannerp avatar image
0 Likes"
tannerp answered

@Enrique Elizaga,

You can try adding a TaskSequence.dispatch() activity as explained in the User Manual. But, I don't think this will wait for the task sequence to be completed like in the Process Flow. What you're doing is probably the best/easiest solution for this. Is there a reason why you can't use the Dispatch activity in Process Flow?

Also, keep in mind that FlexSim used to require using custom task sequences for everything. We strayed from that and developed Process Flow activities so you don't have to go through all the trouble of what you're doing. So, unless there's a really good reason against using Process Flow activities, I suggest using them.

5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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