Omnet++,Veins,Sumo - Simulation time difference between Omnet++ and SUMO - omnet++

I have scheduled a flow of vehicles to enter a route at different time steps using the rou.xml file in sumo. And I can see these vehicles entering in those specified times when I run the simulation with the sumo gui. But when I run my simulation with omnet++, the time seems to be different.
I want to know why that is and how I can correct it if can. Please help.

Vehicle movement in SUMO is random. You can choose a pseudorandom seed when the simulation starts. By default, Veins chooses a seed based on the run you are executing (same config, same seed - different replication, different seed). This means that the seed will likely be different to that of a SUMO simulation you manually start. If this is not what you want you will need to change either the seed that pure SUMO uses or the seed that Veins uses. Both are simple configuration options.

Related

How to get lane statistics (Scalars or Vectors) using Veins

I am trying to collect the following data using Veins towards each single lane, including throughput, density, mean speed, delay and collision. I know TraCI has the Simulation Value Retrieval, which can provide some information that I need. Also, the Lane Value Retrieval can help. But I have no clue where should I put the customized codes, so that the statistics can be recorded properly. For example, I want to collect the density and the mean speed of each lane every minute of the simulation time, which class should I put my codes to? TraCISenarioManager?
Any suggestion is appreciated.
I think putting the code in TraCIScenarioManager is entirely reasonable. If you want per-vehicle statistics I'd recommend putting them in the vehicles' application code, the way VEINS already collects some statistics out of the box.

I would like to re-enter the vehicles in VEINS after leaving scenario

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.
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).

Reduce the simulation time of a large scenario

I simulated a large scenario (using the whole map of a city) with Omnet-5.0 , Veins-4.5 and SUMO-0.29.0.
The first scenario simulated took one week.
I need to know the computing time used by Veins comparing it to SUMO and Omnet++. I asked for SUMO, I have a response that SUMO takes 1 second to load the network and 0.3 seconds to run the simulation.
Is there a tool to reduce the simulation time of my scenario please?

Veins Framework Tutorial Accident rate

Currently, I am doing some research scenarios with Veins framework. I modified the Veins example (which is in the tutorial) and made it use my network file and ran the simulation for 3000 step.
From the OMNeT++ console, I can see that there are lot of accidents scheduled and performed. May I know how these accidents are being scheduled? In what rate? For example 2 accidents per minute or 5 accidents per SUMO 15 steps?
In omnetpp.ini at the mobility tab it is possible to specify which node, when and for how long the accident will occur, for example:
*.node[*0].veinsmobility.accidentCount = 1
*.node[*0].veinsmobility.accidentStart = 10s
*.node[*0].veinsmobility.accidentDuration = 1s
Another thing to care about is that accident start is
relative to the time where a node enters the simulation. If there aren't many accidents maybe you can specify these accidents manually.

About changing the playground size of the Veins

How to reduce the playground size as well as how to start the vehicles from the middle of the road. Where and which file should I have change?
In Veins, node mobility of cars is entirely managed by SUMO. Whenever a new car starts in the SUMO simulation, a node is created in OMNeT++. Whenever (and wherever) the car moves in SUMO, it is moved in OMNeT++. If you want to change how the nodes (that represent cars) move, just change the SUMO simulation (by creating new routes or an entirely new network).
If you want to know more about how to create and change SUMO simulations, you can find in-depth information in the SUMO manual.

Resources