AGV startRecharge

AGV startRecharge

xucq
Enthusiast Enthusiast
829 Views
3 Replies
Message 1 of 4

AGV startRecharge

xucq
Enthusiast
Enthusiast

[ FlexSim 19.2.4 ]

I want to use startRecharge command to simulate agv electronic. The agv is created by the usercommand, because the agv number is flexsible.

When I use the agv network's way point logic, it did work,as the gif1.

23969-1121.gif

But when I use my user command to create a new agv ,then use a customer code activity to startRecharge, it didnot work the first time,I must run second time ,and then the startRecharge command will work.Such as the gif2.

23970-1122.gif

Because my model is special, I need to use the customer code activity to realize my logic. Can you tell me why it has to run second time which just like a update, is there any other way?agv-chargev1924-1.fsmagv-chargev1924.fsm

0 Likes
Accepted solutions (1)
830 Views
3 Replies
Replies (3)
Message 2 of 4

joshua_s
Not applicable

@Shiny Xu

Have you tried to use resources for your AGVs? It allows you to set the amount of AGVs you will use at the start of your model.

0 Likes
Message 3 of 4

Brandon_Peterson
Autodesk
Autodesk
Accepted solution

Shiny Xu,

The reason that you are having a problem with the model is that a specific data node is not being created/updated properly until after you run the model once. if you add the following line of code to the end of your user command "createagv" your model will work the first time you hit reset and run.

function_s(getvarnode(aa, "navigator").first.value, "assertStatistic", "BatteryLevel");

If for some reason you think that someone will just try to hit run without hitting reset first you can also add the command "resetmodel()" after the line above.

I want to give a shout out to @anthony.johnson for supplying me with the line of code that fixed the problem. I wouldn't have been able to do it without him!

Good Luck with the rest of your model! Brandon

img src="https://damassets.autodesk.net/content/dam/autodesk/logos/autodesk-logo-primary-rgbblack-small_forum.png" >

Brandon Peterson
Principal Technology Consultant
>
Message 4 of 4

xucq
Enthusiast
Enthusiast

Thank you and Anthony for your answer.

It's very helpful.