AGV still chooses an alternative route even when the path to Queue2 is idle

AGV still chooses an alternative route even when the path to Queue2 is idle

tom5568835
Participant Participant
198 Views
5 Replies
Message 1 of 6

AGV still chooses an alternative route even when the path to Queue2 is idle

tom5568835
Participant
Participant

I’ve encountered an issue.
As shown in the video, my vehicle still chooses an alternative route even when the path to Queue2 is idle.

 

I suspect the problem might be related to the “Decide” activity in the process flow — specifically the “Send Token To” part. However, after spending 4–5 hours trying (and even checking the FlexSim documentation), I still can’t figure out how to fix it.
I’d really appreciate it if anyone else in the forum could give me some advice on how to resolve this.

 

Also, since my actual model includes several queues and processors (with multiple product process routes), I’d like to ask:
Is there a faster or more general way to build an appropriate process flow, or do I need to create many small ones (like Load to Q2, Load to Q3, …, Load to QN) individually?

 

Thanks in advance for your time and help!

 

Best regards,

 

Fuzi

0 Likes
Accepted solutions (1)
199 Views
5 Replies
Replies (5)
Message 2 of 6

moehlmann_fe
Advocate
Advocate
Accepted solution

Your Decide activity only sends the AGV along the path next to the queue if the output statistic of the "Travel to CP 17" activity is 0. This is naturally only the case for the first (and maybe second, depending on timing) token. What you should do instead is check if CP17 is currently allocated.

And while using a Decide is fine if you only have a single case of such an alternate path, using an Event-Triggered Source that reacts to a request being made would be more easily scalable (the source could listen to a whole group of CPs). The created token can check if the CP is available and reroute the AGV if this is not the case. A 'neat' way to know where the AGV should be redirected to is to use cp connections.

Similarly, if you somehow link the destination queue to the source queue (in the attached model I just use a label), you only need a single Process Flow block with a source that listens to all source queues. One final note: Pushing the item to a list doesn't do anything in your model, since the created token just pulls it immediately. The list can be removed.

 

0 Likes
Message 3 of 6

tom5568835
Participant
Participant

tom5568835_0-1760026662793.png

Hi,

Thank you very much for sharing your method — it works perfectly for my test3 model!
I’m now trying to extend test3 to handle more than two different Queues, but before that, I have a few questions:

1.  In your model, when I connect two control points using an “A connection,” the system automatically forces the connection type to AltRoute (instead of allowing me to choose NextWorkPoint or other options). Why does this happen?

2.  In the Redirect If Occupied code, where can I learn or find documentation about the available method names (e.g. AGV(token.AGV), cpconnection(cp, "AltRoute", 1), agv.redirect(..., REDIRECT_AND_CONTINUE_ON_PRE_ARRIVAL)), the predefined variable names (e.g. cp.allocations, agv.finalDestinationCP), or the default object names?

3.  Is REDIRECT_AND_CONTINUE_ON_PRE_ARRIVAL a special predefined variable, or what exactly is it?

Thanks again for your time and help!

 

0 Likes
Message 4 of 6

moehlmann_fe
Advocate
Advocate

1. This seems to be caused by the connection name starting with "Alt". The picklist stays open if you rename the connection to something else.

2. Check out the class reference for AGV classes in the documentation (or any other classes).

https://docs.flexsim.com/en/25.2/Reference/CodingInFlexSim/FlexScriptAPIReference/AGV/AGV.html

3. It's a default global define. You can add defines yourself in the toolbox. The compiler interprets them as the number they are set to represent. They are mainly used to make understanding/debugging code easier, since you now the purpose of a parameter/variable this way instead of just seeing a number.

https://docs.flexsim.com/en/25.2/Reference/Tools/GlobalVariables/GlobalVariables.html#macros

0 Likes
Message 5 of 6

tom5568835
Participant
Participant

Hi moehlmann_fe

Thank you for your suggestion!


After changing the name of AltRoute to something else, I was able to select other options successfully.

Right now, I’ve extended your model so that Queue1 should deliver items to two different queues — I want Queue2 to receive red boxes and Queue3 to receive green boxes.
However, I haven’t been able to make it work.


I think the issue is that in your original model, the destination was already defined as Queue2 at Queue1, so all items are still routed to Queue2.
Even when I add another destination (Queue3) in Queue1, everything still goes to Queue2.


Do you know if there’s another way to achieve what I’m trying to do?


Thanks again for your time and help!

0 Likes
Message 6 of 6

moehlmann_fe
Advocate
Advocate

There are two broad options: Either you add a Decide or similar logic to the Process Flow that determines where the item is send. For example there is an array label on the source queue and the item type determines the index of the array entry the item should be transported to. Or the routing logic stays as part of the 3d model (either through port connections or list push/pull) and the Process Flow reacts to the "Transport Reference" trigger of the queue.

0 Likes