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...
 
int 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 1080 of file vanet-routing-compare.cc.

Constructor & Destructor Documentation

VanetRoutingExperiment::VanetRoutingExperiment ( )

Constructor.

Returns
none

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

References m_log, m_routingHelper, and m_wifiPhyStats.

Member Function Documentation

void VanetRoutingExperiment::CheckThroughput ( )
private

Checks the throughput and outputs summary to CSV file1.

This is scheduled and called once per second

Returns
none

Definition at line 1757 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, 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:

void VanetRoutingExperiment::ConfigureApplications ( )
protectedvirtual

Configure applications.

Returns
none

Reimplemented from WifiApp.

Definition at line 1626 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:

void VanetRoutingExperiment::ConfigureChannels ( )
protectedvirtual

Configure channels.

Returns
none

Reimplemented from WifiApp.

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

References SetupAdhocDevices().

+ Here is the call graph for this function:

void VanetRoutingExperiment::ConfigureDefaults ( void  )
private

Configure default attributes.

Returns
none

Definition at line 2117 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:

void VanetRoutingExperiment::ConfigureDevices ( )
protectedvirtual

Configure devices.

Returns
none

Reimplemented from WifiApp.

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

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

+ Here is the call graph for this function:

void VanetRoutingExperiment::ConfigureMobility ( )
protectedvirtual

Configure mobility.

Returns
none

Reimplemented from WifiApp.

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

References SetupAdhocMobilityNodes().

+ Here is the call graph for this function:

void VanetRoutingExperiment::ConfigureNodes ( )
protectedvirtual

Configure nodes.

Returns
none

Reimplemented from WifiApp.

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

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

+ Here is the call graph for this function:

void VanetRoutingExperiment::ConfigureTracing ( )
protectedvirtual

Configure tracing.

Returns
none

Reimplemented from WifiApp.

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

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

+ Here is the call graph for this function:

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 1734 of file vanet-routing-compare.cc.

References ns3::Object::GetObject(), ns3::MobilityModel::GetPosition(), ns3::MobilityModel::GetVelocity(), and ns3::Now().

Referenced by SetupAdhocMobilityNodes().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Run the simulation.

Returns
none

Definition at line 1720 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:

void VanetRoutingExperiment::RunSimulation ( )
protectedvirtual

Run the simulation.

Returns
none

Reimplemented from WifiApp.

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

References Run().

+ Here is the call graph for this function:

void VanetRoutingExperiment::SetDefaultAttributeValues ( )
protectedvirtual

Sets default attribute values.

Returns
none

Reimplemented from WifiApp.

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

void VanetRoutingExperiment::SetGlobalsFromConfig ( )
private

Set up the global variables from the configuration parameters.

Returns
none

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

References g_80211mode, g_asciiTrace, g_CSVfileName, g_CSVfileName2, g_cumulativeBsmCaptureStart, g_fading, g_gpsAccuracyNs, g_logFile, g_lossModel, g_mobility, g_nNodes, g_nodePause, g_nodeSpeed, g_nSinks, g_pcap, g_phyMode, g_phyModeB, g_port, g_protocol, g_rate, g_routingTables, g_scenario, g_totalTime, g_traceFile, g_traceMobility, g_trName, g_txMaxDelayMs, g_txp, g_txSafetyRange1, g_txSafetyRange10, g_txSafetyRange2, g_txSafetyRange3, g_txSafetyRange4, g_txSafetyRange5, g_txSafetyRange6, g_txSafetyRange7, g_txSafetyRange8, g_txSafetyRange9, g_verbose, g_waveInterval, g_wavePacketSize, ns3::StringValue::Get(), m_80211mode, m_asciiTrace, m_CSVfileName, m_CSVfileName2, m_cumulativeBsmCaptureStart, m_fading, m_gpsAccuracyNs, m_logFile, m_lossModel, m_mobility, m_nNodes, m_nodePause, m_nodeSpeed, m_nSinks, m_pcap, m_phyMode, m_phyModeB, m_port, m_protocol, m_rate, m_routingTables, m_scenario, m_TotalSimTime, m_traceFile, m_traceMobility, m_trName, m_txMaxDelayMs, m_txp, m_txSafetyRange1, m_txSafetyRange10, m_txSafetyRange2, m_txSafetyRange3, m_txSafetyRange4, m_txSafetyRange5, m_txSafetyRange6, m_txSafetyRange7, m_txSafetyRange8, m_txSafetyRange9, m_verbose, m_waveInterval, m_wavePacketSize, and ns3::GlobalValue::SetValue().

Referenced by ParseCommandLineArguments().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void VanetRoutingExperiment::SetupLogFile ( )
private

Set up log file.

Returns
none

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

References m_logFile, and m_os.

Referenced by ConfigureTracing().

+ Here is the caller graph for this function:

void VanetRoutingExperiment::SetupLogging ( )
private

Set up logging.

Returns
none

Definition at line 2107 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:

void VanetRoutingExperiment::SetupRoutingMessages ( )
private

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

Returns
none

Definition at line 2349 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:

