Reputation: 3
I am new to Omnet++ and currently trying to simulate a simple example where a user:StandardHost sends a message every five seconds to a scheduler:StandardHost which inturn sends it once to Client01:StandardHost and once to Client02:StandardHost. I have no clue of how to code it as StandardHost is a compound module and doesnt have any public methods from where i could change its behavior. Can any one here help me out simulating this or direct me to a similar example tutorial?
Upvotes: 0
Views: 525
Reputation: 881
A StandardHost is a compound module, just like you said. That only means that it is a combination of various simple (or other compound) modules, which (for simple modules) have source code files.
In your case, you would need to take a look at the actual application used in your StandardHost
. This application should generate traffic and receive and forward packets.
The INET Wireless Tutorial is aimed at wireless networks, but it includes most of the things that you would need (basic introduction to INET, how to configure nodes, how to set parameters in NED files or in the omnetpp.ini
, traffic patterns, etc). If you haven't checked it out, I recommend it as your first step into INET.
As for your specific "problem", I'd suggest to create three simple applications (maybe named sender and forwarder and receiver), which you define as the actual applications in your StandardHost NED file. Remember that a simple module needs source code and a NED file. The NED file of your applications should be either "imported" in the INET StandardHost.ned file or you need to derive your applications from INET's standard applications (like the Ping or UDP apps) and use the interface classes (IPingApp
) defined there.
The actual applications should:
handleMessage()
function, implement a part that checks for self-messages (like the "timer" you created in the initialize()
of your application) and whenever the "timer runs out" (meaning your self-message was delivered to your module), re-schedules the timer and sends a message to the other node (scheduler)dup()
method) of the incoming message to your Client01 and Client02 modules.handleMessage()
to (maybe) count the received messages or generate some other statistics.You can either use the sendDirect()
method, if you want to send messages directly (without using a specific channel) to a module or you can send the messages over NED connections (which could model delays), here you would need to clearly define which connection goes to which node, maybe through different names in your network NED file.
The basic TicTocTutorial of OMNeT++ does explain much of these things without using INET or its modules and structures (like StandardHost).
More complex INET examples with TCP/UDP traffic can be found in the examples folder of INET, take a look at the ber
or tcpclientserver
examples there to find out more about the configuration of NED files etc.
Upvotes: 3