使用 INet 在 Omnet++ 上检查和投射错误
Check and Cast error on Omnet++ with INet
我正在尝试通过 AP 和路由器从 WirelessHost (Host1) 向 StandardHost (Host3) 发送 Udp 消息,但是当我 运行 模拟 (i称我的网络为“poi”):
check_and_cast(): Cannot cast 'inet::physicallayer::INoise*' to type
'const inet::physicallayer::NarrowbandNoiseBase *' -- in module
(inet::physicallayer::Ieee80211Radio) poi.router.wlan[0].radio
(id=80), during network initialization
几天前我开始将 omnet++ 与 Inet 一起使用,并且我的代码基于教程和文档,但我找不到解决此错误的方法。任何经验或解决方案?
谢谢
这是 .ned 代码,没有导入:
network poi {
parameters:
@display("bgb=514,316;bgg=100,1,grey95");
@figure[title](type=label; pos=0,-1; anchor=sw; color=darkblue);
@figure[rcvdPkText](type=indicatorText; pos=380,20; anchor=w; font=,18; textFormat="packets received: %g"; initialValue=0);
@statistic[packetReceived](source=host3.app[0].packetReceived; record=figure(count); targetFigure=rcvdPkText);
submodules:
host1: WirelessHost {
@display("p=403,224");
numWlanInterfaces = 1;
numApps = 1;
}
router: Router {
@display("p=193,224");
numWlanInterfaces = 2;
numEthInterfaces = 2;
numApps = 4;
}
accessPoint: AccessPoint {
@display("p=303,217;r=2000");
}
host3: StandardHost {
@display("p=73,224");
numEthInterfaces = 1;
numApps = 1;
}
integratedCanvasVisualizer: IntegratedCanvasVisualizer {
@display("p=379,57");
}
configurator: Ipv4NetworkConfigurator {
@display("p=104,35");
}
unitDiskRadioMedium: UnitDiskRadioMedium {
@display("p=216,100;r=10000");
}
connections:
accessPoint.ethg++ <--> Eth10G { @display("ls=,0"); } <--> router.ethg[0];
router.ethg[1] <--> Eth10G { @display("ls=,0"); } <--> host3.ethg[0];
}
和 .ini 文件:
[General]
network = poi
*.host*.ipv4.arp.typename = "GlobalArp"
*.router.ipv4.arp.typename = "GlobalArp"
*.router.app[*].typename = "UdpBasicApp"
*.host1.app[0].typename = "UdpBasicApp"
*.host1.app[0].destAddresses = "accessPoint"
*.host1.app[0].messageLength = 500B
*.host1.app[0].sendInterval = uniform(1ms,10ms)
*.host1.app[0].packetName = "UDPData"
*.host1.wlan[*].radio.radioMediumModule = "unitDiskRadioMedium"
*.router.wlan[*].radio.radioMediumModule = "unitDiskRadioMedium"
*.accessPoint.wlan[*].radio.radioMediumModule = "unitDiskRadioMedium"
*.host*.wlan[*].radio.receiver.ignoreInterference = true
*.host3.app[*].typename = "UdpBasicApp"
*.host*.wlan[0].typename = "AckingWirelessInterface"
*.host*.wlan[0].mac.useAck = false
*.host*.wlan[0].mac.fullDuplex = true
*.host*.wlan[0].radio.transmitter.communicationRange = 500m
*.host*.wlan[0].mac.headerLength = 1B
*.host*.**.bitrate = 1Gbps
添加到您的 ini 文件:
**.wlan[*].radio.typename = "UnitDiskRadio"
除此之外,您还可以在ini中设置未分配的参数,例如:
**.app[0].destPort = 4000
**.app[0].messageLength= 100B
**.app[0].sendInterval= 1s
**.transmitter.communicationRange = 500m
我正在尝试通过 AP 和路由器从 WirelessHost (Host1) 向 StandardHost (Host3) 发送 Udp 消息,但是当我 运行 模拟 (i称我的网络为“poi”):
check_and_cast(): Cannot cast 'inet::physicallayer::INoise*' to type 'const inet::physicallayer::NarrowbandNoiseBase *' -- in module (inet::physicallayer::Ieee80211Radio) poi.router.wlan[0].radio (id=80), during network initialization
几天前我开始将 omnet++ 与 Inet 一起使用,并且我的代码基于教程和文档,但我找不到解决此错误的方法。任何经验或解决方案? 谢谢
这是 .ned 代码,没有导入:
network poi {
parameters:
@display("bgb=514,316;bgg=100,1,grey95");
@figure[title](type=label; pos=0,-1; anchor=sw; color=darkblue);
@figure[rcvdPkText](type=indicatorText; pos=380,20; anchor=w; font=,18; textFormat="packets received: %g"; initialValue=0);
@statistic[packetReceived](source=host3.app[0].packetReceived; record=figure(count); targetFigure=rcvdPkText);
submodules:
host1: WirelessHost {
@display("p=403,224");
numWlanInterfaces = 1;
numApps = 1;
}
router: Router {
@display("p=193,224");
numWlanInterfaces = 2;
numEthInterfaces = 2;
numApps = 4;
}
accessPoint: AccessPoint {
@display("p=303,217;r=2000");
}
host3: StandardHost {
@display("p=73,224");
numEthInterfaces = 1;
numApps = 1;
}
integratedCanvasVisualizer: IntegratedCanvasVisualizer {
@display("p=379,57");
}
configurator: Ipv4NetworkConfigurator {
@display("p=104,35");
}
unitDiskRadioMedium: UnitDiskRadioMedium {
@display("p=216,100;r=10000");
}
connections:
accessPoint.ethg++ <--> Eth10G { @display("ls=,0"); } <--> router.ethg[0];
router.ethg[1] <--> Eth10G { @display("ls=,0"); } <--> host3.ethg[0];
}
和 .ini 文件:
[General]
network = poi
*.host*.ipv4.arp.typename = "GlobalArp"
*.router.ipv4.arp.typename = "GlobalArp"
*.router.app[*].typename = "UdpBasicApp"
*.host1.app[0].typename = "UdpBasicApp"
*.host1.app[0].destAddresses = "accessPoint"
*.host1.app[0].messageLength = 500B
*.host1.app[0].sendInterval = uniform(1ms,10ms)
*.host1.app[0].packetName = "UDPData"
*.host1.wlan[*].radio.radioMediumModule = "unitDiskRadioMedium"
*.router.wlan[*].radio.radioMediumModule = "unitDiskRadioMedium"
*.accessPoint.wlan[*].radio.radioMediumModule = "unitDiskRadioMedium"
*.host*.wlan[*].radio.receiver.ignoreInterference = true
*.host3.app[*].typename = "UdpBasicApp"
*.host*.wlan[0].typename = "AckingWirelessInterface"
*.host*.wlan[0].mac.useAck = false
*.host*.wlan[0].mac.fullDuplex = true
*.host*.wlan[0].radio.transmitter.communicationRange = 500m
*.host*.wlan[0].mac.headerLength = 1B
*.host*.**.bitrate = 1Gbps
添加到您的 ini 文件:
**.wlan[*].radio.typename = "UnitDiskRadio"
除此之外,您还可以在ini中设置未分配的参数,例如:
**.app[0].destPort = 4000
**.app[0].messageLength= 100B
**.app[0].sendInterval= 1s
**.transmitter.communicationRange = 500m