omnet++veinssumotraffic

How is communication between the vehicles themselves and the vehicles and RSUs?


I am studying UVCAST protocol for VANET that consists of group of vehicles and RSU. you know ,that communication between vehicles themselves and between vehicles and RSU is done using IEEE 802.11p and MAC 1609_4 Protocols for Physical and MAC (link) Layers , that means that communication is wireless . When I am executing simulation for UVCAST protocol in vehicular ad hoc network consists of vehicles and infrastructure (RSU) using omnet 4.4.1,veins 4.4,sumo 0.24 on windows 7 Ultimate Service Pack1(2009) 64 bit and using Phy, MAC(802.11p,MAc1609_4) layers and if the wired ethernet port (nic /network interface card )is disabled on the laptop which the simulation is implemented .Does that affect the result of simulation . you know that RSUs are configuring using cat5 ethernet cables and RJ45 that belongs the wired cables on roads (intersection and traffic lights) because of the base station .How is communication between the vehicles themselves and the vehicles and RSUs? Is it purely wireless or is there a wired part in communication? I am using veins 4.4 please the reply with consideration the files in path /veins/src/veins/base/connectionManager:

NicEntryDirect.cc
/* -*- mode:c++ -*- ********************************************************
* file:        NicEntryDirect.cc
*
* author:      Daniel Willkomm
*
* copyright:   (C) 2005 Telecommunication Networks Group (TKN) at
*              Technische Universitaet Berlin, Germany.
*
*              This program is free software; you can redistribute it
*              and/or modify it under the terms of the GNU General Public
*              License as published by the Free Software Foundation; either
*              version 2 of the License, or (at your option) any later
*              version.
*              For further information see file COPYING
*              in the top level directory
***************************************************************************
* part of:     framework implementation developed by tkn
* description: Class to store information about a nic for the
*              ConnectionManager module
**************************************************************************/


#include "veins/base/connectionManager/NicEntryDirect.h"
#include "veins/base/connectionManager/ChannelAccess.h"

#ifndef nicEV
#define nicEV EV << "NicEntry: "
#endif

using std::endl;

void NicEntryDirect::connectTo(NicEntry* other)
{
   cModule* otherPtr = other->nicPtr;

   nicEV <<"connecting nic #"<<nicId<< " and #"<<other->nicId<<endl;

   cGate *radioGate=NULL;
   if( (radioGate = otherPtr->gate("radioIn")) == NULL )
       throw cRuntimeError("Nic has no radioIn gate!");

   outConns[other] = radioGate->getPathStartGate();
}


void NicEntryDirect::disconnectFrom(NicEntry* other)
{
   nicEV <<"disconnecting nic #"<<nicId<< " and #"<<other->nicId<<endl;
   outConns.erase(other);
}

NicEntryDirect.h
/* -*- mode:c++ -*- ********************************************************
* file:        NicEntryDirect.h
*
* author:      Daniel Willkomm
*
* copyright:   (C) 2005 Telecommunication Networks Group (TKN) at
*              Technische Universitaet Berlin, Germany.
*
*              This program is free software; you can redistribute it
*              and/or modify it under the terms of the GNU General Public
*              License as published by the Free Software Foundation; either
*              version 2 of the License, or (at your option) any later
*              version.
*              For further information see file COPYING
*              in the top level directory
***************************************************************************
* part of:     framework implementation developed by tkn
* description: Class to store information about a nic for the
*              ConnectionManager module
**************************************************************************/

#ifndef NICENTRYDIRECT_H
#define NICENTRYDIRECT_H

#include "veins/base/connectionManager/NicEntry.h"


/**
* @brief NicEntry is used by ConnectionManager to store the necessary
* information for each nic
*
* @ingroup connectionManager
* @author Daniel Willkomm
* @sa ConnectionManager, NicEntry
*/
class NicEntryDirect: public NicEntry
{
 public:
   /** @brief Constructor, initializes all members
    */
   NicEntryDirect(bool debug) : NicEntry(debug) {};

