I'm trying to implement RSU to RSU communication in Veins. To do that, I have added an inout gate into the RSU module (RSU.ned file):
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;
}
Also, in the RSUExampleScenario.ned file, I have added a second RSU and connect the two RSUs:
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++;
}
In the TraciDemoRSU11p.cc file, I attempt to send a message like that:
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_);
While executing this code, I have the following error: No such gate or gate vector: 'gate' -- in module (TraCIDemoRSU11p) RSUExampleScenario.rsu[1].appl (id=16), at t=26.019453568907s, event #452
How can I deal with?