Presentation is loading. Please wait.

Presentation is loading. Please wait.

Modelling and Simulation

Similar presentations


Presentation on theme: "Modelling and Simulation"— Presentation transcript:

1 Modelling and Simulation
OMNeT++

2 How to install OMNET++ Download zip file located “Intranet\Faculties\Information & Engineering Technology\Modelling and Simulation” Unzip In mingwenv file type ./configure make 4) You can open OMNeT now from ide folder

3 Tictoc1.ned Tictoc 1 is a network.
It consists of 2 submodules tic and toc. Tic and toc are instances of the same module type called Txc1 Tic’s output gate is connected to toc’s inpute gate and vice versa

4 Tictoc1.ned

5 Txc1.cc It is a simple module, it is implemented in c++.
It has to be subclassed from cSimpleModule.

6 Initialize() method: It is called at the beginning of the simulation.
It checks if it is tic, a message object(cMessage) is created and sent to the “out” gate which is the input gate of another module.

7 handleMessage(cMessage *msg) method:
After the message is sent it will be delivered to the handleMessage. handleMessage is called whenever a messages arrives at the module.

8 Txc1.cc

9 Txc2.cc Adding Debug Messages

10 Tictoc2.ned

11 Txc3.cc Adding a variable

12 Tictoc4.ned How to add input parameters to the simulation?
Parameters have to be declared in the NED file

13 Txc4.cc Read the parameter in the initialize() method

14 Tictoc5.ned Using Inheritance

15 Tictoc5.ned

16 Txc6.cc tic and toc will hold the message before sending it back.
In the initialize method:

17 Txc6.cc In the handleMessage method:

18 Useful Methods cMessage *copy = (cMessage *)msg->dup();
It creates duplicate messages. Int k=intuniform(a,b) It returns a random integer with uniform distribution in the range[a,b]. Record-eventlog = true It records a detailed log about your message exchanges automatically


Download ppt "Modelling and Simulation"

Similar presentations


Ads by Google