OMNet ++를 사용하여 무선 네트워크를 시뮬레이션하고 있습니다. 코드는 다음과 같습니다 :OMNet ++는 한 노드에서 다른 노드로 패킷을 보내고 패킷을 보내고 에너지 소비를 그래프로 기록합니다.
NED FILE
import inet.common.figures.DelegateSignalConfigurator;
import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
import inet.node.inet.INetworkNode;
import inet.physicallayer.contract.packetlevel.IRadioMedium;
import inet.visualizer.integrated.IntegratedCanvasVisualizer;
network WirelessA
{
parameters:
string hostType = default("WirelessHost");
string mediumType = default("IdealRadioMedium");
@display("bgb=2500,2500;bgg=100,1,grey95");
@figure[title](type=label; pos=0,-1; anchor=sw; color=darkblue);
@figure[rcvdPkText](type=indicatorText; pos=900,50; anchor=w; font=,50; textFormat="Packets Received: %g"; initialValue=0);
//@statistic[rcvdPk](source=hostB_rcvdPk; record=figure(count); targetFigure=rcvdPkText);
//@signal[hostB_rcvdPk];
//@delegatesignal[rcvdPk](source=hostB.udpApp[0].rcvdPk; target=hostB_rcvdPk);
submodules:
visualizer: IntegratedCanvasVisualizer {
@display("p=2400,50");
}
configurator: IPv4NetworkConfigurator {
@display("p=2400,250");
}
radioMedium: <mediumType> like IRadioMedium {
@display("p=2400,450");
}
figureHelper: DelegateSignalConfigurator {
@display("p=2400,650");
}
BaseStation: <hostType> like INetworkNode {
@display("p=1200,1200;i=device/antennatower");
}
SubStationA: <hostType> like INetworkNode {
@display("p=600,650;i=device/receiverdish");
}
SubStationB: <hostType> like INetworkNode {
@display("p=1750,600;i=device/receiverdish");
}
SubStationC: <hostType> like INetworkNode {
@display("p=1700,1700;i=device/receiverdish");
}
SubStationD: <hostType> like INetworkNode {
@display("p=650,1750;i=device/receiverdish");
}
SensorNodeA1: <hostType> like INetworkNode {
@display("p=875,900;i=device/device");
}
SensorNodeA2: <hostType> like INetworkNode {
@display("p=425,975;i=device/device");
}
SensorNodeA3: <hostType> like INetworkNode {
@display("p=225,625;i=device/device");
}
SensorNodeA4: <hostType> like INetworkNode {
@display("p=475,275;i=device/device");
}
SensorNodeA5: <hostType> like INetworkNode {
@display("p=875,450;i=device/device");
}
SensorNodeB1: <hostType> like INetworkNode {
@display("p=1875,300;i=device/device");
}
SensorNodeB2: <hostType> like INetworkNode {
@display("p=1450,425;i=device/device");
}
SensorNodeB3: <hostType> like INetworkNode {
@display("p=1475,850;i=device/device");
}
SensorNodeB4: <hostType> like INetworkNode {
@display("p=1925,925;i=device/device");
}
SensorNodeB5: <hostType> like INetworkNode {
@display("p=2100,575;i=device/device");
}
SensorNodeC1: <hostType> like INetworkNode {
@display("p=1425,1950;i=device/device");
}
SensorNodeC2: <hostType> like INetworkNode {
@display("p=1450,1500;i=device/device");
}
SensorNodeC3: <hostType> like INetworkNode {
@display("p=1875,2075;i=device/device");
}
SensorNodeC4: <hostType> like INetworkNode {
@display("p=2100,1750;i=device/device");
}
SensorNodeC5: <hostType> like INetworkNode {
@display("p=1900,1400;i=device/device");
}
SensorNodeD1: <hostType> like INetworkNode {
@display("p=800,2075;i=device/device");
}
SensorNodeD2: <hostType> like INetworkNode {
@display("p=1000,1700;i=device/device");
}
SensorNodeD3: <hostType> like INetworkNode {
@display("p=650,1450;i=device/device");
}
SensorNodeD4: <hostType> like INetworkNode {
@display("p=350,2050;i=device/device");
}
SensorNodeD5: <hostType> like INetworkNode {
@display("p=275,1625;i=device/device");
}
}
INI 파일 여기
[Config Wireless01]
description = Militart Based WSN Model
network = WirelessA
sim-time-limit = 5s
*.BaseStation.networkLayer.arpType = "GlobalARP"
*.SubStation*.networkLayer.arpType = "GlobalARP"
*.SensorNode**.networkLayer.arpType = "GlobalARP"
*.BaseStation.wlan[0].typename = "WirelessNic"
*.BaseStation.wlan[0].radioType = "IdealRadio"
*.BaseStation.wlan[0].macType = "CsmaCaMac"
*.BaseStation.wlan[0].mac.useAck = true
#*.BaseStation.wlan[0].mac.fullDuplex = false
*.BaseStation.wlan[0].radio.transmitter.communicationRange = 1300m
*.BaseStation.wlan[0].radio.receiver.ignoreInterference = true
*.BaseStation.wlan[0].radio.displayCommunicationRange = true
*.BaseStation.**.bitrate = 10Mbps
*.BaseStation.wlan[0].radio.energyConsumerType = "StateBasedEnergyConsumer"
*.BaseStation.wlan[0].radio.energyConsumer.offPowerConsumption = -1mW
*.BaseStation.wlan[0].radio.energyConsumer.sleepPowerConsumption = 0mW
*.BaseStation.wlan[0].radio.energyConsumer.switchingPowerConsumption = 1mW
*.BaseStation.wlan[0].radio.energyConsumer.receiverIdlePowerConsumption = 2mW
*.BaseStation.wlan[0].radio.energyConsumer.receiverBusyPowerConsumption = 5mW
*.BaseStation.wlan[0].radio.energyConsumer.receiverReceivingPowerConsumption = 10mW
*.BaseStation.wlan[0].radio.energyConsumer.transmitterIdlePowerConsumption = 2mW
*.BaseStation.wlan[0].radio.energyConsumer.transmitterTransmittingPowerConsumption = 100mW
*.BaseStation.energyStorageType = "IdealEnergyStorage"
*.SubStation*.wlan[0].typename = "WirelessNic"
*.SubStation*.wlan[0].radioType = "IdealRadio"
*.SubStation*.wlan[0].macType = "CsmaCaMac"
*.SubStation*.wlan[0].mac.useAck = true
#*.SubStation*.wlan[0].mac.fullDuplex = true
*.SubStation*.wlan[0].radio.transmitter.communicationRange = 600m
*.SubStation*.wlan[0].radio.receiver.ignoreInterference = true
*.SubStation*.wlan[0].radio.displayCommunicationRange = true
*.SubStation*.**.bitrate = 5Mbps
*.SubStation*.wlan[0].radio.energyConsumerType = "StateBasedEnergyConsumer"
*.SubStation*.wlan[0].radio.energyConsumer.offPowerConsumption = -1mW
*.SubStation*.wlan[0].radio.energyConsumer.sleepPowerConsumption = 0mW
*.SubStation*.wlan[0].radio.energyConsumer.switchingPowerConsumption = 1mW
*.SubStation*.wlan[0].radio.energyConsumer.receiverIdlePowerConsumption = 2mW
*.SubStation*.wlan[0].radio.energyConsumer.receiverBusyPowerConsumption = 5mW
*.SubStation*.wlan[0].radio.energyConsumer.receiverReceivingPowerConsumption = 10mW
*.SubStation*.wlan[0].radio.energyConsumer.transmitterIdlePowerConsumption = 2mW
*.SubStation*.wlan[0].radio.energyConsumer.transmitterTransmittingPowerConsumption = 100mW
*.SubStation*.energyStorageType = "IdealEnergyStorage"
*.SensorNode**.wlan[0].typename = "WirelessNic"
*.SensorNode**.wlan[0].radioType = "IdealRadio"
*.SensorNode**.wlan[0].macType = "CsmaCaMac"
*.SensorNode**.wlan[0].mac.useAck = true
#*.SensorNode**.wlan[0].mac.fullDuplex = true
*.SensorNode**.wlan[0].radio.transmitter.communicationRange = 250m
*.SensorNode**.wlan[0].radio.displayCommunicationRange = true
*.SensorNode**.wlan[0].radio.receiver.ignoreInterference = true
*.SensorNode**.**.bitrate = 1Mbps
*.SensorNode**.wlan[0].radio.energyConsumerType = "StateBasedEnergyConsumer"
*.SensorNode**.wlan[0].radio.energyConsumer.offPowerConsumption = -1mW
*.SensorNode**.wlan[0].radio.energyConsumer.sleepPowerConsumption = 0mW
*.SensorNode**.wlan[0].radio.energyConsumer.switchingPowerConsumption = 1mW
*.SensorNode**.wlan[0].radio.energyConsumer.receiverIdlePowerConsumption = 2mW
*.SensorNode**.wlan[0].radio.energyConsumer.receiverBusyPowerConsumption = 5mW
*.SensorNode**.wlan[0].radio.energyConsumer.receiverReceivingPowerConsumption = 10mW
*.SensorNode**.wlan[0].radio.energyConsumer.transmitterIdlePowerConsumption = 2mW
*.SensorNode**.wlan[0].radio.energyConsumer.transmitterTransmittingPowerConsumption = 100mW
*.SensorNode**.energyStorageType = "IdealEnergyStorage"
*.configurator.addStaticRoutes = false
*.hostType = "AODVRouter"
*.visualizer.dataLinkVisualizer.packetNameFilter = "AODV*"
*.visualizer.mediumVisualizer.displaySignals = true
*.SensorNodeA1.numUdpApps = 1
*.SensorNodeA1.udpApp[0].typename = "UDPBasicApp"
*.SensorNodeA1.udpApp[0].destAddresses = "SubStationA"
*.SensorNodeA1.udpApp[0].destPort = 5000
*.SensorNodeA1.udpApp[0].messageLength = 1000B
*.SensorNodeA1.udpApp[0].sendInterval = exponential(12ms)
*.SensorNodeA1.udpApp[0].packetName = "UDPData"
*.SubStationA.numUdpApps = 1
*.SubStationA.udpApp[0].typename = "UDPSink"
*.SubStationA.udpApp[0].localPort = 5000
네트워크가 만들어지고 있지만, 내가 SubStationA에 SensorNodeA1에서 패킷을 보내려고 할 때, 시뮬레이션 중에 패킷이 SensorNodeA1에서 모든 노드로 전송됩니다. 한 노드에서 다른 단일 노드로 패킷을 보내려면 어떻게해야합니까? 또한 나는 기록하고 각 노드의 에너지 소비와 시간에 따라 전송 된 패킷 그래프를 그려보고 싶다. 나는 여전히 OMNet ++에 익숙하지 않기 때문에 누군가가 나를 안내 할 수 있다면 도움이 될 것입니다.