How to get Fuel Consumption results in a vehicular network in omnet++? - omnet++

When we run a simulation and check the results folder, we can see CO2 emission data for each vehicle. Likewise, can we get fuel emission data for each vehicle as well?

Related

How to change the behavior of nodes (cars), rsu in Omnet++ Veins project

I have setup my environment using omnet++, sumo and veins in ubuntu. I want to reduce packet loss in an emergency situation among vehicles and improve packet delivery time and cost. My project is about choosing the suitable processing position among cluster head (nodes), road side unit (rsu) and cloud. I want to achieve certain tasks that is need to implement my veins project. I have configured 50 nodes and 4 rsu and provide data rate about 6mbps and assign the packet size upto 2MB.
Therefore, how can I change the behavior of vehicles (nodes), road side unit (rsu) and cloud in order to implement the following parameters?
processing rate of clusters (nodes) = 3 Mbps.
processing rate of RSUs = 7 Mbps.
processing rate of cloud = 10 Mbps.
the range of clusters (nodes) = 60 m.
the range of RSU = 120 m.
the range of cloud = 500 m.
If you could help with building these parameters I will appreciate it.
Thank you
If you are talking about transsmision rate, then you can set the bit rate in the ini file (check veins example) but if you meant processing delay then it is usually simulated by scheduling self messages (check tictoc example). In terms of transsmsion range, veins uses Free Space Propagation model and the related parameters are set in the ini file so you can change them to decide the required range. Finally, I recommand to read more about veins and how it deal with the parameters you asked about. There are alot of answered questions on StackOverFlow about your questions.

Time of Flight of a transmitted message in Veins

I am using veins to simulate localization of vehicle. RSU send a message in a fixed interval (100ms) and the vehicle recieving this wants to estimate the distance from RSU using Time of Arrival technique. I use bsm->getArrivalTime()and bsm->getTimestamp() to get the time at which the message arrives at the vehicle and starts transmission from RSU respectively. It turns out that the times really are as measured when the message is in the respective application layer; However what is desired is the time at which the message leaves the physical layer of the RSU and arrives at the physical layer of the vehicle.I am attaaching the event log to make my problem more clear
In the log what I want to measure is #9833 and #9832, contrary to what the bsm->get...()measures is #9828 and #9842.

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

Aggregating results of vectors based on Omnet++ signals

I want to compute an overall delivery ratio in function of time using vectors based on Omnet++ signals ? How can i achieve it when there is a multiple source and only one sink.
For example, say that i have 10 mobiles nodes that send data to a fixed AP, the delivery ratio is equal to (received/sent packets), but the AP knows only the amount of received packets.
I declared the following signals and statistics:
For AP:
#signal[receivedBndl](type = "int");
#statistic[receivedBundle](title="ReceivedBundle";source=receivedBndl;record=count,mean,last,vector);
For Nodes:
#signal[sentBndl](type = "int");
#statistic[sentBundle](title="SentBundle";source=sentBndl;record=count,mean,last,vector);
Is it possible to create another #statistics that compute the Delivery Ratio in function of time with this 2 signals ?
Thanks,
This is more like a network wide statistic, than something related to a single node so you have to install your statistic listeners on the top-level network module itself instead of the actual nodes. OMNeT++ signals propagate up on the containment chain so any signal that was sent to a specific node will be delivered also to the containing network module. This makes it possible to install the statistics on the network and get the given signal there (too).
To achieve this I would rewrite the code to actually emit the sent/received cPacket objects (and not the count of them as an integer). You still can count the number of packets using the count() function in the statistics.
For AP:
#signal[receivedBndl](type = cPacket);
For nodes:
#signal[sentBndl](type = cPacket);
As each actual sent/received packet is now emitted to their sending/receiving module (and anything above them), you can install a statistic in the top-level module and combine them into a single statistic:
#statistic[deliveryratio](source=count(receivedBndl)/count(sentBndl); record=last);
This last line will install two signal listeners on the top level module and the statistics will calculate the value each and every time any module generates or receives a packet anywhere in the network.

Resources