see https://sumo.dlr.de/docs/Simulation/Traffic_Lights.html#controlling_traffic_lights_via_traci
Am Mi., 16. Dez. 2020 um 14:36 Uhr schrieb Shah Sultan < [email protected]>: > Hello everyone > > I am trying to change the green and red phase timing for every simulation > run from traci. > Here, following are my valid traffic lights' IDs > Traffic Lights id #1: 1886728151 > Traffic Lights id #2: 2273469505 > Traffic Lights id #3: 268032054 > Traffic Lights id #4: 454336319 > > Let say for Traffic Lights id #4. > > By using *traci.trafficlight.getAllProgramLogics("454336319")*, I tried to > see the whole logic of this signal id and the output that I get is the > following > > (Logic(programID='0', type=0, currentPhaseIndex=0, > phases=(Phase(*/duration=40.0/*, state='GGrr', minDur=40.0, maxDur=40.0, > next=()), Phase(duration=3.0, state='yyrr', minDur=3.0, maxDur=3.0, > next=()), Phase(duration=2.0, state='rrYY', minDur=2.0, maxDur=2.0, > next=()), Phase(/*duration=40.0*/, state='rrGG', minDur=40.0, maxDur=40.0, > next=()), Phase(duration=3.0, state='rryy', minDur=3.0, maxDur=3.0, > next=()), Phase(duration=2.0, state='YYrr', minDur=2.0, maxDur=2.0, > next=())), subParameter={}),) > > I want to change the phase duration of the above-given phases (that are in > Bold and Itallic) during each simulation run. In other words, during every > simulation run, I want these phases to work according to the time that I am > going to assign to them. > > For that first I use traci.trafficlight.getRedYellowGreenState("454336319") > to see which state is in right now then I use > traci.trafficlight.setPhaseDuration('454336319',55) for setting new phase > duration. > > When I checked the duration by > traci.trafficlight.getPhaseDuration("454336319"), it is showing me *40.0* > which is unchanged. > > So, can you give me any idea how can I change the particular phase timing > during each simulation run? > > > > > > > > > > > -- > Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/ > _______________________________________________ > sumo-user mailing list > [email protected] > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/sumo-user >
_______________________________________________ sumo-user mailing list [email protected] To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
