remove extra WifiPhy::SendPacket argument. Add header mode support
This commit is contained in:
1 parent
77d313ebaf
commit
f286cbaff4
5 files changed
+25
-30
No files matched your search
@@ -50,13 +50,13 @@ MacParameters::Initialize80211a (WifiPhy const*phy)
|
||||
WifiMacHeader hdr;
|
||||
hdr.SetType (WIFI_MAC_CTL_CTS);
|
||||
m_ctsTimeout = m_sifs;
|
||||
m_ctsTimeout += phy->CalculateTxDuration (hdr.GetSize (), phy->GetMode (0));
|
||||
m_ctsTimeout += phy->CalculateTxDuration (hdr.GetSize (), phy->GetMode (0), phy->GetMode (0));
|
||||
m_ctsTimeout += m_maxPropagationDelay * Scalar (2);
|
||||
m_ctsTimeout += m_slot;
|
||||
|
||||
hdr.SetType (WIFI_MAC_CTL_ACK);
|
||||
m_ackTimeout = m_sifs;
|
||||
m_ackTimeout += phy->CalculateTxDuration (hdr.GetSize (), phy->GetMode (0));
|
||||
m_ackTimeout += phy->CalculateTxDuration (hdr.GetSize (), phy->GetMode (0), phy->GetMode (0));
|
||||
m_ackTimeout += m_maxPropagationDelay * Scalar (2);
|
||||
m_ackTimeout += m_slot;
|
||||
}
|
||||
|
||||
@@ -30,12 +30,11 @@
|
||||
namespace ns3 {
|
||||
|
||||
WifiChannel::ReceiveData::ReceiveData (const Packet &packet, double rxPowerDbm,
|
||||
WifiMode txMode, WifiMode headerMode, uint32_t extra)
|
||||
WifiMode txMode, WifiMode headerMode)
|
||||
: m_packet (packet),
|
||||
m_rxPowerDbm (rxPowerDbm),
|
||||
m_wifiMode (txMode),
|
||||
m_headerMode (headerMode),
|
||||
m_extra (extra)
|
||||
m_headerMode (headerMode)
|
||||
{}
|
||||
|
||||
|
||||
@@ -62,7 +61,7 @@ WifiChannel::Add (Ptr<NetDevice> device, ReceiveCallback callback)
|
||||
}
|
||||
void
|
||||
WifiChannel::Send (Ptr<NetDevice> sender, const Packet &packet, double txPowerDbm,
|
||||
WifiMode wifiMode, WifiMode headerMode, uint32_t extra) const
|
||||
WifiMode wifiMode, WifiMode headerMode) const
|
||||
{
|
||||
Ptr<MobilityModel> senderMobility = sender->GetNode ()->QueryInterface<MobilityModel> (MobilityModel::iid);
|
||||
uint32_t j = 0;
|
||||
@@ -74,7 +73,7 @@ WifiChannel::Send (Ptr<NetDevice> sender, const Packet &packet, double txPowerDb
|
||||
double distance = senderMobility->GetDistanceFrom (receiverMobility);
|
||||
Time delay = m_delay->GetDelay (distance);
|
||||
double rxPowerDbm = m_loss->GetRxPower (txPowerDbm, distance);
|
||||
struct ReceiveData data = ReceiveData (packet, rxPowerDbm, wifiMode, headerMode, extra);
|
||||
struct ReceiveData data = ReceiveData (packet, rxPowerDbm, wifiMode, headerMode);
|
||||
Simulator::Schedule (delay, &WifiChannel::Receive, this,
|
||||
j, data);
|
||||
}
|
||||
@@ -86,7 +85,7 @@ void
|
||||
WifiChannel::Receive (uint32_t i,
|
||||
const struct ReceiveData &data) const
|
||||
{
|
||||
m_deviceList[i].second (data.m_packet, data.m_rxPowerDbm, data.m_wifiMode, data.m_headerMode, data.m_extra);
|
||||
m_deviceList[i].second (data.m_packet, data.m_rxPowerDbm, data.m_wifiMode, data.m_headerMode);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
||||
@@ -35,7 +35,7 @@ class PropagationDelayModel;
|
||||
class WifiChannel : public Channel
|
||||
{
|
||||
public:
|
||||
typedef Callback<void,Packet,double,WifiMode,WifiMode,uint32_t> ReceiveCallback;
|
||||
typedef Callback<void,Packet,double,WifiMode,WifiMode> ReceiveCallback;
|
||||
WifiChannel ();
|
||||
virtual ~WifiChannel ();
|
||||
|
||||
@@ -47,18 +47,17 @@ public:
|
||||
|
||||
void Add (Ptr<NetDevice> device, ReceiveCallback callback);
|
||||
void Send (Ptr<NetDevice> sender, const Packet &packet, double txPowerDbm,
|
||||
WifiMode wifiMode, WifiMode headerMode, uint32_t extra) const;
|
||||
WifiMode wifiMode, WifiMode headerMode) const;
|
||||
|
||||
private:
|
||||
typedef std::vector<std::pair<Ptr<NetDevice>, ReceiveCallback> > DeviceList;
|
||||
struct ReceiveData {
|
||||
ReceiveData (const Packet &packet, double rxPowerDbm,
|
||||
WifiMode txMode, WifiMode headerMode, uint32_t extra);
|
||||
WifiMode txMode, WifiMode headerMode);
|
||||
Packet m_packet;
|
||||
double m_rxPowerDbm;
|
||||
WifiMode m_wifiMode;
|
||||
WifiMode m_headerMode;
|
||||
uint32_t m_extra;
|
||||
};
|
||||
void Receive (uint32_t i,
|
||||
const struct ReceiveData &data) const;
|
||||
|
||||
@@ -246,10 +246,9 @@ void
|
||||
WifiPhy::ReceivePacket (Packet const packet,
|
||||
double rxPowerW,
|
||||
WifiMode txMode,
|
||||
WifiMode headerMode,
|
||||
uint32_t extra)
|
||||
WifiMode headerMode)
|
||||
{
|
||||
Time rxDuration = CalculateTxDuration (packet.GetSize (), txMode);
|
||||
Time rxDuration = CalculateTxDuration (packet.GetSize (), txMode, headerMode);
|
||||
Time endRx = Simulator::Now () + rxDuration;
|
||||
m_startRxLogger (rxDuration, rxPowerW);
|
||||
|
||||
@@ -288,8 +287,7 @@ WifiPhy::ReceivePacket (Packet const packet,
|
||||
assert (m_endSyncEvent.IsExpired ());
|
||||
m_endSyncEvent = Simulator::Schedule (rxDuration, &WifiPhy::EndSync, this,
|
||||
packet,
|
||||
event,
|
||||
extra);
|
||||
event);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -337,7 +335,7 @@ WifiPhy::ReceivePacket (Packet const packet,
|
||||
event->Unref ();
|
||||
}
|
||||
void
|
||||
WifiPhy::SendPacket (Packet const packet, WifiMode txMode, WifiMode headerMode, uint8_t txPower, uint32_t stuff)
|
||||
WifiPhy::SendPacket (Packet const packet, WifiMode txMode, WifiMode headerMode, uint8_t txPower)
|
||||
{
|
||||
/* Transmission can happen if:
|
||||
* - we are syncing on a packet. It is the responsability of the
|
||||
@@ -351,11 +349,11 @@ WifiPhy::SendPacket (Packet const packet, WifiMode txMode, WifiMode headerMode,
|
||||
m_endSyncEvent.Cancel ();
|
||||
}
|
||||
|
||||
Time txDuration = CalculateTxDuration (packet.GetSize (), txMode);
|
||||
Time txDuration = CalculateTxDuration (packet.GetSize (), txMode, headerMode);
|
||||
m_startTxLogger (txDuration, txMode.GetPhyRate (), GetPowerDbm (txPower));
|
||||
NotifyTxStart (txDuration);
|
||||
SwitchToTx (txDuration);
|
||||
m_channel->Send (m_device, packet, GetPowerDbm (txPower) + m_txGainDbm, txMode, headerMode, stuff);
|
||||
m_channel->Send (m_device, packet, GetPowerDbm (txPower) + m_txGainDbm, txMode, headerMode);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -519,10 +517,10 @@ WifiPhy::GetDelayUntilIdle (void)
|
||||
|
||||
|
||||
Time
|
||||
WifiPhy::CalculateTxDuration (uint32_t size, WifiMode payloadMode) const
|
||||
WifiPhy::CalculateTxDuration (uint32_t size, WifiMode payloadMode, WifiMode headerMode) const
|
||||
{
|
||||
uint64_t delay = m_plcpPreambleDelayUs;
|
||||
delay += m_plcpHeaderLength * 1000000 / GetMode (0).GetDataRate ();
|
||||
delay += m_plcpHeaderLength * 1000000 / headerMode.GetDataRate ();
|
||||
uint64_t nbits = size * 8;
|
||||
delay += nbits * 1000000 / payloadMode.GetDataRate ();
|
||||
return MicroSeconds (delay);
|
||||
@@ -1164,7 +1162,7 @@ WifiPhy::CalculatePer (Ptr<const RxEvent> event, NiChanges *ni) const
|
||||
|
||||
|
||||
void
|
||||
WifiPhy::EndSync (Packet const packet, Ptr<RxEvent> event, uint32_t extra)
|
||||
WifiPhy::EndSync (Packet const packet, Ptr<RxEvent> event)
|
||||
{
|
||||
assert (IsStateSync ());
|
||||
assert (event->GetEndTime () == Simulator::Now ());
|
||||
@@ -1188,7 +1186,7 @@ WifiPhy::EndSync (Packet const packet, Ptr<RxEvent> event, uint32_t extra)
|
||||
m_endSyncLogger (true);
|
||||
NotifySyncEndOk ();
|
||||
SwitchFromSync ();
|
||||
m_syncOkCallback (packet, snr, event->GetPayloadMode (), event->GetHeaderMode (), extra);
|
||||
m_syncOkCallback (packet, snr, event->GetPayloadMode (), event->GetHeaderMode ());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
class WifiPhy
|
||||
{
|
||||
public:
|
||||
typedef Callback<void,Packet const , double, WifiMode, WifiMode, uint32_t> SyncOkCallback;
|
||||
typedef Callback<void,Packet const , double, WifiMode, WifiMode> SyncOkCallback;
|
||||
typedef Callback<void,Packet const , double> SyncErrorCallback;
|
||||
|
||||
WifiPhy (Ptr<WifiNetDevice> device);
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
void SetReceiveOkCallback (SyncOkCallback callback);
|
||||
void SetReceiveErrorCallback (SyncErrorCallback callback);
|
||||
|
||||
void SendPacket (Packet const packet, WifiMode mode, WifiMode headeMode, uint8_t txPower, uint32_t stuff);
|
||||
void SendPacket (Packet const packet, WifiMode mode, WifiMode headerMode, uint8_t txPower);
|
||||
|
||||
void RegisterListener (WifiPhyListener *listener);
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
Time GetStateDuration (void);
|
||||
Time GetDelayUntilIdle (void);
|
||||
|
||||
Time CalculateTxDuration (uint32_t size, WifiMode payloadMode) const;
|
||||
Time CalculateTxDuration (uint32_t size, WifiMode payloadMode, WifiMode headerMode) const;
|
||||
|
||||
void Configure80211a (void);
|
||||
void SetEdThresholdDbm (double rxThreshold);
|
||||
@@ -157,7 +157,7 @@ private:
|
||||
double CalculateSnr (double signal, double noiseInterference, WifiMode mode) const;
|
||||
double CalculateChunkSuccessRate (double snir, Time delay, WifiMode mode) const;
|
||||
double CalculatePer (Ptr<const RxEvent> event, NiChanges *ni) const;
|
||||
void EndSync (Packet const packet, Ptr<RxEvent> event, uint32_t stuff);
|
||||
void EndSync (Packet const packet, Ptr<RxEvent> event);
|
||||
double Log2 (double val) const;
|
||||
double GetBpskBer (double snr, uint32_t signalSpread, uint32_t phyRate) const;
|
||||
double GetQamBer (double snr, unsigned int m, uint32_t signalSpread, uint32_t phyRate) const;
|
||||
@@ -179,8 +179,7 @@ private:
|
||||
void ReceivePacket (Packet packet,
|
||||
double rxPowerW,
|
||||
WifiMode mode,
|
||||
WifiMode headerMode,
|
||||
uint32_t stuff);
|
||||
WifiMode headerMode);
|
||||
private:
|
||||
uint64_t m_txPrepareDelayUs;
|
||||
uint64_t m_plcpPreambleDelayUs;
|
||||
|
||||
Reference in new issue
Block a user