question

Kari Payton avatar image
1 Like"
Kari Payton asked Kari Payton edited

Preemption error for context saved in a zone for machine breakdown.

Hi

I get this error on attempt to restore contents on tokens in a zone. preemption-help.fsm

time: 33.379470 exception: Error: Invalid token reference at save context activity "Restore Context" in "ProcessFlow". Must be a valid reference to a token.

I am using the same label for the released tokens.

FlexSim 17.0.2
preemption
preemption-help.fsm (24.9 KiB)
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

Logan Gold avatar image
2 Likes"
Logan Gold answered Kari Payton commented

At time 30.00, the preemptedTokens array is set on token 6 with references to a number of tokens in the model. From time 30.00 to 33.379470, when token 6 is going through a Delay activity, one of the other tokens stored in the preemptedTokens array (token 5) finishes its block of activities and is destroyed in the Sink at the end of that block.

So by the time token 6 hits the Restore Context activity at time 33.379470, it is trying to restore a token with a reference set to NULL and that is what throws the error.

· 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.

Kari Payton avatar image Kari Payton commented ·

@Logan Gold OK that makes sense. So I'm trying to setup machine breakdowns using the preempted token, but it looks like the tokens in the zone are still moving. Do you know a better way to do this? Please note that the machines are being pushed and pulled from lists.

1 Like 1 ·
Logan Gold avatar image Logan Gold ♦♦ Kari Payton commented ·

@Kari Payton, I think the issue is in the Release Token activity. You are referencing token.tokens, but I believe it should be token.preemptedTokens.

Also, in the second Assign Labels activity where you are setting up the preemptedTokens label, the Value field (where it says Tokens in Object) isn't set up quite right. This option is expecting the name of an activity (or zone in this case), but the token.zone label is returning a reference to the zone instead. You should use token.zone.name instead and I believe it will do what you want.

0 Likes 0 ·
Kari Payton avatar image Kari Payton Logan Gold ♦♦ commented ·

OK I got it now. I needed to set that label by "Token in Shared Asset" instead of "Tokens in Activity". Thanks @Logan Gold

Model Reference: preemption-help.fsm

0 Likes 0 ·
preemption-help.fsm (26.9 KiB)