22 #ifndef SIMPLE_OFDM_WIMAX_PHY_H
23 #define SIMPLE_OFDM_WIMAX_PHY_H
27 #include "ns3/callback.h"
28 #include "ns3/nstime.h"
29 #include "ns3/event-id.h"
30 #include "ns3/random-variable-stream.h"
31 #include "wimax-phy.h"
33 #include "ns3/snr-to-block-error-rate-manager.h"
34 #include "wimax-connection.h"
41 class SimpleOfdmWimaxChannel;
49 enum FrameDurationCode
51 FRAME_DURATION_2_POINT_5_MS, FRAME_DURATION_4_MS, FRAME_DURATION_5_MS, FRAME_DURATION_8_MS, FRAME_DURATION_10_MS,
52 FRAME_DURATION_12_POINT_5_MS, FRAME_DURATION_20_MS
55 static TypeId GetTypeId (
void);
110 WimaxPhy::ModulationType modulationType,
190 Time DoGetTransmissionTime (uint32_t size, WimaxPhy::ModulationType modulationType)
const;
191 uint64_t DoGetNrSymbols (uint32_t size, WimaxPhy::ModulationType modulationType)
const;
192 uint64_t DoGetNrBytes (uint32_t symbols, WimaxPhy::ModulationType modulationType)
const;
195 void CreateFecBlocks (
const bvec &buffer, WimaxPhy::ModulationType modulationType);
196 bvec RecreateBuffer ();
197 uint32_t GetFecBlockSize (WimaxPhy::ModulationType type)
const;
198 uint32_t GetCodedFecBlockSize (WimaxPhy::ModulationType modulationType)
const;
199 void SetBlockParameters (uint32_t burstSize, WimaxPhy::ModulationType modulationType);
200 uint16_t GetNrBlocks (uint32_t burstSize, WimaxPhy::ModulationType modulationType)
const;
203 void EndSendFecBlock (WimaxPhy::ModulationType modulationType, uint8_t direction);
205 void EndReceiveFecBlock (uint32_t burstSize,
206 WimaxPhy::ModulationType modulationType,
210 void StartSendDummyFecBlock (
bool isFirstBlock,
211 WimaxPhy::ModulationType modulationType,
213 Time GetBlockTransmissionTime (WimaxPhy::ModulationType modulationType)
const;
214 void DoSetDataRates (
void);
215 void InitSimpleOfdmWimaxPhy (
void);
217 void GetModulationFecParams (WimaxPhy::ModulationType modulationType, uint8_t &bitsPerSymbol,
double &fecCode)
const;
218 uint32_t CalculateDataRate (WimaxPhy::ModulationType modulationType)
const;
219 uint32_t DoGetDataRate (WimaxPhy::ModulationType modulationType)
const;
220 uint16_t DoGetTtg (
void)
const;
221 uint16_t DoGetRtg (
void)
const;
222 uint8_t DoGetFrameDurationCode (
void)
const;
223 Time DoGetFrameDuration (uint8_t frameDurationCode)
const;
224 void DoSetPhyParameters (
void);
225 uint16_t DoGetNfft (
void)
const;
226 void DoSetNfft (uint16_t);
227 double DoGetSamplingFactor (
void)
const;
228 double DoGetSamplingFrequency (
void)
const;
229 double DoGetGValue (
void)
const;
230 void DoSetGValue (
double);
232 double GetRxGain (
void)
const;
233 void SetRxGain (
double rxgain);
235 double GetTxGain (
void)
const;
236 void SetTxGain (
double txgain);
238 std::string GetTraceFilePath (
void)
const;
239 void SetTraceFilePath (std::string path);
241 uint16_t m_fecBlockSize;
242 uint32_t m_currentBurstSize;
244 std::list<bvec> *m_receivedFecBlocks;
245 uint32_t m_nrFecBlocksSent;
246 std::list<bvec> *m_fecBlocks;
253 uint32_t m_dataRateBpsk12, m_dataRateQpsk12, m_dataRateQpsk34, m_dataRateQam16_12, m_dataRateQam16_34,
254 m_dataRateQam64_23, m_dataRateQam64_34;
258 uint16_t m_nrRemainingBlocksToSend;
260 uint16_t m_blockSize;
261 uint32_t m_paddingBits;
262 uint16_t m_nbErroneousBlock;
263 uint16_t m_nrRecivedFecBlocks;
268 double m_noiseFigure;
void SetNoiseFigure(double nf)
set the noise figure of the device
void StartReceive(uint32_t burstSize, bool isFirstBlock, uint64_t frequency, WimaxPhy::ModulationType modulationType, uint8_t direction, double rxPower, Ptr< PacketBurst > burst)
start the reception of a fec block
smart pointer class similar to boost::intrusive_ptr
void SetSNRToBlockErrorRateTracesPath(char *tracesPath)
Set the path of the repository containing the traces.
TracedCallback< Ptr< PacketBurst > > m_phyRxEndTrace
void Send(Ptr< PacketBurst > burst, WimaxPhy::ModulationType modulationType, uint8_t direction)
Sends a burst on the channel.
void NotifyRxDrop(Ptr< PacketBurst > burst)
void NotifyRxBegin(Ptr< PacketBurst > burst)
int64_t AssignStreams(int64_t stream)
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
void NotifyTxDrop(Ptr< PacketBurst > burst)
void NotifyTxBegin(Ptr< PacketBurst > burst)
TracedCallback< Ptr< PacketBurst > > m_phyTxDropTrace
void SetBandwidth(uint32_t BW)
Set the bandwidth.
TracedCallback< Ptr< PacketBurst > > m_phyTxBeginTrace
Ptr< UniformRandomVariable > m_URNG
Provides uniform random variables.
The SendParams class defines the parameters with which Send() function of a particular PHY is called...
void NotifyRxEnd(Ptr< PacketBurst > burst)
double GetTxPower(void) const
double GetNoiseFigure(void) const
void DoAttach(Ptr< WimaxChannel > channel)
void ActivateLoss(bool loss)
if called with true it will enable the loss model
void NotifyTxEnd(Ptr< PacketBurst > burst)
TracedCallback< Ptr< PacketBurst > > m_phyRxBeginTrace
void SetTxPower(double txPower)
set the transmission power
TracedCallback< Ptr< PacketBurst > > m_phyTxEndTrace
uint32_t GetBandwidth(void) const
WimaxPhy::PhyType GetPhyType(void) const
returns the type this physical layer
void SetReceiveCallback(Callback< void, Ptr< PacketBurst >, Ptr< WimaxConnection > > callback)
set the callback function to call when a burst is received
This class handles the SNR to BlcER traces. A path to a repository containing trace files should be p...
a unique identifier for an interface.
TracedCallback< Ptr< PacketBurst > > m_phyRxDropTrace