question

FRANCESCO S2 avatar image
0 Likes"
FRANCESCO S2 asked Jason Lightfoot edited

how can i charge my AGV

hi everyone,

in my warehouse i would like that the task executer goes to battery station when the battery goes down 15 % and than it restarts its task.

I show my logic in this picture but the "decide" doesn't work well.

this is the model: elci 2 alb.fsm

can anybody help me?

FlexSim 20.0.1
agvbattery charge
immagine4.png (40.4 KiB)
elci-2-alb.fsm (151.8 KiB)
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
1 Like"
Jason Lightfoot answered Jason Lightfoot edited

In your script window you can test access to the BatteryLevel using this:

AGV(Model.find("TaskExecuter1")).batteryLevel

or

AGV agv1=AGV(Model.find("TaskExecuter1"));
return agv1.batteryLevel;

You will see it doesn't work unless the Navigator is set to AGVNetwork, and as you state in your comments you're using A*. One key indicator that it will work is if the quick properties of the task executer show AGV Properties like this:

In your model's case you'll just see this in that area:



agvquick.png (4.4 KiB)
astarquick.png (2.0 KiB)
5 |100000

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

tannerp avatar image
0 Likes"
tannerp answered FRANCESCO S2 commented

@FRANCESCO S2,

I don't know if you're aware of this already, but there is an AGV Process Flow template that has the battery/recharging logic built-in. I suggest reviewing that in case it fits your needs. It will save you lots of headaches creating your own logic.

If you're already familiar with the AGV Process Flow template, then let's try and figure out the Decide activity. The Decide activity in the model you uploaded causes the model to crash. I suggest updating the syntax of your AGV reference from this:

AGV(token.Pickers).batteryLevel;

to this:

token.Pickers.as(AGV).batteryLevel;

For whatever reason, this accesses the AGV object in the correct way. (I'm not the person to explain this, but I know the syntax is important.) Try accessing your AGV's battery level in this new way I've explained in both your Decide and Custom Code activities and see if it works better.

Hopefully this helps!


1602112147748.png (8.4 KiB)
· 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.

tannerp avatar image tannerp commented ·

You're also going to want to use the code below for recharging the AGV. I don't think batteryLevel works like most variables and so you can't just tell it to be 100 and have that work. At least, I don't think so. Try using this and then a delay activity (like while your AGV is parked).

0 Likes 0 ·
1602112350015.png (5.3 KiB)
FRANCESCO S2 avatar image FRANCESCO S2 tannerp commented ·

I think that the classic logic doesn' t work because my task executer travel with A* navigation logic and maybe it can influence the classic AGV Process Flow template for charging

1 Like 1 ·
FRANCESCO S2 avatar image FRANCESCO S2 tannerp commented ·

thank you, but I try to modify the syntax from:

AGV(token.Pickers).batteryLevel;

to:

AGV(token.Pickers).batteryLevel;

in "decide" and also in costum code but it doesn't work and give me the same error:

time: 50.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/ProcessFlow/Decide~2>variables/decision

time: 52.195545 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/ProcessFlow/Custom Code~2>variables/codeNode

than I try also to modify the custom code with:

AGV(current).startRecharge().

but the same i didnt fix the problem.

0 Likes 0 ·