Я пытаюсь реализовать связь RSU с RSU в венах. Для этого я добавил входной шлюз в модуль 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), at t = 26.019453568907s, событие # 452
Как я могу с этим справиться?
While executing this code, I have the following error: No such gate or gate vector: 'gate' [...] How can I deal with?
. - person Christoph Sommer   schedule 23.04.2019