Set Object State by Custom code but State not change

Set Object State by Custom code but State not change

anutt_k
Not applicable
257 Views
2 Replies
Message 1 of 3

Set Object State by Custom code but State not change

anutt_k
Not applicable

[ FlexSim 22.2.2 ]

Hello. In this case I want to use 2 Operators start travel together but once of Operator will arrive first at the destination.

1673315831474.png


In case of need to use Spilt and Joint in 2D logic from this picture, Operator2 will arrive the destination before Operator1. So Operator2 will be Idel state.

Then I use custom code for try to Set State of Operator2, It should be Waiting state.

How can I set object state in this case at use Split and Joint.

I has attached model here. Thank You.

Test Set State Object in Split.fsm

0 Likes
Accepted solutions (1)
258 Views
2 Replies
Replies (2)
Message 2 of 3

moehlmann_fe
Advocate
Advocate
Accepted solution

When overwriting states of an object, timing is important. In this case, when the travel operation ends, the Process Flow token moves to the next activity and executes it before the state change back to "idle" happens. Because the custom change happens first, it is then immediately overwritten again by the pending change back to "idle".

By placing a 0s delay after the travel activity, you can make sure that the default state change has happened before the custom one is executed.

1673339525623.png

test-set-state-object-in-split_1.fsm

Message 3 of 3

anutt_k
Not applicable
Ok. I get it from your explain. Thank You so much.
0 Likes