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?
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()