Hi Billy,
you can limit detectors to specific vehicle types, say ambulances. You
just need to set the attribute vTypes to the names of the vehicle types
it should consider (see docs
<https://sumo.dlr.de/docs/Simulation/Output/Induction_Loops_Detectors_%28E1%29.html>).
Regards
Mirko
Am 16.11.2021 um 16:44 schrieb William Hefter:
Hello all,
I am aiming to create a simulation that is a variation of the
following tutorial:
https://sumo.dlr.de/docs/Tutorials/TraCI4Traffic_Lights.html
I want to recreate something very similar to the simulation
described in the following paper:
https://www.researchgate.net/publication/304290654_A_smart_traffic_solution_for_High_Priority_Vehicles
My aim is to modify this tutorial so that ambulances (priority
vehicles) and cars may come from both east-west directions AND
north-south direction. In this tutorial, cars only come from
east-west, and ambulances only come from north-south.
I have already been able to implement both cars and ambulances
arriving from both directions, but now I am having trouble figuring
out how to have the lights change in a way that accounts for the
priority of the ambulances.
This is the TraCi control loop that is in the tutorial:
def run():
"""execute the TraCI control loop"""
step = 0
# we start with phase 2 where EW has green
traci.trafficlight.setPhase("0", 2)
while traci.simulation.getMinExpectedNumber() > 0:
traci.simulationStep()
if traci.trafficlight.getPhase("0") == 2:
# we are not already switching
if traci.inductionloop.getLastStepVehicleNumber("0") > 0:
# there is a vehicle from the north, switch
traci.trafficlight.setPhase("0", 3)
else:
# otherwise try to keep green for EW
traci.trafficlight.setPhase("0", 2)
step += 1
traci.close()
sys.stdout.flush()
What I want to have happen is for the traffic lights to treat
ambulances with priority, whether they come either from the north
south direction, or the east west direction. I notice that the
current ambulance detection is based on an induction loop, so this
would have trouble distinguishing between cars and ambulances if they
are on the same road segment. This makes me think I need to find a
different approach to the traffic light control loop.
I know that this is possible since it is done in the aforementioned "A
Smart Traffic Solution for High Priority Vehicles" paper. I was
wondering if someone would be able to point me in the right direction
of how to tackle this!
Thank you,
Billy
_______________________________________________
sumo-user mailing list
[email protected]
To unsubscribe from this list,
visithttps://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
[email protected]
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user