question

mark zhen avatar image
0 Likes"
mark zhen asked Felix Möhlmann commented

use label to control agv speed

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

FlexSim 25.0.0
label valueagv speed
1744792504552.png (3.3 KiB)
1744792516642.png (4.8 KiB)
plc.fsm (67.2 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.

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Felix Möhlmann commented

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)


1744875126496.png (60.7 KiB)
· 4
5 |100000

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

mark zhen avatar image mark zhen commented ·

so my code will change like?

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

i think it weird

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann mark zhen commented ·

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 0 ·
mark zhen avatar image mark zhen Felix Möhlmann commented ·
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 0 ·
Show more comments