omnet - Inet - Which factor decides transmission sequence of the nodes - omnet++

I have a general question regarding the transmission sequence. In INET ->exapmles->manetrouting->dynamicNodeCreation, how does it decide which node should initiate beacon transmission. And how does the next node would be selected to transmit.
I tried to go through the tic-toc example where getIndex() in initialize function is used for the selection of transmitting node (eg txc10.cc). But I haven't figure out such functionality in INET examples.
Is there a way, in which I can select the respective node for beacon transmission as par my beacon occupancy map vector?
Is there a way, in which I can select the resepective node for beacon transmission as par my beacon occupancy map vector.
I beg your forgiveness for not being comprehensive for this problem.

I will take the example of INET ->examples->manetrouting->dynamicNodeCreation to answer my question. When I run this example in omnet the first event after initialize (at run time) is 'beaconTimer' for a fixhost (in my case it is meshtest.fixhost2[4].wlan[0].magmt ) So basically its starting with mgmt submodule. (If you check hierarchy of any single node at run time, it would be :- Delayunit -> wlan0 and in wlan0 its again mgmt->mac->radio. The code for mgmt is written in inet->source->linklayer->ieee80211->mgmt->Ieee80211MgmtAP.cc
Now in the initialize function for this class, there is a code line scheduleAt(simTime()+uniform(0,beaconInterval) , beaconTimer) . Here uniform is a Omnet defined uniform distribution function and gives a random value, beaconInterval is the time after which next super frame will start and beaconTimer is a message. This function schedule a random time for sending beacons for all nodes (respectively by their own mgmt module). So whichever device got the lowest value by this uniform function, will start beacon sending. Other devices should follow accordingly.
Now if I want to send beacons in prescheduled manner then I would change in handleTimer function in the same module as it provides the scheduleAt() function for next event.

Related

How to set the duty cycle to a desied value

I am trying to study the performance of B-MAC/X-MAC while varying the duty cycle ratio using INET framework. I know for wireless sensor networks, duty cycle is the ratio of active period and the summation of sleelping period and active period.Can anyone please explain for XMAC, which parameter(s) actually defines the duty cycle ratio?
For example, if I want to set the duty cycle to 5%, which parameters need to be considered in omnetpp.ini file, and what should be those parameters' values?
Thank you.
I think in XMac and BMac you can only set the slotDuration (which is the sleep period of the nodes). The active period can be variable in length, depending on what happens in the network, and what messages the node receives or transmits, etc. So the duty cycle is variable in length as well.

How to simulate multi interface wireless node and changing channels by Omnet++

How to simulate an adhoc network with the following conditions in Omnet++ in IEEE802.11b/g? (omnetpp.ini and NED file are expected)
1-Two wireless nodes (e.g. n1 and n2) having two interfaces with each other(e.g i1 and i2)
2-n1.i1 makes a link to communicate with n2.i1 and also n1.i2 makes a link with n2.i2, n1.i1 means interface i1 of node n1
3-channel 1 are allocated to link n1.i1 and n2.i1 in all simulation runtime
4-channel 2 are allocated to link n1.i2 and n2.i2 in the first second of simulation runtime, then channel 3 in the 2nd second, and so on until 10nd seconds, then repeat this circle.
Thanks in advance
Take a look at examples\adhoc\ieee80211 in INET. It contains simple network for testing the IEEE 802.11 in ad-hoc mode.

What is the unit of travel time and speed in Veins?

I'm working on Veins in OMNeT++, by using TraCI commands to get the travel time of roads using this method:
double getCurrentTravelTime().
The value which I get from this is very small. So I wondered what the unit of travel time is and also how to get the mean speed in SuMO or Veins?
This commands queries variable 0x5a from an edge. Its meaning is documented on the SUMO wiki, on page http://www.sumo.dlr.de/wiki/TraCI/Edge_Value_Retrieval:
current travel time (0x5a): double, Returns the current travel time (length/mean speed).
Where not specified otherwise, SUMO uses the international system of units, that is, the return value is in seconds.

Getting a ETA of a packet in Omnet++

I embedded the Omnet++ simulation kernel into my application and I'm using the inet framework for my simulation. The problem I'm having is that I need to estimate at witch time a packet is going to arrive at it's destination.
So more specific: There are two EtherHost, named H0 and H1 (inet.node.ethernet.EtherHost) and one EtherSwitch named switch (inet.node.ethernet.EtherSwitch), the three are connected like this:
H0 <-> C <-> switch <-> C <-> H1
C denotes a DatarateChannel with datarate = 100Mbps and delay = 0.1us. When the EtherAppCli in H0 sends a EtherAppReq to H1, I need to get a ETA on the EterAppReq packet during the transfer of said packet.
My first thought was to always get the encapsulating package of EtherAppReq, wich is added in the EtherLLC and EtherMAC module but this is not as simple as I thought.. I would need to change all the encapsulating functions in all the lower layers to always get a pointer to the encapsulating package, or am I wrong?
Or is there another way to get a ETA of a packet mid-transfer?
Edit: For my purpose I only need the arrival time at the next module, so if the packet is in the mac module of H0 I need the arrival time at the mac layer in the switch (So no multi module hops). Like when you have a cMessage you can call getArrivalTime() on the message and get a estimate of the arrival time if I'm not mistaken.
Thank you very much for the help in advance!
It is impossible to obtain ETA of a packet in advance. The time of packet's arriving depends on many factors (like in real network), for example: current number of packets in host's and switch's queues, processing time in switch, number of CPU of switch, processing time of MAC layer in a host etc. Therefore at the moment of sending a packet neither the host nor simulation environment do not know when this packet arrive a destination host. So we prepare a model and do a simulation in order to measure this time and learn how some factors influence it.
By the way: there is no H1 in your figure.

How to get current simulation time in omnet++?

I am measuring energy level when the packet comes to one of the specific LCN from anothers.I want to get the current simulation time when packet arrives to this LCN.To do this, I used
SimTime();
function but it always gives me the 0. So, how can I get current simulation time. I need to draw the energy level of the LCN with respect to time until simulation ends.I mean what is energy level of of LCN when the time is 10? (for example)
When you call SimTime() you actually call the constructor for the class SimTime.
What you are looking for is the global function simTime().

Resources