Open aminissn opened 2 months ago
Looks useful. My first thought is on the feasibility of adding this code within SUMO to the actuated controller and activate it with params. (#9163 or even #9595). But having this out there as a well-contained tool is a good start and with a bit of polish could be included in the distribution.
I wasn't aware of these issues. Would be nice to push this. I also think this can be a tool of its own and maintained in the future distributions. How could I better share the code? I still think it is not clear enough what is happening in the code because I was testing a few things on the network and of course there are special cases in there.
cc: @AlessioRimoldi
I made a pull request to add the code to tools/tls/busPriority.py. Maybe on a new branch would have been better until the code gets an acceptable state for distribution? see https://github.com/eclipse-sumo/sumo/pull/15230
Here would be my criteria for acceptability:
Nice to have:
To agree on the logic and to suggest ideas to improve my initial logic, I would like to ask for your opinion if I can already improve it. This is what I have currently in mind: 1) bus signin, 2) phase transition and 3) bus signout we have signin detectors x meters upstream of a tls that detect incoming buses, and then a phase transition starts to accommodate the bus going through the tls with a specific and dedicated green phase with a maxDur (60sec). This is important because, in offline mode, we cannot know in which direction the bus might turn at the tls, therefore we need a phase that has green for all lanes for that edge from which the bus is approaching the tls. Downstream of the tls, we have signout detectors that immediately switch back to the original tls logic. Limitation 1: once a priority transition starts, we cannot consider another bus coming from another approach. Limitation 2: If there is a long queue or a bus stop and the bus cannot pass through the tls in 60sec, it cannot be re-detected. Limitation 3: Switching back to normal tls logic may not be ideal, to compensate the conflicting phases.
I am working on a function to add bus priority by modifying tllogic mainly using next and earlyTarget attributes. It is working on single intersections coming with certain limitations, but I would like share my code and ask for anyone to contribute and improve it. There are certain cases where it doesn't work, for example if two buses come from two directions, or when time since detection is shorter than required minimum green + amber times from conflicting approaches. This function also requires some extra functionalities from sumolib for which I will create pull request. Hopefully, they won't causes any backward compatibility or test failures. bus_priority.py.zip