void VanetRoutingExperiment::SetupScenario ( )
private

Set up a prescribed scenario.

Returns
none

Definition at line 2361 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:

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

Returns
none

Definition at line 2323 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:

void VanetRoutingExperiment::WriteCsvHeader ( )
private

Write the header line to the CSV file1.

Returns
none

Definition at line 2405 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

uint32_t VanetRoutingExperiment::m_80211mode
private
NetDeviceContainer VanetRoutingExperiment::m_adhocTxDevices
private

adhoc transmit devices

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

Referenced by SetupAdhocDevices(), and SetupRoutingMessages().

Ipv4InterfaceContainer VanetRoutingExperiment::m_adhocTxInterfaces
private

adhoc transmit interfaces

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

Referenced by SetupRoutingMessages(), and SetupWaveMessages().

NodeContainer VanetRoutingExperiment::m_adhocTxNodes
private
int VanetRoutingExperiment::m_asciiTrace
private
std::string VanetRoutingExperiment::m_CSVfileName
private
std::string VanetRoutingExperiment::m_CSVfileName2
private
int VanetRoutingExperiment::m_cumulativeBsmCaptureStart
private

capture start

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

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

std::string VanetRoutingExperiment::m_exp
private

exp

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

Referenced by CommandSetup().

uint32_t VanetRoutingExperiment::m_fading
private
double VanetRoutingExperiment::m_gpsAccuracyNs
private

GPS accuracy.

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

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

std::string VanetRoutingExperiment::m_loadConfigFilename
private

load config file name

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

Referenced by CommandSetup().

int VanetRoutingExperiment::m_log
private
std::string VanetRoutingExperiment::m_logFile
private
uint32_t VanetRoutingExperiment::m_lossModel
private
std::string VanetRoutingExperiment::m_lossModelName
private

loss model name

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

Referenced by SetupAdhocDevices().

uint32_t VanetRoutingExperiment::m_mobility
private
uint32_t VanetRoutingExperiment::m_nNodes
private
int VanetRoutingExperiment::m_nodePause
private
int VanetRoutingExperiment::m_nodeSpeed
private
uint32_t VanetRoutingExperiment::m_nSinks
private
std::ofstream VanetRoutingExperiment::m_os
private

output stream

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

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

int VanetRoutingExperiment::m_pcap
private
std::string VanetRoutingExperiment::m_phyMode
private
std::string VanetRoutingExperiment::m_phyModeB
private
uint32_t VanetRoutingExperiment::m_port
private

port

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

Referenced by SetConfigFromGlobals(), and SetGlobalsFromConfig().

uint32_t VanetRoutingExperiment::m_protocol
private
std::string VanetRoutingExperiment::m_protocolName
private

protocol name

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

Referenced by CheckThroughput().

std::string VanetRoutingExperiment::m_rate
private
Ptr<RoutingHelper> VanetRoutingExperiment::m_routingHelper
private
int VanetRoutingExperiment::m_routingTables
private

routing tables

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

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

std::string VanetRoutingExperiment::m_saveConfigFilename
private

save configi file name

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

Referenced by CommandSetup(), and ParseCommandLineArguments().

uint32_t VanetRoutingExperiment::m_scenario
private
int64_t VanetRoutingExperiment::m_streamIndex
private

used to get consistent random numbers across scenarios

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

Referenced by SetupAdhocMobilityNodes(), and SetupWaveMessages().

double VanetRoutingExperiment::m_TotalSimTime
private
std::string VanetRoutingExperiment::m_traceFile
private
bool VanetRoutingExperiment::m_traceMobility
private

trace mobility

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

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

std::string VanetRoutingExperiment::m_trName
private

trace file name

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

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

double VanetRoutingExperiment::m_txMaxDelayMs
private

transmit maximum delay

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

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

double VanetRoutingExperiment::m_txp
private
double VanetRoutingExperiment::m_txSafetyRange1
private
double VanetRoutingExperiment::m_txSafetyRange10
private
double VanetRoutingExperiment::m_txSafetyRange2
private
double VanetRoutingExperiment::m_txSafetyRange3
private
double VanetRoutingExperiment::m_txSafetyRange4
private
double VanetRoutingExperiment::m_txSafetyRange5
private
double VanetRoutingExperiment::m_txSafetyRange6
private
double VanetRoutingExperiment::m_txSafetyRange7
private
double VanetRoutingExperiment::m_txSafetyRange8
private
double VanetRoutingExperiment::m_txSafetyRange9
private
std::vector<double> VanetRoutingExperiment::m_txSafetyRanges
private

list of ranges

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

Referenced by ParseCommandLineArguments(), and SetupWaveMessages().

int VanetRoutingExperiment::m_verbose
private
WaveBsmHelper VanetRoutingExperiment::m_waveBsmHelper
private
double VanetRoutingExperiment::m_waveInterval
private
uint32_t VanetRoutingExperiment::m_wavePacketSize
private
Ptr<WifiPhyStats> VanetRoutingExperiment::m_wifiPhyStats
private

wifi phy statistics

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

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


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