I wish the codes below will help you.

#----------  x is duration array.

def set_sig(x):
    phases = []
    phases.append(traci.trafficlights.Phase(x[0], 0, 0, "GGrr"))
    phases.append(traci.trafficlights.Phase(3, 0, 0, "yyrr"))
    phases.append(traci.trafficlights.Phase(x[1], 0, 0, "rrGG"))
    phases.append(traci.trafficlights.Phase(3, 0, 0, "rryy"))
    logic = traci.trafficlights.Logic("new-program", 0, 0, 0, phases)
    traci.trafficlights.setCompleteRedYellowGreenDefinition("gneJ1", logic)



Hajar LAMGHARI <[email protected]> 於 2019年1月10日 週四 19:45 寫道:

> Hello,
> I am using TraCI and I want to make Traffic light duration Dynamic. I
> found that to define new tlLogic with new durations and new states in real
> time, I have to use :
> traci.trafficlights.getCompleteRedYellowGreenDefinition(tlsID) and,
> traci.trafficlights.setCompleteRedYellowGreenDefinition(tlsID)
> But it doesn't work for me!  I need just a tutorial to understand how to
> implement my dynamic solution using these functions (Such that I already
> saw the details in tools/ traci/ trafficlights.py).
> Than you in advance...
>
> regards,
>
>
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>  Garanti
> sans virus. www.avg.com
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#m_8226939228324058988_m_7934994886985236438_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> _______________________________________________
> sumo-user mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-user
>
_______________________________________________
sumo-user mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to