Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Traci for signal's 'offset time

Thanks a lot.

Jakob Erdmann <namdre.sumo@xxxxxxxxx> 於 2019年3月25日 週一 下午2:44寫道:
setting <tlLogic id="..." offset="-10"/> has the effect of making the whole cycle switch 10s earlier.
The same effect can be achieved via TraCI using the following calls once at the start of the simulation:

remainingSeconds = traci.trafficlight.getNextSwitch(tlsID) - traci.simulation.getTime()
traci.trafficlight.setPhaseDuration(tlsID, remainingSeconds - 10)

(this assumes that the first phase has a duration of at least 10s)

Am Mo., 25. März 2019 um 02:42 Uhr schrieb iCashWave <icashwave@xxxxxxxxx>:
Hi,
The traci.trafficlights.Logic seems can not  set offset time. 
At the beginning of the simulation, if I want to set the offset time with Traci, how can I do it? 

Best regards.

Jakob Erdmann <namdre.sumo@xxxxxxxxx> 於 2019年3月25日 週一 上午3:49寫道:
The call traci.trafficlights.setPhaseDuration() only affects the duration of the current phase. Subsequent cycles will have the original duration.
This means a single call can shift the whole cycle just as if you had applied an offset value in the beginning.

Am Sa., 23. März 2019 um 15:39 Uhr schrieb iCashWave <icashwave@xxxxxxxxx>:
Hi,
(1) I know how to set signal's "offset time" as below:
<tlLogic id="…" type="static" programID="..." offset="0">

(2) I also know how to write simple codes with Traci as below:

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)

(3)However, if I want to set the offset time dynamically by Traci, how can I do?
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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