Veins source module reading -connectionManager

After remember once stepped on pit depth, fought in the pit for a few days and found into the wrong pit. Reserved for later use veins do car networking simulation into the pit who, a little inspiration.
The original purpose:
I had intended to achieve and Car RSU have different communication distance. Modifying the ini file maxInterfDistand drawMaxIntfDistthen observed through simulation page coverage and RSU vehicle has changed, and in the communication process from the transmission of data packets also happens to be maxInterfDista range. We mistakenly think, this is the place to achieve RSU and different communication range of Car. Then began the depth of the stepped pit tour.
Conclusion:
If you want to achieve and RSU different communication range Car, only need to modify their transmission power to mac layer. connectionManager module just to manage their direct connection, i.e. of which modules are connected (between port NIC), which connect the node removed. However, the specific data packet can not be received, based on the transmission power, received power is determined. Simulation page is too confusing people, even if a packet is the last simulation process, not necessarily really received (because of power problems). Specific specific output may be seen in the simulation process, the only receive Airframe within range, but in the process will find the process did not receive the packet.
Then we take a look connectionManager module specifically what to do?
connectionManager module

  • ConnectionManager.ned

Here Insert Picture Description
We can see from the above comments, the connection between the management and coordination of all the nodes, and the door handle dynamic creation. Thus it periodically and the mobile channel access module and a communication module.
maxInterfDistIs the largest upper bound of any transmission.

  • ConnectionManager.h&ConnectionManager.cc
    Here Insert Picture Description
    Headers to define a virtual function, calculate the maximum communication range.
    Here Insert Picture Description
    Here only read the maximum communication range defined in the ini file, and then returns.
    Here are another way, more power, frequency, etc., using the free space fading model calculation. But here's needs ned and header files are required to make the appropriate changes.
   double interfDistance;

    //the minimum carrier frequency for this cell
    double carrierFrequency = par("carrierFrequency").doubleValue();
    //maximum transmission power possible
    double pMax             = par("pMax").doubleValue();
    if (pMax <=0) {
        error("Max transmission power is <=0!");
    }
    //minimum signal attenuation threshold
    double sat              = par("sat").doubleValue();
    //minimum path loss coefficient
    double alpha            = par("alpha").doubleValue();

    //const
    double waveLength     = (BaseWorldUtility::speedOfLight()/carrierFrequency);

    //minimum power level to be able to physically receive a signal
    double minReceivePower = pow(10.0, sat/10.0);

    ccEV << "max interference distance:" << interfDistance << endl;

    return interfDistance;
  • BaseConnectionManager.h
    This function is the most important function, just to cover each function does.
    Here Insert Picture Description
    First, we declare a class grid coordinates in the header file, probably means that the entire context of the simulation is divided according to the maximum transmission distance of several grid, and then using a coordinate to represent each grid.
    Here Insert Picture Description
    This is because C ++ is no hash set, built to simulate a class hash set.

Here Insert Picture Description
Here is the main function of the relationship between the many functions call each other. The first is the initializeinitialization function. Then is the
Here Insert Picture Description
ChannelAccess::receiveSignalfunction begins to gradually make calls, according to that order, followed by reading the source code to comment.
Note:
In the car simulation networked, this one does not need to make changes. Just to help you understand Veinsif how they work together.

Published 32 original articles · won praise 7 · views 7573

Guess you like

Origin blog.csdn.net/Isaacddx/article/details/101161169