52 #include "ns3/core-module.h"
53 #include "ns3/wifi-net-device.h"
54 #include "ns3/yans-wifi-channel.h"
55 #include "ns3/yans-wifi-phy.h"
56 #include "ns3/propagation-loss-model.h"
57 #include "ns3/propagation-delay-model.h"
58 #include "ns3/error-rate-model.h"
59 #include "ns3/yans-error-rate-model.h"
61 #include "ns3/mobility-model.h"
62 #include "ns3/constant-position-mobility-model.h"
63 #include "ns3/vector.h"
64 #include "ns3/packet.h"
65 #include "ns3/simulator.h"
66 #include "ns3/nstime.h"
67 #include "ns3/command-line.h"
68 #include "ns3/wifi-tx-vector.h"
95 void SendA (
void)
const;
96 void SendB (
void)
const;
105 Ptr<Packet> p = Create<Packet> (m_input.packetSizeA);
108 txVector.SetMode (
WifiMode (m_input.txModeA));
109 m_txA->SendPacket (p, txVector, m_input.preamble,
NORMAL_MPDU);
115 Ptr<Packet> p = Create<Packet> (m_input.packetSizeB);
118 txVector.SetMode (
WifiMode (m_input.txModeB));
119 m_txB->SendPacket (p, txVector, m_input.preamble,
NORMAL_MPDU);
129 txModeA (
"OfdmRate54Mbps"),
130 txModeB (
"OfdmRate54Mbps"),
145 double range = std::max (std::abs (input.
xA), input.
xB);
160 m_txA = CreateObject<YansWifiPhy> ();
161 m_txB = CreateObject<YansWifiPhy> ();
166 m_txB->SetErrorRateModel (error);
167 rx->SetErrorRateModel (error);
169 m_txB->SetChannel (channel);
170 rx->SetChannel (channel);
172 m_txB->SetMobility (posTxB);
173 rx->SetMobility (posRx);
176 m_txB->ConfigureStandard (input.
standard);
177 rx->ConfigureStandard (input.
standard);
183 Simulator::Destroy ();
187 int main (
int argc,
char *argv[])
190 std::string str_standard =
"WIFI_PHY_STANDARD_80211a";
191 std::string str_preamble =
"WIFI_PREAMBLE_LONG";
195 cmd.
AddValue (
"delay",
"Delay in microseconds between frame transmission from sender A and frame transmission from sender B", delay);
196 cmd.
AddValue (
"xA",
"The position of transmitter A (< 0)", input.
xA);
197 cmd.
AddValue (
"xB",
"The position of transmitter B (> 0)", input.
xB);
202 cmd.
AddValue (
"txModeA",
"Wifi mode used for payload transmission of sender A", input.
txModeA);
203 cmd.
AddValue (
"txModeB",
"Wifi mode used for payload transmission of sender B", input.
txModeB);
204 cmd.
AddValue (
"standard",
"IEEE 802.11 flavor", str_standard);
205 cmd.
AddValue (
"preamble",
"Type of preamble", str_preamble);
206 cmd.
Parse (argc, argv);
213 if (input.
xA >= 0 || input.
xB <= 0)
215 std::cout <<
"Value of xA must be smaller than 0 and value of xB must be bigger than 0!" << std::endl;
219 if (str_standard ==
"WIFI_PHY_STANDARD_80211a")
223 else if (str_standard ==
"WIFI_PHY_STANDARD_80211b")
227 else if (str_standard ==
"WIFI_PHY_STANDARD_80211g")
231 else if (str_standard ==
"WIFI_PHY_STANDARD_80211n_2_4GHZ")
235 else if (str_standard ==
"WIFI_PHY_STANDARD_80211n_5GHZ")
239 else if (str_standard ==
"WIFI_PHY_STANDARD_80211ac")
266 std::cout <<
"Preamble does not exist or is not compatible with the selected standard!" << std::endl;
271 experiment.
Run (input);
ERP-OFDM PHY (Clause 19, Section 19.5)
void experiment(bool enableCtsRts)
Run single 10 seconds experiment with enabled or disabled RTS/CTS mechanism.
Simulation virtual time values and global simulation resolution.
HT OFDM PHY for the 5 GHz band (clause 20)
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetErrorRateModel(Ptr< ErrorRateModel > rate)
Sets the error rate model.
void SetPropagationLossModel(Ptr< PropagationLossModel > loss)
void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
HT OFDM PHY for the 2.4 GHz band (clause 20)
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
void SetMobility(Ptr< MobilityModel > mobility)
assign a mobility model to this device
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
The MPDU is not part of an A-MPDU.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Parse command-line arguments.
void SetChannel(Ptr< YansWifiChannel > channel)
Set the YansWifiChannel this YansWifiPhy is to be connected to.
OFDM PHY for the 5 GHz band (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
void Run(struct InterferenceExperiment::Input input)
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
void SetPosition(const Vector &position)
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
virtual void ConfigureStandard(enum WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetDefault(std::string name, const AttributeValue &value)
void Parse(int argc, char *argv[])
Parse the program arguments.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
This class can be used to hold variables of floating point type such as 'double' or 'float'...