question

Student590 avatar image
0 Likes"
Student590 asked Felix Möhlmann commented

How to create dynamic switching based on real-time queue detection

Hi, I want to implement a logic for dynamic switching based on real-time queue detection such that:

  • AGV Priority Mode (when there is a high volume of AGVs)
  • Truck Priority Mode (when manned vehicle traffic peaks)

So the scenario is:

  • Traffic sensors count AGVs and Trucks waiting at the junction
  • The system decides based on real-time priority logic:
    • If Trucks are waiting > X seconds, give them green
    • If AGVs are waiting > Y seconds, give them green
    • If both have a queue, the system decides dynamically based on
      • Queue length
      • Wait time thresholds
      • Current congestion
  • Example Decision Logic
    • If 3+ Trucks are waiting AND their queue time > 20 seconds, Truck gets priority
    • If AGVs are waiting AND their queue time > 20 seconds, AGV gets priority
    • If both queues are full, switch every X seconds to balance the flow
    • If neither is waiting, keep the last active mode until demand change


If the above is not possible, I want to be able to set it such that:

  • If the AGV queue length exceeds a threshold (e.g., 5 AGVs waiting), trigger the AGV Green phase
  • If Trucks waiting ≥ 3, trigger Trucks Green phase for a short duration

This is my current model:

1742493038033.png

Traffic Logi.fsm

FlexSim 24.2.2
agvtraffic controltraffic lighttraffic light logicsmart traffic control
1742493038033.png (37.3 KiB)
traffic-logi.fsm (68.4 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

The logic you currently have in the model is not suited for dynamic timings of the traffic lights. The time at which a TE will resume is set as soon as it arrives at the intersection based on fixed timings.

You can keep using waypoints for the logic and change it so that the TE is redirected to stop if the light is red, but without a wait time. Resuming the TE would then happen in the Process Flow when the light switches to green. So the TE would probably need to be pushed to a list to have a reference available to resume it.

You could also use the system I showcase in this post. It manually allows or blocks allocation requests for a control area.

A simple way to count waiting traffic would be to place a control area over the incoming path and count the allocations of that area.

The waiting time could be measured by a kinetic tracked variable. When a traveller arrives a the intersection control point, the rate of the TR is set to 1. When the traveller later deallocates the CP the TR rate and value are reset back to 0.

This would allow you to react to both a change in the number of waiting travellers and the wait time reaching a given threshold in an Event-Triggered Source. Then read all current values from each direction and possibly change the lights.

· 2
5 |100000

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