eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.5k stars 1.41k forks source link

Different output between libsumo and taci #15460

Open way-thu opened 1 week ago

way-thu commented 1 week ago

I may meet a confusing mistake between libsumo and traci. Specifically, I want to obtain the cumulative waiting time of a vehicle, but using libsumo and traci, I got different results. Here are the details below.

First of all, my signal control method is actuated. image

When I use traci, the result of the vehicle is 56.0. image image

However, if I change traci to libsumo, the result changes to 94.0. image image

What makes me more puzzled is that when my signal control method is static, the results obtained are consistent. However, when I change the signal control method to actuated, the results obtained by libsumo and traci will deviate. I don't know where the problem lies for the time being.

I hope to hear your reply, thanks for your help.

SUMO-version: 1.18.0 libsumo-version: 1.20 **operating system: windows

namdre commented 1 week ago

Results may change between versions due to bug fixes, so a difference in behavior between versions is not unexpected. Your logging output also shows situations that are 48s apart in time. A vehicle that has accumulated 56s of waiting time may well have 94s accumulated waiting time at this later point (if it remains stationary for 38 out of 48s).

To compare two scenarios between versions, it is helpful to compare fcd-output and also traffic light output (https://sumo.dlr.de/docs/Simulation/Output/Traffic_Lights.html)

way-thu commented 1 week ago

In fact, this vehicle will only stop once (because there is only one traffic light). To be precise, when using Traci, the vehicle completes its journey at time 113.5 and then disappears. However, when using libsumo, the vehicle continues until 151.5 seconds and also waits for a longer time.

way-thu commented 1 week ago

I'm not sure if this is a version issue, but if you have time, you could give it a try and fix it.

way-thu commented 1 week ago

I further checked my version and I found that both traci and libsumo are 1.20.0. As mentioned above, this seems to be related to the signal control method. When using static control, there doesn't seem to be an error, but when switching to actuated, the above error occurs.

namdre commented 1 week ago

Here is a description of what an error report needs to include to be actionable: https://sumo.dlr.de/docs/FAQ.html#how_do_i_report_erroneous_behavior_of_a_sumo_application

way-thu commented 6 days ago

problems.zip @namdre Hello, I upload the problems I meet, I hope to hear your reply.

namdre commented 6 days ago

On my system, both of your scripts return the same output. My best guess is, that one of the scripts picks up the library from SUMO_HOME (version 1.18.0) and the other one picks the installed version (1.20.0). For debugging, see https://sumo.dlr.de/docs/TraCI/Interfacing_TraCI_from_Python.html#determine_the_traci_library_being_loaded

way-thu commented 6 days ago

image image I modified the import paths for traci and libsumo, but the results I'm getting are still different. Is there something wrong with what I'm doing?

namdre commented 6 days ago

Please check the path of the actually loaded modules as described in my link.

way-thu commented 6 days ago

Sorry for my bad understanding, I still not solve it. Is it possible that the issue arises because the version of libsumo I am using is 1.20, while the SUMO version is 1.18.0? Could the inconsistency between the versions of libsumo and SUMO cause this problem?

namdre commented 5 days ago

yes