   /**
    * @brief Destructor -- needs to be there...
    */
   virtual ~NicEntryDirect() {}

   /** @brief Connect two nics
    *
    * Establish unidirectional connection with other nic
    *
    * @param other reference to remote nic (other NicEntry)
    *
    * This function acquires an in gate at the remote nic and an out
    * gate at this nic, connects the two and updates the freeInGate,
    * freeOutGate and outConns data sets.
    */
   virtual void connectTo(NicEntry*);

   /** @brief Disconnect two nics
    *
    * Release unidirectional connection with other nic
    *
    * @param other reference to remote nic (other NicEntry)
    */
   virtual void disconnectFrom(NicEntry*);
};

#endif
NicEntryDebug.cc
/* -*- mode:c++ -*- ********************************************************
* file:        NicEntryDebug.cc
*
* author:      Daniel Willkomm
*
* copyright:   (C) 2005 Telecommunication Networks Group (TKN) at
*              Technische Universitaet Berlin, Germany.
*
*              This program is free software; you can redistribute it
*              and/or modify it under the terms of the GNU General Public
*              License as published by the Free Software Foundation; either
*              version 2 of the License, or (at your option) any later
*              version.
*              For further information see file COPYING
*              in the top level directory
***************************************************************************
* part of:     framework implementation developed by tkn
* description: Class to store information about a nic for the
*              ConnectionManager module
**************************************************************************/

#include "veins/base/connectionManager/NicEntryDebug.h"

#include <cassert>

#include "veins/base/connectionManager/ChannelAccess.h"
#include "veins/base/utils/FindModule.h"

#ifndef nicEV
#define nicEV EV << "NicEntry: "
#endif

using std::endl;

void NicEntryDebug::connectTo(NicEntry* other) {
   nicEV<<"connecting nic #"<<nicId<< " and #"<<other->nicId<<endl;

   NicEntryDebug* otherNic = (NicEntryDebug*) other;

   cGate *localoutgate = requestOutGate();
   localoutgate->connectTo(otherNic->requestInGate());
   outConns[other] = localoutgate->getPathStartGate();
}


void NicEntryDebug::disconnectFrom(NicEntry* other) {
   nicEV<<"disconnecting nic #"<<nicId<< " and #"<<other->nicId<<endl;

   NicEntryDebug* otherNic = (NicEntryDebug*) other;

   //search the connection in the outConns list
   GateList::iterator p = outConns.find(other);
   //no need to check whether entry is valid; is already check by ConnectionManager isConnected
   //get the hostGate
   //order is phyGate->nicGate->hostGate
   cGate* hostGate = p->second->getNextGate()->getNextGate();

   // release local out gate
   freeOutGates.push_back(hostGate);

   // release remote in gate
   otherNic->freeInGates.push_back(hostGate->getNextGate());

   //reset gates
   //hostGate->getNextGate()->connectTo(0);
   hostGate->disconnect();

   //delete the connection
   outConns.erase(p);
}

int NicEntryDebug::collectGates(const char* pattern, GateStack& gates)
{
   cModule* host = nicPtr->getParentModule();
   int i = 1;
   char gateName[20];
   //create the unique name for the gate (composed of the nic module id and a counter)
   sprintf(gateName, pattern, nicId, i);
   while(host->hasGate(gateName))
   {
       cGate* hostGate = host->gate(gateName);
       if(hostGate->isConnectedOutside()) {
           throw cRuntimeError("Gate %s is still connected but not registered with this "
                     "NicEntry. Either the last NicEntry for this NIC did not "
                     "clean up correctly or another gate creation module is "
                     "interfering with this one!", gateName);
       }
       assert(hostGate->isConnectedInside());
       gates.push_back(hostGate);

       ++i;
       sprintf(gateName, pattern, nicId, i);
   }

   return i - 1;
}

