use label to control agv speed

use label to control agv speed

a9080109
Observer Observer
23 Views
5 Replies
Message 1 of 6

use label to control agv speed

a9080109
Observer
Observer

[ FlexSim 25.0.0 ]

i want to set the speed by label and label will catch plc but i use this code to control but speed didnt change

token.agv.as(Object).setVariable("emptyspeed", token.speed);

plc.fsm

1744792504552.png1744792516642.png

0 Likes
24 Views
5 Replies
Replies (5)
Message 2 of 6

moehlmann_fe
Observer
Observer

You need to change the values in the speeds table in the AGV network properties. To do so, you can cast the marked "speeds" node as a table and use the normal table syntax to change values. Keep in mind that changes will only take effect at the start of the next travel task.

1744875126496.png

(I don't know what the "loadedspeed" and "emptyspeed" variables are actually used for)

0 Likes
Message 3 of 6

a9080109
Observer
Observer

so my code will change like?

token.agv.as(Object).setVariable("plc", token.speed);

i think it weird

0 Likes
Message 4 of 6

moehlmann_fe
Observer
Observer

No, you need to change the value in the speeds table of the AGV navigator object. Assuming the AGV has the first (DefaultAGV) type, then that would be the following.

Object agvNav = ownerobject(AGV(token.agv));
treenode speeds = agvNav.find(">variables/agvTypes/1/speeds"); Table speedsTable = speeds; speedsTable[8][1] = token.speed; // Forward empty speedsTable[8][2] = token.speed; // Forward loaded speedsTable[14][1] = token.speed; // Reverse empty speedsTable[14][2] = token.speed; // Reverse loaded
0 Likes
Message 5 of 6

a9080109
Observer
Observer
the wrong code happend!!

Flexscript Error MODEL:/Tools/ProcessFlow/ProcessFlow/Custom Code>variables/codeNode Line 8 Invalid type for parameter 1 in call to command ownerobject. Expecting treenode. Type is AGV Flexscript Error MODEL:/Tools/ProcessFlow/ProcessFlow/Custom Code>variables/codeNode Could not finish parsing because of previous errors.

0 Likes
Message 6 of 6

moehlmann_fe
Observer
Observer

Add "as(treenode)".

Object agvNav = ownerobject(AGV(token.agv).as(treenode));

0 Likes