A Discrete-Event Network Simulator
API
VanetRoutingExperiment Class Reference

The VanetRoutingExperiment class implements a wifi app that allows VANET routing experiments to be simulated. More...

+ Inheritance diagram for VanetRoutingExperiment:
+ Collaboration diagram for VanetRoutingExperiment:

Public Member Functions

 VanetRoutingExperiment ()
 Constructor. More...
 
- Public Member Functions inherited from WifiApp
 WifiApp ()
 Constructor. More...
 
virtual ~WifiApp ()
 Destructor. More...
 
void Simulate (int argc, char **argv)
 Enacts simulation of an ns-3 wifi application. More...
 

Protected Member Functions

virtual void ConfigureApplications ()
 Configure applications. More...
 
virtual void ConfigureChannels ()
 Configure channels. More...
 
virtual void ConfigureDevices ()
 Configure devices. More...
 
virtual void ConfigureMobility ()
 Configure mobility. More...
 
virtual void ConfigureNodes ()
 Configure nodes. More...
 
virtual void ConfigureTracing ()
 Configure tracing. More...
 
virtual void ParseCommandLineArguments (int argc, char **argv)
 Process command line arguments. More...
 
virtual void ProcessOutputs ()
 Process outputs. More...
 
virtual void RunSimulation ()
 Run the simulation. More...
 
virtual void SetDefaultAttributeValues ()
 Sets default attribute values. More...
 

Private Member Functions

void CheckThroughput ()
 Checks the throughput and outputs summary to CSV file1. More...
 
void CommandSetup (int argc, char **argv)
 Run the simulation. More...
 
void ConfigureDefaults ()
 Configure default attributes. More...
 
void Run ()
 Run the simulation. More...
 
void SetConfigFromGlobals ()
 Set up configuration parameter from the global variables. More...
 
void SetGlobalsFromConfig ()
 Set up the global variables from the configuration parameters. More...
 
void SetupAdhocDevices ()
 Set up the adhoc devices. More...
 
void SetupAdhocMobilityNodes ()
 Set up the adhoc mobility nodes. More...
 
void SetupLogFile ()
 Set up log file. More...
 
void SetupLogging ()
 Set up logging. More...
 
void SetupRoutingMessages ()
 Set up generation of packets to be routed through the vehicular network. More...
 
void SetupScenario ()
 Set up a prescribed scenario. More...
 
void SetupWaveMessages ()
 Set up generation of IEEE 1609 WAVE messages, as a Basic Safety Message (BSM). More...
 
void WriteCsvHeader ()
 Write the header line to the CSV file1. More...
 

Static Private Member Functions

static void CourseChange (std::ostream *os, std::string context, Ptr< const MobilityModel > mobility)
 Course change function. More...
 

Private Attributes

uint32_t m_80211mode
 80211 mode More...
 
NetDeviceContainer m_adhocTxDevices
 adhoc transmit devices More...
 
Ipv4InterfaceContainer m_adhocTxInterfaces
 adhoc transmit interfaces More...
 
NodeContainer m_adhocTxNodes
 adhoc transmit nodes More...
 
int m_asciiTrace
 ascii trace More...
 
std::string m_CSVfileName
 CSV file name. More...
 
std::string m_CSVfileName2
 CSV file name. More...
 
Time m_cumulativeBsmCaptureStart
 capture start More...
 
std::string m_exp
 exp More...
 
uint32_t m_fading
 fading More...
 
double m_gpsAccuracyNs
 GPS accuracy. More...
 
std::string m_loadConfigFilename
 load config file name More...
 
int m_log
 log More...
 
std::string m_logFile
 log file More...
 
uint32_t m_lossModel
 loss model More...
 
std::string m_lossModelName
 loss model name More...
 
uint32_t m_mobility
 mobility More...
 
uint32_t m_nNodes
 number of nodes More...
 
int m_nodePause
 in s More...
 
int m_nodeSpeed
 in m/s More...
 
uint32_t m_nSinks
 number of sinks More...
 
std::ofstream m_os
 output stream More...
 
int m_pcap
 PCAP. More...
 
std::string m_phyMode
 phy mode More...
 
std::string m_phyModeB
 phy mode More...
 
uint32_t m_port
 port More...
 
uint32_t m_protocol
 protocol More...
 
std::string m_protocolName
 protocol name More...
 
std::string m_rate
 rate More...
 
Ptr< RoutingHelperm_routingHelper
 routing helper More...
 
int m_routingTables
 routing tables More...
 
std::string m_saveConfigFilename
 save configi file name More...
 
