问题
I am using OMNet++ to simulate a wireless network.
The scenario is : "sensor nodes send sensory data to some nodes (called RN)(send to the nearest RN). and some mobile elements collect data from these points." sensors distribute uniform in field and position of RNs are determined.also MEs follow BonnMobility with predefined path.
I'm using omnet 5.4 with inet 3.6.
numHost=500 ** numME=5 ** numRN=50
NED file:
network MyNet
{
parameters:
int numHost;
int numME;
int numRN;
string hostType = default("WirelessHost");
string mediumType = default("IdealRadioMedium");
@display("bgb=600,600;bgu=m");
submodules:
visualizer: IntegratedCanvasVisualizer {
parameters:
@display("p=47,16");
}
configurator: IPv4NetworkConfigurator {
parameters:
@display("p=398.63998,15.7039995");
}
radioMedium: <mediumType> like IRadioMedium {
parameters:
@display("p=280.256,15.7039995");
}
lifecycleController: LifecycleController {
parameters:
@display("p=513.4,15.7039995");
}
host[numHost]: <hostType> like INetworkNode {
parameters:
@display("p=300,300;i=device/cellphone");
}
ME[numME]: <hostType> like INetworkNode {
@display("p=577.424,506.152;i=device/pocketpc");
}
RN[numRN]: <hostType> like INetworkNode {
@display("p=300.792,413.136;i=device/server");
}
physicalEnvironment: PhysicalEnvironment {
@display("p=157.04,15.7039995");
}
sinkNode: SinkNode {
@display("p=300,565.344;i=device/antennatower;is=l");
}
}
the question is:
how can i set udp traffic in .ini file? How could RN receive packets from sensors and on the other hand send them to MEs?
After running this simulation, all nodes send packet to all others, provided I set a specific destination node. Is it correct or not?
this is a part of ini file.
*.*.networkLayer.arpType = "GlobalARP"
*.host[*].numUdpApps = 1
*.host[*].udpApp[0].typename = "UDPBasicApp"
*.host[*].udpApp[0].destAddresses=moduleListByPath("**.RN[*]")
*.host[*].udpApp[0].destPort = 1000
*.host[*].udpApp[0].messageLength = 100 bytes
*.host[*].udpApp[0].sendInterval = exponential(12s)
*.host[*].udpApp[0].startTime = uniform(0s,10s)
*.host[*].udpApp[0].packetName = "UDPData"
*.RN[*].numUdpApps =2
*.RN[*].udpApp[0].typename = "UDPBasicApp" # or "UDPSink"???
*.RN[*].udpApp[0].localPort = 1000
*.RN[*].udpApp[0].destPort = 1001
*.RN[*].udpApp[0].destAddresses = moduleListByPath("**.ME[*]")
*.RN[*].udpApp[0].messageLength = 100 bytes
*.RN[*].udpApp[0].sendInterval = exponential(40s)
*.RN[*].udpApp[1].typename = "UDPSink"
*.RN[*].udpApp[1].localPort = 1002
*.RN[*].udpApp[1].destPort = 1001
*.RN[*].udpApp[1].messageLength = 100 bytes
*.RN[*].udpApp[1].sendInterval = exponential(40s)
*.RN[*].udpApp[1].packetName = "UDPData"
*.ME[*].numUdpApps = 1
*.ME[*].udpApp[0].typename = "UDPSink"
*.ME[*].udpApp[0].localPort = 1001
NED file
INI file
来源:https://stackoverflow.com/questions/51525684/how-could-nodes-receive-packets-from-sensors-and-on-the-other-hand-send-them-to