question

David Seo avatar image
0 Likes"
David Seo asked Logan Gold edited

how to change the speed via the conveyorSystem's conveyorType using code

I set many conveyors' speed via conveyorSystem's conveyorType.

The conveyor System has various conveyor Types with different speed.

I want to change many conveyors speed via conveyor Type in the conveyor system using code.

How can I change the speed of them?

For example,

1) set the gloval variable as the conveyor speed

2) manually change the gloval variable speed

3) Reset trigger will make the conveyors speed using code of gloval variable..

I attach the sample model.

changeconveyorspeed.fsm

FlexSim 17.0.3
how to change the conveyor speed of conveyortype
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

Logan Gold avatar image
0 Likes"
Logan Gold answered Logan Gold edited

The problem with the code in your example model is the speed node that is a subnode of the ConveyorType1 node is not a variable of ConveyorType1, so setvarnum will not work in this situation. Instead, you can use some more dot syntax FlexScript like this:

conv1.subnodes["speed"].value = gvSpeed1;
conv2.subnodes["speed"].value = gvSpeed2;
5 |100000

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