uint32_t m_scenario
 scenario More...
 
int64_t m_streamIndex
 used to get consistent random numbers across scenarios More...
 
double m_TotalSimTime
 total sim time More...
 
std::string m_traceFile
 trace file More...
 
bool m_traceMobility
 trace mobility More...
 
std::string m_trName
 trace file name More...
 
double m_txMaxDelayMs
 transmit maximum delay More...
 
double m_txp
 distance More...
 
double m_txSafetyRange1
 range 1 More...
 
double m_txSafetyRange10
 range 10 More...
 
double m_txSafetyRange2
 range 2 More...
 
double m_txSafetyRange3
 range 3 More...
 
double m_txSafetyRange4
 range 4 More...
 
double m_txSafetyRange5
 range 5 More...
 
double m_txSafetyRange6
 range 6 More...
 
double m_txSafetyRange7
 range 7 More...
 
double m_txSafetyRange8
 range 8 More...
 
double m_txSafetyRange9
 range 9 More...
 
std::vector< double > m_txSafetyRanges
 list of ranges More...
 
int m_verbose
 verbose More...
 
WaveBsmHelper m_waveBsmHelper
 helper More...
 
double m_waveInterval
 seconds More...
 
uint32_t m_wavePacketSize
 bytes More...
 
Ptr< WifiPhyStatsm_wifiPhyStats
 wifi phy statistics More...
 

Detailed Description

The VanetRoutingExperiment class implements a wifi app that allows VANET routing experiments to be simulated.

Definition at line 1048 of file vanet-routing-compare.cc.

Constructor & Destructor Documentation

◆ VanetRoutingExperiment()

VanetRoutingExperiment::VanetRoutingExperiment ( )

Constructor.

Definition at line 1259 of file vanet-routing-compare.cc.

References m_log, m_routingHelper, and m_wifiPhyStats.

Member Function Documentation

◆ CheckThroughput()

void VanetRoutingExperiment::CheckThroughput ( )
private

Checks the throughput and outputs summary to CSV file1.

This is scheduled and called once per second

Definition at line 1786 of file vanet-routing-compare.cc.

References RoutingStats::GetCumulativeTxBytes(), RoutingHelper::GetRoutingStats(), RoutingStats::GetRxBytes(), RoutingStats::GetRxPkts(), WifiPhyStats::GetTxBytes(), ns3::WaveBsmHelper::GetWaveBsmStats(), m_CSVfileName, m_cumulativeBsmCaptureStart, m_log, m_nSinks, m_protocolName, m_routingHelper, m_txp, m_waveBsmHelper, m_wifiPhyStats, ns3::Now(), NS_LOG_UNCOND, packetsReceived, ns3::Seconds(), RoutingStats::SetRxBytes(), and RoutingStats::SetRxPkts().

Referenced by Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CommandSetup()

◆ ConfigureApplications()

void VanetRoutingExperiment::ConfigureApplications ( )
protectedvirtual

Configure applications.

Reimplemented from WifiApp.

Definition at line 1655 of file vanet-routing-compare.cc.

References ns3::Config::Connect(), m_routingHelper, ns3::MakeCallback(), RoutingHelper::OnOffTrace(), SetupRoutingMessages(), and SetupWaveMessages().

+ Here is the call graph for this function:

◆ ConfigureChannels()

void VanetRoutingExperiment::ConfigureChannels ( )
protectedvirtual

Configure channels.

Reimplemented from WifiApp.

Definition at line 1617 of file vanet-routing-compare.cc.

References SetupAdhocDevices().

+ Here is the call graph for this function:

◆ ConfigureDefaults()

void VanetRoutingExperiment::ConfigureDefaults ( void  )
private

Configure default attributes.

Definition at line 2148 of file vanet-routing-compare.cc.

References m_80211mode, m_phyMode, m_phyModeB, m_rate, and ns3::Config::SetDefault().

Referenced by ParseCommandLineArguments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConfigureDevices()

void VanetRoutingExperiment::ConfigureDevices ( )
protectedvirtual

Configure devices.

Reimplemented from WifiApp.

Definition at line 1624 of file vanet-routing-compare.cc.

References ns3::Config::Connect(), m_80211mode, m_wifiPhyStats, ns3::MakeCallback(), WifiPhyStats::PhyRxDrop(), WifiPhyStats::PhyTxDrop(), and WifiPhyStats::PhyTxTrace().

+ Here is the call graph for this function:

◆ ConfigureMobility()

void VanetRoutingExperiment::ConfigureMobility ( )
protectedvirtual

Configure mobility.

Reimplemented from WifiApp.

