question

hby avatar image
0 Likes"
hby asked hby commented

How to Increase AGV Battery Level on Passing Control Points

Hello, how can I increment the battery level by 8 every time an AGV passes by specific control points?

I attached my model where I tried to create process flow instances for the following control points: charge1, charge2, charge3, charge4, charge5, and charge6.

testing charging battery.fsm

Thank you in advance!

FlexSim 24.2.0
agvcontrolpointbattery charge
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
0 Likes"
Felix Möhlmann answered hby commented

In the Event Triggered Source you assign a pointer reference to the task executer to the label "agv" on the token. Hence you have to access it through "token.agv".

This is, as I said, a pointer to the TE, not the AGV class representation of that TE. Before you can access the batterylevel property you first need to cast it to the correct class.

AGV agv = AGV(token.agv);
agv.batteryLevel += 8;

Furthermore, the "On Arrival" event only fires if the AGV comes to a stop at the control point. To also trigger the logic for passing AGVs use On Pre Arrival, On Allocate or On Deallocate.

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

hby avatar image hby commented ·

Thank you for your answer. I tried changing the assignment, but I still get the same error saying that the label 'agv' doesn't exist on the token.

testing charging battery 2.fsm

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann hby commented ·

The source was setup correctly before. You only enter the label name there.

1728912856255.png

0 Likes 0 ·
1728912856255.png (14.4 KiB)
hby avatar image hby Felix Möhlmann commented ·

Thank you, it’s working!

0 Likes 0 ·