Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] How to obtain the red duration for a link with given index via Traci

Thank you for sharing your thoughts on this. I really appreciate it.

On Sun, May 7, 2023 at 5:27 AM Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
The easiest solution is to track the state of each link with your own code each second and aggregated the red times.  While the type 'actuated' controller actually tracks red time per link internally, there is no such feature for NEMA and there is no TraCI API to retrieve the values anyway.

Am Sa., 6. Mai 2023 um 15:29 Uhr schrieb Tianjia Yang <tianjiayang254@xxxxxxxxx>:
Thanks for the information. And sorry about my unclear _expression_.
I just want to monitor the elapsed red time (the time period between when the red light started and my request time) in the given links at each simulation timestep. The elapsed red time in each link will act as the penalty in my optimization objective function. I am trying to develop an optimization algorithm that can control the signal light at each simulation timestep via Traci. There is no prediction involved.
So is there a workaround for getting the elapsed red time in each simulation timestep?

On Sat, May 6, 2023 at 3:43 AM Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
Since the NEMA controller is traffic actuated you cannot easily predict the green/red durations in advance. The only way to obtain the upper/lower boundaries is to examine the whole program and add up the time for phases that are potentially consecutive where the link of interest maintains the same state.  On the other hand, if you are content with analyzing the durations at the end of the simulation, you can get the them from https://sumo.dlr.de/docs/Simulation/Output/Traffic_Lights.html#tls_programs

Am Fr., 5. Mai 2023 um 22:41 Uhr schrieb Tianjia Yang <tianjiayang254@xxxxxxxxx>:
Thanks for the quick reply. 
I would like to obtain the green or red duration of each link, not the duration of the phases. 
I use the NEMA phase program. Even though the phase is changing, the signal light in some of the links (turning directions) is kept unchanged. For example, if the north-through/south-through phase switches to the north-through/north-left phase, the signal light in the north-through direction remains green. Therefore, the green duration for the north-through links is greater than each of the single phases.
So I am wondering if there is a way to get this kind of value via Traci.

Sincerely,
Tianjia Yang

On Fri, May 5, 2023 at 2:21 PM Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
trafficlight.getAllProgramLogics will return a list of programs and for each program you can retrieve the states and durations for all phases.

Am Fr., 5. Mai 2023 um 18:11 Uhr schrieb Tianjia Yang <tianjiayang254@xxxxxxxxx>:
Hi there,

I am trying to use Python to control a traffic light based on the duration in seconds of each link. So I need to obtain the current green or red duration for the given link via Traci.

I know that GetPhaseDuration can return the duration for the current phase. But I didn't find a way to get the current green or red duration for a given link.

Would your please help me with this? Thank you for your time.

Sincerely,

Tianjia Yang

_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
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