question

Michael D6 avatar image
0 Likes"
Michael D6 asked Joerg Vogel commented

AGV Parameter AStar

AGV as Parameter Random Placement.fsmHello, I created a simple model attached that has an A Star network and then an AGV as a parameter. When I increase the number of AGVs they all are placed in the same spot. I would ideally like the AGVs assigned to random spots in the AStar network. Can someone recommend an easy way to do that so that the location of the AGVs is different on startup?

FlexSim 21.2.3
agvastar
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

·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Joerg Vogel commented

Object location property can alter a position of an object by setting separately components of Vec3 property x, y or z. Or you can set a whole position by a created Vec3 data value.

There is a Vec3 class value constructor which translates three double values for x, y, and z or an array of three number values.

Statistical distribution duniform returns discrete values in parameter range lowest to highest value. You can also use other uniform or statistical distributions to get randomly values to assign them as values into a location property.

· 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.

Michael D6 avatar image Michael D6 commented ·
Thanks @Joerg Vogel I think I understand. I will give it a shot. If it is not to much effort would you be able to post a quick sample using the attached model or whatever is easiest. I am not familiar with all of the things you said so this would help.
0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Michael D6 commented ·

In the attached model the "On Set" trigger of the parameter is changed to place each subsequent AGV two meters below the last. As this trigger happens before the reset position is evaluated (which is copied from the first AGV as well), the reset position of the copies has to be cleared. Otherwise the position would be overwritten by it.

The code in the script window at the bottom places each object connected to the dispatcher at a random location within 10 meters in either direction from the model origin point.

agv-as-parameter-random-placement(1).fsm

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Michael D6 commented ·

Each AGV (Taskexecuter has got still a Reset Position active.

You have to clear them at each vehicle by Right Mouse Button Menu!

clear-reset-position.jpgThen a reset trigger can alter the location (eg. Toolbox > Model Triggers > On Model Reset)

Array Gmembers = Group("AGV Count").toFlatArray();
while (Gmembers.length>0){
Object agv = Gmembers.pop();
agv.location.x = duniform(1,19)-10;
agv.location.y = duniform(1,19)-10;
}

agv_random_location.fsm

By the way, if you want to see different locations, please deactivate repeat random streams under statistics menu

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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