Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Generating the same scenario simulation from the vehicles' initial states

I tried the option of using the built-in facilities for restoring simulation state including RNG:
https://sumo.dlr.de/docs/Simulation/SaveAndLoad.html
https://sumo.dlr.de/docs/Simulation/SaveAndLoad.html#random_number_generators_rng

I successfully saved the state of the original simulation using traci.simulation.saveState("Test_state.xml")
However, when I tried to reproduce this state in a new simulation by starting SUMO traci.start(["sumo-gui","-c","Senario.sumocfg"])  then loading the saved state traci.simulation.loadState("Test_state.xml"),  I got error traci.exceptions.FatalTraCIError: connection closed by SUMO.

I have two questions:
1- First, how to set option --save-state.rng to save the state of the random number generator ??  should it be set in the .sumocfg file of the original simulation ? What is the syntax that should be used for this option ?
2- how to run the new SUMO simulation and load the saved state without having the error traci.exceptions.FatalTraCIError: connection closed by SUMO ?


Best regards,
________________________
Zine el abidine KHERROUBI


Le ven. 16 juin 2023 à 11:26, Jakob Erdmann <namdre.sumo@xxxxxxxxx> a écrit :
Many aspects of the simulation are subject to stochasticity, controlled by RNGs and the initial random seed (https://sumo.dlr.de/docs/Simulation/Randomness.html).
After running the simulation for some time, the RNG is in a particular configuration and you can only reproduce that situation by also restoring this RNG configuration.
Here are two possible solutions:
1) Use the the initial setup as you are doing now but sample a larger configuration space by running with different values for the --seed option until you find a situation of interest (which may not be the exact situation you had originally but nevertheless suitable to your purpose).
2) Use the built-in facilities for restoring simulation state including RNG:

regards,
Jakob

Am Fr., 16. Juni 2023 um 08:58 Uhr schrieb Kherroubi Zineelabidine <znbd.kherroubi@xxxxxxxxx>:
Hi all,

I have a simulation of an accident scenario that occurs at the 16000th simulation time-step. I would like to generate this same accident scenario (same geometry, same vehicles, same vehicles speed behaviors and trajectories) in a new simulation (at the beginning time step instead of waiting until 16000 as in the original simulation).
For that, I saved all the vehicles' states in the original simulation of accident: Position, speed, acceleration, type, angle, speed_factor, speed_deviation, lane_id, lane_position.

In the new simulation, I added the vehicles from the accident scenario:
1- traci.vehicle.add(vehID ,routeID ,departSpeed,typeID, departPos=0)

then, for each vehicle , and before executing a simulation step, I adjusted the state of vehicles as in the original scenario accident:
2- traci.vehicle.setAccel(vehID ,accel)
3- traci.vehicle.setSpeed(vehID,speed)
4- traci.vehicle.setSpeedFactor(vehID,factor)
5- traci.vehicle.moveTo(vehID,laneID,pos) 


There is only one vehicle that I control through traci using the same rule-based control function as in the accident scenario.

However when I run this new simulation, no accident happen and the trajectories of vehicles are different from the original accident scenario. I thought that I included all the information to reproduce the original accident scenario, especially the vehicle type and speedFactor (where I forced speedFactor Deviation to 0).

Why is the new scenario different from the original ?
How to reproduce the same scenario using initial vehicle states ?

Best regards,
________________________
Zine el abidine KHERROUBI
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top