question

Maciej Kotlicki avatar image
0 Likes"
Maciej Kotlicki asked Sam Stubbs commented

Starting a Process Flow in Tasksequence

I'm trying to implement a process flow into an existing simulation that is mainly built using task sequence and triggers OnMessage.

I'm having troubles starting my process flow (that mainly dictates how flow items are to be located insinde a Queue) through that task sequence.

Choose One
process flowtask sequenceprocess flow tasksequencehelp request
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

·
Matt Long avatar image
1 Like"
Matt Long answered Sam Stubbs commented

Process Flow has two activities that can be used to listen to events on objects. This is the Event-Triggered Source and the Wait For Event. The Event-Triggered Source will create a new token when the event fires, the Wait for Event requires a token to already exist that will wait on the activity until the specified event fires.

In both cases you can tie the activity to listen to events like On Entry, On Message, etc. (Use the sample button and hover over the desired object to see a list of that object's events). Each events passes in different parameters that you get access to (for instance, a reference to an entering or exiting item). You can store off the parameters and then send the token through a set of activities to perform whatever logic you're trying to accomplish.

· 3
5 |100000

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

Sam Stubbs avatar image Sam Stubbs ♦ commented ·

I've not used it much myself yet, but there is a createtoken() command. This will create a token in the instanced (or general) process flow, at the designated activity. You could try using this command to create tokens at a certains starting point in your process flow, during the execution of the task sequence code.

Here is the info about create token:

createtoken(instanceObject, activity, start)

Creates a token and places the token inside the activity for the given owner object (instance).

Parameters

(obj instanceObject, obj/str activity, int start)

Description

Creates a token and places the token inside the activity for the given owner object (instance). If start is 1, the token will immediately call the activity's start and begin moving through the process flow. If start is 0, the token will sit in the activity until releasetoken() is called on the token. Calling releasetoken() will fire the activity's finish causing the activity's start to never be called. This may affect how the token responds to the activity it was created in.

For example, if a token is created in an Assign Labels activity with a start of 1, the created token will evaluate the Assign Labels as if entering the activity and receive whatever labels are assigned to it. If a token is created in the same Assign Labels with a start of 0 and then later releasetoken() is called on that token, the token will never evaluate the Assign Labels and will not get any labels set on it.

Return value is the created token.

Example

treenode token = creattoken(node("Operator1", model()), "Start", 0);
setlabel(token, "type", 1);
releasetoken(token);

0 Likes 0 ·
Mischa Spelt avatar image Mischa Spelt Sam Stubbs ♦ commented ·

Did you copy that verbatim from the user manual? Because there is a typo in the first line of the example: creat(e)token.

0 Likes 0 ·
Matt Long avatar image Matt Long Mischa Spelt commented ·

Thanks for pointing that out.

0 Likes 0 ·

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.