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 [email protected]:

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" <[email protected]>

An: "[email protected]" <[email protected]>

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
[email protected]
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

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

Reply via email to