A Discrete-Event Network Simulator
API
vanet-routing-compare.cc
Go to the documentation of this file.
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2014 North Carolina State University
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Scott E. Carpenter <scarpen@ncsu.edu>
19 *
20 */
21
22/*
23 * This example program allows one to run vehicular ad hoc
24 * network (VANET) simulation scenarios in ns-3 to assess
25 * performance by evaluating different 802.11p MAC/PHY
26 * characteristics, propagation loss models (e.g. Friss,
27 * Two-Ray Ground, or ITU R-P.1411), and application traffic
28 * (e.g. Basic Safety Message) and/or routing traffic (e.g.
29 * DSDV, AODV, OLSR, or DSR) under either a synthetic highway
30 * scenario (i.e. a random waypoint mobility model) or by
31 * playing back mobility trace files (i.e. ns-2 movement files).
32 *
33 * The script draws from several ns-3 examples, including:
34 * /examples/routing/manet-routing-compare.cc
35 * /src/propagation/model/itu-r-1411-los-propagation-loss-model.cc
36 * /src/mobility/examples/ns2-mobility-trace.cc
37 * /src/wave/examples/wave-simple-80211p.cc
38 *
39 * The script allows many parameters to be modified and
40 * includes two predefined scenarios. By default
41 * scenario=1 runs for 10 simulated seconds with 40 nodes
42 * (i.e. vehicles) moving according to RandomWaypointMobilityModel
43 * with a speed of 20 m/s and no pause time within a 300x1500 m
44 * region. The WiFi is 802.11p with continuous access to a 10 MHz
45 * Control Channel (CH) for all traffic. All nodes transmit a
46 * 200-byte safety message 10 times per second at 6 Mbps.
47 * Additionally, all nodes (optionally) attempt to
48 * continuously route 64-byte packets at an application
49 * rate of 2.048 Kbps to one of 10 other nodes,
50 * selected as sink nodes. The default routing protocol is AODV
51 * and the Two-Ray Ground loss model is used.
52 * The transmit power is set to 20 dBm and the transmission range
53 * for safety message packet delivery is 145 m.
54 *
55 * Scenario 2 plays back vehicular trace files in
56 * ns-2 movement format, and are taken from:
57 * http://www.lst.inf.ethz.ch/research/ad-hoc/car-traces/
58 * This scenario is 300 simulation seconds of 99
59 * vehicles respectively within the Unterstrass
60 * section of Zurich Switzerland that travel based on
61 * models derived from real traffic data. Note that these
62 * scenarios can require a lot of clock time to complete.
63 *
64 * All parameters can be changed from their defaults (see
65 * --help) and changing simulation parameters can have dramatic
66 * impact on network performance.
67 *
68 * Several items can be output:
69 * - a CSV file of data reception statistics, output once per
70 * second
71 * - final statistics, in a CSV file
72 * - dump of routing tables at 5 seconds into the simulation
73 * - ASCII trace file
74 * - PCAP trace files for each node
75 *
76 * Simulation scenarios can be defined and configuration
77 * settings can be saved using config-store (raw text)
78 * which can they be replayed again. This is an easy way
79 * to define and save the settings for a scenario, and then
80 * re-execute the same scenario exactly, or to set up
81 * several different simulation scenarios.
82 * For example, to set up a scenario and save the configuration
83 * as "scenario1.txt":
84 * ./ns3 run "vanet-routing-compare --scenario=1 --saveconfig=scenario1.txt"
85 * Then, to re-play the scenario using the save configuration
86 * settings:
87 * ./ns3 run "vanet-routing-compare --loadconfig=scenario1.txt"
88 *
89 * Class Diagram:
90 * main()
91 * +--uses-- VanetRoutingExperiment
92 * +--is_a--- WifiApp
93 * +--uses--- ConfigStoreHelper
94 * +--has_a-- WaveBsmHelper
95 * | +--has_a-- WaveBsmStats
96 * +--has_a-- RoutingHelper
97 * | +--has_a--RoutingStats
98 * +--has_a-- WifiPhyStats
99 *
100 */
101
102#include <fstream>
103#include <iostream>
104#include "ns3/core-module.h"
105#include "ns3/network-module.h"
106#include "ns3/internet-module.h"
107#include "ns3/mobility-module.h"
108#include "ns3/aodv-module.h"
109#include "ns3/olsr-module.h"
110#include "ns3/dsdv-module.h"
111#include "ns3/dsr-module.h"
112#include "ns3/applications-module.h"
113#include "ns3/itu-r-1411-los-propagation-loss-model.h"
114#include "ns3/ocb-wifi-mac.h"
115#include "ns3/wifi-80211p-helper.h"
116#include "ns3/wave-mac-helper.h"
117#include "ns3/flow-monitor-module.h"
118#include "ns3/config-store-module.h"
119#include "ns3/integer.h"
120#include "ns3/wave-bsm-helper.h"
121#include "ns3/wave-helper.h"
122#include "ns3/yans-wifi-helper.h"
123
124using namespace ns3;
125using namespace dsr;
126
127NS_LOG_COMPONENT_DEFINE ("vanet-routing-compare");
128
136{
137public:
141 RoutingStats ();
142
148
154
160
166
172 void IncRxBytes (uint32_t rxBytes);
173
177 void IncRxPkts ();
178
183 void SetRxBytes (uint32_t rxBytes);
184
189 void SetRxPkts (uint32_t rxPkts);
190
196
202
208
214
219 void IncTxBytes (uint32_t txBytes);
220
224 void IncTxPkts ();
225
230 void SetTxBytes (uint32_t txBytes);
231
236 void SetTxPkts (uint32_t txPkts);
237
238private:
247};
248
250 : m_RxBytes (0),
251 m_cumulativeRxBytes (0),
252 m_RxPkts (0),
253 m_cumulativeRxPkts (0),
254 m_TxBytes (0),
255 m_cumulativeTxBytes (0),
256 m_TxPkts (0),
257 m_cumulativeTxPkts (0)
258{
259}
260
263{
264 return m_RxBytes;
265}
266
269{
270 return m_cumulativeRxBytes;
271}
272
275{
276 return m_RxPkts;
277}
278
281{
282 return m_cumulativeRxPkts;
283}
284
285void
287{
288 m_RxBytes += rxBytes;
289 m_cumulativeRxBytes += rxBytes;
290}
291
292void
294{
295 m_RxPkts++;
297}
298
299void
301{
302 m_RxBytes = rxBytes;
303}
304
305void
307{
308 m_RxPkts = rxPkts;
309}
310
313{
314 return m_TxBytes;
315}
316
319{
320 return m_cumulativeTxBytes;
321}
322
325{
326 return m_TxPkts;
327}
328
331{
332 return m_cumulativeTxPkts;
333}
334
335void
337{
338 m_TxBytes += txBytes;
339 m_cumulativeTxBytes += txBytes;
340}
341
342void
344{
345 m_TxPkts++;
347}
348
349void
351{
352 m_TxBytes = txBytes;
353}
354
355void
357{
358 m_TxPkts = txPkts;
359}
360
371class RoutingHelper : public Object
372{
373public:
378 static TypeId GetTypeId (void);
379
383 RoutingHelper ();
384
388 virtual ~RoutingHelper ();
389
402 void Install (NodeContainer & c,
405 double totalTime,
406 int protocol,
407 uint32_t nSinks,
408 int routingTables);
409
415 void OnOffTrace (std::string context, Ptr<const Packet> packet);
416
422
427 void SetLogging (int log);
428
429private:
435
442 Ipv4InterfaceContainer & adhocTxInterfaces);
443
450 Ipv4InterfaceContainer & adhocTxInterfaces);
451
459
464 void ReceiveRoutingPacket (Ptr<Socket> socket);
465
472 std::string m_protocolName;
473 int m_log;
474};
475
477
478TypeId
480{
481 static TypeId tid = TypeId ("ns3::RoutingHelper")
482 .SetParent<Object> ()
483 .AddConstructor<RoutingHelper> ();
484 return tid;
485}
486
488 : m_TotalSimTime (300.01),
489 m_protocol (0),
490 m_port (9),
491 m_nSinks (0),
492 m_routingTables (0),
493 m_log (0)
494{
495}
496
498{
499}
500
501void
505 double totalTime,
506 int protocol,
507 uint32_t nSinks,
508 int routingTables)
509{
510 m_TotalSimTime = totalTime;
511 m_protocol = protocol;
512 m_nSinks = nSinks;
513 m_routingTables = routingTables;
514
516 AssignIpAddresses (d, i);
518}
519
522{
523 TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
524 Ptr<Socket> sink = Socket::CreateSocket (node, tid);
526 sink->Bind (local);
527 sink->SetRecvCallback (MakeCallback (&RoutingHelper::ReceiveRoutingPacket, this));
528
529 return sink;
530}
531
532void
534{
535 AodvHelper aodv;
537 DsdvHelper dsdv;
538 DsrHelper dsr;
539 DsrMainHelper dsrMain;
541 InternetStackHelper internet;
542
543 Time rtt = Time (5.0);
544 AsciiTraceHelper ascii;
545 Ptr<OutputStreamWrapper> rtw = ascii.CreateFileStream ("routing_table");
546
547 switch (m_protocol)
548 {
549 case 0:
550 m_protocolName = "NONE";
551 break;
552 case 1:
553 if (m_routingTables != 0)
554 {
555 olsr.PrintRoutingTableAllAt (rtt, rtw);
556 }
557 list.Add (olsr, 100);
558 m_protocolName = "OLSR";
559 break;
560 case 2:
561 if (m_routingTables != 0)
562 {
563 aodv.PrintRoutingTableAllAt (rtt, rtw);
564 }
565 list.Add (aodv, 100);
566 m_protocolName = "AODV";
567 break;
568 case 3:
569 if (m_routingTables != 0)
570 {
571 dsdv.PrintRoutingTableAllAt (rtt, rtw);
572 }
573 list.Add (dsdv, 100);
574 m_protocolName = "DSDV";
575 break;
576 case 4:
577 // setup is later
578 m_protocolName = "DSR";
579 break;
580 default:
581 NS_FATAL_ERROR ("No such protocol:" << m_protocol);
582 break;
583 }
584
585 if (m_protocol < 4)
586 {
587 internet.SetRoutingHelper (list);
588 internet.Install (c);
589 }
590 else if (m_protocol == 4)
591 {
592 internet.Install (c);
593 dsrMain.Install (dsr, c);
594 }
595
596 if (m_log != 0)
597 {
598 NS_LOG_UNCOND ("Routing Setup for " << m_protocolName);
599 }
600}
601
602void
604 Ipv4InterfaceContainer & adhocTxInterfaces)
605{
606 NS_LOG_INFO ("Assigning IP addresses");
607 Ipv4AddressHelper addressAdhoc;
608 // we may have a lot of nodes, and want them all
609 // in same subnet, to support broadcast
610 addressAdhoc.SetBase ("10.1.0.0", "255.255.0.0");
611 adhocTxInterfaces = addressAdhoc.Assign (d);
612}
613
614void
616 Ipv4InterfaceContainer & adhocTxInterfaces)
617{
618 // Setup routing transmissions
619 OnOffHelper onoff1 ("ns3::UdpSocketFactory",Address ());
620 onoff1.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
621 onoff1.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));
622
623 Ptr<UniformRandomVariable> var = CreateObject<UniformRandomVariable> ();
624 int64_t stream = 2;
625 var->SetStream (stream);
626 for (uint32_t i = 0; i < m_nSinks; i++)
627 {
628 // protocol == 0 means no routing data, WAVE BSM only
629 // so do not set up sink
630 if (m_protocol != 0)
631 {
632 Ptr<Socket> sink = SetupRoutingPacketReceive (adhocTxInterfaces.GetAddress (i), c.Get (i));
633 }
634
635 AddressValue remoteAddress (InetSocketAddress (adhocTxInterfaces.GetAddress (i), m_port));
636 onoff1.SetAttribute ("Remote", remoteAddress);
637
638 ApplicationContainer temp = onoff1.Install (c.Get (i + m_nSinks));
639 temp.Start (Seconds (var->GetValue (1.0,2.0)));
640 temp.Stop (Seconds (m_TotalSimTime));
641 }
642}
643
651static inline std::string
653{
654 std::ostringstream oss;
655
656 oss << Simulator::Now ().As (Time::S) << " " << socket->GetNode ()->GetId ();
657
658 if (InetSocketAddress::IsMatchingType (srcAddress))
659 {
660 InetSocketAddress addr = InetSocketAddress::ConvertFrom (srcAddress);
661 oss << " received one packet from " << addr.GetIpv4 ();
662 }
663 else
664 {
665 oss << " received one packet!";
666 }
667 return oss.str ();
668}
669
670void
672{
673 Ptr<Packet> packet;
674 Address srcAddress;
675 while ((packet = socket->RecvFrom (srcAddress)))
676 {
677 // application data, for goodput
678 uint32_t RxRoutingBytes = packet->GetSize ();
679 GetRoutingStats ().IncRxBytes (RxRoutingBytes);
681 if (m_log != 0)
682 {
683 NS_LOG_UNCOND (m_protocolName + " " + PrintReceivedRoutingPacket (socket, packet, srcAddress));
684 }
685 }
686}
687
688void
689RoutingHelper::OnOffTrace (std::string context, Ptr<const Packet> packet)
690{
691 uint32_t pktBytes = packet->GetSize ();
692 routingStats.IncTxBytes (pktBytes);
693}
694
697{
698 return routingStats;
699}
700
701void
703{
704 m_log = log;
705}
706
711class WifiPhyStats : public Object
712{
713public:
718 static TypeId GetTypeId (void);
719
723 WifiPhyStats ();
724
728 virtual ~WifiPhyStats ();
729
736
745 void PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower);
746
752 void PhyTxDrop (std::string context, Ptr<const Packet> packet);
753
760 void PhyRxDrop (std::string context, Ptr<const Packet> packet, WifiPhyRxfailureReason reason);
761
762private:
765};
766
768
769TypeId
771{
772 static TypeId tid = TypeId ("ns3::WifiPhyStats")
773 .SetParent<Object> ()
774 .AddConstructor<WifiPhyStats> ();
775 return tid;
776}
777
779 : m_phyTxPkts (0),
780 m_phyTxBytes (0)
781{
782}
783
785{
786}
787
788void
789WifiPhyStats::PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
790{
791 NS_LOG_FUNCTION (this << context << packet << "PHYTX mode=" << mode );
792 ++m_phyTxPkts;
793 uint32_t pktSize = packet->GetSize ();
795
796 //NS_LOG_UNCOND ("Received PHY size=" << pktSize);
797}
798
799void
800WifiPhyStats::PhyTxDrop (std::string context, Ptr<const Packet> packet)
801{
802 NS_LOG_UNCOND ("PHY Tx Drop");
803}
804
805void
807{
808 NS_LOG_UNCOND ("PHY Rx Drop");
809}
810
813{
814 return m_phyTxBytes;
815}
816
822{
823public:
827 WifiApp ();
828
832 virtual ~WifiApp ();
833
839 void Simulate (int argc, char **argv);
840
841protected:
845 virtual void SetDefaultAttributeValues ();
846
852 virtual void ParseCommandLineArguments (int argc, char **argv);
853
857 virtual void ConfigureNodes ();
858
862 virtual void ConfigureChannels ();
863
867 virtual void ConfigureDevices ();
868
872 virtual void ConfigureMobility ();
873
877 virtual void ConfigureApplications ();
878
882 virtual void ConfigureTracing ();
883
887 virtual void RunSimulation ();
888
892 virtual void ProcessOutputs ();
893};
894
896{
897}
898
900{
901}
902
903void
904WifiApp::Simulate (int argc, char **argv)
905{
906 // Simulator Program Flow:
907 // (source: NS-3 Annual Meeting, May, 2014, session 2 slides 6, 28)
908 // (HandleProgramInputs:)
909 // SetDefaultAttributeValues
910 // ParseCommandLineArguments
911 // (ConfigureTopology:)
912 // ConfigureNodes
913 // ConfigureChannels
914 // ConfigureDevices
915 // ConfigureMobility
916 // ConfigureApplications
917 // e.g AddInternetStackToNodes
918 // ConfigureIpAddressingAndRouting
919 // configureSendMessages
920 // ConfigureTracing
921 // RunSimulation
922 // ProcessOutputs
923
925 ParseCommandLineArguments (argc, argv);
932 RunSimulation ();
934}
935
936void
938{
939}
940
941void
943{
944}
945
946void
948{
949}
950
951void
953{
954}
955
956void
958{
959}
960
961void
963{
964}
965
966void
968{
969}
970
971void
973{
974}
975
976void
978{
979}
980
981void
983{
984}
985
991{
992public:
997
1002 void LoadConfig (std::string configFilename);
1003
1008 void SaveConfig (std::string configFilename);
1009};
1010
1012{
1013}
1014
1015void
1016ConfigStoreHelper::LoadConfig (std::string configFilename)
1017{
1018 // Input config store from txt format
1019 Config::SetDefault ("ns3::ConfigStore::Filename", StringValue (configFilename));
1020 Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue ("RawText"));
1021 Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Load"));
1022 ConfigStore inputConfig;
1023 inputConfig.ConfigureDefaults ();
1024 //inputConfig.ConfigureAttributes ();
1025}
1026
1027void
1028ConfigStoreHelper::SaveConfig (std::string configFilename)
1029{
1030 // only save if a non-empty filename has been specified
1031 if (configFilename.compare ("") != 0)
1032 {
1033 // Output config store to txt format
1034 Config::SetDefault ("ns3::ConfigStore::Filename", StringValue (configFilename));
1035 Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue ("RawText"));
1036 Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Save"));
1037 ConfigStore outputConfig;
1038 outputConfig.ConfigureDefaults ();
1039 //outputConfig.ConfigureAttributes ();
1040 }
1041}
1042
1049{
1050public:
1055
1056protected:
1060 virtual void SetDefaultAttributeValues ();
1061
1067 virtual void ParseCommandLineArguments (int argc, char **argv);
1068
1072 virtual void ConfigureNodes ();
1073
1077 virtual void ConfigureChannels ();
1078
1082 virtual void ConfigureDevices ();
1083
1087 virtual void ConfigureMobility ();
1088
1092 virtual void ConfigureApplications ();
1093
1097 virtual void ConfigureTracing ();
1098
1102 virtual void RunSimulation ();
1103
1107 virtual void ProcessOutputs ();
1108
1109private:
1113 void Run ();
1114
1120 void CommandSetup (int argc, char **argv);
1121
1126 void CheckThroughput ();
1127
1131 void SetupLogFile ();
1132
1136 void SetupLogging ();
1137
1141 void ConfigureDefaults ();
1142
1147
1151 void SetupAdhocDevices ();
1152
1159 void SetupWaveMessages ();
1160
1165 void SetupRoutingMessages ();
1166
1170 void SetupScenario ();
1171
1175 void WriteCsvHeader ();
1176
1180 void SetConfigFromGlobals ();
1181
1185 void SetGlobalsFromConfig ();
1186
1193 static void
1194 CourseChange (std::ostream *os, std::string context, Ptr<const MobilityModel> mobility);
1195
1197 std::string m_CSVfileName;
1198 std::string m_CSVfileName2;
1200 std::string m_protocolName;
1201 double m_txp;
1204
1207 std::string m_lossModelName;
1208
1209 std::string m_phyMode;
1211
1212 std::string m_traceFile;
1213 std::string m_logFile;
1217 std::string m_rate;
1218 std::string m_phyModeB;
1219 std::string m_trName;
1225 std::ofstream m_os;
1236
1240 int m_log;
1254 std::vector <double> m_txSafetyRanges;
1255 std::string m_exp;
1257};
1258
1260 : m_port (9),
1261 m_CSVfileName ("vanet-routing.output.csv"),
1262 m_CSVfileName2 ("vanet-routing.output2.csv"),
1263 m_nSinks (10),
1264 m_protocolName ("protocol"),
1265 m_txp (20),
1266 m_traceMobility (false),
1267 // AODV
1268 m_protocol (2),
1269 // Two-Ray ground
1270 m_lossModel (3),
1271 m_fading (0),
1272 m_lossModelName (""),
1273 m_phyMode ("OfdmRate6MbpsBW10MHz"),
1274 // 1=802.11p
1275 m_80211mode (1),
1276 m_traceFile (""),
1277 m_logFile ("low99-ct-unterstrass-1day.filt.7.adj.log"),
1278 m_mobility (1),
1279 m_nNodes (156),
1280 m_TotalSimTime (300.01),
1281 m_rate ("2048bps"),
1282 m_phyModeB ("DsssRate11Mbps"),
1283 m_trName ("vanet-routing-compare"),
1284 m_nodeSpeed (20),
1285 m_nodePause (0),
1286 m_wavePacketSize (200),
1287 m_waveInterval (0.1),
1288 m_verbose (0),
1289 m_scenario (1),
1290 m_gpsAccuracyNs (40),
1291 m_txMaxDelayMs (10),
1292 m_routingTables (0),
1293 m_asciiTrace (0),
1294 m_pcap (0),
1295 m_loadConfigFilename ("load-config.txt"),
1296 m_saveConfigFilename (""),
1297 m_log (0),
1298 m_streamIndex (0),
1299 m_adhocTxNodes (),
1300 m_txSafetyRange1 (50.0),
1301 m_txSafetyRange2 (100.0),
1302 m_txSafetyRange3 (150.0),
1303 m_txSafetyRange4 (200.0),
1304 m_txSafetyRange5 (250.0),
1305 m_txSafetyRange6 (300.0),
1306 m_txSafetyRange7 (350.0),
1307 m_txSafetyRange8 (400.0),
1308 m_txSafetyRange9 (450.0),
1309 m_txSafetyRange10 (500.0),
1310 m_txSafetyRanges (),
1311 m_exp (""),
1312 m_cumulativeBsmCaptureStart (0)
1313{
1314 m_wifiPhyStats = CreateObject<WifiPhyStats> ();
1315 m_routingHelper = CreateObject<RoutingHelper> ();
1316
1317 // set to non-zero value to enable
1318 // simply uncond logging during simulation run
1319 m_log = 1;
1320}
1321
1322void
1324{
1325 // handled in constructor
1326}
1327
1328// important configuration items stored in global values
1329
1331static ns3::GlobalValue g_port ("VRCport",
1332 "Port",
1334 ns3::MakeUintegerChecker<uint32_t> ());
1335
1337static ns3::GlobalValue g_nSinks ("VRCnSinks",
1338 "Number of sink nodes for routing non-BSM traffic",
1339 ns3::UintegerValue (10),
1340 ns3::MakeUintegerChecker<uint32_t> ());
1341
1343static ns3::GlobalValue g_traceMobility ("VRCtraceMobility",
1344 "Trace mobility 1=yes;0=no",
1346 ns3::MakeUintegerChecker<uint32_t> ());
1347
1349static ns3::GlobalValue g_protocol ("VRCprotocol",
1350 "Routing protocol",
1352 ns3::MakeUintegerChecker<uint32_t> ());
1353
1355static ns3::GlobalValue g_lossModel ("VRClossModel",
1356 "Propagation Loss Model",
1358 ns3::MakeUintegerChecker<uint32_t> ());
1359
1361static ns3::GlobalValue g_fading ("VRCfading",
1362 "Fast Fading Model",
1364 ns3::MakeUintegerChecker<uint32_t> ());
1365
1367static ns3::GlobalValue g_80211mode ("VRC80211mode",
1368 "802.11 mode (0=802.11a;1=802.11p)",
1370 ns3::MakeUintegerChecker<uint32_t> ());
1371
1373static ns3::GlobalValue g_mobility ("VRCmobility",
1374 "Mobility mode 0=random waypoint;1=mobility trace file",
1376 ns3::MakeUintegerChecker<uint32_t> ());
1377
1379static ns3::GlobalValue g_nNodes ("VRCnNodes",
1380 "Number of nodes (vehicles)",
1381 ns3::UintegerValue (156),
1382 ns3::MakeUintegerChecker<uint32_t> ());
1383
1385static ns3::GlobalValue g_nodeSpeed ("VRCnodeSpeed",
1386 "Node speed (m/s) for RWP model",
1387 ns3::UintegerValue (20),
1388 ns3::MakeUintegerChecker<uint32_t> ());
1389
1391static ns3::GlobalValue g_nodePause ("VRCnodePause",
1392 "Node pause time (s) for RWP model",
1394 ns3::MakeUintegerChecker<uint32_t> ());
1395
1397static ns3::GlobalValue g_wavePacketSize ("VRCwavePacketSize",
1398 "Size in bytes of WAVE BSM",
1399 ns3::UintegerValue (200),
1400 ns3::MakeUintegerChecker<uint32_t> ());
1401
1403static ns3::GlobalValue g_verbose ("VRCverbose",
1404 "Verbose 0=no;1=yes",
1406 ns3::MakeUintegerChecker<uint32_t> ());
1407
1409static ns3::GlobalValue g_scenario ("VRCscenario",
1410 "Scenario",
1412 ns3::MakeUintegerChecker<uint32_t> ());
1413
1415static ns3::GlobalValue g_routingTables ("VRCroutingTables",
1416 "Dump routing tables at t=5 seconds 0=no;1=yes",
1418 ns3::MakeUintegerChecker<uint32_t> ());
1419
1421static ns3::GlobalValue g_asciiTrace ("VRCasciiTrace",
1422 "Dump ASCII trace 0=no;1=yes",
1424 ns3::MakeUintegerChecker<uint32_t> ());
1425
1427static ns3::GlobalValue g_pcap ("VRCpcap",
1428 "Generate PCAP files 0=no;1=yes",
1430 ns3::MakeUintegerChecker<uint32_t> ());
1431
1433static ns3::GlobalValue g_cumulativeBsmCaptureStart ("VRCcumulativeBsmCaptureStart",
1434 "Simulation start time for capturing cumulative BSM",
1435 ns3::TimeValue (Seconds (0)),
1437
1439static ns3::GlobalValue g_txSafetyRange1 ("VRCtxSafetyRange1",
1440 "BSM range for PDR inclusion",
1441 ns3::DoubleValue (50.0),
1442 ns3::MakeDoubleChecker<double> ());
1443
1445static ns3::GlobalValue g_txSafetyRange2 ("VRCtxSafetyRange2",
1446 "BSM range for PDR inclusion",
1447 ns3::DoubleValue (100.0),
1448 ns3::MakeDoubleChecker<double> ());
1449
1451static ns3::GlobalValue g_txSafetyRange3 ("VRCtxSafetyRange3",
1452 "BSM range for PDR inclusion",
1453 ns3::DoubleValue (150.0),
1454 ns3::MakeDoubleChecker<double> ());
1455
1457static ns3::GlobalValue g_txSafetyRange4 ("VRCtxSafetyRange4",
1458 "BSM range for PDR inclusion",
1459 ns3::DoubleValue (200.0),
1460 ns3::MakeDoubleChecker<double> ());
1461
1463static ns3::GlobalValue g_txSafetyRange5 ("VRCtxSafetyRange5",
1464 "BSM range for PDR inclusion",
1465 ns3::DoubleValue (250.0),
1466 ns3::MakeDoubleChecker<double> ());
1467
1469static ns3::GlobalValue g_txSafetyRange6 ("VRCtxSafetyRange6",
1470 "BSM range for PDR inclusion",
1471 ns3::DoubleValue (300.0),
1472 ns3::MakeDoubleChecker<double> ());
1473
1475static ns3::GlobalValue g_txSafetyRange7 ("VRCtxSafetyRange7",
1476 "BSM range for PDR inclusion",
1477 ns3::DoubleValue (350.0),
1478 ns3::MakeDoubleChecker<double> ());
1479
1481static ns3::GlobalValue g_txSafetyRange8 ("VRCtxSafetyRange8",
1482 "BSM range for PDR inclusion",
1483 ns3::DoubleValue (400.0),
1484 ns3::MakeDoubleChecker<double> ());
1485
1487static ns3::GlobalValue g_txSafetyRange9 ("VRCtxSafetyRange9",
1488 "BSM range for PDR inclusion",
1489 ns3::DoubleValue (450.0),
1490 ns3::MakeDoubleChecker<double> ());
1491
1493static ns3::GlobalValue g_txSafetyRange10 ("VRCtxSafetyRange10",
1494 "BSM range for PDR inclusion",
1495 ns3::DoubleValue (500.0),
1496 ns3::MakeDoubleChecker<double> ());
1497
1499static ns3::GlobalValue g_txp ("VRCtxp",
1500 "Transmission power dBm",
1501 ns3::DoubleValue (7.5),
1502 ns3::MakeDoubleChecker<double> ());
1503
1505static ns3::GlobalValue g_totalTime ("VRCtotalTime",
1506 "Total simulation time (s)",
1507 ns3::DoubleValue (300.01),
1508 ns3::MakeDoubleChecker<double> ());
1509
1511static ns3::GlobalValue g_waveInterval ("VRCwaveInterval",
1512 "Interval (s) between WAVE BSMs",
1513 ns3::DoubleValue (0.1),
1514 ns3::MakeDoubleChecker<double> ());
1515
1517static ns3::GlobalValue g_gpsAccuracyNs ("VRCgpsAccuracyNs",
1518 "GPS sync accuracy (ns)",
1519 ns3::DoubleValue (40),
1520 ns3::MakeDoubleChecker<double> ());
1521
1523static ns3::GlobalValue g_txMaxDelayMs ("VRCtxMaxDelayMs",
1524 "Tx May Delay (ms)",
1525 ns3::DoubleValue (10),
1526 ns3::MakeDoubleChecker<double> ());
1527
1529static ns3::GlobalValue g_CSVfileName ("VRCCSVfileName",
1530 "CSV filename (for time series data)",
1531 ns3::StringValue ("vanet-routing.output.csv"),
1533
1535static ns3::GlobalValue g_CSVfileName2 ("VRCCSVfileName2",
1536 "CSV filename 2 (for overall simulation scenario results)",
1537 ns3::StringValue ("vanet-routing.output2.csv"),
1539
1541static ns3::GlobalValue g_phyMode ("VRCphyMode",
1542 "PHY mode (802.11p)",
1543 ns3::StringValue ("OfdmRate6MbpsBW10MHz"),
1545
1547static ns3::GlobalValue g_traceFile ("VRCtraceFile",
1548 "Mobility trace filename",
1549 ns3::StringValue ("./src/wave/examples/low99-ct-unterstrass-1day.filt.7.adj.mob"),
1551
1553static ns3::GlobalValue g_logFile ("VRClogFile",
1554 "Log filename",
1555 ns3::StringValue ("low99-ct-unterstrass-1day.filt.7.adj.log"),
1557
1559static ns3::GlobalValue g_rate ("VRCrate",
1560 "Data rate",
1561 ns3::StringValue ("2048bps"),
1563
1565static ns3::GlobalValue g_phyModeB ("VRCphyModeB",
1566 "PHY mode (802.11a)",
1567 ns3::StringValue ("DsssRate11Mbps"),
1569
1571static ns3::GlobalValue g_trName ("VRCtrName",
1572 "Trace name",
1573 ns3::StringValue ("vanet-routing-compare"),
1575
1576void
1578{
1579 CommandSetup (argc, argv);
1580 SetupScenario ();
1581
1582 // user may specify up to 10 different tx distances
1583 // to be used for calculating different values of Packet
1584 // Delivery Ratio (PDR). Used to see the effects of
1585 // fading over distance
1586 m_txSafetyRanges.resize (10, 0);
1597
1599
1600 // we are done with all configuration
1601 // save config-store, if requested
1603 ConfigStoreHelper configStoreHelper;
1604 configStoreHelper.SaveConfig (m_saveConfigFilename);
1605
1606 m_waveBsmHelper.GetWaveBsmStats ()->SetLogging (m_log);
1608}
1609
1610void
1612{
1614}
1615
1616void
1618{
1619 // set up channel and devices
1621}
1622
1623void
1625{
1626 // devices are set up in SetupAdhocDevices(),
1627 // called by ConfigureChannels()
1628
1629 // use a PHY callback for tracing
1630 // to determine the total amount of
1631 // data transmitted, and then used to calculate
1632 // the MAC/PHY overhead beyond the app-data
1633 if (m_80211mode == 3)
1634 {
1635 // WAVE
1636 Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/State/Tx", MakeCallback (&WifiPhyStats::PhyTxTrace, m_wifiPhyStats));
1637 Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/PhyTxDrop", MakeCallback (&WifiPhyStats::PhyTxDrop, m_wifiPhyStats));
1638 Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/PhyRxDrop", MakeCallback (&WifiPhyStats::PhyRxDrop, m_wifiPhyStats));
1639 }
1640 else
1641 {
1642 Config::Connect ("/NodeList/*/DeviceList/*/Phy/State/Tx", MakeCallback (&WifiPhyStats::PhyTxTrace, m_wifiPhyStats));
1643 Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxDrop", MakeCallback (&WifiPhyStats::PhyTxDrop, m_wifiPhyStats));
1644 Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop", MakeCallback (&WifiPhyStats::PhyRxDrop, m_wifiPhyStats));
1645}
1646 }
1647
1648void
1650{
1652}
1653
1654void
1656{
1657 // Traffic mix consists of:
1658 // 1. routing data
1659 // 2. Broadcasting of Basic Safety Message (BSM)
1662
1663 // config trace to capture app-data (bytes) for
1664 // routing data, subtracted and used for
1665 // routing overhead
1666 std::ostringstream oss;
1667 oss.str ("");
1668 oss << "/NodeList/*/ApplicationList/*/$ns3::OnOffApplication/Tx";
1670}
1671
1672void
1674{
1675 WriteCsvHeader ();
1676 SetupLogFile ();
1677 SetupLogging ();
1678
1679 AsciiTraceHelper ascii;
1680 MobilityHelper::EnableAsciiAll (ascii.CreateFileStream (m_trName + ".mob"));
1681}
1682
1683void
1685{
1686 Run ();
1687}
1688
1689void
1691{
1692 // calculate and output final results
1693 double bsm_pdr1 = m_waveBsmHelper.GetWaveBsmStats ()->GetCumulativeBsmPdr (1);
1694 double bsm_pdr2 = m_waveBsmHelper.GetWaveBsmStats ()->GetCumulativeBsmPdr (2);
1695 double bsm_pdr3 = m_waveBsmHelper.GetWaveBsmStats ()->GetCumulativeBsmPdr (3);
1696 double bsm_pdr4 = m_waveBsmHelper.GetWaveBsmStats ()->GetCumulativeBsmPdr (4);
1697 double bsm_pdr5 = m_waveBsmHelper.GetWaveBsmStats ()->GetCumulativeBsmPdr (5);
1698 double bsm_pdr6 = m_waveBsmHelper.GetWaveBsmStats ()->GetCumulativeBsmPdr (6);
1699 double bsm_pdr7 = m_waveBsmHelper.GetWaveBsmStats ()->GetCumulativeBsmPdr (7);
1700 double bsm_pdr8 = m_waveBsmHelper.GetWaveBsmStats ()->GetCumulativeBsmPdr (8);
1701 double bsm_pdr9 = m_waveBsmHelper.GetWaveBsmStats ()->GetCumulativeBsmPdr (9);
1702 double bsm_pdr10 = m_waveBsmHelper.GetWaveBsmStats ()->GetCumulativeBsmPdr (10);
1703
1704 double averageRoutingGoodputKbps = 0.0;
1706 averageRoutingGoodputKbps = (((double) totalBytesTotal * 8.0) / m_TotalSimTime) / 1000.0;
1707
1708 // calculate MAC/PHY overhead (mac-phy-oh)
1709 // total WAVE BSM bytes sent
1710 uint32_t cumulativeWaveBsmBytes = m_waveBsmHelper.GetWaveBsmStats ()->GetTxByteCount ();
1711 uint32_t cumulativeRoutingBytes = m_routingHelper->GetRoutingStats ().GetCumulativeTxBytes ();
1712 uint32_t totalAppBytes = cumulativeWaveBsmBytes + cumulativeRoutingBytes;
1713 uint32_t totalPhyBytes = m_wifiPhyStats->GetTxBytes ();
1714 // mac-phy-oh = (total-phy-bytes - total-app-bytes) / total-phy-bytes
1715 double mac_phy_oh = 0.0;
1716 if (totalPhyBytes > 0)
1717 {
1718 mac_phy_oh = (double) (totalPhyBytes - totalAppBytes) / (double) totalPhyBytes;
1719 }
1720
1721 if (m_log != 0)
1722 {
1723 NS_LOG_UNCOND ("BSM_PDR1=" << bsm_pdr1 << " BSM_PDR2=" << bsm_pdr2 << " BSM_PDR3=" << bsm_pdr3 << " BSM_PDR4=" << bsm_pdr4 << " BSM_PDR5=" << bsm_pdr5 << " BSM_PDR6=" << bsm_pdr6 << " BSM_PDR7=" << bsm_pdr7 << " BSM_PDR8=" << bsm_pdr8 << " BSM_PDR9=" << bsm_pdr9 << " BSM_PDR10=" << bsm_pdr10 << " Goodput=" << averageRoutingGoodputKbps << "Kbps MAC/PHY-oh=" << mac_phy_oh);
1724
1725 }
1726
1727 std::ofstream out (m_CSVfileName2.c_str (), std::ios::app);
1728
1729 out << bsm_pdr1 << ","
1730 << bsm_pdr2 << ","
1731 << bsm_pdr3 << ","
1732 << bsm_pdr4 << ","
1733 << bsm_pdr5 << ","
1734 << bsm_pdr6 << ","
1735 << bsm_pdr7 << ","
1736 << bsm_pdr8 << ","
1737 << bsm_pdr9 << ","
1738 << bsm_pdr10 << ","
1739 << averageRoutingGoodputKbps << ","
1740 << mac_phy_oh << ""
1741 << std::endl;
1742
1743 out.close ();
1744
1745 m_os.close (); // close log file
1746}
1747
1748void
1750{
1751 NS_LOG_INFO ("Run Simulation.");
1752
1753 CheckThroughput ();
1754
1755 Simulator::Stop (Seconds (m_TotalSimTime));
1756 Simulator::Run ();
1757 Simulator::Destroy ();
1758}
1759
1760// Prints actual position and velocity when a course change event occurs
1761void
1763CourseChange (std::ostream *os, std::string context, Ptr<const MobilityModel> mobility)
1764{
1765 Vector pos = mobility->GetPosition (); // Get position
1766 Vector vel = mobility->GetVelocity (); // Get velocity
1767
1768 pos.z = 1.5;
1769
1770 int nodeId = mobility->GetObject<Node> ()->GetId ();
1771 double t = (Simulator::Now ()).GetSeconds ();
1772 if (t >= 1.0)
1773 {
1774 WaveBsmHelper::GetNodesMoving ()[nodeId] = 1;
1775 }
1776
1777 //NS_LOG_UNCOND ("Changing pos for node=" << nodeId << " at " << Simulator::Now () );
1778
1779 // Prints position and velocities
1780 *os << Simulator::Now () << " POS: x=" << pos.x << ", y=" << pos.y
1781 << ", z=" << pos.z << "; VEL:" << vel.x << ", y=" << vel.y
1782 << ", z=" << vel.z << std::endl;
1783}
1784
1785void
1787{
1790 double kbps = (bytesTotal * 8.0) / 1000;
1791 double wavePDR = 0.0;
1792 int wavePktsSent = m_waveBsmHelper.GetWaveBsmStats ()->GetTxPktCount ();
1793 int wavePktsReceived = m_waveBsmHelper.GetWaveBsmStats ()->GetRxPktCount ();
1794 if (wavePktsSent > 0)
1795 {
1796 int wavePktsReceived = m_waveBsmHelper.GetWaveBsmStats ()->GetRxPktCount ();
1797 wavePDR = (double) wavePktsReceived / (double) wavePktsSent;
1798 }
1799
1800 int waveExpectedRxPktCount = m_waveBsmHelper.GetWaveBsmStats ()->GetExpectedRxPktCount (1);
1801 int waveRxPktInRangeCount = m_waveBsmHelper.GetWaveBsmStats ()->GetRxPktInRangeCount (1);
1802 double wavePDR1_2 = m_waveBsmHelper.GetWaveBsmStats ()->GetBsmPdr (1);
1803 double wavePDR2_2 = m_waveBsmHelper.GetWaveBsmStats ()->GetBsmPdr (2);
1804 double wavePDR3_2 = m_waveBsmHelper.GetWaveBsmStats ()->GetBsmPdr (3);
1805 double wavePDR4_2 = m_waveBsmHelper.GetWaveBsmStats ()->GetBsmPdr (4);
1806 double wavePDR5_2 = m_waveBsmHelper.GetWaveBsmStats ()->GetBsmPdr (5);
1807 double wavePDR6_2 = m_waveBsmHelper.GetWaveBsmStats ()->GetBsmPdr (6);
1808 double wavePDR7_2 = m_waveBsmHelper.GetWaveBsmStats ()->GetBsmPdr (7);
1809 double wavePDR8_2 = m_waveBsmHelper.GetWaveBsmStats ()->GetBsmPdr (8);
1810 double wavePDR9_2 = m_waveBsmHelper.GetWaveBsmStats ()->GetBsmPdr (9);
1811 double wavePDR10_2 = m_waveBsmHelper.GetWaveBsmStats ()->GetBsmPdr (10);
1812
1813 // calculate MAC/PHY overhead (mac-phy-oh)
1814 // total WAVE BSM bytes sent
1815 uint32_t cumulativeWaveBsmBytes = m_waveBsmHelper.GetWaveBsmStats ()->GetTxByteCount ();
1816 uint32_t cumulativeRoutingBytes = m_routingHelper->GetRoutingStats ().GetCumulativeTxBytes ();
1817 uint32_t totalAppBytes = cumulativeWaveBsmBytes + cumulativeRoutingBytes;
1818 uint32_t totalPhyBytes = m_wifiPhyStats->GetTxBytes ();
1819 // mac-phy-oh = (total-phy-bytes - total-app-bytes) / total-phy-bytes
1820 double mac_phy_oh = 0.0;
1821 if (totalPhyBytes > 0)
1822 {
1823 mac_phy_oh = (double) (totalPhyBytes - totalAppBytes) / (double) totalPhyBytes;
1824 }
1825
1826 std::ofstream out (m_CSVfileName.c_str (), std::ios::app);
1827
1828 if (m_log != 0 )
1829 {
1830 NS_LOG_UNCOND ("At t=" << (Simulator::Now ()).As (Time::S) << " BSM_PDR1=" << wavePDR1_2 << " BSM_PDR1=" << wavePDR2_2 << " BSM_PDR3=" << wavePDR3_2 << " BSM_PDR4=" << wavePDR4_2 << " BSM_PDR5=" << wavePDR5_2 << " BSM_PDR6=" << wavePDR6_2 << " BSM_PDR7=" << wavePDR7_2 << " BSM_PDR8=" << wavePDR8_2 << " BSM_PDR9=" << wavePDR9_2 << " BSM_PDR10=" << wavePDR10_2 << " Goodput=" << kbps << "Kbps" /*<< " MAC/PHY-OH=" << mac_phy_oh*/);
1831 }
1832
1833 out << (Simulator::Now ()).As (Time::S) << ","
1834 << kbps << ","
1835 << packetsReceived << ","
1836 << m_nSinks << ","
1837 << m_protocolName << ","
1838 << m_txp << ","
1839 << wavePktsSent << ","
1840 << wavePktsReceived << ","
1841 << wavePDR << ","
1842 << waveExpectedRxPktCount << ","
1843 << waveRxPktInRangeCount << ","
1844 << wavePDR1_2 << ","
1845 << wavePDR2_2 << ","
1846 << wavePDR3_2 << ","
1847 << wavePDR4_2 << ","
1848 << wavePDR5_2 << ","
1849 << wavePDR6_2 << ","
1850 << wavePDR7_2 << ","
1851 << wavePDR8_2 << ","
1852 << wavePDR9_2 << ","
1853 << wavePDR10_2 << ","
1854 << mac_phy_oh << ""
1855 << std::endl;
1856
1857 out.close ();
1858
1861 m_waveBsmHelper.GetWaveBsmStats ()->SetRxPktCount (0);
1862 m_waveBsmHelper.GetWaveBsmStats ()->SetTxPktCount (0);
1863 for (int index = 1; index <= 10; index++)
1864 {
1865 m_waveBsmHelper.GetWaveBsmStats ()->SetExpectedRxPktCount (index, 0);
1866 m_waveBsmHelper.GetWaveBsmStats ()->SetRxPktInRangeCount (index, 0);
1867 }
1868
1869 Time currentTime = Simulator::Now ();
1870 if (currentTime <= m_cumulativeBsmCaptureStart)
1871 {
1872 for (int index = 1; index <= 10; index++)
1873 {
1874 m_waveBsmHelper.GetWaveBsmStats ()->ResetTotalRxPktCounts (index);
1875 }
1876 }
1877
1878 Simulator::Schedule (Seconds (1.0), &VanetRoutingExperiment::CheckThroughput, this);
1879}
1880
1881void
1883{
1884 // get settings saved from config-store
1885 UintegerValue uintegerValue;
1886 DoubleValue doubleValue;
1887 StringValue stringValue;
1888 TimeValue timeValue;
1889
1890 // This may not be the best way to manage program configuration
1891 // (directing them through global values), but management
1892 // through the config-store here is copied from
1893 // src/lte/examples/lena-dual-stripe.cc
1894
1895 GlobalValue::GetValueByName ("VRCport", uintegerValue);
1896 m_port = uintegerValue.Get ();
1897 GlobalValue::GetValueByName ("VRCnSinks", uintegerValue);
1898 m_nSinks = uintegerValue.Get ();
1899 GlobalValue::GetValueByName ("VRCtraceMobility", uintegerValue);
1900 m_traceMobility = uintegerValue.Get ();
1901 GlobalValue::GetValueByName ("VRCprotocol", uintegerValue);
1902 m_protocol = uintegerValue.Get ();
1903 GlobalValue::GetValueByName ("VRClossModel", uintegerValue);
1904 m_lossModel = uintegerValue.Get ();
1905 GlobalValue::GetValueByName ("VRCfading", uintegerValue);
1906 m_fading = uintegerValue.Get ();
1907 GlobalValue::GetValueByName ("VRC80211mode", uintegerValue);
1908 m_80211mode = uintegerValue.Get ();
1909 GlobalValue::GetValueByName ("VRCmobility", uintegerValue);
1910 m_mobility = uintegerValue.Get ();
1911 GlobalValue::GetValueByName ("VRCnNodes", uintegerValue);
1912 m_nNodes = uintegerValue.Get ();
1913 GlobalValue::GetValueByName ("VRCnodeSpeed", uintegerValue);
1914 m_nodeSpeed = uintegerValue.Get ();
1915 GlobalValue::GetValueByName ("VRCnodePause", uintegerValue);
1916 m_nodePause = uintegerValue.Get ();
1917 GlobalValue::GetValueByName ("VRCwavePacketSize", uintegerValue);
1918 m_wavePacketSize = uintegerValue.Get ();
1919 GlobalValue::GetValueByName ("VRCverbose", uintegerValue);
1920 m_verbose = uintegerValue.Get ();
1921 GlobalValue::GetValueByName ("VRCscenario", uintegerValue);
1922 m_scenario = uintegerValue.Get ();
1923 GlobalValue::GetValueByName ("VRCroutingTables", uintegerValue);
1924 m_routingTables = uintegerValue.Get ();
1925 GlobalValue::GetValueByName ("VRCasciiTrace", uintegerValue);
1926 m_asciiTrace = uintegerValue.Get ();
1927 GlobalValue::GetValueByName ("VRCpcap", uintegerValue);
1928 m_pcap = uintegerValue.Get ();
1929 GlobalValue::GetValueByName ("VRCcumulativeBsmCaptureStart", timeValue);
1930 m_cumulativeBsmCaptureStart = timeValue.Get ();
1931
1932
1933 GlobalValue::GetValueByName ("VRCtxSafetyRange1", doubleValue);
1934 m_txSafetyRange1 = doubleValue.Get ();
1935 GlobalValue::GetValueByName ("VRCtxSafetyRange2", doubleValue);
1936 m_txSafetyRange2 = doubleValue.Get ();
1937 GlobalValue::GetValueByName ("VRCtxSafetyRange3", doubleValue);
1938 m_txSafetyRange3 = doubleValue.Get ();
1939 GlobalValue::GetValueByName ("VRCtxSafetyRange4", doubleValue);
1940 m_txSafetyRange4 = doubleValue.Get ();
1941 GlobalValue::GetValueByName ("VRCtxSafetyRange5", doubleValue);
1942 m_txSafetyRange5 = doubleValue.Get ();
1943 GlobalValue::GetValueByName ("VRCtxSafetyRange6", doubleValue);
1944 m_txSafetyRange6 = doubleValue.Get ();
1945 GlobalValue::GetValueByName ("VRCtxSafetyRange7", doubleValue);
1946 m_txSafetyRange7 = doubleValue.Get ();
1947 GlobalValue::GetValueByName ("VRCtxSafetyRange8", doubleValue);
1948 m_txSafetyRange8 = doubleValue.Get ();
1949 GlobalValue::GetValueByName ("VRCtxSafetyRange9", doubleValue);
1950 m_txSafetyRange9 = doubleValue.Get ();
1951 GlobalValue::GetValueByName ("VRCtxSafetyRange10", doubleValue);
1952 m_txSafetyRange10 = doubleValue.Get ();
1953 GlobalValue::GetValueByName ("VRCtxp", doubleValue);
1954 m_txp = doubleValue.Get ();
1955 GlobalValue::GetValueByName ("VRCtotalTime", doubleValue);
1956 m_TotalSimTime = doubleValue.Get ();
1957 GlobalValue::GetValueByName ("VRCwaveInterval", doubleValue);
1958 m_waveInterval = doubleValue.Get ();
1959 GlobalValue::GetValueByName ("VRCgpsAccuracyNs", doubleValue);
1960 m_gpsAccuracyNs = doubleValue.Get ();
1961 GlobalValue::GetValueByName ("VRCtxMaxDelayMs", doubleValue);
1962 m_txMaxDelayMs = doubleValue.Get ();
1963
1964 GlobalValue::GetValueByName ("VRCCSVfileName", stringValue);
1965 m_CSVfileName = stringValue.Get ();
1966 GlobalValue::GetValueByName ("VRCCSVfileName2", stringValue);
1967 m_CSVfileName2 = stringValue.Get ();
1968 GlobalValue::GetValueByName ("VRCphyMode", stringValue);
1969 m_phyMode = stringValue.Get ();
1970 GlobalValue::GetValueByName ("VRCtraceFile", stringValue);
1971 m_traceFile = stringValue.Get ();
1972 GlobalValue::GetValueByName ("VRClogFile", stringValue);
1973 m_logFile = stringValue.Get ();
1974 GlobalValue::GetValueByName ("VRCrate", stringValue);
1975 m_rate = stringValue.Get ();
1976 GlobalValue::GetValueByName ("VRCphyModeB", stringValue);
1977 m_phyModeB = stringValue.Get ();
1978 GlobalValue::GetValueByName ("VRCtrName", stringValue);
1979 m_trName = stringValue.Get ();
1980}
1981
1982void
1984{
1985 // get settings saved from config-store
1986 UintegerValue uintegerValue;
1987 DoubleValue doubleValue;
1988 StringValue stringValue;
1989
2008
2024
2033 GlobalValue::GetValueByName ("VRCtrName", stringValue);
2034 m_trName = stringValue.Get ();
2035}
2036
2037void
2039{
2040 CommandLine cmd (__FILE__);
2041 double txDist1 = 50.0;
2042 double txDist2 = 100.0;
2043 double txDist3 = 150.0;
2044 double txDist4 = 200.0;
2045 double txDist5 = 250.0;
2046 double txDist6 = 300.0;
2047 double txDist7 = 350.0;
2048 double txDist8 = 350.0;
2049 double txDist9 = 350.0;
2050 double txDist10 = 350.0;
2051
2052 // allow command line overrides
2053 cmd.AddValue ("CSVfileName", "The name of the CSV output file name", m_CSVfileName);
2054 cmd.AddValue ("CSVfileName2", "The name of the CSV output file name2", m_CSVfileName2);
2055 cmd.AddValue ("totaltime", "Simulation end time", m_TotalSimTime);
2056 cmd.AddValue ("nodes", "Number of nodes (i.e. vehicles)", m_nNodes);
2057 cmd.AddValue ("sinks", "Number of routing sinks", m_nSinks);
2058 cmd.AddValue ("txp", "Transmit power (dB), e.g. txp=7.5", m_txp);
2059 cmd.AddValue ("traceMobility", "Enable mobility tracing", m_traceMobility);
2060 cmd.AddValue ("protocol", "1=OLSR;2=AODV;3=DSDV;4=DSR", m_protocol);
2061 cmd.AddValue ("lossModel", "1=Friis;2=ItuR1411Los;3=TwoRayGround;4=LogDistance", m_lossModel);
2062 cmd.AddValue ("fading", "0=None;1=Nakagami;(buildings=1 overrides)", m_fading);
2063 cmd.AddValue ("phyMode", "Wifi Phy mode", m_phyMode);
2064 cmd.AddValue ("80211Mode", "1=802.11p; 2=802.11b; 3=WAVE-PHY", m_80211mode);
2065 cmd.AddValue ("traceFile", "Ns2 movement trace file", m_traceFile);
2066 cmd.AddValue ("logFile", "Log file", m_logFile);
2067 cmd.AddValue ("mobility", "1=trace;2=RWP", m_mobility);
2068 cmd.AddValue ("rate", "Rate", m_rate);
2069 cmd.AddValue ("phyModeB", "Phy mode 802.11b", m_phyModeB);
2070 cmd.AddValue ("speed", "Node speed (m/s)", m_nodeSpeed);
2071 cmd.AddValue ("pause", "Node pause (s)", m_nodePause);
2072 cmd.AddValue ("verbose", "0=quiet;1=verbose", m_verbose);
2073 cmd.AddValue ("bsm", "(WAVE) BSM size (bytes)", m_wavePacketSize);
2074 cmd.AddValue ("interval", "(WAVE) BSM interval (s)", m_waveInterval);
2075 cmd.AddValue ("scenario", "1=synthetic, 2=playback-trace", m_scenario);
2076 // User is allowed to have up to 10 different PDRs (Packet
2077 // Delivery Ratios) calculate, and so can specify up to
2078 // 10 different tx distances.
2079 cmd.AddValue ("txdist1", "Expected BSM tx range, m", txDist1);
2080 cmd.AddValue ("txdist2", "Expected BSM tx range, m", txDist2);
2081 cmd.AddValue ("txdist3", "Expected BSM tx range, m", txDist3);
2082 cmd.AddValue ("txdist4", "Expected BSM tx range, m", txDist4);
2083 cmd.AddValue ("txdist5", "Expected BSM tx range, m", txDist5);
2084 cmd.AddValue ("txdist6", "Expected BSM tx range, m", txDist6);
2085 cmd.AddValue ("txdist7", "Expected BSM tx range, m", txDist7);
2086 cmd.AddValue ("txdist8", "Expected BSM tx range, m", txDist8);
2087 cmd.AddValue ("txdist9", "Expected BSM tx range, m", txDist9);
2088 cmd.AddValue ("txdist10", "Expected BSM tx range, m", txDist10);
2089 cmd.AddValue ("gpsaccuracy", "GPS time accuracy, in ns", m_gpsAccuracyNs);
2090 cmd.AddValue ("txmaxdelay", "Tx max delay, in ms", m_txMaxDelayMs);
2091 cmd.AddValue ("routingTables", "Dump routing tables at t=5 seconds", m_routingTables);
2092 cmd.AddValue ("asciiTrace", "Dump ASCII Trace data", m_asciiTrace);
2093 cmd.AddValue ("pcap", "Create PCAP files for all nodes", m_pcap);
2094 cmd.AddValue ("loadconfig", "Config-store filename to load", m_loadConfigFilename);
2095 cmd.AddValue ("saveconfig", "Config-store filename to save", m_saveConfigFilename);
2096 cmd.AddValue ("exp", "Experiment", m_exp);
2097 cmd.AddValue ("BsmCaptureStart", "Start time to begin capturing pkts for cumulative Bsm", m_cumulativeBsmCaptureStart);
2098 cmd.Parse (argc, argv);
2099
2100 m_txSafetyRange1 = txDist1;
2101 m_txSafetyRange2 = txDist2;
2102 m_txSafetyRange3 = txDist3;
2103 m_txSafetyRange4 = txDist4;
2104 m_txSafetyRange5 = txDist5;
2105 m_txSafetyRange6 = txDist6;
2106 m_txSafetyRange7 = txDist7;
2107 m_txSafetyRange8 = txDist8;
2108 m_txSafetyRange9 = txDist9;
2109 m_txSafetyRange10 = txDist10;
2110 // load configuration info from config-store
2111 ConfigStoreHelper configStoreHelper;
2112 configStoreHelper.LoadConfig (m_loadConfigFilename);
2113 // transfer config-store values to config parameters
2115
2116 // parse again so you can override input file default values via command line
2117 cmd.Parse (argc, argv);
2118
2119 m_txSafetyRange1 = txDist1;
2120 m_txSafetyRange2 = txDist2;
2121 m_txSafetyRange3 = txDist3;
2122 m_txSafetyRange4 = txDist4;
2123 m_txSafetyRange5 = txDist5;
2124 m_txSafetyRange6 = txDist6;
2125 m_txSafetyRange7 = txDist7;
2126 m_txSafetyRange8 = txDist8;
2127 m_txSafetyRange9 = txDist9;
2128 m_txSafetyRange10 = txDist10;
2129}
2130
2131void
2133{
2134 // open log file for output
2135 m_os.open (m_logFile.c_str ());
2136}
2137
2139{
2140
2141 // Enable logging from the ns2 helper
2142 LogComponentEnable ("Ns2MobilityHelper",LOG_LEVEL_DEBUG);
2143
2144 Packet::EnablePrinting ();
2145}
2146
2147void
2149{
2150 Config::SetDefault ("ns3::OnOffApplication::PacketSize",StringValue ("64"));
2151 Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue (m_rate));
2152
2153 //Set Non-unicastMode rate to unicast mode
2154 if (m_80211mode == 2)
2155 {
2156 Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",StringValue (m_phyModeB));
2157 }
2158 else
2159 {
2160 Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",StringValue (m_phyMode));
2161 }
2162}
2163
2164void
2166{
2167 if (m_mobility == 1)
2168 {
2169 // Create Ns2MobilityHelper with the specified trace log file as parameter
2171 ns2.Install (); // configure movements for each node, while reading trace file
2172 // initially assume all nodes are not moving
2173 WaveBsmHelper::GetNodesMoving ().resize (m_nNodes, 0);
2174 }
2175 else if (m_mobility == 2)
2176 {
2177 MobilityHelper mobilityAdhoc;
2178
2179 ObjectFactory pos;
2180 pos.SetTypeId ("ns3::RandomBoxPositionAllocator");
2181 pos.Set ("X", StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=1500.0]"));
2182 pos.Set ("Y", StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=300.0]"));
2183 // we need antenna height uniform [1.0 .. 2.0] for loss model
2184 pos.Set ("Z", StringValue ("ns3::UniformRandomVariable[Min=1.0|Max=2.0]"));
2185
2186 Ptr<PositionAllocator> taPositionAlloc = pos.Create ()->GetObject<PositionAllocator> ();
2187 m_streamIndex += taPositionAlloc->AssignStreams (m_streamIndex);
2188
2189 std::stringstream ssSpeed;
2190 ssSpeed << "ns3::UniformRandomVariable[Min=0.0|Max=" << m_nodeSpeed << "]";
2191 std::stringstream ssPause;
2192 ssPause << "ns3::ConstantRandomVariable[Constant=" << m_nodePause << "]";
2193 mobilityAdhoc.SetMobilityModel ("ns3::RandomWaypointMobilityModel",
2194 "Speed", StringValue (ssSpeed.str ()),
2195 "Pause", StringValue (ssPause.str ()),
2196 "PositionAllocator", PointerValue (taPositionAlloc));
2197 mobilityAdhoc.SetPositionAllocator (taPositionAlloc);
2198 mobilityAdhoc.Install (m_adhocTxNodes);
2200
2201 // initially assume all nodes are moving
2202 WaveBsmHelper::GetNodesMoving ().resize (m_nNodes, 1);
2203 }
2204
2205 // Configure callback for logging
2206 Config::Connect ("/NodeList/*/$ns3::MobilityModel/CourseChange",
2208}
2209
2210void
2212{
2213 if (m_lossModel == 1)
2214 {
2215 m_lossModelName = "ns3::FriisPropagationLossModel";
2216 }
2217 else if (m_lossModel == 2)
2218 {
2219 m_lossModelName = "ns3::ItuR1411LosPropagationLossModel";
2220 }
2221 else if (m_lossModel == 3)
2222 {
2223 m_lossModelName = "ns3::TwoRayGroundPropagationLossModel";
2224 }
2225 else if (m_lossModel == 4)
2226 {
2227 m_lossModelName = "ns3::LogDistancePropagationLossModel";
2228 }
2229 else
2230 {
2231 // Unsupported propagation loss model.
2232 // Treating as ERROR
2233 NS_LOG_ERROR ("Invalid propagation loss model specified. Values must be [1-4], where 1=Friis;2=ItuR1411Los;3=TwoRayGround;4=LogDistance");
2234 }
2235
2236 // frequency
2237 double freq = 0.0;
2238 if ((m_80211mode == 1)
2239 || (m_80211mode == 3))
2240 {
2241 // 802.11p 5.9 GHz
2242 freq = 5.9e9;
2243 }
2244 else
2245 {
2246 // 802.11b 2.4 GHz
2247 freq = 2.4e9;
2248 }
2249
2250 // Setup propagation models
2251 YansWifiChannelHelper wifiChannel;
2252 wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
2253 if (m_lossModel == 3)
2254 {
2255 // two-ray requires antenna height (else defaults to Friss)
2256 wifiChannel.AddPropagationLoss (m_lossModelName, "Frequency", DoubleValue (freq), "HeightAboveZ", DoubleValue (1.5));
2257 }
2258 else
2259 {
2260 wifiChannel.AddPropagationLoss (m_lossModelName, "Frequency", DoubleValue (freq));
2261 }
2262
2263 // Propagation loss models are additive.
2264 if (m_fading != 0)
2265 {
2266 // if no obstacle model, then use Nakagami fading if requested
2267 wifiChannel.AddPropagationLoss ("ns3::NakagamiPropagationLossModel");
2268 }
2269
2270 // the channel
2271 Ptr<YansWifiChannel> channel = wifiChannel.Create ();
2272
2273 // The below set of helpers will help us to put together the wifi NICs we want
2274 YansWifiPhyHelper wifiPhy;
2275 wifiPhy.SetChannel (channel);
2276 // ns-3 supports generate a pcap trace
2277 wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11);
2278
2279 YansWavePhyHelper wavePhy = YansWavePhyHelper::Default ();
2280 wavePhy.SetChannel (channel);
2281 wavePhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11);
2282
2283 // Setup WAVE PHY and MAC
2284 NqosWaveMacHelper wifi80211pMac = NqosWaveMacHelper::Default ();
2285 WaveHelper waveHelper = WaveHelper::Default ();
2286 Wifi80211pHelper wifi80211p = Wifi80211pHelper::Default ();
2287 if (m_verbose)
2288 {
2289 wifi80211p.EnableLogComponents (); // Turn on all Wifi 802.11p logging
2290 // likewise, turn on WAVE PHY logging
2291 waveHelper.EnableLogComponents ();
2292 }
2293
2295
2296 // Setup 802.11b stuff
2297 wifi.SetStandard (WIFI_STANDARD_80211b);
2298
2299 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
2300 "DataMode",StringValue (m_phyModeB),
2301 "ControlMode",StringValue (m_phyModeB));
2302
2303 // Setup 802.11p stuff
2304 wifi80211p.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
2305 "DataMode",StringValue (m_phyMode),
2306 "ControlMode",StringValue (m_phyMode));
2307
2308 // Setup WAVE-PHY stuff
2309 waveHelper.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
2310 "DataMode",StringValue (m_phyMode),
2311 "ControlMode",StringValue (m_phyMode));
2312
2313 // Set Tx Power
2314 wifiPhy.Set ("TxPowerStart",DoubleValue (m_txp));
2315 wifiPhy.Set ("TxPowerEnd", DoubleValue (m_txp));
2316 wavePhy.Set ("TxPowerStart",DoubleValue (m_txp));
2317 wavePhy.Set ("TxPowerEnd", DoubleValue (m_txp));
2318
2319 // Add an upper mac and disable rate control
2320 WifiMacHelper wifiMac;
2321 wifiMac.SetType ("ns3::AdhocWifiMac");
2322 QosWaveMacHelper waveMac = QosWaveMacHelper::Default ();
2323
2324 // Setup net devices
2325
2326 if (m_80211mode == 3)
2327 {
2328 m_adhocTxDevices = waveHelper.Install (wavePhy, waveMac, m_adhocTxNodes);
2329 }
2330 else if (m_80211mode == 1)
2331 {
2332 m_adhocTxDevices = wifi80211p.Install (wifiPhy, wifi80211pMac, m_adhocTxNodes);
2333 }
2334 else
2335 {
2336 m_adhocTxDevices = wifi.Install (wifiPhy, wifiMac, m_adhocTxNodes);
2337 }
2338
2339 if (m_asciiTrace != 0)
2340 {
2341 AsciiTraceHelper ascii;
2342 Ptr<OutputStreamWrapper> osw = ascii.CreateFileStream ( (m_trName + ".tr").c_str ());
2343 wifiPhy.EnableAsciiAll (osw);
2344 wavePhy.EnableAsciiAll (osw);
2345 }
2346 if (m_pcap != 0)
2347 {
2348 wifiPhy.EnablePcapAll ("vanet-routing-compare-pcap");
2349 wavePhy.EnablePcapAll ("vanet-routing-compare-pcap");
2350 }
2351}
2352
2353void
2355{
2356 // WAVE PHY mode
2357 // 0=continuous channel; 1=channel-switching
2358 int chAccessMode = 0;
2359 if (m_80211mode == 3)
2360 {
2361 chAccessMode = 1;
2362 }
2363
2368 // GPS accuracy (i.e, clock drift), in number of ns
2371 chAccessMode,
2372 // tx max delay before transmit, in ms
2374
2375 // fix random number streams
2377}
2378
2379void
2381{
2386 m_protocol,
2387 m_nSinks,
2389}
2390
2391void
2393{
2394 // member variable parameter use
2395 // defaults or command line overrides,
2396 // except where scenario={1,2,3,...}
2397 // have been specified, in which case
2398 // specify parameters are overwritten
2399 // here to setup for specific scenarios
2400
2401 // certain parameters may be further overridden
2402 // i.e. specify a scenario, override tx power.
2403
2404 if (m_scenario == 1)
2405 {
2406 // 40 nodes in RWP 300 m x 1500 m synthetic highway, 10s
2407 m_traceFile = "";
2408 m_logFile = "";
2409 m_mobility = 2;
2410 if (m_nNodes == 156)
2411 {
2412 m_nNodes = 40;
2413 }
2414 if (m_TotalSimTime == 300.01)
2415 {
2416 m_TotalSimTime = 10.0;
2417 }
2418 }
2419 else if (m_scenario == 2)
2420 {
2421 // Realistic vehicular trace in 4.6 km x 3.0 km suburban Zurich
2422 // "low density, 99 total vehicles"
2423 m_traceFile = "src/wave/examples/low99-ct-unterstrass-1day.filt.7.adj.mob";
2424 m_logFile = "low99-ct-unterstrass-1day.filt.7.adj.log";
2425 m_mobility = 1;
2426 m_nNodes = 99;
2427 m_TotalSimTime = 300.01;
2428 m_nodeSpeed = 0;
2429 m_nodePause = 0;
2430 m_CSVfileName = "low_vanet-routing-compare.csv";
2431 m_CSVfileName = "low_vanet-routing-compare2.csv";
2432 }
2433}
2434
2435void
2437{
2438 //blank out the last output file and write the column headers
2439 std::ofstream out (m_CSVfileName.c_str ());
2440 out << "SimulationSecond," <<
2441 "ReceiveRate," <<
2442 "PacketsReceived," <<
2443 "NumberOfSinks," <<
2444 "RoutingProtocol," <<
2445 "TransmissionPower," <<
2446 "WavePktsSent," <<
2447 "WavePtksReceived," <<
2448 "WavePktsPpr," <<
2449 "ExpectedWavePktsReceived," <<
2450 "ExpectedWavePktsInCoverageReceived," <<
2451 "BSM_PDR1," <<
2452 "BSM_PDR2," <<
2453 "BSM_PDR3," <<
2454 "BSM_PDR4," <<
2455 "BSM_PDR5," <<
2456 "BSM_PDR6," <<
2457 "BSM_PDR7," <<
2458 "BSM_PDR8," <<
2459 "BSM_PDR9," <<
2460 "BSM_PDR10," <<
2461 "MacPhyOverhead" <<
2462 std::endl;
2463 out.close ();
2464
2465 std::ofstream out2 (m_CSVfileName2.c_str ());
2466 out2 << "BSM_PDR1,"
2467 << "BSM_PDR2,"
2468 << "BSM_PDR3,"
2469 << "BSM_PDR4,"
2470 << "BSM_PDR5,"
2471 << "BSM_PDR6,"
2472 << "BSM_PDR7,"
2473 << "BSM_PDR8,"
2474 << "BSM_PDR9,"
2475 << "BSM_PDR10,"
2476 << "AverageRoutingGoodputKbps,"
2477 << "MacPhyOverhead"
2478 << std::endl;
2479 out2.close ();
2480}
2481
2482int
2483main (int argc, char *argv[])
2484{
2486 experiment.Simulate (argc, argv);
2487}
The ConfigStoreHelper class simplifies config-store raw text load and save.
void SaveConfig(std::string configFilename)
Saves a configuration to a given named config-store raw text configuration file.
void LoadConfig(std::string configFilename)
Loads a saved config-store raw text configuration from a given named file.
The RoutingHelper class generates routing data between nodes (vehicles) and uses the RoutingStats cla...
uint32_t m_protocol
routing protocol; 0=NONE, 1=OLSR, 2=AODV, 3=DSDV, 4=DSR
void SetLogging(int log)
Enable/disable logging.
double m_TotalSimTime
seconds
void SetupRoutingMessages(NodeContainer &c, Ipv4InterfaceContainer &adhocTxInterfaces)
Sets up routing messages on the nodes and their interfaces.
int m_routingTables
dump routing table (at t=5 sec). 0=No, 1=Yes
Ptr< Socket > SetupRoutingPacketReceive(Ipv4Address addr, Ptr< Node > node)
Sets up a routing packet for tranmission.
RoutingHelper()
Constructor.
virtual ~RoutingHelper()
Destructor.
void SetupRoutingProtocol(NodeContainer &c)
Sets up the protocol protocol on the nodes.
static TypeId GetTypeId(void)
Get class TypeId.
void AssignIpAddresses(NetDeviceContainer &d, Ipv4InterfaceContainer &adhocTxInterfaces)
Assigns IPv4 addresses to net devices and their interfaces.
void Install(NodeContainer &c, NetDeviceContainer &d, Ipv4InterfaceContainer &i, double totalTime, int protocol, uint32_t nSinks, int routingTables)
Installs routing functionality on nodes and their devices and interfaces.
RoutingStats routingStats
routing statistics
uint32_t m_nSinks
number of sink nodes (< all nodes)
RoutingStats & GetRoutingStats()
Returns the RoutingStats instance.
std::string m_protocolName
protocol name
void OnOffTrace(std::string context, Ptr< const Packet > packet)
Trace the receipt of an on-off-application generated packet.
void ReceiveRoutingPacket(Ptr< Socket > socket)
Process a received routing packet.
The RoutingStats class manages collects statistics on routing data (application-data packet and byte ...
uint32_t m_cumulativeRxBytes
cumulative receive bytes
uint32_t GetTxPkts()
Returns the number of packets transmitted.
uint32_t m_RxBytes
reeive bytes
void IncRxBytes(uint32_t rxBytes)
Increments the number of (application-data) bytes received, not including MAC/PHY overhead.
uint32_t m_cumulativeTxPkts
cumulative transmit packets
void IncRxPkts()
Increments the count of packets received.
uint32_t m_TxPkts
transmit packets
void IncTxPkts()
Increment the count of packets transmitted.
uint32_t GetTxBytes()
Returns the number of bytes transmitted.
uint32_t m_cumulativeRxPkts
cumulative receive packets
uint32_t GetCumulativeTxPkts()
Returns the cumulative number of packets transmitted.
void SetRxPkts(uint32_t rxPkts)
Sets the number of packets received.
void IncTxBytes(uint32_t txBytes)
Increment the number of bytes transmitted.
void SetTxPkts(uint32_t txPkts)
Sets the number of packets transmitted.
uint32_t m_RxPkts
receive packets
RoutingStats()
Constructor.
void SetTxBytes(uint32_t txBytes)
Sets the number of bytes transmitted.
uint32_t GetRxBytes()
Returns the number of bytes received.
uint32_t m_cumulativeTxBytes
cumulative transmit bytes
uint32_t GetRxPkts()
Returns the count of packets received.
uint32_t GetCumulativeTxBytes()
Returns the cumulative number of bytes transmitted.
uint32_t GetCumulativeRxPkts()
Returns the cumulative count of packets received.
uint32_t GetCumulativeRxBytes()
Returns the cumulative number of bytes received.
uint32_t m_TxBytes
transmit bytes
void SetRxBytes(uint32_t rxBytes)
Sets the number of bytes received.
The VanetRoutingExperiment class implements a wifi app that allows VANET routing experiments to be si...
std::string m_trName
trace file name
void ConfigureDefaults()
Configure default attributes.
std::string m_CSVfileName
CSV file name.
virtual void ParseCommandLineArguments(int argc, char **argv)
Process command line arguments.
virtual void RunSimulation()
Run the simulation.
virtual void ConfigureMobility()
Configure mobility.
int64_t m_streamIndex
used to get consistent random numbers across scenarios
std::string m_saveConfigFilename
save configi file name
void SetupRoutingMessages()
Set up generation of packets to be routed through the vehicular network.
std::string m_loadConfigFilename
load config file name
std::string m_protocolName
protocol name
void SetupScenario()
Set up a prescribed scenario.
void Run()
Run the simulation.
NetDeviceContainer m_adhocTxDevices
adhoc transmit devices
WaveBsmHelper m_waveBsmHelper
helper
Ptr< WifiPhyStats > m_wifiPhyStats
wifi phy statistics
std::vector< double > m_txSafetyRanges
list of ranges
void CommandSetup(int argc, char **argv)
Run the simulation.
std::string m_traceFile
trace file
Time m_cumulativeBsmCaptureStart
capture start
std::string m_phyModeB
phy mode
void CheckThroughput()
Checks the throughput and outputs summary to CSV file1.
virtual void ConfigureDevices()
Configure devices.
virtual void ConfigureNodes()
Configure nodes.
std::string m_CSVfileName2
CSV file name.
static void CourseChange(std::ostream *os, std::string context, Ptr< const MobilityModel > mobility)
Course change function.
void SetupAdhocDevices()
Set up the adhoc devices.
virtual void ConfigureTracing()
Configure tracing.
void SetupLogging()
Set up logging.
double m_txMaxDelayMs
transmit maximum delay
double m_gpsAccuracyNs
GPS accuracy.
std::string m_lossModelName
loss model name
NodeContainer m_adhocTxNodes
adhoc transmit nodes
uint32_t m_nSinks
number of sinks
void SetupLogFile()
Set up log file.
void SetupWaveMessages()
Set up generation of IEEE 1609 WAVE messages, as a Basic Safety Message (BSM).
uint32_t m_nNodes
number of nodes
virtual void ProcessOutputs()
Process outputs.
virtual void ConfigureApplications()
Configure applications.
double m_TotalSimTime
total sim time
void SetupAdhocMobilityNodes()
Set up the adhoc mobility nodes.
virtual void SetDefaultAttributeValues()
Sets default attribute values.
bool m_traceMobility
trace mobility
void SetConfigFromGlobals()
Set up configuration parameter from the global variables.
void WriteCsvHeader()
Write the header line to the CSV file1.
virtual void ConfigureChannels()
Configure channels.
Ipv4InterfaceContainer m_adhocTxInterfaces
adhoc transmit interfaces
void SetGlobalsFromConfig()
Set up the global variables from the configuration parameters.
std::ofstream m_os
output stream
Ptr< RoutingHelper > m_routingHelper
routing helper
The WifiApp class enforces program flow for ns-3 wifi applications.
void Simulate(int argc, char **argv)
Enacts simulation of an ns-3 wifi application.
virtual void ConfigureChannels()
Configure channels.
virtual void ParseCommandLineArguments(int argc, char **argv)
Process command line arguments.
virtual void RunSimulation()
Run the simulation.
WifiApp()
Constructor.
virtual void ConfigureNodes()
Configure nodes.
virtual void ConfigureTracing()
Configure tracing.
virtual void ConfigureApplications()
Configure applications.
virtual ~WifiApp()
Destructor.
virtual void ConfigureMobility()
Configure mobility.
virtual void ConfigureDevices()
Configure devices.
virtual void SetDefaultAttributeValues()
Sets default attribute values.
virtual void ProcessOutputs()
Process outputs.
The WifiPhyStats class collects Wifi MAC/PHY statistics.
void PhyTxDrop(std::string context, Ptr< const Packet > packet)
Callback signiture for Phy/TxDrop.
virtual ~WifiPhyStats()
Destructor.
uint32_t m_phyTxBytes
phy transmit bytes
static TypeId GetTypeId(void)
Gets the class TypeId.
WifiPhyStats()
Constructor.
void PhyTxTrace(std::string context, Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
Callback signiture for Phy/Tx trace.
void PhyRxDrop(std::string context, Ptr< const Packet > packet, WifiPhyRxfailureReason reason)
Callback signiture for Phy/RxDrop.
uint32_t GetTxBytes()
Returns the number of bytes that have been transmitted (this includes MAC/PHY overhead)
uint32_t m_phyTxPkts
phy transmit packets
a polymophic address class
Definition: address.h:91
AttributeValue implementation for Address.
Helper class that adds AODV routing to nodes.
Definition: aodv-helper.h:35
holds a vector of ns3::Application pointers.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
void EnableAsciiAll(std::string prefix)
Enable ascii trace output on each device (which is of the appropriate type) in the set of all nodes c...
Manage ASCII trace files for device models.
Definition: trace-helper.h:163
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits.
Parse command-line arguments.
Definition: command-line.h:229
Introspection did not find any typical Config paths.
Definition: config-store.h:60
void ConfigureDefaults(void)
Configure the default values.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
double Get(void) const
Definition: double.cc:35
Helper class that adds DSDV routing to nodes.
Definition: dsdv-helper.h:46
DSR helper class to manage creation of DSR routing instance and to insert it on a node as a sublayer ...
Definition: dsr-helper.h:53
Helper class that adds DSR routing to nodes.
void Install(DsrHelper &dsrHelper, NodeContainer nodes)
Install routing to the nodes.
Hold a so-called 'global value'.
Definition: global-value.h:74
bool SetValue(const AttributeValue &value)
Set the value of this GlobalValue.
an Inet address class
Ipv4Address GetIpv4(void) const
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
void SetRoutingHelper(const Ipv4RoutingHelper &routing)
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Helper class that adds ns3::Ipv4ListRouting objects.
static void PrintRoutingTableAllAt(Time printTime, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the routing tables of all nodes at a particular time.
Helper class used to assign positions and mobility models to nodes.
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
int64_t AssignStreams(NodeContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the mobility models on t...
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
A network Node.
Definition: node.h:57
uint32_t GetId(void) const
Definition: node.cc:109
Nqos Wave Mac Helper class.
Helper class which can read ns-2 movement files and configure nodes mobility.
void Install(void) const
Read the ns2 trace file and configure the movement patterns of all nodes contained in the global ns3:...
Instantiate subclasses of ns3::Object.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
A base class which provides memory management and object aggregation.
Definition: object.h:88
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
Helper class that adds OLSR routing to nodes.
Definition: olsr-helper.h:41
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:43
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:856
void EnablePcapAll(std::string prefix, bool promiscuous=false)
Enable pcap output on each device (which is of the appropriate type) in the set of all nodes created ...
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Allocate a set of positions.
Qos Wave Mac Helper class.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
Read a single packet from the socket and retrieve the sender address.
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with.
Hold variables of type string.
Definition: string.h:41
std::string Get(void) const
Definition: string.cc:31
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:418
AttributeValue implementation for Time.
Definition: nstime.h:1308
Time Get(void) const
Definition: time.cc:519
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
Hold an unsigned integer type.
Definition: uinteger.h:44
uint64_t Get(void) const
Definition: uinteger.cc:35
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
The WaveBsmHelper class manages IEEE 1609 WAVE (Wireless Access in Vehicular Environments) Basic Safe...
ApplicationContainer Install(Ipv4InterfaceContainer i) const
Install an ns3::BsmApplication on each node of the input container configured with all the attributes...
Ptr< WaveBsmStats > GetWaveBsmStats()
Returns the WaveBsmStats instance.
int64_t AssignStreams(NodeContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
helps to create WaveNetDevice objects
Definition: wave-helper.h:114
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
Definition: wave-helper.cc:361
static void EnableLogComponents(void)
Helper to enable all WaveNetDevice log components with one statement.
Definition: wave-helper.cc:424
void SetRemoteStationManager(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wave-helper.cc:315
helps to create wifi 802.11p objects of WifiNetDevice class
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &macHelper, NodeContainer c) const
helps to create WifiNetDevice objects
Definition: wifi-helper.h:274
void SetRemoteStationManager(std::string type, Args &&... args)
Helper function used to set the station manager.
Definition: wifi-helper.h:464
create MAC layers for a ns3::WifiNetDevice.
void SetType(std::string type, Args &&... args)
represent a single transmission mode
Definition: wifi-mode.h:48
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:518
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:154
To trace WaveNetDevice, we have to overwrite the trace functions of class YansWifiPhyHelper.
Definition: wave-helper.h:41
manage and create wifi channel objects for the YANS model.
void SetPropagationDelay(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Ptr< YansWifiChannel > Create(void) const
void AddPropagationLoss(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Make it easy to create and manage PHY objects for the YANS model.
void SetChannel(Ptr< YansWifiChannel > channel)
void experiment(std::string queue_disc_type)
Ptr< const AttributeChecker > MakeStringChecker(void)
Definition: string.cc:30
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:920
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:257
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionally.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1709
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1252
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
@ WIFI_STANDARD_80211b
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:793
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:522
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
Definition: log.h:104
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:361
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1648
Definition: olsr.py:1
cmd
Definition: second.py:35
channel
Definition: third.py:92
wifi
Definition: third.py:99
mobility
Definition: third.py:107
#define list
static ns3::GlobalValue g_port("VRCport", "Port", ns3::UintegerValue(9), ns3::MakeUintegerChecker< uint32_t >())
Port.
static ns3::GlobalValue g_txMaxDelayMs("VRCtxMaxDelayMs", "Tx May Delay (ms)", ns3::DoubleValue(10), ns3::MakeDoubleChecker< double >())
Tx May Delay (ms)
static ns3::GlobalValue g_CSVfileName2("VRCCSVfileName2", "CSV filename 2 (for overall simulation scenario results)", ns3::StringValue("vanet-routing.output2.csv"), ns3::MakeStringChecker())
CSV filename 2 (for overall simulation scenario results)
static ns3::GlobalValue g_txSafetyRange10("VRCtxSafetyRange10", "BSM range for PDR inclusion", ns3::DoubleValue(500.0), ns3::MakeDoubleChecker< double >())
BSM range for PDR inclusion.
static ns3::GlobalValue g_fading("VRCfading", "Fast Fading Model", ns3::UintegerValue(0), ns3::MakeUintegerChecker< uint32_t >())
Fast Fading Model.
static ns3::GlobalValue g_wavePacketSize("VRCwavePacketSize", "Size in bytes of WAVE BSM", ns3::UintegerValue(200), ns3::MakeUintegerChecker< uint32_t >())
Size in bytes of WAVE BSM.
static ns3::GlobalValue g_gpsAccuracyNs("VRCgpsAccuracyNs", "GPS sync accuracy (ns)", ns3::DoubleValue(40), ns3::MakeDoubleChecker< double >())
GPS sync accuracy (ns)
static ns3::GlobalValue g_protocol("VRCprotocol", "Routing protocol", ns3::UintegerValue(2), ns3::MakeUintegerChecker< uint32_t >())
Routing protocol.
static ns3::GlobalValue g_scenario("VRCscenario", "Scenario", ns3::UintegerValue(1), ns3::MakeUintegerChecker< uint32_t >())
Scenario.
static ns3::GlobalValue g_pcap("VRCpcap", "Generate PCAP files 0=no;1=yes", ns3::UintegerValue(0), ns3::MakeUintegerChecker< uint32_t >())
Generate PCAP files 0=no;1=yes.
static ns3::GlobalValue g_nodeSpeed("VRCnodeSpeed", "Node speed (m/s) for RWP model", ns3::UintegerValue(20), ns3::MakeUintegerChecker< uint32_t >())
Node speed (m/s) for RWP model.
static ns3::GlobalValue g_cumulativeBsmCaptureStart("VRCcumulativeBsmCaptureStart", "Simulation start time for capturing cumulative BSM", ns3::TimeValue(Seconds(0)), ns3::MakeTimeChecker())
Simulation start time for capturing cumulative BSM.
static ns3::GlobalValue g_80211mode("VRC80211mode", "802.11 mode (0=802.11a;1=802.11p)", ns3::UintegerValue(1), ns3::MakeUintegerChecker< uint32_t >())
802.11 mode (0=802.11a;1=802.11p)
static ns3::GlobalValue g_traceMobility("VRCtraceMobility", "Trace mobility 1=yes;0=no", ns3::UintegerValue(0), ns3::MakeUintegerChecker< uint32_t >())
Trace mobility 1=yes;0=no.
static ns3::GlobalValue g_totalTime("VRCtotalTime", "Total simulation time (s)", ns3::DoubleValue(300.01), ns3::MakeDoubleChecker< double >())
Total simulation time (s)
static ns3::GlobalValue g_nNodes("VRCnNodes", "Number of nodes (vehicles)", ns3::UintegerValue(156), ns3::MakeUintegerChecker< uint32_t >())
Number of nodes (vehicles)
static ns3::GlobalValue g_rate("VRCrate", "Data rate", ns3::StringValue("2048bps"), ns3::MakeStringChecker())
Data rate.
static std::string PrintReceivedRoutingPacket(Ptr< Socket > socket, Ptr< Packet > packet, Address srcAddress)
Print a received routing packet on a string.
static ns3::GlobalValue g_txSafetyRange1("VRCtxSafetyRange1", "BSM range for PDR inclusion", ns3::DoubleValue(50.0), ns3::MakeDoubleChecker< double >())
BSM range for PDR inclusion.
static ns3::GlobalValue g_mobility("VRCmobility", "Mobility mode 0=random waypoint;1=mobility trace file", ns3::UintegerValue(1), ns3::MakeUintegerChecker< uint32_t >())
Mobility mode 0=random waypoint;1=mobility trace file.
static ns3::GlobalValue g_routingTables("VRCroutingTables", "Dump routing tables at t=5 seconds 0=no;1=yes", ns3::UintegerValue(0), ns3::MakeUintegerChecker< uint32_t >())
Dump routing tables at t=5 seconds 0=no;1=yes.
static ns3::GlobalValue g_txSafetyRange4("VRCtxSafetyRange4", "BSM range for PDR inclusion", ns3::DoubleValue(200.0), ns3::MakeDoubleChecker< double >())
BSM range for PDR inclusion.
static ns3::GlobalValue g_nodePause("VRCnodePause", "Node pause time (s) for RWP model", ns3::UintegerValue(0), ns3::MakeUintegerChecker< uint32_t >())
Node pause time (s) for RWP model.
static ns3::GlobalValue g_verbose("VRCverbose", "Verbose 0=no;1=yes", ns3::UintegerValue(0), ns3::MakeUintegerChecker< uint32_t >())
Verbose 0=no;1=yes.
static ns3::GlobalValue g_txSafetyRange2("VRCtxSafetyRange2", "BSM range for PDR inclusion", ns3::DoubleValue(100.0), ns3::MakeDoubleChecker< double >())
BSM range for PDR inclusion.
static ns3::GlobalValue g_txSafetyRange7("VRCtxSafetyRange7", "BSM range for PDR inclusion", ns3::DoubleValue(350.0), ns3::MakeDoubleChecker< double >())
BSM range for PDR inclusion.
static ns3::GlobalValue g_asciiTrace("VRCasciiTrace", "Dump ASCII trace 0=no;1=yes", ns3::UintegerValue(0), ns3::MakeUintegerChecker< uint32_t >())
Dump ASCII trace 0=no;1=yes.
static ns3::GlobalValue g_traceFile("VRCtraceFile", "Mobility trace filename", ns3::StringValue("./src/wave/examples/low99-ct-unterstrass-1day.filt.7.adj.mob"), ns3::MakeStringChecker())
Mobility trace filename.
static ns3::GlobalValue g_logFile("VRClogFile", "Log filename", ns3::StringValue("low99-ct-unterstrass-1day.filt.7.adj.log"), ns3::MakeStringChecker())
Log filename.
static ns3::GlobalValue g_trName("VRCtrName", "Trace name", ns3::StringValue("vanet-routing-compare"), ns3::MakeStringChecker())
Trace name)
static ns3::GlobalValue g_txSafetyRange5("VRCtxSafetyRange5", "BSM range for PDR inclusion", ns3::DoubleValue(250.0), ns3::MakeDoubleChecker< double >())
BSM range for PDR inclusion.
static ns3::GlobalValue g_txp("VRCtxp", "Transmission power dBm", ns3::DoubleValue(7.5), ns3::MakeDoubleChecker< double >())
Transmission power dBm.
static ns3::GlobalValue g_CSVfileName("VRCCSVfileName", "CSV filename (for time series data)", ns3::StringValue("vanet-routing.output.csv"), ns3::MakeStringChecker())
CSV filename (for time series data)
static ns3::GlobalValue g_txSafetyRange6("VRCtxSafetyRange6", "BSM range for PDR inclusion", ns3::DoubleValue(300.0), ns3::MakeDoubleChecker< double >())
BSM range for PDR inclusion.
static ns3::GlobalValue g_nSinks("VRCnSinks", "Number of sink nodes for routing non-BSM traffic", ns3::UintegerValue(10), ns3::MakeUintegerChecker< uint32_t >())
Number of sink nodes for routing non-BSM traffic.
static ns3::GlobalValue g_txSafetyRange3("VRCtxSafetyRange3", "BSM range for PDR inclusion", ns3::DoubleValue(150.0), ns3::MakeDoubleChecker< double >())
BSM range for PDR inclusion.
static ns3::GlobalValue g_phyModeB("VRCphyModeB", "PHY mode (802.11a)", ns3::StringValue("DsssRate11Mbps"), ns3::MakeStringChecker())
PHY mode (802.11a)
static ns3::GlobalValue g_waveInterval("VRCwaveInterval", "Interval (s) between WAVE BSMs", ns3::DoubleValue(0.1), ns3::MakeDoubleChecker< double >())
Interval (s) between WAVE BSMs.
static ns3::GlobalValue g_phyMode("VRCphyMode", "PHY mode (802.11p)", ns3::StringValue("OfdmRate6MbpsBW10MHz"), ns3::MakeStringChecker())
PHY mode (802.11p)
static ns3::GlobalValue g_txSafetyRange8("VRCtxSafetyRange8", "BSM range for PDR inclusion", ns3::DoubleValue(400.0), ns3::MakeDoubleChecker< double >())
BSM range for PDR inclusion.
static ns3::GlobalValue g_txSafetyRange9("VRCtxSafetyRange9", "BSM range for PDR inclusion", ns3::DoubleValue(450.0), ns3::MakeDoubleChecker< double >())
BSM range for PDR inclusion.
static ns3::GlobalValue g_lossModel("VRClossModel", "Propagation Loss Model", ns3::UintegerValue(3), ns3::MakeUintegerChecker< uint32_t >())
Propagation Loss Model.
std::map< Mac48Address, uint64_t > packetsReceived
Map that stores the total packets received per STA (and addressed to that STA)
Definition: wifi-bianchi.cc:70
uint32_t pktSize
packet size used for the simulation (in bytes)
Definition: wifi-bianchi.cc:89
Ptr< PacketSink > sink
Definition: wifi-tcp.cc:56