Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Cannot set trafficlights logic

Hi,
I have a question.
If I want to set the 'offset time' by traci, how can I do?

matthew_zammit <matthewzammit.77@xxxxxxxxx> 於 2019年3月1日 週五 01:52寫道:
Thanks, that was it. For anyone who has the same problem:

Q: How to permanently change phase duration with Traci/sumo?
A: This code should help you figure it out:

/def set_durations(phase0_duration, phase2_duration):
  phases = []
  phases.append(traci.trafficlights.Phase(phase0_duration,"rG", 0, 0))
#(durationtochangeto,state,min,max)
  phases.append(traci.trafficlights.Phase(3, "yy", 0, 0))
  phases.append(traci.trafficlights.Phase(phase2_duration,"Gr", 0, 0))
  phases.append(traci.trafficlights.Phase(3, "yy", 0, 0))
  logic = traci.trafficlights.Logic("0", 0, 0,
phases=phases)#(program_ID,typeofTLprog(0),always0,phases)
  traci.trafficlights.setCompleteRedYellowGreenDefinition("tl1", logic)/

Look for the parameter positions in _trafficlight.py because they may be
different depending on the Sumo version you have.



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top