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.55k stars 1.43k forks source link

traci.simulation.loadState failed in conjunction with calibrators #10277

Closed kkusic closed 2 years ago

kkusic commented 2 years ago

Hello @namdre, I am trying to use traci.simulation.loadState. After saving the simulation state in a file, for each vehicle definition, I get additional attributes departPos="random_free" departSpeed="max" speed="33.33" that make loading to fail. If I remove these attributes and keep the remaining ones, loading is successful. It seems that there is redundant information about the position and speed of the vehicle.

Vehicle definition in save_state.xml:

<vehicle id="caliCar1_ES_N_onRamp1.0.0" type="vtype_car1" depart="45.25" departPos="random_free" departSpeed="max" speed="33.33" route="route_cali_ES_N182_onRamp1" distance="337.9 0" speedFactor="1.0210" state="134218778 45250 8 37.41 0 0.25 59500 0 0" pos="28.47 23.47 5.67" speed="22.69 22.69" angle="331.81" posLat="0.00" waitingTime="100000 0">
        <device id="tripinfo_caliCar1_ES_N_onRamp1.0.0" state="ES_N56_onramp2_0 0 22.6866 300.488 0 0 0 0 -1"/></vehicle>

These unnecessary attributes have been pulled from the calibrator definition calibrator.add.xml file while saving simulation state:

<calibrator id="caliCar1_S_NE19_0" vTypes="vtype_car1" lane="S_NE19_0" pos="0" output="caliCar1_S_NE19_0.xml">
         <flow begin="0.00" end="60.00" route="route_cali_S_NE18_19" vehsPerHour="180" speed="33.33" type="vtype_car1" 
           departPos="random_free" departSpeed="max"/>
</calibrator> 

Do you have any idea how to avoid saving these attributes from the calibrator definition while saving the simulation state?

Input definition:

<input>
        <net-file value="in/motorway_GE_edges_50m.net.xml"/>
        <route-files value="in/route/routesDistributions.rou.xml"/>
        <additional-files value="in/add/vtype/vTypes.add.xml, in/add/detector/detectors.add.xml, 
                                                in/add/cali/cali_E_NS.add.xml,in/add/cali/cali_S_NE.add.xml, in/add/cali/cali_N_ES.add.xml, 
                                                in/add/cali/cali_N_ES_onRamp1.add.xml, in/add/cali/cali_ES_N_onRamp1.add.xml"/>
</input>

SUMO-v1_12_0 (March 03 2022 00:14:56 UTC):

Windows 64-bit:

Thanks Kresimir

kkusic commented 2 years ago

Also, when the departPos="random_free" departSpeed="max" speed="33.33" attributes were removed and loading was successful, the calibrators were also loaded, but they become inactive and no vehicle is added to the network while the simulation continues, even though an initial flow rate is defined in each calibrator within 1-minute intervals. From that point, I am also unable to change the flow rate via traci.calibrator.setFlow(). image Usually calibrator has attributes like this image

Any advice?

Thanks Kresimir

namdre commented 2 years ago

additional work remains (#10284) but it's impact should be low for 1-minute intervals and you should be able to use the calibrators after loading state now.

namdre commented 2 years ago

previous fixes were for traci.load whereas simulation.loadState has another problem

kkusic commented 2 years ago

It works. Thanks for the quick response and fix.

Kresimir