Definition at line 1649 of file vanet-routing-compare.cc.

References SetupAdhocMobilityNodes().

+ Here is the call graph for this function:

◆ ConfigureNodes()

void VanetRoutingExperiment::ConfigureNodes ( )
protectedvirtual

Configure nodes.

Reimplemented from WifiApp.

Definition at line 1611 of file vanet-routing-compare.cc.

References ns3::NodeContainer::Create(), m_adhocTxNodes, and m_nNodes.

+ Here is the call graph for this function:

◆ ConfigureTracing()

void VanetRoutingExperiment::ConfigureTracing ( )
protectedvirtual

Configure tracing.

Reimplemented from WifiApp.

Definition at line 1673 of file vanet-routing-compare.cc.

References ns3::AsciiTraceHelper::CreateFileStream(), m_trName, SetupLogFile(), SetupLogging(), and WriteCsvHeader().

+ Here is the call graph for this function:

◆ CourseChange()

void VanetRoutingExperiment::CourseChange ( std::ostream *  os,
std::string  context,
Ptr< const MobilityModel mobility 
)
staticprivate

Course change function.

Parameters
osthe output stream
contexttrace source context (unused)
mobilitythe mobility model

Definition at line 1763 of file vanet-routing-compare.cc.

References third::mobility, and ns3::Now().

Referenced by SetupAdhocMobilityNodes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ParseCommandLineArguments()

void VanetRoutingExperiment::ParseCommandLineArguments ( int  argc,
char **  argv 
)
protectedvirtual

◆ ProcessOutputs()

void VanetRoutingExperiment::ProcessOutputs ( )
protectedvirtual

◆ Run()

void VanetRoutingExperiment::Run ( void  )
private

Run the simulation.

Definition at line 1749 of file vanet-routing-compare.cc.

References CheckThroughput(), m_TotalSimTime, NS_LOG_INFO, and ns3::Seconds().

Referenced by RunSimulation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RunSimulation()

void VanetRoutingExperiment::RunSimulation ( )
protectedvirtual

Run the simulation.

Reimplemented from WifiApp.

Definition at line 1684 of file vanet-routing-compare.cc.

References Run().

+ Here is the call graph for this function:

◆ SetConfigFromGlobals()

◆ SetDefaultAttributeValues()

void VanetRoutingExperiment::SetDefaultAttributeValues ( )
protectedvirtual

Sets default attribute values.

Reimplemented from WifiApp.

Definition at line 1323 of file vanet-routing-compare.cc.

◆ SetGlobalsFromConfig()

void VanetRoutingExperiment::SetGlobalsFromConfig ( )
private

◆ SetupAdhocDevices()

◆ SetupAdhocMobilityNodes()

◆ SetupLogFile()

void VanetRoutingExperiment::SetupLogFile ( )
private

Set up log file.

Definition at line 2132 of file vanet-routing-compare.cc.

References m_logFile, and m_os.

Referenced by ConfigureTracing().

+ Here is the caller graph for this function:

◆ SetupLogging()

void VanetRoutingExperiment::SetupLogging ( )
private

Set up logging.

Definition at line 2138 of file vanet-routing-compare.cc.

References ns3::LOG_LEVEL_DEBUG, and ns3::LogComponentEnable().

Referenced by ConfigureTracing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetupRoutingMessages()

void VanetRoutingExperiment::SetupRoutingMessages ( )
private

Set up generation of packets to be routed through the vehicular network.

Definition at line 2380 of file vanet-routing-compare.cc.

References RoutingHelper::Install(), m_adhocTxDevices, m_adhocTxInterfaces, m_adhocTxNodes, m_nSinks, m_protocol, m_routingHelper, m_routingTables, and m_TotalSimTime.

Referenced by ConfigureApplications().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetupScenario()

void VanetRoutingExperiment::SetupScenario ( )
private

Set up a prescribed scenario.

Definition at line 2392 of file vanet-routing-compare.cc.

References m_CSVfileName, m_logFile, m_mobility, m_nNodes, m_nodePause, m_nodeSpeed, m_scenario, m_TotalSimTime, and m_traceFile.

Referenced by ParseCommandLineArguments().

+ Here is the caller graph for this function:

◆ SetupWaveMessages()

void VanetRoutingExperiment::SetupWaveMessages ( )
private

Set up generation of IEEE 1609 WAVE messages, as a Basic Safety Message (BSM).

The BSM is typically a ~200-byte packets broadcast by all vehicles at a nominal rate of 10 Hz

Definition at line 2354 of file vanet-routing-compare.cc.

