Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if len(sys.argv) > 1:
import libsumo as traci # noqa
else:
import traci # noqa
import sumolib # noqa
sumoBinary = sumolib.checkBinary('sumo')
cmd = [
sumoBinary,
"-n", "input_net2.net.xml",
"-r", "input_routes.rou.xml",
"--fcd-output", "fcd.xml",
"--vehroute-output", "vehroutes.xml",
"--default.speeddev", "0",
"--no-step-log"]
traci.start(cmd)
def step():
s = traci.simulation.getTime()
traci.simulationStep()
return s
p = "p0"
s = step()
s = step()
while traci.simulation.getMinExpectedNumber() > 0:
if s == 10:
traci.person.rerouteTraveltime("p0")
s = step()