The configuration file is what defines how the simulation will run. In every simulation, this configuration is called omnetpp.ini
. Without this file, the simulation will not run.
To demonstrate a configuration file, let's consider the following network described by this topology:
package book.simulations; import inet.examples.httptools.socket.tenserverssocket .ethernetline; import inet.networklayer.autorouting.ipv4.FlatNetworkConfigurator; import inet.nodes.inet.Router; import inet.nodes.inet.StandardHost; network My_Network { @display("bgb=620,293"); submodules: standardHost: StandardHost { @display("p=90,176"); } standardHost1: StandardHost { @display("p=365,215"); } router: Router { @display("p=243,87"); } flatNetworkConfigurator: FlatNetworkConfigurator { @display("p=527,112"); } connections: standardHost.ethg++ <-->ethernetline<-->router.ethg++; router.ethg++ <-->ethernetline<--> standardHost1.ethg++; }
The preceding code snippet creates the following network:
For this simulation to work, the following configuration file (omnetpp.ini
) must be made as follows:
[General] network = book.simulations.My_Network #We will make standardHost a TCP Session Application in order for it to #communicate **.standardHost.numTcpApps = 1 **.standardHost.tcpApp[0].typename = "TCPSessionApp" **.standardHost.tcpApp[0].connectAddress = "standardHost1" **.standardHost.tcpApp[0].connectPort = 1000 #We will make standardHost1 a TCP Echo Application, this means that it will send #an echo packet once it receives a packet. **.standardHost1.numTcpApps = 1 **.standardHost1.tcpApp[0].typename = "TCPEchoApp" **.standardHost1.tcpApp[0].localPort = 1000 **.standardHost1.tcpApp[0].echoFactor = 3.0 #**.ppp[*].queueType = "DropTailQueue" #**.ppp[*].queue.frameCapacity = 10 #**.eth[*].queueType = "DropTailQueue"
The first thing that we see in our configuration file is that the network to run is defined. The configuration file then goes on to describe how standardHost
and standardHost1
should behave. We connect standardHost
to standardHost1
with the following lines of code:
**.standardHost.tcpApp[0].connectAddress = "standardHost1" **.standardHost.tcpApp[0].connectPort = 1000
The **
at the start of the preceding lines mean that we don't have to use the following syntax instead:
My_Network.standardHost.tcpApp[0].connectAddress = "standardHost1" My_Network.standardHost.tcpApp[0].connectPort = 1000
The **
symbol is a wildcard, which works in this scenario as there is only one network it can pick from because I have only defined one.
Similar to the graphical editor for creating network topologies, there is also a form version for writing the configuration file of your network simulation.
You may prefer to use this instead of writing out the configuration file from scratch for the same reason as you may want to use the graphical editor to create the network topology for your network.
3.138.34.80