References ns3::WaveBsmHelper::AssignStreams(), ns3::WaveBsmHelper::Install(), m_80211mode, m_adhocTxInterfaces, m_adhocTxNodes, m_gpsAccuracyNs, m_streamIndex, m_TotalSimTime, m_txMaxDelayMs, m_txSafetyRanges, m_waveBsmHelper, m_waveInterval, m_wavePacketSize, ns3::MilliSeconds(), and ns3::Seconds().

Referenced by ConfigureApplications().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ WriteCsvHeader()

void VanetRoutingExperiment::WriteCsvHeader ( )
private

Write the header line to the CSV file1.

Definition at line 2436 of file vanet-routing-compare.cc.

References m_CSVfileName, and m_CSVfileName2.

Referenced by ConfigureTracing().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_80211mode

uint32_t VanetRoutingExperiment::m_80211mode
private

◆ m_adhocTxDevices

NetDeviceContainer VanetRoutingExperiment::m_adhocTxDevices
private

adhoc transmit devices

Definition at line 1226 of file vanet-routing-compare.cc.

Referenced by SetupAdhocDevices(), and SetupRoutingMessages().

◆ m_adhocTxInterfaces

Ipv4InterfaceContainer VanetRoutingExperiment::m_adhocTxInterfaces
private

adhoc transmit interfaces

Definition at line 1227 of file vanet-routing-compare.cc.

Referenced by SetupRoutingMessages(), and SetupWaveMessages().

◆ m_adhocTxNodes

NodeContainer VanetRoutingExperiment::m_adhocTxNodes
private

◆ m_asciiTrace

int VanetRoutingExperiment::m_asciiTrace
private

◆ m_CSVfileName

std::string VanetRoutingExperiment::m_CSVfileName
private

◆ m_CSVfileName2

std::string VanetRoutingExperiment::m_CSVfileName2
private

◆ m_cumulativeBsmCaptureStart

Time VanetRoutingExperiment::m_cumulativeBsmCaptureStart
private

capture start

Definition at line 1256 of file vanet-routing-compare.cc.

Referenced by CheckThroughput(), CommandSetup(), SetConfigFromGlobals(), and SetGlobalsFromConfig().

◆ m_exp

std::string VanetRoutingExperiment::m_exp
private

exp

Definition at line 1255 of file vanet-routing-compare.cc.

Referenced by CommandSetup().

◆ m_fading

uint32_t VanetRoutingExperiment::m_fading
private

◆ m_gpsAccuracyNs

double VanetRoutingExperiment::m_gpsAccuracyNs
private

GPS accuracy.

Definition at line 1229 of file vanet-routing-compare.cc.

Referenced by CommandSetup(), SetConfigFromGlobals(), SetGlobalsFromConfig(), and SetupWaveMessages().

◆ m_loadConfigFilename

std::string VanetRoutingExperiment::m_loadConfigFilename
private

load config file name

Definition at line 1234 of file vanet-routing-compare.cc.

Referenced by CommandSetup().

◆ m_log

int VanetRoutingExperiment::m_log
private

◆ m_logFile

std::string VanetRoutingExperiment::m_logFile
private

◆ m_lossModel

uint32_t VanetRoutingExperiment::m_lossModel
private

◆ m_lossModelName

std::string VanetRoutingExperiment::m_lossModelName
private

loss model name

Definition at line 1207 of file vanet-routing-compare.cc.

Referenced by SetupAdhocDevices().

◆ m_mobility

uint32_t VanetRoutingExperiment::m_mobility
private

◆ m_nNodes

uint32_t VanetRoutingExperiment::m_nNodes
private

◆ m_nodePause

int VanetRoutingExperiment::m_nodePause
private

◆ m_nodeSpeed

int VanetRoutingExperiment::m_nodeSpeed
private

◆ m_nSinks

uint32_t VanetRoutingExperiment::m_nSinks
private

◆ m_os

std::ofstream VanetRoutingExperiment::m_os
private

output stream

Definition at line 1225 of file vanet-routing-compare.cc.

Referenced by ProcessOutputs(), SetupAdhocMobilityNodes(), and SetupLogFile().

◆ m_pcap

int VanetRoutingExperiment::m_pcap
private

◆ m_phyMode

std::string VanetRoutingExperiment::m_phyMode
private

◆ m_phyModeB

std::string VanetRoutingExperiment::m_phyModeB
private

◆ m_port

uint32_t VanetRoutingExperiment::m_port
private

port

Definition at line 1196 of file vanet-routing-compare.cc.

