Hi Yu,
please review your condition for calling the TraCI functions. You check for the next step, but actually you should check the current step:
if (t+1) % 30 == 0 # no, replace t+1 by t
You can call traci.simulation.getTime() to get a better understanding, too.
Best regards
Mirko
-----Original-Nachricht-----
Betreff: [sumo-user] Inconsistency between Traci and Output File
Datum: 2023-07-22T22:28:24+0200
Von: "yu tang via sumo-user" <sumo-user@xxxxxxxxxxx>
An: "Sumo project User discussions" <sumo-user@xxxxxxxxxxx>
Hi all,
I found inconsistent results from Traci and simulation outputs of induction loops. I used SUMO 1.18.0 and traci 1.18.0. My project simulates traffic for one hour, where induction loops collect flow, speed, occupancy every 30 second. Using traci, I applied inductionloop.getLastIntervalMeanSpeed(), inductionloop.getLastIntervalOccupancy(), inductionloop.getLastIntervalVehicleNumber() at time 30, 60, 90, .... Unfortunately, I found these data are slightly different from the 30-second results indicated by the xml output file; see the attached figures. Besides, I failed to replicate the results of xml output file by using other methods such as inductionloop.getIntervalMeanSpeed(). Is it a bug? For better understanding my problem, I also attach a zip file containing the simulation file and the code.
Best,
Yu