首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OMNET++无线通信客户端服务器

OMNET++无线通信客户端服务器
EN

Stack Overflow用户
提问于 2016-05-18 12:08:10
回答 1查看 1.4K关注 0票数 0

这是我第一次使用OMNET++。

我想从最基本的东西开始,了解它是如何工作的。我成功地用两个主机创建了我的第一次模拟(来自tictoc示例)。

我现在要做的是模拟一个AP和一个无线节点之间简单的客户机-服务器无线通信。我正在尝试使用inet中的元素来实现这一点,但是我被困住了,而且它不起作用。

代码语言:javascript
复制
import inet.networklayer.configurator.base.NetworkConfiguratorBase;
import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
import inet.networklayer.configurator.ipv4.IPv4NodeConfigurator;
import inet.node.inet.WirelessHost;
import inet.node.wireless.AccessPoint;
import inet.physicallayer.common.packetlevel.RadioMedium;
import inet.physicallayer.contract.packetlevel.IRadioMedium;
import inet.physicallayer.ieee80211.packetlevel.Ieee80211RadioMedium;


//
// TODO documentation
//
network net
{
    string mediumType = default("IdealRadioMedium");
    @display("bgb=620,426");
    submodules:
        wirelessHost1: WirelessHost {
            @display("p=423,164");
        }
        accessPoint1: AccessPoint {
            @display("p=147,197");
        }
        iRadioMedium: <mediumType> like IRadioMedium {
            @display("p=523,302");
        }
        iPv4NetworkConfigurator: IPv4NetworkConfigurator {
        @display("p=270,324");
        assignDisjunctSubnetAddresses = false;
    }
}

然后,我使用tictoc创建了一个wirelessHost.cc源文件,以使两个节点进行通信。

但是它不起作用,我得到了一个错误:

代码语言:javascript
复制
<!> Error in module (inet::IPv4NodeConfigurator) infrastructure.wirelessHost1.networkLayer.configurator (id=13) during network initialization: Configurator module 'configurator' not found (check the 'networkConfiguratorModule' parameter).

但是在做某事之前,这是关于接入点的另一个错误(找不到wlan模块)。有人能帮助我理解如何配置这个模型吗?

编辑这里是配置.ini文件

代码语言:javascript
复制
[General]
network = infrastructure

#cmdenv-output-file = omnetpp.log
#debug-on-errors = true
tkenv-plugin-path = ../../../etc/plugins
#record-eventlog = true

**.constraintAreaMinX = 0m
**.constraintAreaMinY = 0m
**.constraintAreaMinZ = 0m
**.constraintAreaMaxX = 600m
**.constraintAreaMaxY = 500m
**.constraintAreaMaxZ = 0m

**.mobility.typename = "StationaryMobility"
**.mobilityType = "StationaryMobility"


# access point
*.accessPoint.wlan[0].mac.address = "004444444444"
*.accessPoint.wlan[0].radio.channelNumber = 11


# host1 is associated with AP1 on channel 0
**.wirelessHost1.wlan[0].mgmt.accessPointAddress = "004444444444"
*.wirelessHost1.**.mgmtType = "Ieee80211MgmtSTASimplified"


# global data rates
**.wlan*.bitrate = 11Mbps

# application level: host1 pings host2
**.numPingApps = 1
*.wirelessHost1.pingApp[0].destAddr = "accessPoint"
*.wirelessHost1.pingApp[0].sendInterval = 10ms

但是运行我得到的模拟

代码语言:javascript
复制
<!> Error in module (inet::ICMP) infrastructure.wirelessHost1.networkLayer.icmp (id=17) at event #4, t=0.008442657441: check_and_cast(): cannot cast (inet::GenericNetworkProtocolControlInfo*) to type 'inet::IPv4ControlInfo *'.
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-18 12:21:41

网络中的IPv4NetworkConfigurator实例必须将命名为configurator。更改名称后,您的第二个问题也应该得到解决。

此外,RadioMedium实例模块的名称必须是:radioMedium (而不是iRadioMedium)。

编辑

你犯了两个错误。

  1. AccessPoint 没有网络层,因为它只在实际网络中使用MAC层和MAC地址来中继和发送MAC帧。因此,它没有IP地址,不可能将ICMP ping发送到它。
  2. OMNeT++允许使用模块的名称来代替ini文件中的IP地址,例如**.destAddr = "wirelessHost1"。在您的ini中,您尝试使用不存在的accessPoint而不是accessPoint1 (由于第一个错误而不正确)。

我建议添加一个新的WirelesHost (例如wirelessHost2)并向它发送ping,即

代码语言:javascript
复制
*.wirelessHost1.pingApp[0].destAddr = "wirelessHost2"
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37299149

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档