OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #include "ns3/olsr-helper.h" | 58 #include "ns3/olsr-helper.h" |
59 | 59 |
60 using namespace ns3; | 60 using namespace ns3; |
61 | 61 |
62 NS_LOG_COMPONENT_DEFINE ("multirate"); | 62 NS_LOG_COMPONENT_DEFINE ("multirate"); |
63 | 63 |
64 class Experiment | 64 class Experiment |
65 { | 65 { |
66 public: | 66 public: |
67 Experiment (); | 67 Experiment (); |
| 68 /** |
| 69 * Constructor |
| 70 * |
| 71 * \param name reference name |
| 72 */ |
68 Experiment (std::string name); | 73 Experiment (std::string name); |
| 74 /** |
| 75 * Run experiment function |
| 76 * \param wifi the wifi helper |
| 77 * \param wifiPhy the wifi phy layer |
| 78 * \param wifiMac the wifi MAC layer |
| 79 * \param wifiChannel the wifi channel |
| 80 * \param mobility the mobility model |
| 81 * \returns a 2D dataset |
| 82 */ |
69 Gnuplot2dDataset Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy
, | 83 Gnuplot2dDataset Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy
, |
70 const WifiMacHelper &wifiMac, const YansWifiChannelHelpe
r &wifiChannel, const MobilityHelper &mobility); | 84 const WifiMacHelper &wifiMac, const YansWifiChannelHelpe
r &wifiChannel, const MobilityHelper &mobility); |
71 | 85 |
| 86 /** |
| 87 * Command line function |
| 88 * \param argc the number of command line arguments |
| 89 * \param argv the command line arguments |
| 90 * \returns true |
| 91 */ |
72 bool CommandSetup (int argc, char **argv); | 92 bool CommandSetup (int argc, char **argv); |
| 93 /** |
| 94 * Is routing function |
| 95 * \returns true if routing enabled |
| 96 */ |
73 bool IsRouting () | 97 bool IsRouting () |
74 { | 98 { |
75 return (enableRouting == 1) ? 1 : 0; | 99 return (enableRouting == 1) ? 1 : 0; |
76 } | 100 } |
| 101 /** |
| 102 * Is mobility function |
| 103 * \returns true if mobility enabled |
| 104 */ |
77 bool IsMobility () | 105 bool IsMobility () |
78 { | 106 { |
79 return (enableMobility == 1) ? 1 : 0; | 107 return (enableMobility == 1) ? 1 : 0; |
80 } | 108 } |
81 | 109 |
| 110 /** |
| 111 * Get scenario |
| 112 * \returns the scenario |
| 113 */ |
82 uint32_t GetScenario () | 114 uint32_t GetScenario () |
83 { | 115 { |
84 return scenario; | 116 return scenario; |
85 } | 117 } |
86 | 118 |
| 119 /** |
| 120 * Get RTS/CTS threshold |
| 121 * \returns the RTS/CTS threshold |
| 122 */ |
87 std::string GetRtsThreshold () | 123 std::string GetRtsThreshold () |
88 { | 124 { |
89 return rtsThreshold; | 125 return rtsThreshold; |
90 } | 126 } |
| 127 /** |
| 128 * Get output trace file name |
| 129 * \returns the output file name |
| 130 */ |
91 std::string GetOutputFileName () | 131 std::string GetOutputFileName () |
92 { | 132 { |
93 return outputFileName; | 133 return outputFileName; |
94 } | 134 } |
| 135 /** |
| 136 * Get rate manager |
| 137 * \returns the rate manager |
| 138 */ |
95 std::string GetRateManager () | 139 std::string GetRateManager () |
96 { | 140 { |
97 return rateManager; | 141 return rateManager; |
98 } | 142 } |
99 | 143 |
100 private: | 144 private: |
| 145 |
| 146 /** |
| 147 * Setup packet receive function |
| 148 * \param node the node |
| 149 * \returns the socket to receive on |
| 150 */ |
101 Ptr<Socket> SetupPacketReceive (Ptr<Node> node); | 151 Ptr<Socket> SetupPacketReceive (Ptr<Node> node); |
| 152 /** |
| 153 * Generate neighbors function |
| 154 * |
| 155 * \param c list of nodes |
| 156 * \param senderId send ID |
| 157 * \return NodeContainer list of neighbors |
| 158 */ |
102 NodeContainer GenerateNeighbors (NodeContainer c, uint32_t senderId); | 159 NodeContainer GenerateNeighbors (NodeContainer c, uint32_t senderId); |
103 | 160 |
| 161 /** |
| 162 * setup application function |
| 163 * \param client the client node |
| 164 * \param server the server node |
| 165 * \param start the start time in seconds |
| 166 * \param stop the stop time in seconds |
| 167 */ |
104 void ApplicationSetup (Ptr<Node> client, Ptr<Node> server, double start, doubl
e stop); | 168 void ApplicationSetup (Ptr<Node> client, Ptr<Node> server, double start, doubl
e stop); |
| 169 /** |
| 170 * Assign neighbors function |
| 171 * |
| 172 * \param c list of nodes |
| 173 */ |
105 void AssignNeighbors (NodeContainer c); | 174 void AssignNeighbors (NodeContainer c); |
| 175 /** |
| 176 * Select source and dest node |
| 177 * |
| 178 * \param c list of nodes |
| 179 */ |
106 void SelectSrcDest (NodeContainer c); | 180 void SelectSrcDest (NodeContainer c); |
| 181 /** |
| 182 * Receive packet function |
| 183 * \param socket the socket to recieve on |
| 184 */ |
107 void ReceivePacket (Ptr<Socket> socket); | 185 void ReceivePacket (Ptr<Socket> socket); |
| 186 /// Check throughput function |
108 void CheckThroughput (); | 187 void CheckThroughput (); |
| 188 /** |
| 189 * Send to multiple destinations function |
| 190 * |
| 191 * \param sender sender node· |
| 192 * \param c list of nodes |
| 193 */ |
109 void SendMultiDestinations (Ptr<Node> sender, NodeContainer c); | 194 void SendMultiDestinations (Ptr<Node> sender, NodeContainer c); |
110 | 195 |
111 Gnuplot2dDataset m_output; | 196 Gnuplot2dDataset m_output; ///< output data set |
112 | 197 |
113 double totalTime; | 198 double totalTime; ///< total simuation time |
114 double expMean; | 199 double expMean; ///< exponential sampling mean |
115 double samplingPeriod; | 200 double samplingPeriod; ///< sampling period time |
116 | 201 |
117 uint32_t bytesTotal; | 202 uint32_t bytesTotal; ///< total bytes received |
118 uint32_t packetSize; | 203 uint32_t packetSize; ///< packet size |
119 uint32_t gridSize; | 204 uint32_t gridSize; ///< grid dimension (square) |
120 uint32_t nodeDistance; | 205 uint32_t nodeDistance; ///< distnace between nodes |
121 uint32_t port; | 206 uint32_t port; ///< communication port |
122 uint32_t scenario; | 207 uint32_t scenario; ///<test scenario |
123 | 208 |
124 bool enablePcap; | 209 bool enablePcap; ///< enable PCAP tracing |
125 bool enableTracing; | 210 bool enableTracing; ///< enable ASCII tracing |
126 bool enableFlowMon; | 211 bool enableFlowMon; ///< enable flow monitoring |
127 bool enableRouting; | 212 bool enableRouting; ///< enable routing (static and OLSR) |
128 bool enableMobility; | 213 bool enableMobility; ///< enable modility |
129 | 214 |
130 NodeContainer containerA, containerB, containerC, containerD; | 215 // Sets of nodes by quadrant |
131 std::string rtsThreshold, rateManager, outputFileName; | 216 NodeContainer containerA; ///< quandrant A nodes |
| 217 NodeContainer containerB; ///< quadrant B nodes |
| 218 NodeContainer containerC; ///< quadrant C nodes |
| 219 NodeContainer containerD; ///< quadrant D nodes |
| 220 std::string rtsThreshold; ///< threshold for RTS/CTS |
| 221 std::string rateManager; ///< name of the Wifi rate manager implementation |
| 222 std::string outputFileName; ///< nameof the trace file name |
132 }; | 223 }; |
133 | 224 |
134 Experiment::Experiment () | 225 Experiment::Experiment () |
135 { | 226 { |
136 } | 227 } |
137 | 228 |
138 Experiment::Experiment (std::string name) | 229 Experiment::Experiment (std::string name) |
139 : m_output (name), | 230 : m_output (name), |
140 totalTime (0.3), | 231 totalTime (0.3), |
141 expMean (0.1), | 232 expMean (0.1), |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 NS_LOG_INFO ("Routing: " << experiment.IsRouting ()); | 699 NS_LOG_INFO ("Routing: " << experiment.IsRouting ()); |
609 NS_LOG_INFO ("Mobility: " << experiment.IsMobility ()); | 700 NS_LOG_INFO ("Mobility: " << experiment.IsMobility ()); |
610 | 701 |
611 dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel, mobility); | 702 dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel, mobility); |
612 | 703 |
613 gnuplot.AddDataset (dataset); | 704 gnuplot.AddDataset (dataset); |
614 gnuplot.GenerateOutput (outfile); | 705 gnuplot.GenerateOutput (outfile); |
615 | 706 |
616 return 0; | 707 return 0; |
617 } | 708 } |
OLD | NEW |