FlexSim Community Forum

FlexSim Community Forum (https://archive.flexsim.com/index.php)
-   Q&A (https://archive.flexsim.com/forumdisplay.php?f=66)
-   -   how to make AGV decrease speed (https://archive.flexsim.com/showthread.php?t=3334)

Xing Zhang 04-22-2016 01:29 AM

how to make AGV decrease speed
2 Attachment(s)
Could someone provide a solution to this issue:
There are 2 AGVs, travelling on 2 parallel paths, but their direction are opposite.
I want to make both AGVs start to decrease their speed when their distance less than 5m,
until they have passed away each other.
How to build this kind model?

I once tried to use collision spheres,but failed.

Anthony Johnson 04-22-2016 10:00 AM

OK, I'm going to first give you the way I would do it in the current version, and then I'll tell you how I would do it in the next version (due out in June), which in my opinion will be much easier.

In the current version I would put some object in the middle that is there to hold a label containing the number of AGVs in the area. Then I'd use way points to increment and decrement the label, and track the set of AGVs currently in the area. Then when the label gets to 2 or above, I would preempt all the AGVs in the area and get them to restart their travel again, and use the initialize travel field to set their load type to something that says they need to travel slower.

In the next version I would do the same thing in regards to preempting the AGVs, but I would track it all through process flow. In the next version, control areas and control points will have several events that can be subscribed to through process flow. Specifically, I would listen to a control area's OnAllocated and OnDeallocated events to track who is in the control area. And I would listen to the control area's OnAllocationCountChange event to listen for when the number of AGVs in the area gets above 1. When that happens I would preempt all the AGVs in the area, and get them to use a new load type.

The first example is doable, but would require a good amount of code. The second you could do without much code at all.

Jing Chen 04-23-2016 07:16 AM

1 Attachment(s)
Hi Anthony,
I think you may misunderstand what Zhang want to do.
The 2 agvs will decrease their speed "when their distance less than 5m" rather than "all in an area". So agv will slow down in any path.
I think we should detect the distance of 2 agvs in real-time.
Inspired by Anthony's post, I use preempt task to do it. Since distancetotravel() command can not work in AGV path during any running time, I try to use the xloc() to find out the distance between agv and object which only works in staright path.

Maybe collision spheres will be better to find out distance between 2 agvs.

Attached is the model (Version2016) I made and hope it helps.

BTW, I'm looking for a command like distancetotravel() can easily get the distance in AGV path, can anyone help me? or distancetotravel() can work in next version?

Kris Geisberger 04-23-2016 07:40 PM

Careful. Your model is showing different results depending on the Run Speed (refresh rate). You need to call updatelocations() before querying the location of an object in motion.

Jing Chen 04-24-2016 12:18 AM

1 Attachment(s)
Use collision sphere to make a new model.
Much more simple and hope it helps.

Xing Zhang 04-24-2016 09:04 PM

I feel confused about this line code in your model:"if(distance <= slowDown && !flag)"(model 1,line 26),don't quite understand what this mean,why need to judge condition"!flag"? What does this mean to? Is it to determine whether label"flag" exists or not, or whether the value of label"flag" is NULL?
Actually,I always feel confused about this kind of "if" condition,could you please say a little more on this? Thanks a lot.

Jing Chen 04-25-2016 04:29 AM

Hi, Xing
Try to use model2 in #5.
Model1 still has many problems unsolved and the code is also much more and complicated.

PS. label"flag" is used for judge the speed of agvs which you can find in initialize travel field.

SayedMohammad Ayati 05-16-2016 03:56 AM

Jing Chen,

according to your reply, unfortunately I could not open your codes, in my case I would set a condition which is returning the Task Execute to a specific object after passing a certain distance, but it does not work, could you please help me.

Jing Chen 05-16-2016 07:13 AM

I don't know why you can not open my model, my model is built by Version 2016.
I need more information or describe about your model.
Otherwise, you can check this thread https://www.flexsim.com/community/fo...ead.php?t=3147
, maybe it can help.

All times are GMT -6. The time now is 05:07 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.