void NicEntryDebug::collectFreeGates()
{
   if(!checkFreeGates)
       return;

   inCnt = collectGates("in%d-%d", freeInGates);
   nicEV << "found " << inCnt << " already existing usable in-gates." << endl;


   outCnt = collectGates("out%d-%d", freeOutGates);
   nicEV << "found " << inCnt << " already existing usable out-gates." << endl;

   checkFreeGates = false;
}


cGate* NicEntryDebug::requestInGate(void) {
   collectFreeGates();

   // gate of the host
   cGate *hostGate;

   if (!freeInGates.empty()) {
       hostGate = freeInGates.back();
       freeInGates.pop_back();
   } else {
       char gateName[20];

       // we will have one more in gate
       ++inCnt;

       //get a unique name for the gate (composed of the nic module id and a counter)
       sprintf(gateName, "in%d-%d", nicId, inCnt);

       // create a new gate for the host module
       nicPtr->getParentModule()->addGate(gateName, cGate::INPUT);
       hostGate = nicPtr->getParentModule()->gate(gateName);

       // gate of the nic
       cGate *nicGate;

       // create a new gate for the nic module
       nicPtr->addGate(gateName, cGate::INPUT);
       nicGate = nicPtr->gate(gateName);

       // connect the hist gate with the nic gate
       hostGate->connectTo(nicGate);

       // pointer to the phy module
       ChannelAccess* phyModule;
       // gate of the phy module
       cGate *phyGate;

       // to avoid unnecessary dynamic_casting we check for a "phy"-named submodule first
       if ((phyModule = dynamic_cast<ChannelAccess *> (nicPtr->getSubmodule("phy"))) == NULL)
           phyModule = FindModule<ChannelAccess*>::findSubModule(nicPtr);
       assert(phyModule != 0);

       // create a new gate for the phy module
       phyModule->addGate(gateName, cGate::INPUT);
       phyGate = phyModule->gate(gateName);

       // connect the nic gate (the gate of the compound module) to
       // a "real" gate -- the gate of the phy module
       nicGate->connectTo(phyGate);
   }

   return hostGate;
}

cGate* NicEntryDebug::requestOutGate(void) {
   collectFreeGates();

   // gate of the host
   cGate *hostGate;

   if (!freeOutGates.empty()) {
       hostGate = freeOutGates.back();
       freeOutGates.pop_back();
   } else {
       char gateName[20];

       // we will have one more out gate
       ++outCnt;

       //get a unique name for the gate (composed of the nic module id and a counter)
       sprintf(gateName, "out%d-%d", nicId, outCnt);

       // create a new gate for the host module
       nicPtr->getParentModule()->addGate(gateName, cGate::OUTPUT);
       hostGate = nicPtr->getParentModule()->gate(gateName);

       // gate of the nic
       cGate *nicGate;
       // create a new gate for the nic module
       nicPtr->addGate(gateName, cGate::OUTPUT);
       nicGate = nicPtr->gate(gateName);

       // connect the hist gate with the nic gate
       nicGate->connectTo(hostGate);

       // pointer to the phy module
       ChannelAccess* phyModule;
       // gate of the phy module
       cGate *phyGate;

       // to avoid unnecessary dynamic_casting we check for a "phy"-named submodule first
       if ((phyModule = dynamic_cast<ChannelAccess *> (nicPtr->getSubmodule("phy"))) == NULL)
           phyModule = FindModule<ChannelAccess*>::findSubModule(nicPtr);
       assert(phyModule != 0);

       // create a new gate for the phy module
       phyModule->addGate(gateName, cGate::OUTPUT);
       phyGate = phyModule->gate(gateName);

       // connect the nic gate (the gate of the compound module) to
       // a "real" gate -- the gate of the phy module
       phyGate->connectTo(nicGate);
   }

   return hostGate;
}

