Hello,
The symptoms you describe are quite unexpected. Communication between
traci-client and sumo should be fully synchronized and deterministic. If
you send all necessary files for reproducing this behavior (in a
zip-archive) directly to my address I will look into the matter.

regards,
Jakob

2016-10-28 11:20 GMT+02:00 Slavko Žitnik <[email protected]>:

> Dear all,
>
> I would like to know if the execution of TraCI with SUMO is deterministic
> - I get some weird results reading values from induction loops.
>
> For example, I am counting the number of vehicles waiting in front of the
> traffic light. The problem is that if I do not wait a little bit after
> command “traci.simulationStep”, the readings get weird.
>
> A simple example based on tutorial code:
>
> waitingVehiclesNumberNorth = 0
> waitingVehiclesNumberWest = 0
> # we start with phase 2 where EW has green
> traci.trafficlights.setPhase("0", 2)
> while traci.simulation.getMinExpectedNumber() > 0:
>     traci.simulationStep()
>     #time.sleep(0.5) - sometimes, even if I sleep, I get wrong results
>     waitingVehiclesNumberNorth += 
> traci.inductionloop.getLastStepVehicleNumber("0")
> - traci.inductionloop.getLastStepVehicleNumber("2")
>     waitingVehiclesNumberWest += 
> traci.inductionloop.getLastStepVehicleNumber("1")
> - traci.inductionloop.getLastStepVehicleNumber("3")
>
>     print("West: {:3}, North: {:3}".format(waitingVehiclesNumberWest,
> waitingVehiclesNumberNorth))
>     if traci.trafficlights.getPhase("0") == 2:
>         # we are not already switching
>         if  waitingVehiclesNumberNorth > 3 and waitingVehiclesNumberWest <
> 20:
>             # there is a vehicle from the north, switch
>             traci.trafficlights.setPhase("0", 3)
>         else:
>             # otherwise try to keep green for EW
>             traci.trafficlights.setPhase("0", 2)
>
>
> The problem above is that the variable “waitingVehiclesNumberNorth”
> increases although I see the vehicles passed the second induction loop -
> this happens only if I do not use sleep command or if sleep time is short.
>
> Could anyone tell me please if there is some problem in my perception of
> using this library? I am using SUMO 0.27.1, compiled on a Mac.
>
> Thanks,
> Slavko
> ------------------------------------------------------------
> ------------------
> The Command Line: Reinvented for Modern Developers
> Did the resurgence of CLI tooling catch you by surprise?
> Reconnect with the command line and become more productive.
> Learn the new .NET and ASP.NET CLI. Get your free copy!
> http://sdm.link/telerik
> _______________________________________________
> sumo-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sumo-user
>
------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
sumo-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sumo-user

Reply via email to