question

Adam C avatar image
1 Like"
Adam C asked Adam C commented

Stop token in delay task sequence activity when operator is stopped?

DelayActivity-StopToken.fsmThis is a simplified concept model, but I have an operator being used for transport and process tasks built in Process Flow. He gets scheduled breaks via a time table. The time table calls stopobject() on the operator, but the activity timer (delay task sequence) does not pause. Functionally, the work continues to "do itself" while the operator is down.

How would I stop progress (the activity timer) until the break is over? I have tried referencing the tokens as contents or subnodes of the activity, but cannot get the references working in order to call Token.stop.


FlexSim 20.0.5
process flowtokensflexsim 20.0.5delay activitystop tokens
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 Adam C commented

You'll need to use preemption activities to remove the token from the delay task when the object is stopped, wait until the object resumes and then move the token back into the delay task. The preemption activities will store where in the delay time the token was at when it was saved and then starts the delay time back up in the restore context. I've updated your model to show how that would work.

delayactivity-stoptoken.fsm


· 5
5 |100000

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

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

@Matt Long @Adam C You can also use the Token.stop() and Token.resume() flexscript methods to do the same thing without actually having to move the token out of the delay activity.

0 Likes 0 ·
Adam C avatar image Adam C commented ·

It works nicely! In my actual model, this is scaled up where there are many operators, station types, and stations of each type using common process flow "brains" for each. The Operator OnStop triggers for each station (since each station uses the logic), making 10x+ more tokens for evaluation due to duplication. Is there a way to limit this? I can check and throw away duplicates after creation, but I'd rather not make the duplicates at all.

0 Likes 0 ·
Matt Long avatar image Matt Long Adam C commented ·

I should note that doing it this way with tasks will cause the delay time to restart. If you want the delay time to resume with the original time remaining, you'll want to either use a Delay activity and set the state of the operator, or when the operator is stopped, you can store off the remaining time so that when you put the token back into the delay task, it uses the updated delay time.

0 Likes 0 ·
Matt Long avatar image Matt Long Adam C commented ·

I'm not sure I fully see what you're doing with creating duplicate tokens. If this process flow is suppose to be the brains of each operator, you can use a Task Executer Process Flow and attach the process flow to the operators. That will create an instance of the flow for each operator. Process Flow Instances

You can also use sub flows to keep from duplicating a bunch of activities. Refer to the user manual for more on Sub Flows.

If this doesn't answer your question, feel free to post a new question.

0 Likes 0 ·
Adam C avatar image Adam C Matt Long commented ·

The process flow has 15 attached objects (instances), which are the stations. It's because I was using the operator group OnStop as the triggering event. Each instance fired the trigger, so it made 15x the needed tokens.

The simple solution was to add the stations to the time table for breaks and use current OnStop.

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.