NicEntryDebug.h
/* -*- mode:c++ -*- ********************************************************
* file:        NicEntryDebug.h
*
* author:      Daniel Willkomm
*
* copyright:   (C) 2005 Telecommunication Networks Group (TKN) at
*              Technische Universitaet Berlin, Germany.
*
*              This program is free software; you can redistribute it
*              and/or modify it under the terms of the GNU General Public
*              License as published by the Free Software Foundation; either
*              version 2 of the License, or (at your option) any later
*              version.
*              For further information see file COPYING
*              in the top level directory
***************************************************************************
* part of:     framework implementation developed by tkn
* description: Class to store information about a nic for the
*              ConnectionManager module
**************************************************************************/

#ifndef NICENTRYDEBUG_H
#define NICENTRYDEBUG_H

#include "veins/base/connectionManager/NicEntry.h"

#include <map>
#include <vector>

/**
* @brief NicEntry is used by ConnectionManager to store the necessary
* information for each nic
*
* @ingroup connectionManager
* @author Daniel Willkomm
* @sa ConnectionManager, NicEntry
*/
class NicEntryDebug: public NicEntry
{
protected:
  /** @brief Number of in gates allocated for the nic so far*/
  int inCnt;

  /** @brief Number of out gates allocated for the nic so far */
  int outCnt;

  /** @brief Check for unknown free gates before next gate request.
   *
   * This flag is true after creation of the NicEntryDebug and assures
   * that it checks for already existing in- and out-gates from a previous
   * NicEntryDebug (which can happen if the same NIC is unregistered and
   * later again registered with a connection manager.
   */
  bool checkFreeGates;

  typedef std::vector<cGate* > GateStack;
  /** @brief In Gates that were once used but are not connected now */
  GateStack freeInGates;

  /** @brief Out Gates that were once used but are not connected now */
  GateStack freeOutGates;

protected:
  /**
   * @brief Returns a free in gate of the nic
   *
   * This checks the list of free in gates, if one is available it is
   * returned. Otherwise, a new in gate is added to the nic.
   */
  cGate* requestInGate(void);

  /**
   * @brief Returns a free out gate of the nic
   *
   * returns a free out gate. If none is available it is created. See
   * NicEntry::requestInGate for a detailed description
   */
  cGate* requestOutGate(void);

  /**
   * @brief Collects all free gates with a certain pattern as names and puts
   * them on a stack.
   *
   * @param pattern The naming pattern of the gates, something like "out%d-%d"
   * where the first %d is filled with the nic id and the second with an
   * incrementing counter.
   * @param gates The gate stack in which to put the found gates.
   * @return the number of free gates found.
   */
  int collectGates(const char* pattern, GateStack& gates);

  /**
   * @brief Iterates over all existing gates of this NicEntries nic and host
   * and checks wether they are useable by this nic entry.
   *
   * This method is necessary if a nic was unregistered from its connection
   * manager during a simulation and is then again registered with one.
   * When unregistered the gates created by this NicEntryDebug are not deleted
   * so they can be collected and reused again when the nic is registered
   * again.
   */
  void collectFreeGates();

public:
  /**
   * @brief Constructor, initializes all members
   */
  NicEntryDebug(bool debug) :
      NicEntry(debug),
      inCnt(0),
      outCnt(0),
      checkFreeGates(true)
  {};

  /**
   * @brief Removes all dynamically created out-/ingates.
   */
  virtual ~NicEntryDebug() {}

  /**
   * @brief Connect two nics
   *
   * Establish unidirectional connection with other nic
   *
   * @param other reference to remote nic (other NicEntry)
   *
   * This function acquires an in gate at the remote nic and an out
   * gate at this nic, connects the two and updates the freeInGate,
   * freeOutGate and outConns data sets.
   **/
  virtual void connectTo(NicEntry* other);

