I am trying to simulate a scenario where after a fixed number of vehicles have reached the destination node, the vehicles after that should go to a different destination.For this I want to have a RSU at the destination that sends message after it has received the fixed number of vehicles??
Asked
Active
Viewed 155 times
-2
-
So far a valid scenario/use case. What is your problem/question now? – Julian Heinovski Mar 17 '17 at 11:12
-
I want to know how and which commands to use in order to simulate the described scenario?? – Rohit Tapikar Mar 18 '17 at 15:06
-
What have you tried already? The purpose of SO is not to give you exact howtos for the goal you want to achieve but to help you with problems you encounter after you tried already by yourself. Also please ask a specific question instead of describing your scenario. – Julian Heinovski Mar 20 '17 at 13:21
-
Furthermore, I think you got some important information already in your earlier question about [dynamic rerouting of vehicles](http://stackoverflow.com/questions/42781147/regarding-dynamic-routing-in-veins). – Julian Heinovski Mar 20 '17 at 13:41
-
I looked at Traci commands and I found command changeTarget but I am not able to understand how to use it in my application layer for RSU?? – Rohit Tapikar Mar 22 '17 at 09:56
1 Answers
0
Something similar to what you are asking is done in the Veins demo scenario:
RSU side
void TraCIDemoRSU11p::sendMessage(std::string blockedRoadId) {
sentMessage = true;
t_channel channel = dataOnSch ? type_SCH : type_CCH;
WaveShortMessage* wsm = prepareWSM("data", dataLengthBits, channel, dataPriority, -1,2);
wsm->setWsmData(blockedRoadId.c_str());
sendWSM(wsm);
}
wsm->setWsmData(blockedRoadId.c_str())
encodes the ID of the blocked road to the message, so the vehicles can read that.
Vehicle side
void TraCIDemo11p::onData(WaveShortMessage* wsm) {
findHost()->getDisplayString().updateWith("r=16,green");
annotations->scheduleErase(1, annotations->drawLine(wsm->getSenderPos(), mobility->getPositionAt(simTime()), "blue"));
if (mobility->getRoadId()[0] != ':') traciVehicle->changeRoute(wsm->getWsmData(), 9999);
if (!sentMessage) sendMessage(wsm->getWsmData());
}
traciVehicle->changeRoute()
is used to change the route.

user4786271
- 1,555
- 13
- 18