Hello, - take a look at https://sumo.dlr.de/docs/Tutorials/TraCI4Traffic_Lights.html for an example of controlling a traffic light. - you can get the total waiting time using the options --duration-log.statistics --statistic-output FILE - to count waiting vehicles on a lane, either use lanearea.getLastStepHaltingNumber or lane.getLastStepHaltingNumber - the easiest solution for a single-junction project is to hard-code the association between lanes and pre-defined phase-indices (see tutorial). For alternatives, see https://sumo.dlr.de/docs/Simulation/Traffic_Lights.html#controlling_traffic_lights_via_traci
Note, that you will need some experience with programming and that this mailing list is not a place for general programming advice. regards, Jakob Am Sa., 20. Feb. 2021 um 11:09 Uhr schrieb John Eapen < [email protected]>: > Dear Sir/Madam, I have a school project in which I need to run two > simulations and output the total waiting time**. I am using both TraCI and > SUMO's tools for this. > For the 1st simulation, the algorithm will need to: > 1) Count the number of vehicles waiting at a junction.* > 2) Select which lane has the highest number. > 3) Allow the lane with the highest number of vehicles to move, along with > the corresponding lane which can move at the same time (i.e. traffic > flowing in opposite direction). > > For the 2nd simulation, I need to: > 1) Count the time elapsed since last green [lane.getWaitingTime?] for each > lane. > 2) If the 'max time since last green' is reached, to let that lane go > next. [which function can get me this?] > 3) If not, to count number of vehicles waiting in each lane.* > 4) Sum the total number of vehicles in particular combinations of lanes > that can move at the same time. > 5) Let longest combination move. > > I am lost at how to integrate all this together in the TraCI code to > control which lanes gets the green light. What should the code look like? > Would appreciate any and all help I can get on this! > > *To get the count of the Vehicles, I am planning on using e1 detectors to > get the [nVehEntered]. > > **I am planning on using one e3 detector over the whole map to get the > total waiting time. Will that be accurate? > > Kind Regards, > John Eapen > _______________________________________________ > sumo-user mailing list > [email protected] > To unsubscribe from this list, visit > https://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
