question

Fang J avatar image
0 Likes"
Fang J asked Fang J commented

agv state value

Hi I need your advice.

I made a code that captures the status of the AGVs at all times,and print the informations that the AGVs is blocked.But,when the model is runs to 21seconds ,the printed status is blocked,but the listening status is Travel loaded.

AGV.fsm

agv.png

FlexSim 21.2.0
agv
agv.png (149.5 KiB)
agv.fsm (85.3 KiB)
· 2
5 |100000

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

Felix Möhlmann avatar image Felix Möhlmann commented ·
It seems like your model didn't properly upload, only the screenshot is attached as a file. Could you please try to upload the model again? Otherwise it's difficult to help.
0 Likes 0 ·
Fang J avatar image Fang J Felix Möhlmann commented ·

I have re-upload the model,thanks~.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Fang J commented

The first state change that happens after the agv arrives at the control point is from state 15 to 15 (checking whether the end position was reached, then resuming travel - probably). Only then, does the state change to blocked. The wait for event in your code thus registers the change to state 15.

I would suggest to have the event triggered source listen to state changes of the instance object and trigger if it becomes blocked. The current position can still be found through the "currentCP" property of the AGV class.

string position = AGV(current).currentCP.name;

agv_fm.fsm

I hope this helps.


agv-fm.fsm (73.8 KiB)
· 2
5 |100000

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

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

You can also just add a breathe/zero time delay and assign the state then instead of on state change.

The value of the state is

current.stats.state().value


1642082804791.png


0 Likes 0 ·
1642082804791.png (17.8 KiB)
Fang J avatar image Fang J commented ·

this is what i'm looking for! thank you

0 Likes 0 ·