使用INET getContainingNicModule()构建节点:找不到nic模块

时间:2019-02-08 17:48:49

标签: omnet++ inet

我正在构建一个无线节点,目前看起来像这样

 module Node extends NodeBase
 {
    parameters:
        mobility.typename = default("StationaryMobility");
        Physical.antenna.mobilityModule = default("^.^.mobility");
        @display("bgl=8;bgb=230.31801,357.28");
        *.interfaceTableModule = default(absPath(".interfaceTable"));
    gates:
        input radioIn @directIn;
    submodules:
        //Don't know what this does but need interfaceTableModule to be defined
        interfaceTable: InterfaceTable {
            parameters:
                @display("p=125,240;is=s");
        }
        Physical: Ieee802154UwbIrRadio{
            @display("p=41,74");
        }
        Link: <default("Ieee802154Mac")> like IMacProtocol {
            @display("p=41,169");
        }
        Net: BroadcastRouting {
            @display("p=41,248");
        }
    connections allowunconnected:
        radioIn --> Physical.radioIn;
        Physical.upperLayerOut --> Link.lowerLayerIn;
        Physical.upperLayerIn <-- Link.lowerLayerOut;
        Link.upperLayerOut --> Net.fromMac;
        Link.upperLayerIn <-- Net.toMac;
}

当模拟器尝试加载LinkLayer时,会产生运行时错误。

运行时错误:getContainingNicModule(): nic module not found (it should have a property named nic) for module 'network.componenet1.Link' ... during network initialisation

我认为功能getContainingNicModule试图做的是寻找作为链路层父级的网络接口卡模块。 我已经搜索了nic属性,但找不到任何内容。它可能与interface属性有关,但我正在镜像的inet.LinkLayerNodeBase没有这样的属性。

为什么会出现此错误?

1 个答案:

答案 0 :(得分:0)

任何like IMacProtocol模块都必须是IWirelessInterface的子模块

通过将IRadioIMacProtocol实现更改为IWirelessInterface中的组合Ieee802154UwbIrInterface实现,不再给我nic module not found error.

引发错误的函数是findContainingNicModule。它是否可以将父模块转换为InterfaceEntry类型。如果失败,则会引发与nic属性有关的错误,但是不再有模块具有该属性。

自inet 3.6.4起(我认为)Nic types have been replaced with Interface types。不过,对Nic的许多其他引用并未更改。因此,该错误无法准确反映问题。

当前工作模块:

module Node extends NodeBase
{

    parameters:
        mobility.typename = default("StationaryMobility");
        wlan.radio.antenna.mobilityModule = default("^.^.^.mobility");
        @display("bgl=8;bgb=230.31801,357.28");
    gates:
        input radioIn @directIn;
    submodules:
        //Don't know what this does but need interfaceTableModule to be defined
        interfaceTable: InterfaceTable {
            parameters:
                @display("p=125,240;is=s");
        }
        wlan: <default("Ieee802154UwbIrInterface")> like IWirelessInterface{
            parameters:
                @display("p=41,248,row,150;q=queue");
        }
        Net: BroadcastRouting {
            @display("p=41,148");
        }
    connections allowunconnected:
        radioIn --> wlan.radioIn;
        wlan.upperLayerOut --> Net.fromMac;
        wlan.upperLayerIn <-- Net.toMac;
}