Referenced by SetConfigFromGlobals(), and SetGlobalsFromConfig().

◆ m_protocol

uint32_t VanetRoutingExperiment::m_protocol
private

◆ m_protocolName

std::string VanetRoutingExperiment::m_protocolName
private

protocol name

Definition at line 1200 of file vanet-routing-compare.cc.

Referenced by CheckThroughput().

◆ m_rate

std::string VanetRoutingExperiment::m_rate
private

◆ m_routingHelper

Ptr<RoutingHelper> VanetRoutingExperiment::m_routingHelper
private

◆ m_routingTables

int VanetRoutingExperiment::m_routingTables
private

routing tables

Definition at line 1231 of file vanet-routing-compare.cc.

Referenced by CommandSetup(), SetConfigFromGlobals(), SetGlobalsFromConfig(), and SetupRoutingMessages().

◆ m_saveConfigFilename

std::string VanetRoutingExperiment::m_saveConfigFilename
private

save configi file name

Definition at line 1235 of file vanet-routing-compare.cc.

Referenced by CommandSetup(), and ParseCommandLineArguments().

◆ m_scenario

uint32_t VanetRoutingExperiment::m_scenario
private

◆ m_streamIndex

int64_t VanetRoutingExperiment::m_streamIndex
private

used to get consistent random numbers across scenarios

Definition at line 1242 of file vanet-routing-compare.cc.

Referenced by SetupAdhocMobilityNodes(), and SetupWaveMessages().

◆ m_TotalSimTime

double VanetRoutingExperiment::m_TotalSimTime
private

◆ m_traceFile

std::string VanetRoutingExperiment::m_traceFile
private

◆ m_traceMobility

bool VanetRoutingExperiment::m_traceMobility
private

trace mobility

Definition at line 1202 of file vanet-routing-compare.cc.

Referenced by CommandSetup(), SetConfigFromGlobals(), and SetGlobalsFromConfig().

◆ m_trName

std::string VanetRoutingExperiment::m_trName
private

trace file name

Definition at line 1219 of file vanet-routing-compare.cc.

Referenced by ConfigureTracing(), SetConfigFromGlobals(), SetGlobalsFromConfig(), and SetupAdhocDevices().

◆ m_txMaxDelayMs

double VanetRoutingExperiment::m_txMaxDelayMs
private

transmit maximum delay

Definition at line 1230 of file vanet-routing-compare.cc.

Referenced by CommandSetup(), SetConfigFromGlobals(), SetGlobalsFromConfig(), and SetupWaveMessages().

◆ m_txp

double VanetRoutingExperiment::m_txp
private

◆ m_txSafetyRange1

double VanetRoutingExperiment::m_txSafetyRange1
private

◆ m_txSafetyRange10

double VanetRoutingExperiment::m_txSafetyRange10
private

◆ m_txSafetyRange2

double VanetRoutingExperiment::m_txSafetyRange2
private

◆ m_txSafetyRange3

double VanetRoutingExperiment::m_txSafetyRange3
private

◆ m_txSafetyRange4

double VanetRoutingExperiment::m_txSafetyRange4
private

◆ m_txSafetyRange5

double VanetRoutingExperiment::m_txSafetyRange5
private

◆ m_txSafetyRange6

double VanetRoutingExperiment::m_txSafetyRange6
private

◆ m_txSafetyRange7

double VanetRoutingExperiment::m_txSafetyRange7
private

◆ m_txSafetyRange8

double VanetRoutingExperiment::m_txSafetyRange8
private

◆ m_txSafetyRange9

double VanetRoutingExperiment::m_txSafetyRange9
private

◆ m_txSafetyRanges

std::vector<double> VanetRoutingExperiment::m_txSafetyRanges
private

list of ranges

Definition at line 1254 of file vanet-routing-compare.cc.

Referenced by ParseCommandLineArguments(), and SetupWaveMessages().

◆ m_verbose

int VanetRoutingExperiment::m_verbose
private

◆ m_waveBsmHelper

WaveBsmHelper VanetRoutingExperiment::m_waveBsmHelper
private

◆ m_waveInterval

double VanetRoutingExperiment::m_waveInterval
private

◆ m_wavePacketSize

uint32_t VanetRoutingExperiment::m_wavePacketSize
private

◆ m_wifiPhyStats

Ptr<WifiPhyStats> VanetRoutingExperiment::m_wifiPhyStats
private

wifi phy statistics

Definition at line 1239 of file vanet-routing-compare.cc.

Referenced by CheckThroughput(), ConfigureDevices(), ProcessOutputs(), and VanetRoutingExperiment().


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