OMNET ++ main topological model description language NED, it can be done using a network model description. Description network includes the following components: an input stated, channel definition, the definition of the network, and a composite module defined simple modules. NED described using the network, to produce the NED file, the file can not be used directly by the C ++ compiler, the compiler need to use tools provided OMNET ++ .NED documents translated into the NEDC .cpp file. Finally, these files using C ++ compiler will connect into an executable program with a simple and user module program of their own design.
Ned components described
Input: After the profile used to introduce other networks, a network described in the introduction, it contains modules may be used like channel assembly
import inet.networklayer.configurator.ipv4.HostAutoConfigurator; import inet.node.inet.AdhocHost;
Channel definition
-
- ned.IdealChannel (ideally)
- ned.DelayChannel (parameter delay, disabled default flase, = true time discard all message channels )
- ned.DatarateChannel (parameters)
- datarate channel bandwidth in bit / s, kbit / s, Gbit / s. A value of 0 indicates an infinite bandwidth, transmission time 0
- delay
- disabled
- ber bit error rate / per packet error rate (double) values [0,1] default value of 0. (Random numbers based on the channel determination, the packet is handed down when an error occurs, an error flag by the packet receiving module check mark. Marks if they are discarded)
channel CustomChannel extends ned.DatarateChannel{ delay = 100us ; ber = 1e-10; datarate = 100Mbps ; }
May not be used directly extends define channel may be, but requires a corresponding C ++ classes.
Simple and complex modules Module Definition
Simple modules:
simple Processor{ parameters: double of;
.... gates:
input in[];
output out[];
inout port[];
}
Composite module:
module BinaryTree{
parameters:
int count ; gates: submodules:
Node [COUNT]: the Node {// Node module is also a simple definition
Parameters:
Information = "Node"
}
connections allowunconnected:
}
Network definition
network Net6 extends BinaryTree{
parameters:
count = 10;
....
}
function
In NED expression, you can use the following mathematical functions:
(1) C language <math.h> library function: exp (), log (), cos (), floor (), ceil () and the like.
(2) generates a random variable function: uniform, exponential, normal and the like.
(3) use their own definitions, defined functions in c ++ file, and then use NED.
- C ++ files
#include <omnetpp.h> double average (double a ,double b){ return (a+b)/2; } Define_ Function (average, 2);
- NED file
module Compound{ parameters: double a; double b; submodules: proc: Processor {// simple module defined above parameters: of = avreage (a, b); } }