question

Xu Chunqi avatar image
0 Likes"
Xu Chunqi asked Jason Lightfoot commented

Listen to AGV battery level change

Hi,

I listen to the agv battery level change event and when it decrease to an exact value (such as 50), it creates 2 tokens at the same time.

Why?Q1v2022.0.fsm

1650348648439.png

1650348671215.png

FlexSim 22.0.2
decrease to an exact value
1650348648439.png (34.8 KiB)
1650348671215.png (423.7 KiB)
q1v20220.fsm (44.8 KiB)
· 1
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 ·

Hi @Xu Chunqi, was Phil BoBo's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Phil BoBo avatar image
0 Likes"
Phil BoBo answered Logan Gold edited

It isn't creating two tokens at the same time.

The first token is being created, which goes to the 创建任务序列 activity, which pre-empts the AGV from its current task to start a new travel task in the 行进 activity. In starting that task, it recalculates the AGV's battery level, which creates the second token.

If you add a Delay activity with a value > 0 after the Wait for Event activity, then it will behave the way you want so that the current time can progress enough for the battery level to change before creating the new task that will involve recalculating the battery level.

1650988964149.png

q1v20220_1.fsm


1650988964149.png (276.8 KiB)
q1v20220-1.fsm (46.1 KiB)
· 1
5 |100000

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

Logan Gold avatar image Logan Gold ♦♦ commented ·

Phil's answer is going to be easier, but I had already typed up some other options when he posted his answer, so I figured I'd give some alternatives:


1. You can use a label on the AGV that keeps track of if the AGV has already been sent to a parking spot to be charged. So the default state (reset value) of the label is 0, and as soon as the Process Flow determines the AGV needs to recharge, the label gets set to 1. Then, in the Process Flow, you have a Decide activity right after the Source that sends any tokens to a Sink if that label is set to 1. And finally, when the AGV is finished recharging, you set the label back to a 0.

2. Or you can change the Process Flow to only check the battery level of the AGV after certain events. For example, if you look at the Advanced AGV Process Flow Template, you'll see that part of the decision to have an AGV park is based on if the current battery level is below the given battery recharge threshold:

AGV(current).batteryLevel < getprocessflowvar(processFlow, "BatteryRechargeThreshold")

This only occurs after an AGV has arrived at a Work Point and there is nothing else for it to do (and if there is a Parking Spot available). So you can do something similar, like only check if the AGV needs to park and recharge after it has unloaded an item (and if it is empty). And since the battery level can decrease when the AGV is idle, you might need to set up something in the Process Flow to check the battery level after the AGV has been idle for a certain amount of time.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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