31 #include "ns3/packet.h" |
31 #include "ns3/packet.h" |
32 #include "ns3/simulator.h" |
32 #include "ns3/simulator.h" |
33 #include "ns3/nstime.h" |
33 #include "ns3/nstime.h" |
34 #include "ns3/command-line.h" |
34 #include "ns3/command-line.h" |
35 #include "ns3/flow-id-tag.h" |
35 #include "ns3/flow-id-tag.h" |
|
36 #include "ns3/wifi-tx-vector.h" |
36 |
37 |
37 using namespace ns3; |
38 using namespace ns3; |
38 |
39 |
39 class PsrExperiment |
40 class PsrExperiment |
40 { |
41 { |
67 void |
68 void |
68 PsrExperiment::Send (void) |
69 PsrExperiment::Send (void) |
69 { |
70 { |
70 Ptr<Packet> p = Create<Packet> (m_input.packetSize); |
71 Ptr<Packet> p = Create<Packet> (m_input.packetSize); |
71 WifiMode mode = WifiMode (m_input.txMode); |
72 WifiMode mode = WifiMode (m_input.txMode); |
72 m_tx->SendPacket (p, mode, WIFI_PREAMBLE_SHORT, m_input.txPowerLevel); |
73 WifiTxVector txVector; |
|
74 txVector.SetTxPowerLevel (m_input.txPowerLevel); |
|
75 txVector.SetMode (mode); |
|
76 m_tx->SendPacket (p, mode, WIFI_PREAMBLE_SHORT, txVector); |
73 } |
77 } |
74 |
78 |
75 void |
79 void |
76 PsrExperiment::Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble) |
80 PsrExperiment::Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble) |
77 { |
81 { |
169 void |
173 void |
170 CollisionExperiment::SendA (void) const |
174 CollisionExperiment::SendA (void) const |
171 { |
175 { |
172 Ptr<Packet> p = Create<Packet> (m_input.packetSizeA); |
176 Ptr<Packet> p = Create<Packet> (m_input.packetSizeA); |
173 p->AddByteTag (FlowIdTag (m_flowIdA)); |
177 p->AddByteTag (FlowIdTag (m_flowIdA)); |
|
178 WifiTxVector txVector; |
|
179 txVector.SetTxPowerLevel (m_input.txPowerLevelA); |
|
180 txVector.SetMode (WifiMode (m_input.txModeA)); |
174 m_txA->SendPacket (p, WifiMode (m_input.txModeA), |
181 m_txA->SendPacket (p, WifiMode (m_input.txModeA), |
175 WIFI_PREAMBLE_SHORT, m_input.txPowerLevelA); |
182 WIFI_PREAMBLE_SHORT, txVector); |
176 } |
183 } |
177 |
184 |
178 void |
185 void |
179 CollisionExperiment::SendB (void) const |
186 CollisionExperiment::SendB (void) const |
180 { |
187 { |
181 Ptr<Packet> p = Create<Packet> (m_input.packetSizeB); |
188 Ptr<Packet> p = Create<Packet> (m_input.packetSizeB); |
182 p->AddByteTag (FlowIdTag (m_flowIdB)); |
189 p->AddByteTag (FlowIdTag (m_flowIdB)); |
|
190 WifiTxVector txVector; |
|
191 txVector.SetTxPowerLevel (m_input.txPowerLevelB); |
|
192 txVector.SetMode (WifiMode (m_input.txModeB)); |
183 m_txB->SendPacket (p, WifiMode (m_input.txModeB), |
193 m_txB->SendPacket (p, WifiMode (m_input.txModeB), |
184 WIFI_PREAMBLE_SHORT, m_input.txPowerLevelB); |
194 WIFI_PREAMBLE_SHORT, txVector); |
185 } |
195 } |
186 |
196 |
187 void |
197 void |
188 CollisionExperiment::Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble) |
198 CollisionExperiment::Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble) |
189 { |
199 { |