A Discrete-Event Network Simulator
API
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ns3::WaveBsmHelper Class Reference

The WaveBsmHelper class manages IEEE 1609 WAVE (Wireless Access in Vehicular Environments) Basic Safety Messages (BSMs) and uses the WaveBsmStats class to manage statistics about BSMs transmitted and received The BSM is a ~200-byte packet that is generally broadcast from every vehicle at a nominal rate of 10 Hz. More...

#include "wave-bsm-helper.h"

Public Member Functions

 WaveBsmHelper ()
 Constructor. More...
 
int64_t AssignStreams (NodeContainer c, int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this model. More...
 
Ptr< WaveBsmStatsGetWaveBsmStats ()
 Returns the WaveBsmStats instance. More...
 
ApplicationContainer Install (Ipv4InterfaceContainer i) const
 Install an ns3::BsmApplication on each node of the input container configured with all the attributes set with SetAttribute. More...
 
ApplicationContainer Install (Ptr< Node > node) const
 Install an ns3::BsmApplication on the node configured with all the attributes set with SetAttribute. More...
 
void Install (Ipv4InterfaceContainer &i, Time totalTime, uint32_t wavePacketSize, Time waveInterval, double gpsAccuracyNs, std::vector< double > ranges, int chAccessMode, Time txMaxDelay)
 Installs BSM generation on devices for nodes and their interfaces. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Helper function used to set the underlying application attributes. More...
 

Static Public Member Functions

static std::vector< int > & GetNodesMoving ()
 Returns the list of moving nove indicators. More...
 

Private Member Functions

Ptr< ApplicationInstallPriv (Ptr< Node > node) const
 Install an ns3::BsmApplication on the node. More...
 

Private Attributes

ObjectFactory m_factory
 Object factory. More...
 
std::vector< double > m_txSafetyRangesSq
 tx safety range squared, for optimization More...
 
WaveBsmStats m_waveBsmStats
 wave BSM stats More...
 

Static Private Attributes

static std::vector< int > nodesMoving
 nodes moving More...
 

Detailed Description

The WaveBsmHelper class manages IEEE 1609 WAVE (Wireless Access in Vehicular Environments) Basic Safety Messages (BSMs) and uses the WaveBsmStats class to manage statistics about BSMs transmitted and received The BSM is a ~200-byte packet that is generally broadcast from every vehicle at a nominal rate of 10 Hz.

Definition at line 44 of file wave-bsm-helper.h.

Constructor & Destructor Documentation

◆ WaveBsmHelper()

ns3::WaveBsmHelper::WaveBsmHelper ( )

Constructor.

Returns
none

Definition at line 31 of file wave-bsm-helper.cc.

References m_factory, m_txSafetyRangesSq, and ns3::ObjectFactory::SetTypeId().

Member Function Documentation

◆ AssignStreams()

int64_t ns3::WaveBsmHelper::AssignStreams ( NodeContainer  c,
int64_t  stream 
)

Assign a fixed random variable stream number to the random variables used by this model.

Return the number of streams (possibly zero) that have been assigned. The Install() method should have previously been called by the user.

Parameters
streamfirst stream index to use
cNodeContainer of the set of nodes for which the BsmApplication should be modified to use a fixed stream
Returns
the number of stream indices assigned by this helper

Definition at line 139 of file wave-bsm-helper.cc.

References ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), ns3::Node::GetApplication(), and ns3::Node::GetNApplications().

Referenced by VanetRoutingExperiment::SetupWaveMessages().

◆ GetNodesMoving()

std::vector< int > & ns3::WaveBsmHelper::GetNodesMoving ( )
static

Returns the list of moving nove indicators.

Returns
the list of moving node indicators

Definition at line 159 of file wave-bsm-helper.cc.

References nodesMoving.

◆ GetWaveBsmStats()

Ptr< WaveBsmStats > ns3::WaveBsmHelper::GetWaveBsmStats ( )

◆ Install() [1/3]

ApplicationContainer ns3::WaveBsmHelper::Install ( Ipv4InterfaceContainer  i) const

Install an ns3::BsmApplication on each node of the input container configured with all the attributes set with SetAttribute.

