节点如何从传感器接收数据包,另一方面如何将其发送到移动元素?

时间:2018-07-25 18:40:50

标签: omnet++ inet

我正在使用OMNet ++来模拟无线网络。

场景是:“传感器节点将感觉数据发送到某些节点(称为RN)(发送到最近的RN)。一些移动元素从这些点收集数据。”传感器在野外均匀分布并确定RN的位置。ME也遵循BonnMobility并具有预定路径。

我正在使用具有inet 3.6的omnet 5.4。

numHost = 500 ** numME = 5 ** numRN = 50

NED文件:

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");
        }
}

问题是:

如何在.ini文件中设置udp流量? RN如何从传感器接收数据包,并将其发送到ME?

运行此模拟后,如果我设置了特定的目标节点,则所有节点都会向其他所有节点发送数据包。是不是?

这是ini文件的一部分。

*.*.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

0 个答案:

没有答案