question

David Besson avatar image
3 Likes"
David Besson asked Jacob Gillespie commented

Restoring token context with a different resource

(This refers to an answer here about using Process Flow preemption to assign shift schedules)

The "Save Token Context" activity stores also the resource (for example, an operator) acquired by the token.

How could we restore the token context, but with a different resource (other operator)?

For example, if a token had been in a Delay activity for x seconds when its context was saved, it will resume the Delay at x seconds when it is restored BUT NOT the first resource acquired (a new one is then acquired).

FlexSim 16.1.0
process flowresourcepreemptionschedule
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

Adrian Haws avatar image
4 Likes"
Adrian Haws answered Jacob Gillespie commented

The “Save Context” activity only saves data specific to the activity the token is in. For a Delay, that means it saves the delay time and the time the token has already been in the Delay activity. Save Context will not save information on the resource. Something you can do is release the operator and acquire a new one within the preemption flow. I’ve included an example of one way to set this up.

pf-preemption-2.fsm


preemption.png (13.6 KiB)
pf-preemption-2.fsm (27.0 KiB)
· 6
5 |100000

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

Michael O'Connell avatar image Michael O'Connell commented ·
@Adrian Haws

Is there a way to have no specified Delay in the Preempting Event Flow (between Release and Restore)? I would like the delay to be only as long as it takes to Acquire the new resource(s) in the Preempted Token Flow. That might be longer than the Delay of 5 or shorter.

I thought maybe a Wait for Event, but not sure how that would work with multiple tokens preempted on a single preemption.

0 Likes 0 ·
Jacob Gillespie avatar image Jacob Gillespie ♦ Michael O'Connell commented ·

You could restore each entering token after the Sub Flow.

pf-preemption-3.fsm

1 Like 1 ·
pf-preemption-3.fsm (26.8 KiB)
preempt.png (22.4 KiB)
Jacob Gillespie avatar image Jacob Gillespie ♦ Michael O'Connell commented ·
0 Likes 0 ·
Michael O'Connell avatar image Michael O'Connell commented ·

Thanks @Jacob Gillespie, I though I needed the Restore in the main flow.

On a related note, how would you grab more than 1 resource in your sample model. I tried to grab 2 resources by making the following changes: added 2 additional operators and created 2 groups of 2 operators each; assigned those groups to the 2 resources; changed the acquire step to qty=2; replaced the Delay with a task sequence Delay to specify state.

The Acquire step grabs 2 operators and assigns them to the token resource label (array size = 2), but in the Delay activity, only one shows busy. The other remains idle.

Do I need to loop through the operators in the resource label array to get them both working? Is there another way?

0 Likes 0 ·
Jacob Gillespie avatar image Jacob Gillespie ♦ Michael O'Connell commented ·

@Michael O'Connell You should ask this in it's own question.

1 Like 1 ·
Michael O'Connell avatar image Michael O'Connell commented ·

Having trouble uploading modified model. Will continue to try.

0 Likes 0 ·