Parameters
iIpv4InterfaceContainer of the set of interfaces on which an BsmApplication will be installed on the nodes.
Returns
Container of Ptr to the applications installed.

Definition at line 62 of file wave-bsm-helper.cc.

References ns3::ApplicationContainer::Add(), ns3::Ipv4InterfaceContainer::Begin(), ns3::Ipv4InterfaceContainer::End(), ns3::Object::GetObject(), and InstallPriv().

Referenced by Install(), and VanetRoutingExperiment::SetupWaveMessages().

◆ Install() [2/3]

ApplicationContainer ns3::WaveBsmHelper::Install ( Ptr< Node node) const

Install an ns3::BsmApplication on the node configured with all the attributes set with SetAttribute.

Parameters
nodeThe node on which an BsmApplication will be installed.
Returns
Container of Ptr to the applications installed.

Definition at line 56 of file wave-bsm-helper.cc.

References InstallPriv().

◆ Install() [3/3]

void ns3::WaveBsmHelper::Install ( Ipv4InterfaceContainer i,
Time  totalTime,
uint32_t  wavePacketSize,
Time  waveInterval,
double  gpsAccuracyNs,
std::vector< double >  ranges,
int  chAccessMode,
Time  txMaxDelay 
)

Installs BSM generation on devices for nodes and their interfaces.

Parameters
iIPv4 interface container
totalTimetotal amount of time that BSM packets should be transmitted
wavePacketSizethe size, in bytes, of a WAVE BSM
waveIntervalthe time, in seconds, between each WAVE BSM transmission, typically 10 Hz (0.1 second)
gpsAccuracyNsthe timing synchronization accuracy of GPS time, in nanoseconds. GPS time-sync is ~40-100 ns. Universally synchronized time among all vehicles will result in all vehicles transmitting safety messages simultaneously, leading to excessive wireless collisions.
rangesthe expected transmission range, in m.
chAccessModechannel access mode (0=continuous; 1=switching)
txMaxDelaymax delay prior to transmit
Returns
none

Definition at line 86 of file wave-bsm-helper.cc.

References ns3::ApplicationContainer::Begin(), ns3::ApplicationContainer::End(), GetWaveBsmStats(), Install(), m_txSafetyRangesSq, nodesMoving, ns3::Seconds(), ns3::ApplicationContainer::Start(), and ns3::ApplicationContainer::Stop().

◆ InstallPriv()

Ptr< Application > ns3::WaveBsmHelper::InstallPriv ( Ptr< Node node) const
private

Install an ns3::BsmApplication on the node.

Parameters
nodeThe node on which an BsmApplication will be installed.
Returns
Ptr to the application installed.

Definition at line 77 of file wave-bsm-helper.cc.

References ns3::Node::AddApplication(), ns3::ObjectFactory::Create(), and m_factory.

Referenced by Install().

◆ SetAttribute()

void ns3::WaveBsmHelper::SetAttribute ( std::string  name,
const AttributeValue value 
)

Helper function used to set the underlying application attributes.

Parameters
namethe name of the application attribute to set
valuethe value of the application attribute to set

Definition at line 50 of file wave-bsm-helper.cc.

References m_factory, and ns3::ObjectFactory::Set().

Member Data Documentation

◆ m_factory

ObjectFactory ns3::WaveBsmHelper::m_factory
private

Object factory.

Definition at line 140 of file wave-bsm-helper.h.

Referenced by InstallPriv(), SetAttribute(), and WaveBsmHelper().

◆ m_txSafetyRangesSq

std::vector<double> ns3::WaveBsmHelper::m_txSafetyRangesSq
private

tx safety range squared, for optimization

Definition at line 143 of file wave-bsm-helper.h.

Referenced by Install(), and WaveBsmHelper().

◆ m_waveBsmStats

WaveBsmStats ns3::WaveBsmHelper::m_waveBsmStats
private

wave BSM stats

Definition at line 141 of file wave-bsm-helper.h.

Referenced by GetWaveBsmStats().

◆ nodesMoving

std::vector< int > ns3::WaveBsmHelper::nodesMoving
staticprivate

nodes moving

Definition at line 144 of file wave-bsm-helper.h.

Referenced by GetNodesMoving(), and Install().


The documentation for this class was generated from the following files: