如何在omnet ++静脉中实现RSU到RSU的通信?

时间:2019-04-19 11:33:09

标签: omnet++ veins

我正在尝试通过静脉实现RSU到RSU的通信。为此,我将一个inout门添加到RSU模块(RSU.ned文件)中:

module RSU
{
    parameters:
        string applType; //type of the application layer
        string nicType = default("Nic80211p"); // type of network interface card
    gates:
        input veinsradioIn; // gate for sendDirect
        inout gate[]; // add in out gates to ensure communication between RSUs        
    submodules:
        appl: <applType> like org.car2x.veins.base.modules.IBaseApplLayer {
            parameters:
                @display("p=60,50");
        }

        nic: <nicType> like org.car2x.veins.modules.nic.INic80211p {
            parameters:
                @display("p=60,166");
        }

        mobility: BaseMobility {
            parameters:
                @display("p=130,172;i=block/cogwheel");
        }

    connections allowunconnected:
        nic.upperLayerOut --> appl.lowerLayerIn;
        nic.upperLayerIn <-- appl.lowerLayerOut;
        nic.upperControlOut --> appl.lowerControlIn;
        nic.upperControlIn <-- appl.lowerControlOut;

        veinsradioIn --> nic.radioIn;
}

此外,在RSUExampleScenario.ned文件中,我添加了第二个RSU并连接两个RSU:

network RSUExampleScenario extends Scenario
{
    types:
        channel myChannel extends ned.DelayChannel {
            delay = 100ms;
        };

    submodules:
        rsu[2]: RSU {                @display("i=veins/sign/yellowdiamond;is=vs;p=150,140;b=10,10,oval;r=1000");
        }            
    connections allowunconnected:
        rsu[0].gate++ <--> myChannel <--> rsu[1].gate++;
}

在TraciDemoRSU11p.cc文件中,我尝试发送如下消息:

int nb_gate = gateSize("gate");
int out_ = intuniform(0,nb_gate-1);    
cMessage *msg = dynamic_cast<cMessage*>(hmsg);
cMessage *copy = (cMessage *)msg->dup();
send(copy, "gate$o", out_);

在执行此代码时,出现以下错误: 没有这样的门或门矢量:'gate'-在模块(TraCIDemoRSU11p)中RSUExampleScenario.rsu [1] .appl(id = 16),在t = 26.019453568907s,事件#452

我该如何处理?

0 个答案:

没有答案