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