lundi 17 février 2020

OMNeT++ vectors log 2-tuples (TV: time+value) or 3-tuples (ETV: event+time+value) in omnet++/ Veins?

I worked from scratch generated nodes, scenario and all on my own not using inbuilt veins scenario TRACIDEMORSU or TRACIDEMO available.

My RSUs (3 in number) are passing packets to the nodes. I am able to retrieve the values using vector tuples. Here, I stuck with the following questions and read the below link. Any guidance will be much appreciated:

Separate data received from various senders in Veins/OMNET++

  1. Broadcasting is performed from RSU to Nodes using for loop and SendDirect(). Now when RSU1 is sending messages to nodes they are receiving and when I am trying to retrieve the values. That is also working correctly. But when RSU2 is sending the message on the same time to the nodes then again they are retrieving the RSU2 values but not showing RSU1 previously received value by the same node. I want to store both values in a table.

Now my question is:- 1. Are they working as different events? If yes, then How would join these received packets from different RSUs as One table. Because finally, I have to compare some individual fields to acknowledge the request? If not, then again how can I create a table so that I can compare the individual node values.

  1. Am I doing correctly? Do broadcasting happens like this. I read all these things from OMNET++ manual. I hope I am working correctly.

Here, is the code for reference: in RSU .cc

for (int i = 0; i < noOfWirelessNode; i++) {
            int targetNodeDistance = RSUNode::calculateDistanceFromRSU(i, incomingSenderId);
            EV<<"\ntargetNodeDist = "<<targetNodeDistance;
            bubble("RSU Send Beacon to Vehicle.");
            if(targetNodeDistance <= 1000){
            destModule = cModule::getParentModule()->getSubmodule("vehiclenode",
                    i);
            EV << "\n\ndest Module = " << destModule;
            VehicleModule = omnetpp::check_and_cast<Vehicle*>(destModule);
            inMsg->setPacketGenerateTime(omnetpp::simTime().dbl() + T_window);
            omnetpp::simtime_t sendtime = inMsg->getPacketGenerateTime();
            EV << "\nRSU Broadcast Time = " << sendtime.dbl();

            sendDirect(msg->dup(), VehicleModule, "radioIn");
            }

in Vehicle.cc

// here when broadcasting is done by RSU.cc then retrieving the values and storing as a tuple to finally //create a table. But not able to get the combined table.

   typedef std::tuple<int, double> Table;    
        std::vector<Table>NT;
                    NT.push_back(Table(incomingSenderId, beaconRecivingTime.dbl()));
                    EV<<"\n\n********** NT*******\n";
                    for(Table t1:NT){

                             EV<<std::get<0>(t1)<<' ';
                             EV<<std::get<1>(t1)<<' ';

                             EV<<"\n";

                             }

Any help is appreciated.

Aucun commentaire:

Enregistrer un commentaire