question

Nicholas Grazioli avatar image
0 Likes"
Nicholas Grazioli asked Felix Möhlmann commented

AGV custom state

Hi,

I'm working on a model with accumulation paths and AGVs. In this model I would like to make the AGV reach a destination (CP_2) with a specific status (STATE_BUSY), different from the default one (STATE_TRAVEL_EMPTY).

I noticed that the AGV starts to move with the state that I have previously set, but after the allocation of the first point on the path the state of the AGV is overwritten with STATE_TRAVEL_EMPTY. I also tried to disable the accumulation on the paths and if there are control points between the origin CP of the AGV and the destination CP, I've seen the same behavior.

I created a PF with a debug to check when the AGV changes state. The debug triggers at 0.97 seconds the time in which the AGV allocates the first point. So I think it's the allocation mechanism that overwrites the state of the AGV.

I would like to ask if this is a bug or if there is another way I could use to maintain the custom state of the AGV.

I leave attached the model in which I noticed this behavior.

State_Change_After_Allocation_autosave.fsm

FlexSim 22.0.3
agvagvnetworkstates
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

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Felix Möhlmann commented

That's not a bug. All objects in FlexSim (that have a state) will update their state when certain events happen. To keep the busy state I see two possible solutions:

Either define a second state profile on the agv that runs in parallel to the default one. FlexSim will not automatically change states in extra profiles, so you have full control over what state that second profile is in at all times. Though this also means you will have to define each state change manually.

The other option would be to remember which state the agv should be in (in the attached model I simply store in a label) and change the state back every time it switches away. This can be done in the same logic you already built: On any state change, check if the "forcedState" label is set. If that is the case and the toState is different from the forced state, switch back it.

forced-state-fm.fsm


forced-state-fm.fsm (57.1 KiB)
· 4
5 |100000

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

arn-k avatar image arn-k commented ·

Hi all,

I am using the logic on this question to solve the same bug. I had been advised to use parallel states before (I believe is as instructed here) to deal with this issue but since 1) I haven't had worked with nodes and tree mode before and 2) the FlexSim version on my personal computer doesn't have access to the tree mode, I wanted to try adding a "check state" solution that was suggested here.
In my model after the faulty situation comes to an end, machine has to stop and start normal processing again. However, running the simulation, the stopped state switched back to faulty situation (because of the event triggered check state). I wanted to add more constraints. My decision custom code is :

Object current = Model.find("Processor1");

int processorstate = getstatenum(current);

if(current.Fault == 1 && processorstate != STATE_STOPPED)

return 1;

return 2;


But the extra constraint doesn't seem to work. Can anyone help me with it? is there any other/better way to do this? Thanks a lot.screenshot-150.png

try 3 with decide custom code.fsm

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann arn-k commented ·

You never actually stop the processor while it is being repaired. So it keeps cycling through the usual states (Setup, Processing) which your code doesn't take into account.

Furthermore, I'd use the On State Change trigger to have the processing and faulty states override each other, depending on the processor's label.

try-3-with-decide-custom-code-fm.fsm

0 Likes 0 ·
arn-k avatar image arn-k Felix Möhlmann commented ·
Thank you so much @Felix Möhlmann ,

I just don't understand why the processor wasn't being stopped even though a state change code to STATE_STOPPED was in the subflow. Thank you for your help again.

0 Likes 0 ·
Show more comments