0

After the simulation time the vehicles leave the simulation scenario. I would like to re-enter the same vehicles with same previous ID and information in VEINS after leaving scenario. Is there a way to re-use the same vehicle after it exits the scenario.

1 Answers1

2

You should not re-insert vehicles that have left the simulation, because this means you'd copy your entire vehicle to another location. This will make your VANET application behave incorrectly, because the same vehicle is suddenly in a different location.

If you're looking for more traffic, I would recommend switching to another SUMO scenario (this scenario is a lot bigger and also approximates real traffic).

Alternatively you could change your existing SUMO simulation directly, e.g., to increase the amount of vehicles that are inserted, or to change the behavior of the vehicles (by changing the SUMO input, i.e., erlangen.rou.xml in the example simulation that comes with VEINS).

If you want to keep the same vehicles for some reason, you probably want to reroute them to some other location, which you can do over TraCI (using this method).

  • Thank you for your response. Your answer is very useful. Actually I am working in some kind of scenario which need reroute of the same vehicle so that this vehicle will meet other vehicles multiple times. I tried like this: voidTraCI::reroute(std::list rList) { bool reroute; reroute = traciVehicle->changeVehicleRoute(rList); } In this case I need to insert some rList, how can i put the rList ? and where should i call this function. Either void TraCI::finish() {} or somewhere else. Thanks –  Sep 20 '17 at 01:43
  • I'm not really sure how rerouting works exactly -- I suspect what should happen is that you pass SUMO a new route, and that route normally consists of the segments of the road that a vehicle will be using. I'd recommend checking the TraCI documentation or retrieving a route at the start of the simulation (the representation should be similar) – Rens van der Heijden Sep 21 '17 at 08:02