  /**
   * @brief Disconnect two nics
   *
   * Release unidirectional connection with other nic
   *
   * @param other reference to remote nic (other NicEntry)
   **/
  virtual void disconnectFrom(NicEntry* other);
};

#endif
NicEntry.h
/* -*- mode:c++ -*- ********************************************************
* file:        NicEntry.h
*
* author:      Daniel Willkomm
*
* copyright:   (C) 2005 Telecommunication Networks Group (TKN) at
*              Technische Universitaet Berlin, Germany.
*
*              This program is free software; you can redistribute it
*              and/or modify it under the terms of the GNU General Public
*              License as published by the Free Software Foundation; either
*              version 2 of the License, or (at your option) any later
*              version.
*              For further information see file COPYING
*              in the top level directory
***************************************************************************
* part of:     framework implementation developed by tkn
* description: Class to store information about a nic for the
*              ConnectionManager module
**************************************************************************/

#ifndef NICENTRY_H
#define NICENTRY_H

#include <omnetpp.h>
#include <map>

#include "veins/base/utils/MiXiMDefs.h"
#include "veins/base/utils/Coord.h"

namespace Veins {
class ChannelAccess;
}
using Veins::ChannelAccess;


/**
* @brief NicEntry is used by ConnectionManager to store the necessary
* information for each nic
*
* @ingroup connectionManager
* @author Daniel Willkomm
* @sa ConnectionManager
*/
class MIXIM_API NicEntry : public cObject
{
protected:
  class NicEntryComparator {
    public:
      bool operator() (const NicEntry* nic1, const NicEntry* nic2) const {
          return nic1->nicId < nic2->nicId;
      }
  };
public:
  /** @brief Type for map from NicEntry pointer to a gate.*/
  typedef std::map<const NicEntry*, cGate*, NicEntryComparator> GateList;

  /** @brief module id of the nic for which information is stored*/
  int nicId;

  /** @brief Pointer to the NIC module */
  cModule *nicPtr;

  /** @brief Module id of the host module this nic belongs to*/
  int hostId;

  /** @brief Geographic location of the nic*/
  Coord pos;

  /** @brief Points to this nics ChannelAccess module */
  ChannelAccess* chAccess;

protected:
  /** @brief Debug output switch*/
  bool coreDebug;

  /** @brief Outgoing connections of this nic
   *
   * This map stores all connection for this nic to other nics
   *
   * The first entry is the module id of the nic the connection is
   * going to and the second the gate to send the msg to
   **/
  GateList outConns;

public:
  /**
   * @brief Constructor, initializes all members
   */
  NicEntry(bool debug) : nicId(0), nicPtr(0), hostId(0){
      coreDebug = debug;
  };

  /**
   * @brief Destructor -- needs to be there...
   */
  virtual ~NicEntry() {}

  /** @brief Connect two nics */
  virtual void connectTo(NicEntry*) = 0;

  /** @brief Disconnect two nics */
  virtual void disconnectFrom(NicEntry*) = 0;

  /** @brief return the actual gateList*/
  const GateList& getGateList(){
      return outConns;
  }

  /** @brief Checks if this nic is connected to the "other" nic*/
  bool isConnected(const NicEntry* other) {
      return (outConns.find(other) != outConns.end());
  };

  /**
   * Called by P2PPhyLayer. Needed to send a packet directly to a
   * certain nic without other nodes 'hearing' it. This is only useful
   * for physical layers that work with bit error probability like
   * P2PPhyLayer.
   *
   * @param to pointer to the NicEntry to which the packet is about to be sent
   */
  const cGate* getOutGateTo(const NicEntry* to)
  {
      return outConns[to];
  };

};

#endif


Solution

  • You can see that the interface uses radioIn gate, this is an input gate uses only for wireless communication. The vehicles use only wireless communication, and they don't use any other interface.

    Is it cat5 or cat5e? Cat5 is 100 MB/s and cat5e is 1 GB/s.