我正在构建一个无线节点,它目前看起来像这样
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
没有这样的财产。
为什么会出现此错误?
like IMacProtocol
模块都必须是IWirelessInterface
的子模块通过将IRadio
和IMacProtocol
实现更改为IWirelessInterface
中组合的Ieee802154UwbIrInterface
实现,它不再给我nic module not found error.
抛出错误的函数是findContainingNicModule。它查找是否可以将父模块转换为InterfaceEntry
类型。如果它失败则会使错误与nic
属性有关,但是没有模块具有该属性。
自从inet 3.6.4(我认为)Nic types have been replaced with Interface types。尽管如此,很多其他对Nic
s的引用都没有改变。因此错误无法准确反映问题。
工作模块现在:
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;
}