Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Count elapsed time of a phase via TraCI

You can use something like

    phd = traci.trafficlights.getPhaseDuration(tlname)
    nextSwitch = traci.trafficlights.getNextSwitch(tlname)

    runningSince = phd - nextSwitch

Regards Harald

Am 25.07.2018 um 11:06 schrieb m.barthauer@xxxxxxxxxxx:

There is no TraCI helper function for that, but all you need to calculate it is available...

 

If you check the phase ID at every second anyway, you can also keep track of the elapsed time per traffic light/phase in your script. Just make some counter which is reset to 0 when the current phase differs from the previous time step.

 

Regards

Mirko

 

 

 

-----Original-Nachricht-----

Betreff: [sumo-user] Count elapsed time of a phase via TraCI

Datum: 2018-07-25T09:25:14+0200

Von: "Shuyi Yin" <shuyi.yin1@xxxxxxxxx>

An: "sumo-user@xxxxxxxxxxx" <sumo-user@xxxxxxxxxxx>

 

 

 

Hi SUMO community,
 
I'm controlling traffic lights via TraCI, and want to know at every second what is my current phase and elapsed time of the phase.
 
For the current phase, it is easy to use getPhase(juntion), but what about the elapsed time, i.e. the number of seconds this current phase has been in effect?
 
Thanks,
Shuyi


_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/sumo-user



Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Back to the top