/usr/include/ns3.27/ns3/simple-ofdm-wimax-phy.h is in libns3-dev 3.27+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007,2008, 2009 INRIA, UDcast
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
* <amine.ismail@udcast.com>
*/
#ifndef SIMPLE_OFDM_WIMAX_PHY_H
#define SIMPLE_OFDM_WIMAX_PHY_H
#include <stdint.h>
#include <list>
#include "ns3/callback.h"
#include "ns3/nstime.h"
#include "ns3/event-id.h"
#include "ns3/random-variable-stream.h"
#include "wimax-phy.h"
#include "bvec.h"
#include "ns3/snr-to-block-error-rate-manager.h"
#include "wimax-connection.h"
namespace ns3 {
class WimaxChannel;
class WimaxNetDevice;
class NetDevice;
class Packet;
class SimpleOfdmWimaxChannel;
/**
* \ingroup wimax
* \brief SimpleOfdmWimaxPhy class
*/
class SimpleOfdmWimaxPhy : public WimaxPhy
{
public:
/// Frame duration code enumeration
enum FrameDurationCode
{
FRAME_DURATION_2_POINT_5_MS,
FRAME_DURATION_4_MS,
FRAME_DURATION_5_MS,
FRAME_DURATION_8_MS,
FRAME_DURATION_10_MS,
FRAME_DURATION_12_POINT_5_MS,
FRAME_DURATION_20_MS
};
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
SimpleOfdmWimaxPhy (void);
/**
* Constructor
*
* \param tracesPath trace path
*/
SimpleOfdmWimaxPhy (char * tracesPath);
~SimpleOfdmWimaxPhy (void);
/**
* \brief if called with true it will enable the loss model
* \param loss set to true to enable the loss model
*/
void ActivateLoss (bool loss);
/**
* \brief Set the path of the repository containing the traces
* \param tracesPath the path to the repository.
* see snr-to-block-error-rate-manager.h for more details.
*/
void SetSNRToBlockErrorRateTracesPath (char * tracesPath);
/**
* Attach the physical layer to a channel.
* \param channel the channel to which the physical layer will be attached
*/
void DoAttach (Ptr<WimaxChannel> channel);
/**
* \brief set the callback function to call when a burst is received
* \param callback the receive callback function
*/
void SetReceiveCallback (Callback<void, Ptr<PacketBurst>, Ptr<WimaxConnection> > callback);
/**
* \brief Sends a burst on the channel
* \param burst the burst to send
* \param modulationType the modulation that will be used to send this burst
* \param direction set to uplink or downlink
*/
void Send (Ptr<PacketBurst> burst, WimaxPhy::ModulationType modulationType, uint8_t direction);
/**
* \brief Sends a burst on the channel
* \param params parameters
* \see SendParams
*/
void Send (SendParams *params);
/**
* \brief returns the type this physical layer
* \return always WimaxPhy::simpleOfdmWimaxPhy;
*/
WimaxPhy::PhyType GetPhyType (void) const;
/**
* \brief start the reception of a fec block
* \param burstSize the burst size
* \param isFirstBlock true if this block is the first one, false otherwise
* \param frequency the frequency in wich the fec block is being received
* \param modulationType the modulation used to transmit this fec Block
* \param direction set to uplink and downlink
* \param rxPower the received power.
* \param burst the burst to be sent
*/
void StartReceive (uint32_t burstSize,
bool isFirstBlock,
uint64_t frequency,
WimaxPhy::ModulationType modulationType,
uint8_t direction,
double rxPower,
Ptr<PacketBurst> burst);
/**
* \return the bandwidth
*/
uint32_t GetBandwidth (void) const;
/**
* \brief Set the bandwidth
* \param BW the bandwidth
*/
void SetBandwidth (uint32_t BW);
/**
* \return the transmission power
*/
double GetTxPower (void) const;
/**
* \brief set the transmission power
* \param txPower the transmission power
*/
void SetTxPower (double txPower);
/**
* \return the noise figure
*/
double GetNoiseFigure (void) const;
/**
* \brief set the noise figure of the device
* \param nf the noise figure
*/
void SetNoiseFigure (double nf);
/**
* Public method used to fire a PhyTxBegin trace. Implemented for encapsulation
* purposes.
* \param burst the packet burst
*/
void NotifyTxBegin (Ptr<PacketBurst> burst);
/**
* Public method used to fire a PhyTxEnd trace. Implemented for encapsulation
* purposes.
* \param burst the packet burst
*/
void NotifyTxEnd (Ptr<PacketBurst> burst);
/**
* Public method used to fire a PhyTxDrop trace. Implemented for encapsulation
* purposes.
* \param burst the packet burst
*/
void NotifyTxDrop (Ptr<PacketBurst> burst);
/**
* Public method used to fire a PhyRxBegin trace. Implemented for encapsulation
* purposes.
* \param burst the packet burst
*/
void NotifyRxBegin (Ptr<PacketBurst> burst);
/**
* Public method used to fire a PhyRxEnd trace. Implemented for encapsulation
* purposes.
* \param burst the packet burst
*/
void NotifyRxEnd (Ptr<PacketBurst> burst);
/**
* Public method used to fire a PhyRxDrop trace. Implemented for encapsulation
* purposes.
* \param burst the packet burst
*/
void NotifyRxDrop (Ptr<PacketBurst> burst);
/**
* Assign a fixed random variable stream number to the random variables
* used by this model. Return the number of streams (possibly zero) that
* have been assigned.
*
* \param stream first stream index to use
* \return the number of stream indices assigned by this model
*/
int64_t AssignStreams (int64_t stream);
private:
/**
* Get transmission time
* \param size the size
* \param modulationType the modulation type
* \returns the transmission time
*/
Time DoGetTransmissionTime (uint32_t size, WimaxPhy::ModulationType modulationType) const;
/**
* Get number of symbols
* \param size the size
* \param modulationType the modulation type
* \returns the number of symbols
*/
uint64_t DoGetNrSymbols (uint32_t size, WimaxPhy::ModulationType modulationType) const;
/**
* Get number of bytes
* \param symbols the symbols
* \param modulationType the modulation type
* \returns the number of bytes
*/
uint64_t DoGetNrBytes (uint32_t symbols, WimaxPhy::ModulationType modulationType) const;
/**
* Convert burst to bits
* \param burst the packet burst
* \returns the BVEC
*/
bvec ConvertBurstToBits (Ptr<const PacketBurst> burst);
/**
* Convert bits to burst
* \param buffer the BVEC
* \returns the packet burst
*/
Ptr<PacketBurst> ConvertBitsToBurst (bvec buffer);
/**
* Create FEC blocks
* \param buffer the BVEC
* \param modulationType the modulation type
*/
void CreateFecBlocks (const bvec &buffer, WimaxPhy::ModulationType modulationType);
/**
* Recreate buffer
* \returns BVEC
*/
bvec RecreateBuffer ();
/**
* Get FEC block size
* \param type the modulation type
* \returns the FEC block size
*/
uint32_t GetFecBlockSize (WimaxPhy::ModulationType type) const;
/**
* Get coded FEC block size
* \param modulationType the modulation type
* \returns the coded FEC block size
*/
uint32_t GetCodedFecBlockSize (WimaxPhy::ModulationType modulationType) const;
/**
* Set block parameters
* \param burstSize the burst size
* \param modulationType the modulation type
*/
void SetBlockParameters (uint32_t burstSize, WimaxPhy::ModulationType modulationType);
/**
* Get number of blocks
* \param burstSize the burst size
* \param modulationType the modulation type
* \returns the number of blocks
*/
uint16_t GetNrBlocks (uint32_t burstSize, WimaxPhy::ModulationType modulationType) const;
void DoDispose (void);
/// End send
void EndSend (void);
/**
* End send FEC block
* \param modulationType the modulation type
* \param direction the direction
*/
void EndSendFecBlock (WimaxPhy::ModulationType modulationType, uint8_t direction);
/**
* End receive
* \param burst
*/
void EndReceive (Ptr<const PacketBurst> burst);
/**
* End receive FEC block
* \param burstSize the burst size
* \param modulationType the modulation type
* \param direction the direction
* \param drop the drop
* \param burst the burst
*/
void EndReceiveFecBlock (uint32_t burstSize,
WimaxPhy::ModulationType modulationType,
uint8_t direction,
uint8_t drop,
Ptr<PacketBurst> burst);
/**
* Start end dummy FEC block
* \param isFirstBlock is the first block?
* \param modulationType the modulation type
* \param direction the direction
*/
void StartSendDummyFecBlock (bool isFirstBlock,
WimaxPhy::ModulationType modulationType,
uint8_t direction);
/**
* Get block transmission time
* \param modulationType the modulation type
* \returns the block transmission time
*/
Time GetBlockTransmissionTime (WimaxPhy::ModulationType modulationType) const;
/// Set data rates
void DoSetDataRates (void);
/// Initialize simple OFDM WIMAX Phy
void InitSimpleOfdmWimaxPhy (void);
/**
* Get moduleation FEC parameters
* \param modulationType the modulation type
* \param bitsPerSymbol the number of bits per symbol
* \param fecCode the FEC code
*/
void GetModulationFecParams (WimaxPhy::ModulationType modulationType, uint8_t &bitsPerSymbol, double &fecCode) const;
/**
* Calculate data rate
* \param modulationType the modulation type
* \returns the data rate
*/
uint32_t CalculateDataRate (WimaxPhy::ModulationType modulationType) const;
/**
* Get data rate
* \param modulationType the modulation type
* \returns the data rate
*/
uint32_t DoGetDataRate (WimaxPhy::ModulationType modulationType) const;
/**
* Get TTG
* \returns the TTG
*/
uint16_t DoGetTtg (void) const;
/**
* Get RTG
* \returns the RTG
*/
uint16_t DoGetRtg (void) const;
/**
* Get frame duration code
* \returns the frame duration code
*/
uint8_t DoGetFrameDurationCode (void) const;
/**
* Get frame duration
* \param frameDurationCode the frame duration code
* \returns the frame duration
*/
Time DoGetFrameDuration (uint8_t frameDurationCode) const;
/// Set Phy parameters
void DoSetPhyParameters (void);
/**
* Get NFFT
* \returns the NFFT
*/
uint16_t DoGetNfft (void) const;
/**
* Set NFFT
* \param nfft the NFFT
*/
void DoSetNfft (uint16_t nfft);
/**
* Get sampling factor
* \returns the sampling factor
*/
double DoGetSamplingFactor (void) const;
/**
* Get sampling frequency
* \returns the sampling frequency
*/
double DoGetSamplingFrequency (void) const;
/**
* Get G value
* \returns the G value
*/
double DoGetGValue (void) const;
/**
* Set G value
* \param g the G value
*/
void DoSetGValue (double g);
/**
* Get receive gain
* \returns the receive gain
*/
double GetRxGain (void) const;
/**
* Set receive gsain
* \param rxgain the receive gain
*/
void SetRxGain (double rxgain);
/**
* Get transmit gain
* \returns the transmit gain
*/
double GetTxGain (void) const;
/**
* Set transmit gain
* \param txgain the transmit gain
*/
void SetTxGain (double txgain);
/**
* Get trace file path
* \returns the trace file path name
*/
std::string GetTraceFilePath (void) const;
/**
* Set trace file path
* \param path the trace file path
*/
void SetTraceFilePath (std::string path);
uint16_t m_fecBlockSize; ///< in bits, size of FEC block transmitted after PHY operations
uint32_t m_currentBurstSize; ///< current burst size
std::list<bvec> *m_receivedFecBlocks; ///< a list of received FEC blocks until they are combined to recreate the full burst buffer
uint32_t m_nrFecBlocksSent; ///< counting the number of FEC blocks sent (within a burst)
std::list<bvec> *m_fecBlocks; ///< the FEC blocks
Time m_blockTime; ///< block time
TracedCallback<Ptr<const PacketBurst> > m_traceRx; ///< trace receive callback
TracedCallback<Ptr<const PacketBurst> > m_traceTx; ///< trace transmit callback
// data rates for this Phy
uint32_t m_dataRateBpsk12; ///< data rate
uint32_t m_dataRateQpsk12; ///< data rate
uint32_t m_dataRateQpsk34; ///< data rate
uint32_t m_dataRateQam16_12; ///< data rate
uint32_t m_dataRateQam16_34; ///< data rate
uint32_t m_dataRateQam64_23; ///< data rate
uint32_t m_dataRateQam64_34; ///< data rate
// parameters to store for a per burst life-time
uint16_t m_nrBlocks; ///< number of blocks
uint16_t m_nrRemainingBlocksToSend; ///< number of remaining blocks to send
Ptr<PacketBurst> m_currentBurst; ///< current burst
uint16_t m_blockSize; ///< block size
uint32_t m_paddingBits; ///< padding bits
uint16_t m_nbErroneousBlock; ///< erroneous blocks
uint16_t m_nrRecivedFecBlocks; ///< number received FEC blocks
uint16_t m_nfft; ///< NFFT
double m_g; ///< G value
double m_bandWidth; ///< bandwidth
double m_txPower; ///< transmit power
double m_noiseFigure; ///< noise figure
double m_txGain; ///< transmit gain
double m_rxGain; ///< receive gain
/**
* The trace source fired when a packet begins the transmission process on
* the medium.
*
* \see class CallBackTraceSource
* \deprecated The non-const \c Ptr<PacketBurst> argument is deprecated
* and will be changed to \c Ptrc<PacketBurst> in a future release.
*/
TracedCallback <Ptr<PacketBurst > > m_phyTxBeginTrace;
/**
* The trace source fired when a packet ends the transmission process on
* the medium.
*
* \see class CallBackTraceSource
* \deprecated The non-const \c Ptr<PacketBurst> argument is deprecated
* and will be changed to \c Ptrc<PacketBurst> in a future release.
*/
TracedCallback<Ptr<PacketBurst > > m_phyTxEndTrace;
/**
* The trace source fired when the phy layer drops a packet as it tries
* to transmit it.
*
* \see class CallBackTraceSource
* \deprecated The non-const \c Ptr<PacketBurst> argument is deprecated
* and will be changed to \c Ptrc<PacketBurst> in a future release.
*/
TracedCallback<Ptr<PacketBurst > > m_phyTxDropTrace;
/**
* The trace source fired when a packet begins the reception process from
* the medium.
*
* \see class CallBackTraceSource
* \deprecated The non-const \c Ptr<PacketBurst> argument is deprecated
* and will be changed to \c Ptrc<PacketBurst> in a future release.
*/
TracedCallback<Ptr<PacketBurst > > m_phyRxBeginTrace;
/**
* The trace source fired when a packet ends the reception process from
* the medium.
*
* \see class CallBackTraceSource
* \deprecated The non-const \c Ptr<PacketBurst> argument is deprecated
* and will be changed to \c Ptrc<PacketBurst> in a future release.
*/
TracedCallback<Ptr<PacketBurst > > m_phyRxEndTrace;
/**
* The trace source fired when the phy layer drops a packet it has received.
*
* \see class CallBackTraceSource
* \deprecated The non-const \c Ptr<PacketBurst> argument is deprecated
* and will be changed to \c Ptrc<PacketBurst> in a future release.
*/
TracedCallback<Ptr<PacketBurst > > m_phyRxDropTrace;
SNRToBlockErrorRateManager * m_snrToBlockErrorRateManager; ///< SNR to block error rate manager
/// Provides uniform random variables.
Ptr<UniformRandomVariable> m_URNG; ///< URNG
};
} // namespace ns3
#endif /* OFDM_WIMAX_PHY_H */
|