omnetpp | OMNeT Discrete Event Simulation Framework
kandi X-RAY | omnetpp Summary
kandi X-RAY | omnetpp Summary
The example simulations are designed to demonstrate many of the features of OMNeT++. We recommend that you try tictoc first, which also has an accompanying tutorial under doc/.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of omnetpp
omnetpp Key Features
omnetpp Examples and Code Snippets
Community Discussions
Trending Discussions on omnetpp
QUESTION
Suppose in a wireless network with 25 nodes, we have a scenario where some of each node sends messages to some other nodes according to a routing protocol such as AODV. We simulate this network. After finishing the simulation, how to obtain the number of correct messages on the network layer by the Omnet++ result collection? Two metrics are defined, sentPacketCount and receivedPacketCount. By correct messages, I mean messages received by a node whose destination address field is the address of the same node. If retransmission occurs, it should be counted once for the receiver side for receivedPacketCount, in fact, received Packet Count will be increased when the packet is received in destination node. Every packet is sent, sentPacketCount will be increased. If a node has more than an application, all the messages generated by all applications of the same node must be counted.
A part of omnetpp.ini file is for a node:
...ANSWER
Answered 2021-May-26 at 08:09For TcpBasicApp
or any other TCP app, the count of packets is meaningless. Tcp apps have streams, not packets. Even if you send out 1000 bytes in one write operation to a TCP socket, the other end may get it using 3 read operation, or 20... TCP also guarantees the delivery of the packets, so number of successfully sent packets = number of successfully received packets. So byte count statistics also do not matter.
Number of sent/received packets/bytes makes sense for UDP traffic. In UDP there is a concept of packets and there is no guaranteed delivery. Luckily UdpBasicApp
gathers these statistics by default. Take a look at the packetReceived and packetSent
statistic. It gathers both packet count and total byte count.
You may need to turn on scalar recording on all apps:
QUESTION
Suppose in a wireless network with 25 nodes, we have a scenario where some of each node sends messages to some other nodes according to a routing protocol such as AODV. We simulate this network. After finishing the simulation, how to obtain the sum of messages byte length on the network layer by the Omnet++ result collection? For each node, we must have two metrics, a metric for sent message byte lengths (e.g. totalSentMessageByteLengths) and a metric for received message byte lengths (e.g. totalReceivedMessageByteLengths). By correct messages, I mean messages received by a node whose destination address field is the address of the same node. If retransmission occurs, it should be summed once for the receiver side, summed the incorrect message byte lengths, and the correct message byte lengths for the sender side. If a node has more than an application, all the message byte lengths generated by all applications of the same node must be calculated. Message byte lengths mean the total byte of header and data on the network layer per byte. An instace code for a node in omnetpp.ini:
...ANSWER
Answered 2021-May-26 at 09:01The Ipv4 module has several signals that can be used to create statistics either on a node or network level like packetSentToLower
or packetReceivedFromLower
. Just use these signals on your @statistics declaration.
QUESTION
I need to find which methods in the Inet are best for the following conditions and requests:
All applications in the application layer such as TcpApp, UDPApp, UdpBasicApp, etc are processed in a common method when a message or packet is received. For example, when a UdpBasicApp packet is sent, that packet is processed in that function(method). Also, a TcpApp packet is received, that packet is processed in that function(method). I guess that function(method) should be belonging a class on the common path before arriving to all applications(I guess that should be in Network Layer or Transport Layer).
Suppose a part of my omnetpp.ini is:
...ANSWER
Answered 2021-May-16 at 07:56The content of the application data packet is specific to any given application so there is no common function where you could catch 'all' application data. Even if there would be such a method, you would not be able to do anything with the data packet, because you would not know what is inside the packet and how to interpret it. You would just see X bytes of data.
There is no common point down on lower layers either.
- On link layer, data can come in on various interfaces if you have several networking cards.
- On network layer, you can have either IPv6 or IPv4 traffic, so again no common path.
- On transport layer, you can have either UDP, TCP or SCTP
- On application layer, you have many application each interpreting the application data differently.
In short, there is no such method and in fact it does not make sense to have one.
QUESTION
Modules that contain submodules are termed compound modules, as opposed to simple modules at the lowest level of the module hierarchy. Simple modules contain the algorithms of the model. The user implements the simple modules in C++, using the simulation class library A simple module supports handlemessage function, but a compound module doesn't support the handlemessage. An instance and most usage of compound module is AdhocHost module. How can add capability of supporting handlemessage function to compound module? For specially, add the handlemessage capability for AdhocHost module in the network layer.
Is it possible to use a Inet Host like e.g. the WirelessHost from inet and apply custom coding for handling the message when received? I have only seen inet tutorials using the ini and ned files.
When checking basic Tutorials without inet, like tictoc, there was the possibility to use the handleMessage function when a message has been received. Is there a similar possibility when using the WirelessHost or the AdhocHost module in the Inet?
...ANSWER
Answered 2021-May-05 at 11:27By definition, you call something a "compound module" if you delegate the message processing to smaller internal modules. If you have a handleMessage()
method and want to process the message in C++ code, that is called a simple module by definition again.
What you are asking is I guess: Can I add new behavior to INET modules that are coded in C++? And the answer is yes. You can implement your own behavior in simple modules and then you can insert those simple modules inside the node in various places. The most notable example is that you implement an application and then you can install that application inside the host, just like the applications already implemented in INET (like PingApp or UDPBasicApp etc.)
QUESTION
After configuring the simulation environment in Veins 5.0
, different nodes send and receive messages at the same time. However, the following log is output only for specific messages.
Packet has bit Errors. Lost
Packet was not received correctly, sending it as control message to upper layer
After browsing various information, I modified the omnetpp.ini
code as follows, but the same transmission loss log is output.
omnetpp.ini
...ANSWER
Answered 2021-Apr-18 at 09:58What you are describing are collisions: if a node receives two wireless transmissions at the same time, it has difficulties understanding either transmission. (Imagine two people speaking to you at the same time: in this situation you would also have a harder time understanding what is being said).
Normally, 802.11 tries to avoid this situation (this is the whole point of CSMA/CA, backoffs, ...), but there are cases where the mechanisms fail:
A rather well-known case is a "hidden terminal" situation, where a sender is not aware of the presence of another sender (e.g., the other sender is hidden behind a building).
Another, less well known case, is that where both senders start transmitting at the exact same time: Both senders will see that nobody else is transmitting, will change from receive to transmit mode, and will start sending (completely unaware that another sender is doing exactly this at exactly the same time). In practice, this situation is rather uncommon (after all, the two senders would need to start sending at very precisely the same time). Unfortunately, it is rather easy to do this by mistake in simulations: just configure two nodes to transmit at t=42s and they will both be trying to transmit at exactly t=42s.
QUESTION
I have pre-written functions from another project that I want to include as part of my simulations. I have the object file (functions.a) and the header file (functions.h) of these functions.
In a normal C/C++ project, I was able to import them using the steps outlined in this answer. However, my project was created as an OMNeT++ project and it appears the C/C++ Build -> Settings -> GCC C Linker -> Miscellaneous
properties are not made available.
Is there a way to access these properties or another alternative to import object files in an OMNeT project?
EDIT
I tried adding
...ANSWER
Answered 2021-Apr-07 at 20:47OMNeT++ project uses Makefile, therefore to add an external library or class one should modify makefrag.
You should go to Project
| Properties
| OMNeT++
| Makemake
| select root or src
of your project | Options
, then Custom
| Makefrag
and write the following lines:
QUESTION
I have parameters stored in an XML file. Below is a sample of the file.
...ANSWER
Answered 2021-Mar-31 at 13:04Don't do this. par("moduleParameter").xmlValue()
will give you the in memory object tree of the XML document, but that is not meant for modification. Your XML file seems to be just a hierarchical structure and modules and their parameters can mirror that exactly. There is absolutely no reason to reinvent the wheel when you can mirror that with INI file parameters.
QUESTION
I used SUMO
to move vehicles and bus nodes on a four-lane road. The source code of my route file is as follows:
ANSWER
Answered 2021-Mar-23 at 17:33I solved the problem.
First of all, I applied this link to my problem.
Using my question, how to register 2 or more nodes in moduleType
is as follows.
QUESTION
Instead of using OSM
, I used SUMO
to create a straight road with four lanes one way.
The simulation environment I want is to use IEEE 802.11p
and LTE
at the same time. So, Veins
and SimuLTE
framework are used together, and VeinsInetMobility
is used instead of TraCI
.
When running the actual simulation, it is located in the blue box as shown below. I want to move it to the red box position.
Do I need to edit omnetpp.ini
to move it to the red position? I don't know how to write the code to get the position moved.
ANSWER
Answered 2021-Mar-21 at 13:46SUMO and OMNeT++ are using different coordinate systems -- in fact, OMNeT++ normalizes, then flips SUMO coordinates vertically. For more details see the Veins FAQ entry "Why are the coordinates returned by TraCI methods different from the ones I see in the GUI?" on https://veins.car2x.org/documentation/faq/.
If you want your vehicles in OMNeT++ to drive somewhere else you will need to change your SUMO simulation. In particular, if you want your cars in OMNeT++ to move further "south" (i.e., down), you will need to move the roads they are driving on in SUMO further "south". To be sure that SUMO does not just remove empty space in the "north" of your simulation when saving the map, you might have to add some dummy road up there, though I did not test this.
QUESTION
I am using OMNeT++ 5.5.1, veins 5.0 and SUMO 1.7.0 to simulate a highway having six lanes in total (3 lanes in each direction). I am simulating the network with different number of vehicles (e.g., 50, 100, 150, 200) that I am generating from SUMO.
The simulation runs fine when number of vehicles are 50 and 100. However, when I set the number of vehicles to 150, I get an error: "Cannot open output scalar file ...
" (as attached in the screenshot below).
The error occurs when a vehicle (node[84]
) leaves the network.
On debugging, I found that this error is causing in callFinish()
method of cModule.cc
:
https://github.com/omnetpp/omnetpp/blob/omnetpp-5.x/src/sim/cmodule.cc#L1428
and it throws an exception that is caught here: https://github.com/omnetpp/omnetpp/blob/omnetpp-5.x/src/sim/cmodule.cc#L1443
Can anyone suggest how to correct it? Many thanks.
Best Regards,
Yasir Saleem
...ANSWER
Answered 2021-Feb-09 at 12:23Thanks to @ChristophSommer for pointing out the attention towards memory corruption. It helped me to solve the issue.
Cause of Problem: For logging statistics, I was creating a csv file (ofstream) and I realized that the csv was opening by all the vehicles and RSUs (instead of one node) while was closing ofstream by only one node (RSU). This was causing the problem.
Solution: I fixed by making the ofstream variable global and opening and closing the ofstream file it by only one node (RSU).
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install omnetpp
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page