0
votes

I defined the flow by giving the from and to edges. When testing some traffic signal algorithm, I found the network would easily come to a gridlock,partially because vehicles cannot find the dynamic user equilibrium route. Thus my goal is to make those defined flow (vehicle) find dynamic user equilibrium route in every simulation time step. I know the duarouter should be the solution. But how can I call duarouter in every simulation time step, how where should I incorporate duarouter in my code?

I followed the example code provided by SUMO website. Basically I defined a run() function which defines my signal control algorithm. Then I call run() in the main function.

Where should I inset the duarouter?

enter image description here How should I call it in my simulation loop for make sure in every time step, the vehicles in the network can find its user equilibrium route.

dua-iterate.py -n <PATH_TO_SUMO_NET> -t <PATH_TO_TRIPS>


def run():
"""execute the TraCI control loop"""
step = 0
NSphase = 0
EWphase = 2
while traci.simulation.getMinExpectedNumber() > 0: 
    traci.simulationStep() # this means let the simulation go forward for one step 
    step += 1 
    {signal control algorithm}
traci.close()
sys.stdout.flush()

if __name__ == "__main__":
traci.start(["/home/hao/sumo_binaries/bin/sumo-gui", "-c", "/home/hao/Documents/traci_test/randomnet4/random.sumo.cfg",
                         "--tripinfo-output", "tripinfo.xml"])
run()
1
If I understand it correctly, does the duarouter.py only assign DUE routes when the demand file generates vehicle? I mean, the vehicles already loaded on the network, can they still update their routes considering the dynamic traffic condition?Pao Raw

1 Answers

0
votes

Traci is a control interface to sumo. So the basic idea is that you can start a sumo server and connect Traci to the server. Traci will generate the routes based on your network and trips files, statically or dynamically.

In the SUE case, your code

traci.start(["/home/hao/sumo_binaries/bin/sumo-gui", "-c", "/home/hao/Documents/traci_test/randomnet4/random.sumo.cfg", "--tripinfo-output", "tripinfo.xml"])

actually

  • starts the sumo-gui server,
  • and connects Traci (SUE) to the server.

To use DUE with Traci, you should use the duaIterate.py in tools/assign folder. But

traci.start(["python", <PATH TO duaIterate.py>, "-n", <NETWORK FILE>, "-t", <TRIPS FILE>])

only tries to connect Traci (DUE) to a sumo/sumo-gui server. So you should first start the server manually:

sumo-gui -n suedstadt.net.xml --remote-port <PORT NUMBER>

The remote-port option here starts sumo-gui in the server mode. Now you can connect Traci to the server with the port option.

traci.start(["python", <PATH TO duaIterate.py>, "-n", <NETWORK FILE>, "-t", <TRIPS FILE>], port=<PORT NUMBER>)