A Discrete-Event Network Simulator
API
vanet-routing-compare.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 North Carolina State University
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Scott E. Carpenter <scarpen@ncsu.edu>
18  *
19  */
20 
21 /*
22  * This example program allows one to run vehicular ad hoc
23  * network (VANET) simulation scenarios in ns-3 to assess
24  * performance by evaluating different 802.11p MAC/PHY
25  * characteristics, propagation loss models (e.g. Friss,
26  * Two-Ray Ground, or ITU R-P.1411), and application traffic
27  * (e.g. Basic Safety Message) and/or routing traffic (e.g.
28  * DSDV, AODV, OLSR, or DSR) under either a synthetic highway
29  * scenario (i.e. a random waypoint mobility model) or by
30  * playing back mobility trace files (i.e. ns-2 movement files).
31  *
32  * The script draws from several ns-3 examples, including:
33  * /examples/routing/manet-routing-compare.cc
34  * /src/propagation/model/itu-r-1411-los-propagation-loss-model.cc
35  * /src/mobility/examples/ns2-mobility-trace.cc
36  * /src/wave/examples/wave-simple-80211p.cc
37  *
38  * The script allows many parameters to be modified and
39  * includes two predefined scenarios. By default
40  * scenario=1 runs for 10 simulated seconds with 40 nodes
41  * (i.e. vehicles) moving according to RandomWaypointMobilityModel
42  * with a speed of 20 m/s and no pause time within a 300x1500 m
43  * region. The WiFi is 802.11p with continuous access to a 10 MHz
44  * Control Channel (CH) for all traffic. All nodes transmit a
45  * 200-byte safety message 10 times per second at 6 Mbps.
46  * Additionally, all nodes (optionally) attempt to
47  * continuously route 64-byte packets at an application
48  * rate of 2.048 Kbps to one of 10 other nodes,
49  * selected as sink nodes. The default routing protocol is AODV
50  * and the Two-Ray Ground loss model is used.
51  * The transmit power is set to 20 dBm and the transmission range
52  * for safety message packet delivery is 145 m.
53  *
54  * Scenario 2 plays back vehicular trace files in
55  * ns-2 movement format, and are taken from:
56  * https://web.archive.org/web/20150218095728/http://www.lst.inf.ethz.ch/research/ad-hoc/car-traces
57  * This scenario is 300 simulation seconds of 99
58  * vehicles respectively within the Unterstrass
59  * section of Zurich Switzerland that travel based on
60  * models derived from real traffic data. Note that these
61  * scenarios can require a lot of clock time to complete.
62  *
63  * All parameters can be changed from their defaults (see
64  * --help) and changing simulation parameters can have dramatic
65  * impact on network performance.
66  *
67  * Several items can be output:
68  * - a CSV file of data reception statistics, output once per
69  * second
70  * - final statistics, in a CSV file
71  * - dump of routing tables at 5 seconds into the simulation
72  * - ASCII trace file
73  * - PCAP trace files for each node
74  *
75  * Simulation scenarios can be defined and configuration
76  * settings can be saved using config-store (raw text)
77  * which can they be replayed again. This is an easy way
78  * to define and save the settings for a scenario, and then
79  * re-execute the same scenario exactly, or to set up
80  * several different simulation scenarios.
81  * For example, to set up a scenario and save the configuration
82  * as "scenario1.txt":
83  * ./ns3 run "vanet-routing-compare --scenario=1 --saveconfig=scenario1.txt"
84  * Then, to re-play the scenario using the save configuration
85  * settings:
86  * ./ns3 run "vanet-routing-compare --loadconfig=scenario1.txt"
87  *
88  * Class Diagram:
89  * main()
90  * +--uses-- VanetRoutingExperiment
91  * +--is_a--- WifiApp
92  * +--uses--- ConfigStoreHelper
93  * +--has_a-- WaveBsmHelper
94  * | +--has_a-- WaveBsmStats
95  * +--has_a-- RoutingHelper
96  * | +--has_a--RoutingStats
97  * +--has_a-- WifiPhyStats
98  *
99  */
100 
101 #include "ns3/aodv-module.h"
102 #include "ns3/applications-module.h"
103 #include "ns3/config-store-module.h"
104 #include "ns3/core-module.h"
105 #include "ns3/dsdv-module.h"
106 #include "ns3/dsr-module.h"
107 #include "ns3/flow-monitor-module.h"
108 #include "ns3/integer.h"
109 #include "ns3/internet-module.h"
110 #include "ns3/itu-r-1411-los-propagation-loss-model.h"
111 #include "ns3/mobility-module.h"
112 #include "ns3/network-module.h"
113 #include "ns3/ocb-wifi-mac.h"
114 #include "ns3/olsr-module.h"
115 #include "ns3/wave-bsm-helper.h"
116 #include "ns3/wave-helper.h"
117 #include "ns3/wave-mac-helper.h"
118 #include "ns3/wifi-80211p-helper.h"
119 #include "ns3/yans-wifi-helper.h"
120 
121 #include <fstream>
122 #include <iostream>
123 
124 using namespace ns3;
125 using namespace dsr;
126 
127 NS_LOG_COMPONENT_DEFINE("vanet-routing-compare");
128 
136 {
137  public:
141  RoutingStats();
142 
147  uint32_t GetRxBytes() const;
148 
153  uint32_t GetCumulativeRxBytes() const;
154 
159  uint32_t GetRxPkts() const;
160 
165  uint32_t GetCumulativeRxPkts() const;
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 
195  uint32_t GetTxBytes() const;
196 
201  uint32_t GetCumulativeTxBytes() const;
202 
207  uint32_t GetTxPkts() const;
208 
213  uint32_t GetCumulativeTxPkts() const;
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 
238  private:
239  uint32_t m_RxBytes;
241  uint32_t m_RxPkts;
243  uint32_t m_TxBytes;
245  uint32_t m_TxPkts;
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 
261 uint32_t
263 {
264  return m_RxBytes;
265 }
266 
267 uint32_t
269 {
270  return m_cumulativeRxBytes;
271 }
272 
273 uint32_t
275 {
276  return m_RxPkts;
277 }
278 
279 uint32_t
281 {
282  return m_cumulativeRxPkts;
283 }
284 
285 void
286 RoutingStats::IncRxBytes(uint32_t rxBytes)
287 {
288  m_RxBytes += rxBytes;
289  m_cumulativeRxBytes += rxBytes;
290 }
291 
292 void
294 {
295  m_RxPkts++;
297 }
298 
299 void
300 RoutingStats::SetRxBytes(uint32_t rxBytes)
301 {
302  m_RxBytes = rxBytes;
303 }
304 
305 void
306 RoutingStats::SetRxPkts(uint32_t rxPkts)
307 {
308  m_RxPkts = rxPkts;
309 }
310 
311 uint32_t
313 {
314  return m_TxBytes;
315 }
316 
317 uint32_t
319 {
320  return m_cumulativeTxBytes;
321 }
322 
323 uint32_t
325 {
326  return m_TxPkts;
327 }
328 
329 uint32_t
331 {
332  return m_cumulativeTxPkts;
333 }
334 
335 void
336 RoutingStats::IncTxBytes(uint32_t txBytes)
337 {
338  m_TxBytes += txBytes;
339  m_cumulativeTxBytes += txBytes;
340 }
341 
342 void
344 {
345  m_TxPkts++;
347 }
348 
349 void
350 RoutingStats::SetTxBytes(uint32_t txBytes)
351 {
352  m_TxBytes = txBytes;
353 }
354 
355 void
356 RoutingStats::SetTxPkts(uint32_t txPkts)
357 {
358  m_TxPkts = txPkts;
359 }
360 
371 class RoutingHelper : public Object
372 {
373  public:
378  static TypeId GetTypeId();
379 
383  RoutingHelper();
384 
388  ~RoutingHelper() override;
389 
402  void Install(NodeContainer& c,
405  double totalTime,
406  int protocol,
407  uint32_t nSinks,
408  bool routingTables);
409 
415  void OnOffTrace(std::string context, Ptr<const Packet> packet);
416 
422 
427  void SetLogging(bool log);
428 
429  private:
435 
441  void AssignIpAddresses(NetDeviceContainer& d, Ipv4InterfaceContainer& adhocTxInterfaces);
442 
448  void SetupRoutingMessages(NodeContainer& c, Ipv4InterfaceContainer& adhocTxInterfaces);
449 
457 
462  void ReceiveRoutingPacket(Ptr<Socket> socket);
463 
464  double m_TotalSimTime;
465  uint32_t m_protocol;
466  uint32_t m_port;
467  uint32_t m_nSinks;
470  std::string m_protocolName;
471  bool m_log;
472 };
473 
475 
476 TypeId
478 {
479  static TypeId tid =
480  TypeId("ns3::RoutingHelper").SetParent<Object>().AddConstructor<RoutingHelper>();
481  return tid;
482 }
483 
485  : m_TotalSimTime(300.01),
486  m_protocol(0),
487  m_port(9),
488  m_nSinks(0),
489  m_routingTables(false),
490  m_log(false)
491 {
492 }
493 
495 {
496 }
497 
498 void
502  double totalTime,
503  int protocol,
504  uint32_t nSinks,
505  bool routingTables)
506 {
507  m_TotalSimTime = totalTime;
508  m_protocol = protocol;
509  m_nSinks = nSinks;
510  m_routingTables = routingTables;
511 
513  AssignIpAddresses(d, i);
514  SetupRoutingMessages(c, i);
515 }
516 
519 {
520  TypeId tid = TypeId::LookupByName("ns3::UdpSocketFactory");
521  Ptr<Socket> sink = Socket::CreateSocket(node, tid);
523  sink->Bind(local);
524  sink->SetRecvCallback(MakeCallback(&RoutingHelper::ReceiveRoutingPacket, this));
525 
526  return sink;
527 }
528 
529 void
531 {
532  AodvHelper aodv;
534  DsdvHelper dsdv;
535  DsrHelper dsr;
536  DsrMainHelper dsrMain;
538  InternetStackHelper internet;
539 
540  Time rtt = Time(5.0);
541  AsciiTraceHelper ascii;
542  Ptr<OutputStreamWrapper> rtw = ascii.CreateFileStream("routing_table");
543 
544  switch (m_protocol)
545  {
546  case 0:
547  m_protocolName = "NONE";
548  break;
549  case 1:
550  if (m_routingTables)
551  {
552  Ipv4RoutingHelper::PrintRoutingTableAllAt(rtt, rtw);
553  }
554  list.Add(olsr, 100);
555  m_protocolName = "OLSR";
556  break;
557  case 2:
558  if (m_routingTables)
559  {
560  Ipv4RoutingHelper::PrintRoutingTableAllAt(rtt, rtw);
561  }
562  list.Add(aodv, 100);
563  m_protocolName = "AODV";
564  break;
565  case 3:
566  if (m_routingTables)
567  {
569  }
570  list.Add(dsdv, 100);
571  m_protocolName = "DSDV";
572  break;
573  case 4:
574  // setup is later
575  m_protocolName = "DSR";
576  break;
577  default:
578  NS_FATAL_ERROR("No such protocol:" << m_protocol);
579  break;
580  }
581 
582  if (m_protocol < 4)
583  {
584  internet.SetRoutingHelper(list);
585  internet.Install(c);
586  }
587  else if (m_protocol == 4)
588  {
589  internet.Install(c);
590  dsrMain.Install(dsr, c);
591  }
592 
593  if (m_log)
594  {
595  NS_LOG_UNCOND("Routing Setup for " << m_protocolName);
596  }
597 }
598 
599 void
601 {
602  NS_LOG_INFO("Assigning IP addresses");
603  Ipv4AddressHelper addressAdhoc;
604  // we may have a lot of nodes, and want them all
605  // in same subnet, to support broadcast
606  addressAdhoc.SetBase("10.1.0.0", "255.255.0.0");
607  adhocTxInterfaces = addressAdhoc.Assign(d);
608 }
609 
610 void
612 {
613  // Setup routing transmissions
614  OnOffHelper onoff1("ns3::UdpSocketFactory", Address());
615  onoff1.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1.0]"));
616  onoff1.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0.0]"));
617 
618  Ptr<UniformRandomVariable> var = CreateObject<UniformRandomVariable>();
619  int64_t stream = 2;
620  var->SetStream(stream);
621  for (uint32_t i = 0; i < m_nSinks; i++)
622  {
623  // protocol == 0 means no routing data, WAVE BSM only
624  // so do not set up sink
625  if (m_protocol != 0)
626  {
627  Ptr<Socket> sink = SetupRoutingPacketReceive(adhocTxInterfaces.GetAddress(i), c.Get(i));
628  }
629 
630  AddressValue remoteAddress(InetSocketAddress(adhocTxInterfaces.GetAddress(i), m_port));
631  onoff1.SetAttribute("Remote", remoteAddress);
632 
633  ApplicationContainer temp = onoff1.Install(c.Get(i + m_nSinks));
634  temp.Start(Seconds(var->GetValue(1.0, 2.0)));
635  temp.Stop(Seconds(m_TotalSimTime));
636  }
637 }
638 
646 static inline std::string
648 {
649  std::ostringstream oss;
650 
651  oss << Simulator::Now().As(Time::S) << " " << socket->GetNode()->GetId();
652 
653  if (InetSocketAddress::IsMatchingType(srcAddress))
654  {
655  InetSocketAddress addr = InetSocketAddress::ConvertFrom(srcAddress);
656  oss << " received one packet from " << addr.GetIpv4();
657  }
658  else
659  {
660  oss << " received one packet!";
661  }
662  return oss.str();
663 }
664 
665 void
667 {
668  Ptr<Packet> packet;
669  Address srcAddress;
670  while ((packet = socket->RecvFrom(srcAddress)))
671  {
672  // application data, for goodput
673  uint32_t RxRoutingBytes = packet->GetSize();
674  GetRoutingStats().IncRxBytes(RxRoutingBytes);
676  if (m_log)
677  {
679  PrintReceivedRoutingPacket(socket, packet, srcAddress));
680  }
681  }
682 }
683 
684 void
685 RoutingHelper::OnOffTrace(std::string context, Ptr<const Packet> packet)
686 {
687  uint32_t pktBytes = packet->GetSize();
688  routingStats.IncTxBytes(pktBytes);
689 }
690 
693 {
694  return routingStats;
695 }
696 
697 void
699 {
700  m_log = log;
701 }
702 
707 class WifiPhyStats : public Object
708 {
709  public:
714  static TypeId GetTypeId();
715 
719  WifiPhyStats();
720 
724  ~WifiPhyStats() override;
725 
731  uint32_t GetTxBytes() const;
732 
741  void PhyTxTrace(std::string context,
742  Ptr<const Packet> packet,
743  WifiMode mode,
744  WifiPreamble preamble,
745  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 
762  private:
763  uint32_t m_phyTxPkts;
764  uint32_t m_phyTxBytes;
765 };
766 
768 
769 TypeId
771 {
772  static TypeId tid =
773  TypeId("ns3::WifiPhyStats").SetParent<Object>().AddConstructor<WifiPhyStats>();
774  return tid;
775 }
776 
778  : m_phyTxPkts(0),
779  m_phyTxBytes(0)
780 {
781 }
782 
784 {
785 }
786 
787 void
788 WifiPhyStats::PhyTxTrace(std::string context,
789  Ptr<const Packet> packet,
790  WifiMode mode,
791  WifiPreamble preamble,
792  uint8_t txPower)
793 {
794  NS_LOG_FUNCTION(this << context << packet << "PHYTX mode=" << mode);
795  ++m_phyTxPkts;
796  uint32_t pktSize = packet->GetSize();
798 
799  // NS_LOG_UNCOND ("Received PHY size=" << pktSize);
800 }
801 
802 void
803 WifiPhyStats::PhyTxDrop(std::string context, Ptr<const Packet> packet)
804 {
805  NS_LOG_UNCOND("PHY Tx Drop");
806 }
807 
808 void
809 WifiPhyStats::PhyRxDrop(std::string context,
810  Ptr<const Packet> packet,
811  WifiPhyRxfailureReason reason)
812 {
813  NS_LOG_UNCOND("PHY Rx Drop");
814 }
815 
816 uint32_t
818 {
819  return m_phyTxBytes;
820 }
821 
826 class WifiApp
827 {
828  public:
832  WifiApp();
833 
837  virtual ~WifiApp();
838 
844  void Simulate(int argc, char** argv);
845 
846  protected:
850  virtual void SetDefaultAttributeValues();
851 
857  virtual void ParseCommandLineArguments(int argc, char** argv);
858 
862  virtual void ConfigureNodes();
863 
867  virtual void ConfigureChannels();
868 
872  virtual void ConfigureDevices();
873 
877  virtual void ConfigureMobility();
878 
882  virtual void ConfigureApplications();
883 
887  virtual void ConfigureTracing();
888 
892  virtual void RunSimulation();
893 
897  virtual void ProcessOutputs();
898 };
899 
901 {
902 }
903 
905 {
906 }
907 
908 void
909 WifiApp::Simulate(int argc, char** argv)
910 {
911  // Simulator Program Flow:
912  // (source: NS-3 Annual Meeting, May, 2014, session 2 slides 6, 28)
913  // (HandleProgramInputs:)
914  // SetDefaultAttributeValues
915  // ParseCommandLineArguments
916  // (ConfigureTopology:)
917  // ConfigureNodes
918  // ConfigureChannels
919  // ConfigureDevices
920  // ConfigureMobility
921  // ConfigureApplications
922  // e.g AddInternetStackToNodes
923  // ConfigureIpAddressingAndRouting
924  // configureSendMessages
925  // ConfigureTracing
926  // RunSimulation
927  // ProcessOutputs
928 
930  ParseCommandLineArguments(argc, argv);
931  ConfigureNodes();
937  RunSimulation();
938  ProcessOutputs();
939 }
940 
941 void
943 {
944 }
945 
946 void
948 {
949 }
950 
951 void
953 {
954 }
955 
956 void
958 {
959 }
960 
961 void
963 {
964 }
965 
966 void
968 {
969 }
970 
971 void
973 {
974 }
975 
976 void
978 {
979 }
980 
981 void
983 {
984 }
985 
986 void
988 {
989 }
990 
996 {
997  public:
1002 
1007  void LoadConfig(std::string configFilename);
1008 
1013  void SaveConfig(std::string configFilename);
1014 };
1015 
1017 {
1018 }
1019 
1020 void
1021 ConfigStoreHelper::LoadConfig(std::string configFilename)
1022 {
1023  // Input config store from txt format
1024  Config::SetDefault("ns3::ConfigStore::Filename", StringValue(configFilename));
1025  Config::SetDefault("ns3::ConfigStore::FileFormat", StringValue("RawText"));
1026  Config::SetDefault("ns3::ConfigStore::Mode", StringValue("Load"));
1027  ConfigStore inputConfig;
1028  inputConfig.ConfigureDefaults();
1029  // inputConfig.ConfigureAttributes ();
1030 }
1031 
1032 void
1033 ConfigStoreHelper::SaveConfig(std::string configFilename)
1034 {
1035  // only save if a non-empty filename has been specified
1036  if (!configFilename.empty())
1037  {
1038  // Output config store to txt format
1039  Config::SetDefault("ns3::ConfigStore::Filename", StringValue(configFilename));
1040  Config::SetDefault("ns3::ConfigStore::FileFormat", StringValue("RawText"));
1041  Config::SetDefault("ns3::ConfigStore::Mode", StringValue("Save"));
1042  ConfigStore outputConfig;
1043  outputConfig.ConfigureDefaults();
1044  // outputConfig.ConfigureAttributes ();
1045  }
1046 }
1047 
1054 {
1055  public:
1060 
1061  protected:
1065  void SetDefaultAttributeValues() override;
1066 
1072  void ParseCommandLineArguments(int argc, char** argv) override;
1073 
1077  void ConfigureNodes() override;
1078 
1082  void ConfigureChannels() override;
1083 
1087  void ConfigureDevices() override;
1088 
1092  void ConfigureMobility() override;
1093 
1097  void ConfigureApplications() override;
1098 
1102  void ConfigureTracing() override;
1103 
1107  void RunSimulation() override;
1108 
1112  void ProcessOutputs() override;
1113 
1114  private:
1118  void Run();
1119 
1125  void CommandSetup(int argc, char** argv);
1126 
1131  void CheckThroughput();
1132 
1136  void SetupLogFile();
1137 
1141  void SetupLogging();
1142 
1146  void ConfigureDefaults();
1147 
1151  void SetupAdhocMobilityNodes();
1152 
1156  void SetupAdhocDevices();
1157 
1164  void SetupWaveMessages();
1165 
1170  void SetupRoutingMessages();
1171 
1175  void SetupScenario();
1176 
1180  void WriteCsvHeader();
1181 
1185  void SetConfigFromGlobals();
1186 
1190  void SetGlobalsFromConfig();
1191 
1198  static void CourseChange(std::ostream* os,
1199  std::string context,
1201 
1202  uint32_t m_port;
1203  std::string m_CSVfileName;
1204  std::string m_CSVfileName2;
1205  uint32_t m_nSinks;
1206  std::string m_protocolName;
1207  double m_txp;
1209  uint32_t m_protocol;
1210 
1211  uint32_t m_lossModel;
1212  uint32_t m_fading;
1213  std::string m_lossModelName;
1214 
1215  std::string m_phyMode;
1216  uint32_t m_80211mode;
1217 
1218  std::string m_traceFile;
1219  std::string m_logFile;
1220  uint32_t m_mobility;
1221  uint32_t m_nNodes;
1223  std::string m_rate;
1224  std::string m_phyModeB;
1225  std::string m_trName;
1228  uint32_t m_wavePacketSize;
1230  bool m_verbose;
1231  std::ofstream m_os;
1234  uint32_t m_scenario;
1239  bool m_pcap;
1240  std::string m_loadConfigFilename;
1241  std::string m_saveConfigFilename;
1242 
1246  bool m_log;
1247  int64_t m_streamIndex;
1259  std::vector<double> m_txSafetyRanges;
1260  std::string m_exp;
1262 };
1263 
1265  : m_port(9),
1266  m_CSVfileName("vanet-routing.output.csv"),
1267  m_CSVfileName2("vanet-routing.output2.csv"),
1268  m_nSinks(10),
1269  m_protocolName("protocol"),
1270  m_txp(20),
1271  m_traceMobility(false),
1272  // AODV
1273  m_protocol(2),
1274  // Two-Ray ground
1275  m_lossModel(3),
1276  m_fading(0),
1277  m_lossModelName(""),
1278  m_phyMode("OfdmRate6MbpsBW10MHz"),
1279  // 1=802.11p
1280  m_80211mode(1),
1281  m_traceFile(""),
1282  m_logFile("low99-ct-unterstrass-1day.filt.7.adj.log"),
1283  m_mobility(1),
1284  m_nNodes(156),
1285  m_TotalSimTime(300.01),
1286  m_rate("2048bps"),
1287  m_phyModeB("DsssRate11Mbps"),
1288  m_trName("vanet-routing-compare"),
1289  m_nodeSpeed(20),
1290  m_nodePause(0),
1291  m_wavePacketSize(200),
1292  m_waveInterval(0.1),
1293  m_verbose(false),
1294  m_scenario(1),
1295  m_gpsAccuracyNs(40),
1296  m_txMaxDelayMs(10),
1297  m_routingTables(false),
1298  m_asciiTrace(false),
1299  m_pcap(false),
1300  m_loadConfigFilename("load-config.txt"),
1301  m_saveConfigFilename(""),
1302  m_log(false),
1303  m_streamIndex(0),
1304  m_adhocTxNodes(),
1305  m_txSafetyRange1(50.0),
1306  m_txSafetyRange2(100.0),
1307  m_txSafetyRange3(150.0),
1308  m_txSafetyRange4(200.0),
1309  m_txSafetyRange5(250.0),
1310  m_txSafetyRange6(300.0),
1311  m_txSafetyRange7(350.0),
1312  m_txSafetyRange8(400.0),
1313  m_txSafetyRange9(450.0),
1314  m_txSafetyRange10(500.0),
1315  m_txSafetyRanges(),
1316  m_exp(""),
1317  m_cumulativeBsmCaptureStart(0)
1318 {
1319  m_wifiPhyStats = CreateObject<WifiPhyStats>();
1320  m_routingHelper = CreateObject<RoutingHelper>();
1321 
1322  // simply uncond logging during simulation run
1323  m_log = true;
1324 }
1325 
1326 void
1328 {
1329  // handled in constructor
1330 }
1331 
1332 // important configuration items stored in global values
1333 
1335 static ns3::GlobalValue g_port("VRCport",
1336  "Port",
1337  ns3::UintegerValue(9),
1338  ns3::MakeUintegerChecker<uint32_t>());
1339 
1341 static ns3::GlobalValue g_nSinks("VRCnSinks",
1342  "Number of sink nodes for routing non-BSM traffic",
1343  ns3::UintegerValue(10),
1344  ns3::MakeUintegerChecker<uint32_t>());
1345 
1347 static ns3::GlobalValue g_traceMobility("VRCtraceMobility",
1348  "Enable trace mobility",
1349  ns3::BooleanValue(false),
1351 
1353 static ns3::GlobalValue g_protocol("VRCprotocol",
1354  "Routing protocol",
1355  ns3::UintegerValue(2),
1356  ns3::MakeUintegerChecker<uint32_t>());
1357 
1359 static ns3::GlobalValue g_lossModel("VRClossModel",
1360  "Propagation Loss Model",
1361  ns3::UintegerValue(3),
1362  ns3::MakeUintegerChecker<uint32_t>());
1363 
1365 static ns3::GlobalValue g_fading("VRCfading",
1366  "Fast Fading Model",
1367  ns3::UintegerValue(0),
1368  ns3::MakeUintegerChecker<uint32_t>());
1369 
1371 static ns3::GlobalValue g_80211mode("VRC80211mode",
1372  "802.11 mode (0=802.11a;1=802.11p)",
1373  ns3::UintegerValue(1),
1374  ns3::MakeUintegerChecker<uint32_t>());
1375 
1377 static ns3::GlobalValue g_mobility("VRCmobility",
1378  "Mobility mode 0=random waypoint;1=mobility trace file",
1379  ns3::UintegerValue(1),
1380  ns3::MakeUintegerChecker<uint32_t>());
1381 
1383 static ns3::GlobalValue g_nNodes("VRCnNodes",
1384  "Number of nodes (vehicles)",
1385  ns3::UintegerValue(156),
1386  ns3::MakeUintegerChecker<uint32_t>());
1387 
1389 static ns3::GlobalValue g_nodeSpeed("VRCnodeSpeed",
1390  "Node speed (m/s) for RWP model",
1391  ns3::UintegerValue(20),
1392  ns3::MakeUintegerChecker<uint32_t>());
1393 
1395 static ns3::GlobalValue g_nodePause("VRCnodePause",
1396  "Node pause time (s) for RWP model",
1397  ns3::UintegerValue(0),
1398  ns3::MakeUintegerChecker<uint32_t>());
1399 
1401 static ns3::GlobalValue g_wavePacketSize("VRCwavePacketSize",
1402  "Size in bytes of WAVE BSM",
1403  ns3::UintegerValue(200),
1404  ns3::MakeUintegerChecker<uint32_t>());
1405 
1407 static ns3::GlobalValue g_verbose("VRCverbose",
1408  "Enable verbose",
1409  ns3::BooleanValue(false),
1411 
1413 static ns3::GlobalValue g_scenario("VRCscenario",
1414  "Scenario",
1415  ns3::UintegerValue(1),
1416  ns3::MakeUintegerChecker<uint32_t>());
1417 
1419 static ns3::GlobalValue g_routingTables("VRCroutingTables",
1420  "Dump routing tables at t=5 seconds",
1421  ns3::BooleanValue(false),
1423 
1425 static ns3::GlobalValue g_asciiTrace("VRCasciiTrace",
1426  "Dump ASCII trace",
1427  ns3::BooleanValue(false),
1429 
1431 static ns3::GlobalValue g_pcap("VRCpcap",
1432  "Generate PCAP files",
1433  ns3::BooleanValue(false),
1435 
1438  "VRCcumulativeBsmCaptureStart",
1439  "Simulation start time for capturing cumulative BSM",
1440  ns3::TimeValue(Seconds(0)),
1442 
1444 static ns3::GlobalValue g_txSafetyRange1("VRCtxSafetyRange1",
1445  "BSM range for PDR inclusion",
1446  ns3::DoubleValue(50.0),
1447  ns3::MakeDoubleChecker<double>());
1448 
1450 static ns3::GlobalValue g_txSafetyRange2("VRCtxSafetyRange2",
1451  "BSM range for PDR inclusion",
1452  ns3::DoubleValue(100.0),
1453  ns3::MakeDoubleChecker<double>());
1454 
1456 static ns3::GlobalValue g_txSafetyRange3("VRCtxSafetyRange3",
1457  "BSM range for PDR inclusion",
1458  ns3::DoubleValue(150.0),
1459  ns3::MakeDoubleChecker<double>());
1460 
1462 static ns3::GlobalValue g_txSafetyRange4("VRCtxSafetyRange4",
1463  "BSM range for PDR inclusion",
1464  ns3::DoubleValue(200.0),
1465  ns3::MakeDoubleChecker<double>());
1466 
1468 static ns3::GlobalValue g_txSafetyRange5("VRCtxSafetyRange5",
1469  "BSM range for PDR inclusion",
1470  ns3::DoubleValue(250.0),
1471  ns3::MakeDoubleChecker<double>());
1472 
1474 static ns3::GlobalValue g_txSafetyRange6("VRCtxSafetyRange6",
1475  "BSM range for PDR inclusion",
1476  ns3::DoubleValue(300.0),
1477  ns3::MakeDoubleChecker<double>());
1478 
1480 static ns3::GlobalValue g_txSafetyRange7("VRCtxSafetyRange7",
1481  "BSM range for PDR inclusion",
1482  ns3::DoubleValue(350.0),
1483  ns3::MakeDoubleChecker<double>());
1484 
1486 static ns3::GlobalValue g_txSafetyRange8("VRCtxSafetyRange8",
1487  "BSM range for PDR inclusion",
1488  ns3::DoubleValue(400.0),
1489  ns3::MakeDoubleChecker<double>());
1490 
1492 static ns3::GlobalValue g_txSafetyRange9("VRCtxSafetyRange9",
1493  "BSM range for PDR inclusion",
1494  ns3::DoubleValue(450.0),
1495  ns3::MakeDoubleChecker<double>());
1496 
1498 static ns3::GlobalValue g_txSafetyRange10("VRCtxSafetyRange10",
1499  "BSM range for PDR inclusion",
1500  ns3::DoubleValue(500.0),
1501  ns3::MakeDoubleChecker<double>());
1502 
1504 static ns3::GlobalValue g_txp("VRCtxp",
1505  "Transmission power dBm",
1506  ns3::DoubleValue(7.5),
1507  ns3::MakeDoubleChecker<double>());
1508 
1510 static ns3::GlobalValue g_totalTime("VRCtotalTime",
1511  "Total simulation time (s)",
1512  ns3::DoubleValue(300.01),
1513  ns3::MakeDoubleChecker<double>());
1514 
1516 static ns3::GlobalValue g_waveInterval("VRCwaveInterval",
1517  "Interval (s) between WAVE BSMs",
1518  ns3::DoubleValue(0.1),
1519  ns3::MakeDoubleChecker<double>());
1520 
1522 static ns3::GlobalValue g_gpsAccuracyNs("VRCgpsAccuracyNs",
1523  "GPS sync accuracy (ns)",
1524  ns3::DoubleValue(40),
1525  ns3::MakeDoubleChecker<double>());
1526 
1528 static ns3::GlobalValue g_txMaxDelayMs("VRCtxMaxDelayMs",
1529  "Tx May Delay (ms)",
1530  ns3::DoubleValue(10),
1531  ns3::MakeDoubleChecker<double>());
1532 
1534 static ns3::GlobalValue g_CSVfileName("VRCCSVfileName",
1535  "CSV filename (for time series data)",
1536  ns3::StringValue("vanet-routing.output.csv"),
1538 
1540 static ns3::GlobalValue g_CSVfileName2("VRCCSVfileName2",
1541  "CSV filename 2 (for overall simulation scenario results)",
1542  ns3::StringValue("vanet-routing.output2.csv"),
1544 
1546 static ns3::GlobalValue g_phyMode("VRCphyMode",
1547  "PHY mode (802.11p)",
1548  ns3::StringValue("OfdmRate6MbpsBW10MHz"),
1550 
1553  "VRCtraceFile",
1554  "Mobility trace filename",
1555  ns3::StringValue("./src/wave/examples/low99-ct-unterstrass-1day.filt.7.adj.mob"),
1557 
1559 static ns3::GlobalValue g_logFile("VRClogFile",
1560  "Log filename",
1561  ns3::StringValue("low99-ct-unterstrass-1day.filt.7.adj.log"),
1563 
1565 static ns3::GlobalValue g_rate("VRCrate",
1566  "Data rate",
1567  ns3::StringValue("2048bps"),
1569 
1571 static ns3::GlobalValue g_phyModeB("VRCphyModeB",
1572  "PHY mode (802.11a)",
1573  ns3::StringValue("DsssRate11Mbps"),
1575 
1577 static ns3::GlobalValue g_trName("VRCtrName",
1578  "Trace name",
1579  ns3::StringValue("vanet-routing-compare"),
1581 
1582 void
1584 {
1585  CommandSetup(argc, argv);
1586  SetupScenario();
1587 
1588  // user may specify up to 10 different tx distances
1589  // to be used for calculating different values of Packet
1590  // Delivery Ratio (PDR). Used to see the effects of
1591  // fading over distance
1592  m_txSafetyRanges.resize(10, 0);
1603 
1605 
1606  // we are done with all configuration
1607  // save config-store, if requested
1609  ConfigStoreHelper configStoreHelper;
1610  configStoreHelper.SaveConfig(m_saveConfigFilename);
1611 
1612  m_waveBsmHelper.GetWaveBsmStats()->SetLogging(m_log);
1614 }
1615 
1616 void
1618 {
1620 }
1621 
1622 void
1624 {
1625  // set up channel and devices
1627 }
1628 
1629 void
1631 {
1632  // devices are set up in SetupAdhocDevices(),
1633  // called by ConfigureChannels()
1634 
1635  // use a PHY callback for tracing
1636  // to determine the total amount of
1637  // data transmitted, and then used to calculate
1638  // the MAC/PHY overhead beyond the app-data
1639  if (m_80211mode == 3)
1640  {
1641  // WAVE
1642  Config::Connect("/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/State/Tx",
1644  Config::Connect("/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/PhyTxDrop",
1646  Config::Connect("/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/PhyRxDrop",
1648  }
1649  else
1650  {
1651  Config::Connect("/NodeList/*/DeviceList/*/Phy/State/Tx",
1653  Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxDrop",
1655  Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop",
1657  }
1658 }
1659 
1660 void
1662 {
1664 }
1665 
1666 void
1668 {
1669  // Traffic mix consists of:
1670  // 1. routing data
1671  // 2. Broadcasting of Basic Safety Message (BSM)
1674 
1675  // config trace to capture app-data (bytes) for
1676  // routing data, subtracted and used for
1677  // routing overhead
1678  std::ostringstream oss;
1679  oss.str("");
1680  oss << "/NodeList/*/ApplicationList/*/$ns3::OnOffApplication/Tx";
1682 }
1683 
1684 void
1686 {
1687  WriteCsvHeader();
1688  SetupLogFile();
1689  SetupLogging();
1690 
1691  AsciiTraceHelper ascii;
1692  MobilityHelper::EnableAsciiAll(ascii.CreateFileStream(m_trName + ".mob"));
1693 }
1694 
1695 void
1697 {
1698  Run();
1699 }
1700 
1701 void
1703 {
1704  // calculate and output final results
1705  double bsm_pdr1 = m_waveBsmHelper.GetWaveBsmStats()->GetCumulativeBsmPdr(1);
1706  double bsm_pdr2 = m_waveBsmHelper.GetWaveBsmStats()->GetCumulativeBsmPdr(2);
1707  double bsm_pdr3 = m_waveBsmHelper.GetWaveBsmStats()->GetCumulativeBsmPdr(3);
1708  double bsm_pdr4 = m_waveBsmHelper.GetWaveBsmStats()->GetCumulativeBsmPdr(4);
1709  double bsm_pdr5 = m_waveBsmHelper.GetWaveBsmStats()->GetCumulativeBsmPdr(5);
1710  double bsm_pdr6 = m_waveBsmHelper.GetWaveBsmStats()->GetCumulativeBsmPdr(6);
1711  double bsm_pdr7 = m_waveBsmHelper.GetWaveBsmStats()->GetCumulativeBsmPdr(7);
1712  double bsm_pdr8 = m_waveBsmHelper.GetWaveBsmStats()->GetCumulativeBsmPdr(8);
1713  double bsm_pdr9 = m_waveBsmHelper.GetWaveBsmStats()->GetCumulativeBsmPdr(9);
1714  double bsm_pdr10 = m_waveBsmHelper.GetWaveBsmStats()->GetCumulativeBsmPdr(10);
1715 
1716  double averageRoutingGoodputKbps = 0.0;
1717  uint32_t totalBytesTotal = m_routingHelper->GetRoutingStats().GetCumulativeRxBytes();
1718  averageRoutingGoodputKbps = (((double)totalBytesTotal * 8.0) / m_TotalSimTime) / 1000.0;
1719 
1720  // calculate MAC/PHY overhead (mac-phy-oh)
1721  // total WAVE BSM bytes sent
1722  uint32_t cumulativeWaveBsmBytes = m_waveBsmHelper.GetWaveBsmStats()->GetTxByteCount();
1723  uint32_t cumulativeRoutingBytes = m_routingHelper->GetRoutingStats().GetCumulativeTxBytes();
1724  uint32_t totalAppBytes = cumulativeWaveBsmBytes + cumulativeRoutingBytes;
1725  uint32_t totalPhyBytes = m_wifiPhyStats->GetTxBytes();
1726  // mac-phy-oh = (total-phy-bytes - total-app-bytes) / total-phy-bytes
1727  double mac_phy_oh = 0.0;
1728  if (totalPhyBytes > 0)
1729  {
1730  mac_phy_oh = (double)(totalPhyBytes - totalAppBytes) / (double)totalPhyBytes;
1731  }
1732 
1733  if (m_log)
1734  {
1735  NS_LOG_UNCOND("BSM_PDR1=" << bsm_pdr1 << " BSM_PDR2=" << bsm_pdr2
1736  << " BSM_PDR3=" << bsm_pdr3 << " BSM_PDR4=" << bsm_pdr4
1737  << " BSM_PDR5=" << bsm_pdr5 << " BSM_PDR6=" << bsm_pdr6
1738  << " BSM_PDR7=" << bsm_pdr7 << " BSM_PDR8=" << bsm_pdr8
1739  << " BSM_PDR9=" << bsm_pdr9 << " BSM_PDR10=" << bsm_pdr10
1740  << " Goodput=" << averageRoutingGoodputKbps
1741  << "Kbps MAC/PHY-oh=" << mac_phy_oh);
1742  }
1743 
1744  std::ofstream out(m_CSVfileName2, std::ios::app);
1745 
1746  out << bsm_pdr1 << "," << bsm_pdr2 << "," << bsm_pdr3 << "," << bsm_pdr4 << "," << bsm_pdr5
1747  << "," << bsm_pdr6 << "," << bsm_pdr7 << "," << bsm_pdr8 << "," << bsm_pdr9 << ","
1748  << bsm_pdr10 << "," << averageRoutingGoodputKbps << "," << mac_phy_oh << "" << std::endl;
1749 
1750  out.close();
1751 
1752  m_os.close(); // close log file
1753 }
1754 
1755 void
1757 {
1758  NS_LOG_INFO("Run Simulation.");
1759 
1760  CheckThroughput();
1761 
1762  Simulator::Stop(Seconds(m_TotalSimTime));
1763  Simulator::Run();
1764  Simulator::Destroy();
1765 }
1766 
1767 // Prints actual position and velocity when a course change event occurs
1768 void
1770  std::string context,
1772 {
1773  Vector pos = mobility->GetPosition(); // Get position
1774  Vector vel = mobility->GetVelocity(); // Get velocity
1775 
1776  pos.z = 1.5;
1777 
1778  int nodeId = mobility->GetObject<Node>()->GetId();
1779  double t = (Simulator::Now()).GetSeconds();
1780  if (t >= 1.0)
1781  {
1782  WaveBsmHelper::GetNodesMoving()[nodeId] = 1;
1783  }
1784 
1785  // NS_LOG_UNCOND ("Changing pos for node=" << nodeId << " at " << Simulator::Now () );
1786 
1787  // Prints position and velocities
1788  *os << Simulator::Now() << " POS: x=" << pos.x << ", y=" << pos.y << ", z=" << pos.z
1789  << "; VEL:" << vel.x << ", y=" << vel.y << ", z=" << vel.z << std::endl;
1790 }
1791 
1792 void
1794 {
1795  uint32_t bytesTotal = m_routingHelper->GetRoutingStats().GetRxBytes();
1797  double kbps = (bytesTotal * 8.0) / 1000;
1798  double wavePDR = 0.0;
1799  int wavePktsSent = m_waveBsmHelper.GetWaveBsmStats()->GetTxPktCount();
1800  int wavePktsReceived = m_waveBsmHelper.GetWaveBsmStats()->GetRxPktCount();
1801  if (wavePktsSent > 0)
1802  {
1803  int wavePktsReceived = m_waveBsmHelper.GetWaveBsmStats()->GetRxPktCount();
1804  wavePDR = (double)wavePktsReceived / (double)wavePktsSent;
1805  }
1806 
1807  int waveExpectedRxPktCount = m_waveBsmHelper.GetWaveBsmStats()->GetExpectedRxPktCount(1);
1808  int waveRxPktInRangeCount = m_waveBsmHelper.GetWaveBsmStats()->GetRxPktInRangeCount(1);
1809  double wavePDR1_2 = m_waveBsmHelper.GetWaveBsmStats()->GetBsmPdr(1);
1810  double wavePDR2_2 = m_waveBsmHelper.GetWaveBsmStats()->GetBsmPdr(2);
1811  double wavePDR3_2 = m_waveBsmHelper.GetWaveBsmStats()->GetBsmPdr(3);
1812  double wavePDR4_2 = m_waveBsmHelper.GetWaveBsmStats()->GetBsmPdr(4);
1813  double wavePDR5_2 = m_waveBsmHelper.GetWaveBsmStats()->GetBsmPdr(5);
1814  double wavePDR6_2 = m_waveBsmHelper.GetWaveBsmStats()->GetBsmPdr(6);
1815  double wavePDR7_2 = m_waveBsmHelper.GetWaveBsmStats()->GetBsmPdr(7);
1816  double wavePDR8_2 = m_waveBsmHelper.GetWaveBsmStats()->GetBsmPdr(8);
1817  double wavePDR9_2 = m_waveBsmHelper.GetWaveBsmStats()->GetBsmPdr(9);
1818  double wavePDR10_2 = m_waveBsmHelper.GetWaveBsmStats()->GetBsmPdr(10);
1819 
1820  // calculate MAC/PHY overhead (mac-phy-oh)
1821  // total WAVE BSM bytes sent
1822  uint32_t cumulativeWaveBsmBytes = m_waveBsmHelper.GetWaveBsmStats()->GetTxByteCount();
1823  uint32_t cumulativeRoutingBytes = m_routingHelper->GetRoutingStats().GetCumulativeTxBytes();
1824  uint32_t totalAppBytes = cumulativeWaveBsmBytes + cumulativeRoutingBytes;
1825  uint32_t totalPhyBytes = m_wifiPhyStats->GetTxBytes();
1826  // mac-phy-oh = (total-phy-bytes - total-app-bytes) / total-phy-bytes
1827  double mac_phy_oh = 0.0;
1828  if (totalPhyBytes > 0)
1829  {
1830  mac_phy_oh = (double)(totalPhyBytes - totalAppBytes) / (double)totalPhyBytes;
1831  }
1832 
1833  std::ofstream out(m_CSVfileName, std::ios::app);
1834 
1835  if (m_log)
1836  {
1837  NS_LOG_UNCOND("At t=" << (Simulator::Now()).As(Time::S) << " BSM_PDR1=" << wavePDR1_2
1838  << " BSM_PDR1=" << wavePDR2_2 << " BSM_PDR3=" << wavePDR3_2
1839  << " BSM_PDR4=" << wavePDR4_2 << " BSM_PDR5=" << wavePDR5_2
1840  << " BSM_PDR6=" << wavePDR6_2 << " BSM_PDR7=" << wavePDR7_2
1841  << " BSM_PDR8=" << wavePDR8_2 << " BSM_PDR9=" << wavePDR9_2
1842  << " BSM_PDR10=" << wavePDR10_2 << " Goodput=" << kbps
1843  << "Kbps" /*<< " MAC/PHY-OH=" << mac_phy_oh*/);
1844  }
1845 
1846  out << (Simulator::Now()).As(Time::S) << "," << kbps << "," << packetsReceived << ","
1847  << m_nSinks << "," << m_protocolName << "," << m_txp << "," << wavePktsSent << ","
1848  << wavePktsReceived << "," << wavePDR << "," << waveExpectedRxPktCount << ","
1849  << waveRxPktInRangeCount << "," << wavePDR1_2 << "," << wavePDR2_2 << "," << wavePDR3_2
1850  << "," << wavePDR4_2 << "," << wavePDR5_2 << "," << wavePDR6_2 << "," << wavePDR7_2 << ","
1851  << wavePDR8_2 << "," << wavePDR9_2 << "," << wavePDR10_2 << "," << mac_phy_oh << ""
1852  << std::endl;
1853 
1854  out.close();
1855 
1858  m_waveBsmHelper.GetWaveBsmStats()->SetRxPktCount(0);
1859  m_waveBsmHelper.GetWaveBsmStats()->SetTxPktCount(0);
1860  for (int index = 1; index <= 10; index++)
1861  {
1862  m_waveBsmHelper.GetWaveBsmStats()->SetExpectedRxPktCount(index, 0);
1863  m_waveBsmHelper.GetWaveBsmStats()->SetRxPktInRangeCount(index, 0);
1864  }
1865 
1866  Time currentTime = Simulator::Now();
1867  if (currentTime <= m_cumulativeBsmCaptureStart)
1868  {
1869  for (int index = 1; index <= 10; index++)
1870  {
1871  m_waveBsmHelper.GetWaveBsmStats()->ResetTotalRxPktCounts(index);
1872  }
1873  }
1874 
1875  Simulator::Schedule(Seconds(1.0), &VanetRoutingExperiment::CheckThroughput, this);
1876 }
1877 
1878 void
1880 {
1881  // get settings saved from config-store
1882  UintegerValue uintegerValue;
1883  DoubleValue doubleValue;
1884  StringValue stringValue;
1885  TimeValue timeValue;
1886  BooleanValue booleanValue;
1887 
1888  // This may not be the best way to manage program configuration
1889  // (directing them through global values), but management
1890  // through the config-store here is copied from
1891  // src/lte/examples/lena-dual-stripe.cc
1892 
1893  GlobalValue::GetValueByName("VRCport", uintegerValue);
1894  m_port = uintegerValue.Get();
1895  GlobalValue::GetValueByName("VRCnSinks", uintegerValue);
1896  m_nSinks = uintegerValue.Get();
1897  GlobalValue::GetValueByName("VRCtraceMobility", booleanValue);
1898  m_traceMobility = booleanValue.Get();
1899  GlobalValue::GetValueByName("VRCprotocol", uintegerValue);
1900  m_protocol = uintegerValue.Get();
1901  GlobalValue::GetValueByName("VRClossModel", uintegerValue);
1902  m_lossModel = uintegerValue.Get();
1903  GlobalValue::GetValueByName("VRCfading", uintegerValue);
1904  m_fading = uintegerValue.Get();
1905  GlobalValue::GetValueByName("VRC80211mode", uintegerValue);
1906  m_80211mode = uintegerValue.Get();
1907  GlobalValue::GetValueByName("VRCmobility", uintegerValue);
1908  m_mobility = uintegerValue.Get();
1909  GlobalValue::GetValueByName("VRCnNodes", uintegerValue);
1910  m_nNodes = uintegerValue.Get();
1911  GlobalValue::GetValueByName("VRCnodeSpeed", uintegerValue);
1912  m_nodeSpeed = uintegerValue.Get();
1913  GlobalValue::GetValueByName("VRCnodePause", uintegerValue);
1914  m_nodePause = uintegerValue.Get();
1915  GlobalValue::GetValueByName("VRCwavePacketSize", uintegerValue);
1916  m_wavePacketSize = uintegerValue.Get();
1917  GlobalValue::GetValueByName("VRCverbose", booleanValue);
1918  m_verbose = booleanValue.Get();
1919  GlobalValue::GetValueByName("VRCscenario", uintegerValue);
1920  m_scenario = uintegerValue.Get();
1921  GlobalValue::GetValueByName("VRCroutingTables", booleanValue);
1922  m_routingTables = booleanValue.Get();
1923  GlobalValue::GetValueByName("VRCasciiTrace", booleanValue);
1924  m_asciiTrace = booleanValue.Get();
1925  GlobalValue::GetValueByName("VRCpcap", booleanValue);
1926  m_pcap = booleanValue.Get();
1927  GlobalValue::GetValueByName("VRCcumulativeBsmCaptureStart", timeValue);
1928  m_cumulativeBsmCaptureStart = timeValue.Get();
1929 
1930  GlobalValue::GetValueByName("VRCtxSafetyRange1", doubleValue);
1931  m_txSafetyRange1 = doubleValue.Get();
1932  GlobalValue::GetValueByName("VRCtxSafetyRange2", doubleValue);
1933  m_txSafetyRange2 = doubleValue.Get();
1934  GlobalValue::GetValueByName("VRCtxSafetyRange3", doubleValue);
1935  m_txSafetyRange3 = doubleValue.Get();
1936  GlobalValue::GetValueByName("VRCtxSafetyRange4", doubleValue);
1937  m_txSafetyRange4 = doubleValue.Get();
1938  GlobalValue::GetValueByName("VRCtxSafetyRange5", doubleValue);
1939  m_txSafetyRange5 = doubleValue.Get();
1940  GlobalValue::GetValueByName("VRCtxSafetyRange6", doubleValue);
1941  m_txSafetyRange6 = doubleValue.Get();
1942  GlobalValue::GetValueByName("VRCtxSafetyRange7", doubleValue);
1943  m_txSafetyRange7 = doubleValue.Get();
1944  GlobalValue::GetValueByName("VRCtxSafetyRange8", doubleValue);
1945  m_txSafetyRange8 = doubleValue.Get();
1946  GlobalValue::GetValueByName("VRCtxSafetyRange9", doubleValue);
1947  m_txSafetyRange9 = doubleValue.Get();
1948  GlobalValue::GetValueByName("VRCtxSafetyRange10", doubleValue);
1949  m_txSafetyRange10 = doubleValue.Get();
1950  GlobalValue::GetValueByName("VRCtxp", doubleValue);
1951  m_txp = doubleValue.Get();
1952  GlobalValue::GetValueByName("VRCtotalTime", doubleValue);
1953  m_TotalSimTime = doubleValue.Get();
1954  GlobalValue::GetValueByName("VRCwaveInterval", doubleValue);
1955  m_waveInterval = doubleValue.Get();
1956  GlobalValue::GetValueByName("VRCgpsAccuracyNs", doubleValue);
1957  m_gpsAccuracyNs = doubleValue.Get();
1958  GlobalValue::GetValueByName("VRCtxMaxDelayMs", doubleValue);
1959  m_txMaxDelayMs = doubleValue.Get();
1960 
1961  GlobalValue::GetValueByName("VRCCSVfileName", stringValue);
1962  m_CSVfileName = stringValue.Get();
1963  GlobalValue::GetValueByName("VRCCSVfileName2", stringValue);
1964  m_CSVfileName2 = stringValue.Get();
1965  GlobalValue::GetValueByName("VRCphyMode", stringValue);
1966  m_phyMode = stringValue.Get();
1967  GlobalValue::GetValueByName("VRCtraceFile", stringValue);
1968  m_traceFile = stringValue.Get();
1969  GlobalValue::GetValueByName("VRClogFile", stringValue);
1970  m_logFile = stringValue.Get();
1971  GlobalValue::GetValueByName("VRCrate", stringValue);
1972  m_rate = stringValue.Get();
1973  GlobalValue::GetValueByName("VRCphyModeB", stringValue);
1974  m_phyModeB = stringValue.Get();
1975  GlobalValue::GetValueByName("VRCtrName", stringValue);
1976  m_trName = stringValue.Get();
1977 }
1978 
1979 void
1981 {
1982  // get settings saved from config-store
1983  UintegerValue uintegerValue;
1984  DoubleValue doubleValue;
1985  StringValue stringValue;
1986 
2005 
2021 
2030  GlobalValue::GetValueByName("VRCtrName", stringValue);
2031  m_trName = stringValue.Get();
2032 }
2033 
2034 void
2036 {
2037  CommandLine cmd(__FILE__);
2038  double txDist1 = 50.0;
2039  double txDist2 = 100.0;
2040  double txDist3 = 150.0;
2041  double txDist4 = 200.0;
2042  double txDist5 = 250.0;
2043  double txDist6 = 300.0;
2044  double txDist7 = 350.0;
2045  double txDist8 = 350.0;
2046  double txDist9 = 350.0;
2047  double txDist10 = 350.0;
2048 
2049  // allow command line overrides
2050  cmd.AddValue("CSVfileName", "The name of the CSV output file name", m_CSVfileName);
2051  cmd.AddValue("CSVfileName2", "The name of the CSV output file name2", m_CSVfileName2);
2052  cmd.AddValue("totaltime", "Simulation end time", m_TotalSimTime);
2053  cmd.AddValue("nodes", "Number of nodes (i.e. vehicles)", m_nNodes);
2054  cmd.AddValue("sinks", "Number of routing sinks", m_nSinks);
2055  cmd.AddValue("txp", "Transmit power (dB), e.g. txp=7.5", m_txp);
2056  cmd.AddValue("traceMobility", "Enable mobility tracing", m_traceMobility);
2057  cmd.AddValue("protocol", "1=OLSR;2=AODV;3=DSDV;4=DSR", m_protocol);
2058  cmd.AddValue("lossModel", "1=Friis;2=ItuR1411Los;3=TwoRayGround;4=LogDistance", m_lossModel);
2059  cmd.AddValue("fading", "0=None;1=Nakagami;(buildings=1 overrides)", m_fading);
2060  cmd.AddValue("phyMode", "Wifi Phy mode", m_phyMode);
2061  cmd.AddValue("80211Mode", "1=802.11p; 2=802.11b; 3=WAVE-PHY", m_80211mode);
2062  cmd.AddValue("traceFile", "Ns2 movement trace file", m_traceFile);
2063  cmd.AddValue("logFile", "Log file", m_logFile);
2064  cmd.AddValue("mobility", "1=trace;2=RWP", m_mobility);
2065  cmd.AddValue("rate", "Rate", m_rate);
2066  cmd.AddValue("phyModeB", "Phy mode 802.11b", m_phyModeB);
2067  cmd.AddValue("speed", "Node speed (m/s)", m_nodeSpeed);
2068  cmd.AddValue("pause", "Node pause (s)", m_nodePause);
2069  cmd.AddValue("verbose", "Enable verbose output", m_verbose);
2070  cmd.AddValue("bsm", "(WAVE) BSM size (bytes)", m_wavePacketSize);
2071  cmd.AddValue("interval", "(WAVE) BSM interval (s)", m_waveInterval);
2072  cmd.AddValue("scenario", "1=synthetic, 2=playback-trace", m_scenario);
2073  // User is allowed to have up to 10 different PDRs (Packet
2074  // Delivery Ratios) calculate, and so can specify up to
2075  // 10 different tx distances.
2076  cmd.AddValue("txdist1", "Expected BSM tx range, m", txDist1);
2077  cmd.AddValue("txdist2", "Expected BSM tx range, m", txDist2);
2078  cmd.AddValue("txdist3", "Expected BSM tx range, m", txDist3);
2079  cmd.AddValue("txdist4", "Expected BSM tx range, m", txDist4);
2080  cmd.AddValue("txdist5", "Expected BSM tx range, m", txDist5);
2081  cmd.AddValue("txdist6", "Expected BSM tx range, m", txDist6);
2082  cmd.AddValue("txdist7", "Expected BSM tx range, m", txDist7);
2083  cmd.AddValue("txdist8", "Expected BSM tx range, m", txDist8);
2084  cmd.AddValue("txdist9", "Expected BSM tx range, m", txDist9);
2085  cmd.AddValue("txdist10", "Expected BSM tx range, m", txDist10);
2086  cmd.AddValue("gpsaccuracy", "GPS time accuracy, in ns", m_gpsAccuracyNs);
2087  cmd.AddValue("txmaxdelay", "Tx max delay, in ms", m_txMaxDelayMs);
2088  cmd.AddValue("routingTables", "Whether to dump routing tables at t=5 seconds", m_routingTables);
2089  cmd.AddValue("asciiTrace", "Whether to dump ASCII Trace data", m_asciiTrace);
2090  cmd.AddValue("pcap", "Whether to create PCAP files for all nodes", m_pcap);
2091  cmd.AddValue("loadconfig", "Config-store filename to load", m_loadConfigFilename);
2092  cmd.AddValue("saveconfig", "Config-store filename to save", m_saveConfigFilename);
2093  cmd.AddValue("exp", "Experiment", m_exp);
2094  cmd.AddValue("BsmCaptureStart",
2095  "Start time to begin capturing pkts for cumulative Bsm",
2097  cmd.Parse(argc, argv);
2098 
2099  m_txSafetyRange1 = txDist1;
2100  m_txSafetyRange2 = txDist2;
2101  m_txSafetyRange3 = txDist3;
2102  m_txSafetyRange4 = txDist4;
2103  m_txSafetyRange5 = txDist5;
2104  m_txSafetyRange6 = txDist6;
2105  m_txSafetyRange7 = txDist7;
2106  m_txSafetyRange8 = txDist8;
2107  m_txSafetyRange9 = txDist9;
2108  m_txSafetyRange10 = txDist10;
2109  // load configuration info from config-store
2110  ConfigStoreHelper configStoreHelper;
2111  configStoreHelper.LoadConfig(m_loadConfigFilename);
2112  // transfer config-store values to config parameters
2114 
2115  // parse again so you can override input file default values via command line
2116  cmd.Parse(argc, argv);
2117 
2118  m_txSafetyRange1 = txDist1;
2119  m_txSafetyRange2 = txDist2;
2120  m_txSafetyRange3 = txDist3;
2121  m_txSafetyRange4 = txDist4;
2122  m_txSafetyRange5 = txDist5;
2123  m_txSafetyRange6 = txDist6;
2124  m_txSafetyRange7 = txDist7;
2125  m_txSafetyRange8 = txDist8;
2126  m_txSafetyRange9 = txDist9;
2127  m_txSafetyRange10 = txDist10;
2128 }
2129 
2130 void
2132 {
2133  // open log file for output
2134  m_os.open(m_logFile);
2135 }
2136 
2137 void
2139 {
2140  // Enable logging from the ns2 helper
2141  LogComponentEnable("Ns2MobilityHelper", LOG_LEVEL_DEBUG);
2142 
2143  Packet::EnablePrinting();
2144 }
2145 
2146 void
2148 {
2149  Config::SetDefault("ns3::OnOffApplication::PacketSize", StringValue("64"));
2150  Config::SetDefault("ns3::OnOffApplication::DataRate", StringValue(m_rate));
2151 
2152  // Set Non-unicastMode rate to unicast mode
2153  if (m_80211mode == 2)
2154  {
2155  Config::SetDefault("ns3::WifiRemoteStationManager::NonUnicastMode",
2157  }
2158  else
2159  {
2160  Config::SetDefault("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue(m_phyMode));
2161  }
2162 }
2163 
2164 void
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",
2195  StringValue(ssSpeed.str()),
2196  "Pause",
2197  StringValue(ssPause.str()),
2198  "PositionAllocator",
2199  PointerValue(taPositionAlloc));
2200  mobilityAdhoc.SetPositionAllocator(taPositionAlloc);
2201  mobilityAdhoc.Install(m_adhocTxNodes);
2203 
2204  // initially assume all nodes are moving
2205  WaveBsmHelper::GetNodesMoving().resize(m_nNodes, 1);
2206  }
2207 
2208  // Configure callback for logging
2209  Config::Connect("/NodeList/*/$ns3::MobilityModel/CourseChange",
2211 }
2212 
2213 void
2215 {
2216  if (m_lossModel == 1)
2217  {
2218  m_lossModelName = "ns3::FriisPropagationLossModel";
2219  }
2220  else if (m_lossModel == 2)
2221  {
2222  m_lossModelName = "ns3::ItuR1411LosPropagationLossModel";
2223  }
2224  else if (m_lossModel == 3)
2225  {
2226  m_lossModelName = "ns3::TwoRayGroundPropagationLossModel";
2227  }
2228  else if (m_lossModel == 4)
2229  {
2230  m_lossModelName = "ns3::LogDistancePropagationLossModel";
2231  }
2232  else
2233  {
2234  // Unsupported propagation loss model.
2235  // Treating as ERROR
2236  NS_LOG_ERROR("Invalid propagation loss model specified. Values must be [1-4], where "
2237  "1=Friis;2=ItuR1411Los;3=TwoRayGround;4=LogDistance");
2238  }
2239 
2240  // frequency
2241  double freq = 0.0;
2242  if ((m_80211mode == 1) || (m_80211mode == 3))
2243  {
2244  // 802.11p 5.9 GHz
2245  freq = 5.9e9;
2246  }
2247  else
2248  {
2249  // 802.11b 2.4 GHz
2250  freq = 2.4e9;
2251  }
2252 
2253  // Setup propagation models
2254  YansWifiChannelHelper wifiChannel;
2255  wifiChannel.SetPropagationDelay("ns3::ConstantSpeedPropagationDelayModel");
2256  if (m_lossModel == 3)
2257  {
2258  // two-ray requires antenna height (else defaults to Friis)
2259  wifiChannel.AddPropagationLoss(m_lossModelName,
2260  "Frequency",
2261  DoubleValue(freq),
2262  "HeightAboveZ",
2263  DoubleValue(1.5));
2264  }
2265  else
2266  {
2267  wifiChannel.AddPropagationLoss(m_lossModelName, "Frequency", DoubleValue(freq));
2268  }
2269 
2270  // Propagation loss models are additive.
2271  if (m_fading != 0)
2272  {
2273  // if no obstacle model, then use Nakagami fading if requested
2274  wifiChannel.AddPropagationLoss("ns3::NakagamiPropagationLossModel");
2275  }
2276 
2277  // the channel
2278  Ptr<YansWifiChannel> channel = wifiChannel.Create();
2279 
2280  // The below set of helpers will help us to put together the wifi NICs we want
2281  YansWifiPhyHelper wifiPhy;
2282  wifiPhy.SetChannel(channel);
2283  // ns-3 supports generate a pcap trace
2284  wifiPhy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11);
2285 
2286  YansWavePhyHelper wavePhy = YansWavePhyHelper::Default();
2287  wavePhy.SetChannel(channel);
2288  wavePhy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11);
2289 
2290  // Setup WAVE PHY and MAC
2291  NqosWaveMacHelper wifi80211pMac = NqosWaveMacHelper::Default();
2292  WaveHelper waveHelper = WaveHelper::Default();
2293  Wifi80211pHelper wifi80211p = Wifi80211pHelper::Default();
2294  if (m_verbose)
2295  {
2296  Wifi80211pHelper::EnableLogComponents(); // Turn on all Wifi 802.11p logging
2297  // likewise, turn on WAVE PHY logging
2298  WaveHelper::EnableLogComponents();
2299  }
2300 
2301  WifiHelper wifi;
2302 
2303  // Setup 802.11b stuff
2304  wifi.SetStandard(WIFI_STANDARD_80211b);
2305 
2306  wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
2307  "DataMode",
2309  "ControlMode",
2311 
2312  // Setup 802.11p stuff
2313  wifi80211p.SetRemoteStationManager("ns3::ConstantRateWifiManager",
2314  "DataMode",
2316  "ControlMode",
2318 
2319  // Setup WAVE-PHY stuff
2320  waveHelper.SetRemoteStationManager("ns3::ConstantRateWifiManager",
2321  "DataMode",
2323  "ControlMode",
2325 
2326  // Set Tx Power
2327  wifiPhy.Set("TxPowerStart", DoubleValue(m_txp));
2328  wifiPhy.Set("TxPowerEnd", DoubleValue(m_txp));
2329  wavePhy.Set("TxPowerStart", DoubleValue(m_txp));
2330  wavePhy.Set("TxPowerEnd", DoubleValue(m_txp));
2331 
2332  // Add an upper mac and disable rate control
2333  WifiMacHelper wifiMac;
2334  wifiMac.SetType("ns3::AdhocWifiMac");
2335  QosWaveMacHelper waveMac = QosWaveMacHelper::Default();
2336 
2337  // Setup net devices
2338 
2339  if (m_80211mode == 3)
2340  {
2341  m_adhocTxDevices = waveHelper.Install(wavePhy, waveMac, m_adhocTxNodes);
2342  }
2343  else if (m_80211mode == 1)
2344  {
2345  m_adhocTxDevices = wifi80211p.Install(wifiPhy, wifi80211pMac, m_adhocTxNodes);
2346  }
2347  else
2348  {
2349  m_adhocTxDevices = wifi.Install(wifiPhy, wifiMac, m_adhocTxNodes);
2350  }
2351 
2352  if (m_asciiTrace)
2353  {
2354  AsciiTraceHelper ascii;
2355  Ptr<OutputStreamWrapper> osw = ascii.CreateFileStream(m_trName + ".tr");
2356  wifiPhy.EnableAsciiAll(osw);
2357  wavePhy.EnableAsciiAll(osw);
2358  }
2359  if (m_pcap)
2360  {
2361  wifiPhy.EnablePcapAll("vanet-routing-compare-pcap");
2362  wavePhy.EnablePcapAll("vanet-routing-compare-pcap");
2363  }
2364 }
2365 
2366 void
2368 {
2369  // WAVE PHY mode
2370  // 0=continuous channel; 1=channel-switching
2371  int chAccessMode = 0;
2372  if (m_80211mode == 3)
2373  {
2374  chAccessMode = 1;
2375  }
2376 
2381  // GPS accuracy (i.e, clock drift), in number of ns
2384  chAccessMode,
2385  // tx max delay before transmit, in ms
2387 
2388  // fix random number streams
2390 }
2391 
2392 void
2394 {
2399  m_protocol,
2400  m_nSinks,
2401  m_routingTables);
2402 }
2403 
2404 void
2406 {
2407  // member variable parameter use
2408  // defaults or command line overrides,
2409  // except where scenario={1,2,3,...}
2410  // have been specified, in which case
2411  // specify parameters are overwritten
2412  // here to setup for specific scenarios
2413 
2414  // certain parameters may be further overridden
2415  // i.e. specify a scenario, override tx power.
2416 
2417  if (m_scenario == 1)
2418  {
2419  // 40 nodes in RWP 300 m x 1500 m synthetic highway, 10s
2420  m_traceFile = "";
2421  m_logFile = "";
2422  m_mobility = 2;
2423  if (m_nNodes == 156)
2424  {
2425  m_nNodes = 40;
2426  }
2427  if (m_TotalSimTime == 300.01)
2428  {
2429  m_TotalSimTime = 10.0;
2430  }
2431  }
2432  else if (m_scenario == 2)
2433  {
2434  // Realistic vehicular trace in 4.6 km x 3.0 km suburban Zurich
2435  // "low density, 99 total vehicles"
2436  m_traceFile = "src/wave/examples/low99-ct-unterstrass-1day.filt.7.adj.mob";
2437  m_logFile = "low99-ct-unterstrass-1day.filt.7.adj.log";
2438  m_mobility = 1;
2439  m_nNodes = 99;
2440  m_TotalSimTime = 300.01;
2441  m_nodeSpeed = 0;
2442  m_nodePause = 0;
2443  m_CSVfileName = "low_vanet-routing-compare.csv";
2444  m_CSVfileName = "low_vanet-routing-compare2.csv";
2445  }
2446 }
2447 
2448 void
2450 {
2451  // blank out the last output file and write the column headers
2452  std::ofstream out(m_CSVfileName);
2453  out << "SimulationSecond,"
2454  << "ReceiveRate,"
2455  << "PacketsReceived,"
2456  << "NumberOfSinks,"
2457  << "RoutingProtocol,"
2458  << "TransmissionPower,"
2459  << "WavePktsSent,"
2460  << "WavePtksReceived,"
2461  << "WavePktsPpr,"
2462  << "ExpectedWavePktsReceived,"
2463  << "ExpectedWavePktsInCoverageReceived,"
2464  << "BSM_PDR1,"
2465  << "BSM_PDR2,"
2466  << "BSM_PDR3,"
2467  << "BSM_PDR4,"
2468  << "BSM_PDR5,"
2469  << "BSM_PDR6,"
2470  << "BSM_PDR7,"
2471  << "BSM_PDR8,"
2472  << "BSM_PDR9,"
2473  << "BSM_PDR10,"
2474  << "MacPhyOverhead" << std::endl;
2475  out.close();
2476 
2477  std::ofstream out2(m_CSVfileName2);
2478  out2 << "BSM_PDR1,"
2479  << "BSM_PDR2,"
2480  << "BSM_PDR3,"
2481  << "BSM_PDR4,"
2482  << "BSM_PDR5,"
2483  << "BSM_PDR6,"
2484  << "BSM_PDR7,"
2485  << "BSM_PDR8,"
2486  << "BSM_PDR9,"
2487  << "BSM_PDR10,"
2488  << "AverageRoutingGoodputKbps,"
2489  << "MacPhyOverhead" << std::endl;
2490  out2.close();
2491 }
2492 
2493 int
2494 main(int argc, char* argv[])
2495 {
2497  experiment.Simulate(argc, argv);
2498 
2499  return 0;
2500 }
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...
void Install(NodeContainer &c, NetDeviceContainer &d, Ipv4InterfaceContainer &i, double totalTime, int protocol, uint32_t nSinks, bool routingTables)
Installs routing functionality on nodes and their devices and interfaces.
uint32_t m_protocol
routing protocol; 0=NONE, 1=OLSR, 2=AODV, 3=DSDV, 4=DSR
bool m_routingTables
dump routing table (at t=5 sec). 0=No, 1=Yes
double m_TotalSimTime
seconds
void SetLogging(bool log)
Enable/disable logging.
void SetupRoutingMessages(NodeContainer &c, Ipv4InterfaceContainer &adhocTxInterfaces)
Sets up routing messages on the nodes and their interfaces.
Ptr< Socket > SetupRoutingPacketReceive(Ipv4Address addr, Ptr< Node > node)
Sets up a routing packet for transmission.
RoutingHelper()
Constructor.
void SetupRoutingProtocol(NodeContainer &c)
Sets up the protocol protocol on the nodes.
void AssignIpAddresses(NetDeviceContainer &d, Ipv4InterfaceContainer &adhocTxInterfaces)
Assigns IPv4 addresses to net devices and their interfaces.
RoutingStats routingStats
routing statistics
uint32_t m_nSinks
number of sink nodes (< all nodes)
~RoutingHelper() override
Destructor.
RoutingStats & GetRoutingStats()
Returns the RoutingStats instance.
std::string m_protocolName
protocol name
static TypeId GetTypeId()
Get class TypeId.
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 m_RxBytes
receive bytes
void IncRxBytes(uint32_t rxBytes)
Increments the number of (application-data) bytes received, not including MAC/PHY overhead.
uint32_t GetRxBytes() const
Returns the number of bytes received.
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 GetCumulativeTxPkts() const
Returns the cumulative number of packets transmitted.
uint32_t m_cumulativeRxPkts
cumulative receive packets
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 GetCumulativeTxBytes() const
Returns the cumulative number of bytes transmitted.
uint32_t m_cumulativeTxBytes
cumulative transmit bytes
uint32_t GetRxPkts() const
Returns the count of packets received.
uint32_t GetCumulativeRxPkts() const
Returns the cumulative count of packets received.
uint32_t GetTxBytes() const
Returns the number of bytes transmitted.
uint32_t GetCumulativeRxBytes() const
Returns the cumulative number of bytes received.
uint32_t GetTxPkts() const
Returns the number of packets transmitted.
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.
void SetDefaultAttributeValues() override
Sets default attribute values.
void ConfigureApplications() override
Configure applications.
int64_t m_streamIndex
used to get consistent random numbers across scenarios
std::string m_saveConfigFilename
save config file name
void ProcessOutputs() override
Process outputs.
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
void ParseCommandLineArguments(int argc, char **argv) override
Process command line arguments.
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
void ConfigureMobility() override
Configure mobility.
std::string m_phyModeB
phy mode
void CheckThroughput()
Checks the throughput and outputs summary to CSV file1.
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.
void SetupLogging()
Set up logging.
double m_txMaxDelayMs
transmit maximum delay
void ConfigureDevices() override
Configure devices.
double m_gpsAccuracyNs
GPS accuracy.
void ConfigureChannels() override
Configure channels.
std::string m_lossModelName
loss model name
void ConfigureTracing() override
Configure tracing.
bool m_routingTables
routing tables
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
double m_TotalSimTime
total sim time
void RunSimulation() override
Run the simulation.
void SetupAdhocMobilityNodes()
Set up the adhoc mobility nodes.
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.
void ConfigureNodes() override
Configure nodes.
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 signature for Phy/TxDrop.
uint32_t m_phyTxBytes
phy transmit bytes
static TypeId GetTypeId()
Gets the class TypeId.
WifiPhyStats()
Constructor.
void PhyTxTrace(std::string context, Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
Callback signature for Phy/Tx trace.
uint32_t GetTxBytes() const
Returns the number of bytes that have been transmitted (this includes MAC/PHY overhead)
~WifiPhyStats() override
Destructor.
void PhyRxDrop(std::string context, Ptr< const Packet > packet, WifiPhyRxfailureReason reason)
Callback signature for Phy/RxDrop.
uint32_t m_phyTxPkts
phy transmit packets
a polymophic address class
Definition: address.h:100
AttributeValue implementation for Address.
Helper class that adds AODV routing to nodes.
Definition: aodv-helper.h:36
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void Stop(Time stop) const
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:173
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.
AttributeValue implementation for Boolean.
Definition: boolean.h:37
bool Get() const
Definition: boolean.cc:55
Parse command-line arguments.
Definition: command-line.h:232
Introspection did not find any typical Config paths.
Definition: config-store.h:61
void ConfigureDefaults()
Configure the default values.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
double Get() const
Definition: double.cc:37
Helper class that adds DSDV routing to nodes.
Definition: dsdv-helper.h:47
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:76
bool SetValue(const AttributeValue &value)
Set the value of this GlobalValue.
an Inet address class
Ipv4Address GetIpv4() 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:43
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.
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 SetMobilityModel(std::string type, Ts &&... args)
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:56
uint32_t GetId() const
Definition: node.cc:117
Nqos Wave Mac Helper class.
Helper class which can read ns-2 movement files and configure nodes mobility.
void Install() const
Read the ns2 trace file and configure the movement patterns of all nodes contained in the global ns3:...
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
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:89
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:471
Helper class that adds OLSR routing to nodes.
Definition: olsr-helper.h:42
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:44
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() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:863
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< Node > GetNode() const =0
Return the node this socket is associated with.
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.
Hold variables of type string.
Definition: string.h:56
std::string Get() const
Definition: string.cc:31
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:417
AttributeValue implementation for Time.
Definition: nstime.h:1423
Time Get() const
Definition: time.cc:532
a unique identifier for an interface.
Definition: type-id.h:60
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
Hold an unsigned integer type.
Definition: uinteger.h:45
uint64_t Get() const
Definition: uinteger.cc:37
double GetValue(double min, double max)
Get the next random value drawn from the distribution.
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:116
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
Definition: wave-helper.cc:335
void SetRemoteStationManager(std::string type, Ts &&... args)
Definition: wave-helper.h:224
helps to create wifi 802.11p objects of WifiNetDevice class
NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &macHelper, NodeContainer c) const override
helps to create WifiNetDevice objects
Definition: wifi-helper.h:325
void SetRemoteStationManager(std::string type, Args &&... args)
Helper function used to set the station manager.
Definition: wifi-helper.h:605
create MAC layers for a ns3::WifiNetDevice.
void SetType(std::string type, Args &&... args)
represent a single transmission mode
Definition: wifi-mode.h:50
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:543
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:163
To trace WaveNetDevice, we have to overwrite the trace functions of class YansWifiPhyHelper.
Definition: wave-helper.h:42
manage and create wifi channel objects for the YANS model.
void SetPropagationDelay(std::string name, Ts &&... args)
void AddPropagationLoss(std::string name, Ts &&... args)
Ptr< YansWifiChannel > Create() const
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 > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeChecker > MakeStringChecker()
Definition: string.cc:30
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:891
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:975
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:254
#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:202
#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:275
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Definition: callback.h:768
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time Now()
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:296
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1348
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:848
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:305
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:707
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:535
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
Definition: log.h:104
Definition: olsr.py:1
cmd
Definition: second.py:33
channel
Definition: third.py:81
wifi
Definition: third.py:88
mobility
Definition: third.py:96
#define list
static ns3::GlobalValue g_port("VRCport", "Port", ns3::UintegerValue(9), ns3::MakeUintegerChecker< uint32_t >())
Port.
static ns3::GlobalValue g_traceMobility("VRCtraceMobility", "Enable trace mobility", ns3::BooleanValue(false), ns3::MakeBooleanChecker())
Trace mobility 1=yes;0=no.
static ns3::GlobalValue g_asciiTrace("VRCasciiTrace", "Dump ASCII trace", ns3::BooleanValue(false), ns3::MakeBooleanChecker())
Dump ASCII trace 0=no;1=yes.
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_verbose("VRCverbose", "Enable verbose", ns3::BooleanValue(false), ns3::MakeBooleanChecker())
Verbose 0=no;1=yes.
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_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_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_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_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_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_pcap("VRCpcap", "Generate PCAP files", ns3::BooleanValue(false), ns3::MakeBooleanChecker())
Generate PCAP files 0=no;1=yes.
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_routingTables("VRCroutingTables", "Dump routing tables at t=5 seconds", ns3::BooleanValue(false), ns3::MakeBooleanChecker())
Dump routing tables at t=5 seconds 0=no;1=yes.
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:72
uint32_t pktSize
packet size used for the simulation (in bytes)
std::vector< uint64_t > GetRxBytes(bool udp, const ApplicationContainer &serverApp, uint32_t payloadSize)
Ptr< PacketSink > sink
Pointer to the packet sink application.
Definition: wifi-tcp.cc:55