Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Adding traffic lights automatically

Hi Toprak, I hope you are fine.
You can do with a script TRACI before to run the simulation an edition of the archive .net.xml
and using regular expressions add traffic lights in the necessary places and with the required conditions

if __name__ == "__main__":
    options = get_options()
//here for example you can edit with Python and modify the .net.xml file
    if options.nogui:
        sumoBinary = checkBinary('sumo')
    else:
        sumoBinary = checkBinary('sumo-gui')

    traci.start([sumoBinary, "-c", "archivo.sumocfg",
                             "--tripinfo-output", "tripinfo.xml"])
    run()

Please tell me if you need more help.

Saludos cordiales
Mat. Manuel Hernández Rosales
Secretario Técnico
Programa Universitario de Estudios sobre la Ciudad
Universidad Nacional Autónoma de México
Ciudad de México, México
Whats App: 5539621430


El sáb, 21 oct 2023 a las 7:14, Toprak via sumo-user (<sumo-user@xxxxxxxxxxx>) escribió:
Hello,

I want to automatically add traffic lights into the network without manually inserting them in netedit. I am currently generating grid networks and want to add the traffic lights on all junctions. Is there a way to achieve this? I actually would be happier with a system that adds traffic lights with respect to how many roads there are in the junction, so that the corners which have only 2 roads (1 in and 1 out) don’t have traffic lights but other junctions do. If no, maybe I need to write a small python script which modifies the network file?

I checked out the wiki but couldn’t find an answer and —guess true doesn’t do the trick apparently. 
Thanks,
Toprak
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top