A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
simple-ofdm-wimax-phy.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007,2008, 2009 INRIA, UDcast
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
7 * <amine.ismail@udcast.com>
8 */
9
11
13#include "wimax-channel.h"
14#include "wimax-mac-header.h"
15#include "wimax-net-device.h"
16
17#include "ns3/double.h"
18#include "ns3/node.h"
19#include "ns3/packet-burst.h"
20#include "ns3/packet.h"
21#include "ns3/simulator.h"
22#include "ns3/string.h"
23#include "ns3/trace-source-accessor.h"
24#include "ns3/uinteger.h"
25
26#include <cmath>
27#include <string>
28#include <vector>
29
30namespace ns3
31{
32
33NS_LOG_COMPONENT_DEFINE("SimpleOfdmWimaxPhy");
34
35NS_OBJECT_ENSURE_REGISTERED(SimpleOfdmWimaxPhy);
36
37TypeId
39{
40 static TypeId tid =
41 TypeId("ns3::SimpleOfdmWimaxPhy")
43 .SetGroupName("Wimax")
44
45 .AddConstructor<SimpleOfdmWimaxPhy>()
46
47 .AddAttribute(
48 "NoiseFigure",
49 "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.",
50 DoubleValue(5),
54
55 .AddAttribute("TxPower",
56 "Transmission power (dB).",
57 DoubleValue(30),
61
62 .AddAttribute("G",
63 "This is the ratio of CP time to useful time.",
64 DoubleValue(0.25),
68
69 .AddAttribute(
70 "TxGain",
71 "Transmission gain (dB).",
72 DoubleValue(0),
75
76 .AddAttribute(
77 "RxGain",
78 "Reception gain (dB).",
79 DoubleValue(0),
82
83 .AddAttribute("Nfft",
84 "FFT size",
85 UintegerValue(256),
89
90 .AddAttribute("TraceFilePath",
91 "Path to the directory containing SNR to block error rate files",
92 StringValue(""),
96
97 .AddTraceSource("Rx",
98 "Receive trace",
100 "ns3::PacketBurst::TracedCallback")
101 .AddTraceSource("Tx",
102 "Transmit trace",
104 "ns3::PacketBurst::TracedCallback")
105
106 .AddTraceSource(
107 "PhyTxBegin",
108 "Trace source indicating a packet has begun transmitting over the channel medium",
110 "ns3::PacketBurst::TracedCallback")
111
112 .AddTraceSource(
113 "PhyTxEnd",
114 "Trace source indicating a packet has been completely transmitted over the channel",
116 "ns3::PacketBurst::TracedCallback")
117
118 .AddTraceSource("PhyTxDrop",
119 "Trace source indicating a packet has been dropped by the device "
120 "during transmission",
122 "ns3::PacketBurst::TracedCallback")
123
124 .AddTraceSource("PhyRxBegin",
125 "Trace source indicating a packet has begun being received from the "
126 "channel medium by the device",
128 "ns3::PacketBurst::TracedCallback")
129
130 .AddTraceSource("PhyRxEnd",
131 "Trace source indicating a packet has been completely received from "
132 "the channel medium by the device",
134 "ns3::PacketBurst::TracedCallback")
135
136 .AddTraceSource(
137 "PhyRxDrop",
138 "Trace source indicating a packet has been dropped by the device during reception",
140 "ns3::PacketBurst::TracedCallback");
141 return tid;
142}
143
144void
146{
147 m_fecBlockSize = 0;
153
157
158 m_nrBlocks = 0;
159 m_blockSize = 0;
160 m_paddingBits = 0;
161 m_rxGain = 0;
162 m_txGain = 0;
163 m_nfft = 256;
164 m_g = 1.0 / 4;
165 SetNrCarriers(192);
166 m_fecBlocks = new std::list<Bvec>;
167 m_receivedFecBlocks = new std::list<Bvec>;
169 m_noiseFigure = 5; // dB
170 m_txPower = 30; // dBm
171 SetBandwidth(10000000); // 10Mhz
175}
176
185
192
196
197void
202
203void
209
215
216void
221
222double
224{
225 return m_txPower;
226}
227
228void
230{
231 m_txPower = txPower;
232}
233
234double
239
240void
242{
243 m_noiseFigure = noiseFigure;
244}
245
246void
256
257void
259{
260 GetChannel()->Attach(this);
261}
262
263void
265{
266 auto o_params = dynamic_cast<OfdmSendParams*>(params);
267 NS_ASSERT(o_params != nullptr);
268 Send(o_params->GetBurst(),
269 (WimaxPhy::ModulationType)o_params->GetModulationType(),
270 o_params->GetDirection());
271}
272
278
279void
281 WimaxPhy::ModulationType modulationType,
282 uint8_t direction)
283{
284 if (GetState() != PHY_STATE_TX)
285 {
286 m_currentBurstSize = burst->GetSize();
288 m_currentBurst = burst;
289 SetBlockParameters(burst->GetSize(), modulationType);
291 StartSendDummyFecBlock(true, modulationType, direction);
292 m_traceTx(burst);
293 }
294}
295
296void
298 WimaxPhy::ModulationType modulationType,
299 uint8_t direction)
300{
302 bool isLastFecBlock = false;
303 if (isFirstBlock)
304 {
305 m_blockTime = GetBlockTransmissionTime(modulationType);
306 }
307
308 SimpleOfdmWimaxChannel* channel =
310 NS_ASSERT(channel != nullptr);
311
312 isLastFecBlock = (m_nrRemainingBlocksToSend == 1);
313 channel->Send(m_blockTime,
315 this,
316 isFirstBlock,
317 isLastFecBlock,
319 modulationType,
320 direction,
321 m_txPower,
323
327 this,
328 modulationType,
329 direction);
330}
331
332void
334{
337
339 {
340 // this is the last FEC block of the burst
341 NS_ASSERT_MSG(m_nrRemainingBlocksToSend == 0, "Error while sending a burst");
343 }
344 else
345 {
346 StartSendDummyFecBlock(false, modulationType, direction);
347 }
348}
349
350void
355
356void
358 bool isFirstBlock,
359 uint64_t frequency,
360 WimaxPhy::ModulationType modulationType,
361 uint8_t direction,
362 double rxPower,
363 Ptr<PacketBurst> burst)
364{
365 bool drop = false;
366 double Nwb = -114 + m_noiseFigure + 10 * std::log(GetBandwidth() / 1000000000.0) / 2.303;
367 double SNR = rxPower - Nwb;
368
371 double I1 = record->GetI1();
372 double I2 = record->GetI2();
373
374 double blockErrorRate = m_URNG->GetValue(I1, I2);
375
376 double rand = m_URNG->GetValue(0.0, 1.0);
377
378 if (rand < blockErrorRate)
379 {
380 drop = true;
381 }
382 if (rand > blockErrorRate)
383 {
384 drop = false;
385 }
386
387 if (blockErrorRate == 1.0)
388 {
389 drop = true;
390 }
391 if (blockErrorRate == 0.0)
392 {
393 drop = false;
394 }
395 delete record;
396
397 NS_LOG_INFO("PHY: Receive rxPower=" << rxPower << ", Nwb=" << Nwb << ", SNR=" << SNR
398 << ", Modulation=" << modulationType << ", BlockErrorRate="
399 << blockErrorRate << ", drop=" << std::boolalpha << drop);
400
401 switch (GetState())
402 {
404 if (frequency == GetScanningFrequency())
405 {
408 SetSimplex(frequency);
410 }
411 break;
412 case PHY_STATE_IDLE:
413 if (frequency == GetRxFrequency())
414 {
415 if (isFirstBlock)
416 {
417 NotifyRxBegin(burst);
418 m_receivedFecBlocks->clear();
420 SetBlockParameters(burstSize, modulationType);
421 m_blockTime = GetBlockTransmissionTime(modulationType);
422 }
423
426 this,
427 burstSize,
428 modulationType,
429 direction,
430 drop,
431 burst);
432
434 }
435 break;
436 case PHY_STATE_RX:
437 // drop
438 break;
439 case PHY_STATE_TX:
440 if (IsDuplex() && frequency == GetRxFrequency())
441 {
442 }
443 break;
444 }
445}
446
447void
449 WimaxPhy::ModulationType modulationType,
450 uint8_t direction,
451 bool drop,
452 Ptr<PacketBurst> burst)
453{
456
457 if (drop)
458 {
460 }
461
463 {
464 NotifyRxEnd(burst);
465 if (m_nbErroneousBlock == 0)
466 {
468 }
469 else
470 {
471 NotifyRxDrop(burst);
472 }
475 }
476}
477
478void
480{
481 Ptr<PacketBurst> b = burst->Copy();
483 m_traceRx(burst);
484}
485
486Bvec
488{
489 Bvec buffer(burst->GetSize() * 8, false);
490
491 std::list<Ptr<Packet>> packets = burst->GetPackets();
492
493 uint32_t j = 0;
494 for (auto iter = packets.begin(); iter != packets.end(); ++iter)
495 {
496 Ptr<Packet> packet = *iter;
497 auto pstart = (uint8_t*)std::malloc(packet->GetSize());
498 std::memset(pstart, 0, packet->GetSize());
499 packet->CopyData(pstart, packet->GetSize());
500 Bvec temp(8);
501 temp.resize(0, false);
502 temp.resize(8, false);
503 for (uint32_t i = 0; i < packet->GetSize(); i++)
504 {
505 for (uint8_t l = 0; l < 8; l++)
506 {
507 temp[l] = (bool)((((uint8_t)pstart[i]) >> (7 - l)) & 0x01);
508 buffer.at(j * 8 + l) = temp[l];
509 }
510 j++;
511 }
512 std::free(pstart);
513 }
514
515 return buffer;
516}
517
518/*
519 Converts back the bit buffer (Bvec) to the actual burst.
520 Actually creates byte buffer from the Bvec and resets the buffer
521 of each packet in the copy of the original burst stored before transmitting.
522 By doing this it preserves the metadata and tags in the packet.
523 Function could also be named DeserializeBurst because actually it
524 copying to the burst's byte buffer.
525 */
528{
529 const auto bufferSize = buffer.size() / 8;
530 std::vector<uint8_t> bytes(bufferSize, 0);
531 int32_t j = 0;
532 // recreating byte buffer from bit buffer (Bvec)
533 for (std::size_t i = 0; i < buffer.size(); i += 8)
534 {
535 uint8_t temp = 0;
536 for (std::size_t l = 0; l < 8; l++)
537 {
538 bool bin = buffer.at(i + l);
539 temp |= (bin << (7 - l));
540 }
541
542 bytes[j] = temp;
543 j++;
544 }
545 uint16_t pos = 0;
547 while (pos < bufferSize)
548 {
549 uint16_t packetSize = 0;
550 // Get the header type: first bit
551 uint8_t ht = (bytes[pos] >> 7) & 0x01;
552 if (ht == 1)
553 {
554 // BW request header. Size is always 8 bytes
555 packetSize = 6;
556 }
557 else
558 {
559 // Read the size
560 uint8_t Len_MSB = bytes[pos + 1] & 0x07;
561 packetSize = (uint16_t)((uint16_t)(Len_MSB << 8) | (uint16_t)(bytes[pos + 2]));
562 if (packetSize == 0)
563 {
564 break; // padding
565 }
566 }
567
568 Ptr<Packet> p = Create<Packet>(&bytes[pos], packetSize);
569 RecvBurst->AddPacket(p);
570 pos += packetSize;
571 }
572 return RecvBurst;
573}
574
575void
577{
578 Bvec fecBlock(m_blockSize);
579 for (uint32_t i = 0, j = m_nrBlocks; j > 0; i += m_blockSize, j--)
580 {
581 if (j == 1 && m_paddingBits > 0) // last block can be smaller than block size
582 {
583 fecBlock = Bvec(buffer.begin() + i, buffer.end());
584 fecBlock.resize(m_blockSize, false);
585 }
586 else
587 {
588 fecBlock = Bvec(buffer.begin() + i, buffer.begin() + i + m_blockSize);
589 }
590
591 m_fecBlocks->push_back(fecBlock);
592 }
593}
594
595Bvec
597{
598 Bvec buffer(m_blockSize * (unsigned long)m_nrBlocks);
599 Bvec block(m_blockSize);
600 uint32_t i = 0;
601 for (uint32_t j = 0; j < m_nrBlocks; j++)
602 {
603 Bvec tmpRecFecBlock = m_receivedFecBlocks->front();
604 buffer.insert(buffer.begin() + i, tmpRecFecBlock.begin(), tmpRecFecBlock.end());
605 m_receivedFecBlocks->pop_front();
606 i += m_blockSize;
607 }
608 return buffer;
609}
610
611void
622
623void
625 uint8_t& bitsPerSymbol,
626 double& fecCode) const
627{
628 switch (modulationType)
629 {
631 bitsPerSymbol = 1;
632 fecCode = 1.0 / 2;
633 break;
635 bitsPerSymbol = 2;
636 fecCode = 1.0 / 2;
637 break;
639 bitsPerSymbol = 2;
640 fecCode = 3.0 / 4;
641 break;
643 bitsPerSymbol = 4;
644 fecCode = 1.0 / 2;
645 break;
647 bitsPerSymbol = 4;
648 fecCode = 3.0 / 4;
649 break;
651 bitsPerSymbol = 6;
652 fecCode = 2.0 / 3;
653 break;
655 bitsPerSymbol = 6;
656 fecCode = 0.75;
657 break;
658 }
659}
660
663{
664 uint8_t bitsPerSymbol = 0;
665 double fecCode = 0;
666 GetModulationFecParams(modulationType, bitsPerSymbol, fecCode);
667 double symbolsPerSecond = 1 / GetSymbolDuration().GetSeconds();
668 auto bitsTransmittedPerSymbol = (uint16_t)(bitsPerSymbol * GetNrCarriers() * fecCode);
669 // 96, 192, 288, 384, 576, 767 and 864 bits per symbol for the seven modulations, respectively
670
671 return (uint32_t)symbolsPerSecond * bitsTransmittedPerSymbol;
672}
673
676{
677 switch (modulationType)
678 {
680 return m_dataRateBpsk12;
682 return m_dataRateQpsk12;
684 return m_dataRateQpsk34;
686 return m_dataRateQam16_12;
688 return m_dataRateQam16_34;
690 return m_dataRateQam64_23;
692 return m_dataRateQam64_34;
693 }
694 NS_FATAL_ERROR("Invalid modulation type");
695 return 0;
696}
697
698Time
700{
701 return Seconds((double)GetFecBlockSize(modulationType) / DoGetDataRate(modulationType));
702}
703
704Time
706 WimaxPhy::ModulationType modulationType) const
707{
708 /*adding 3 extra nano second to cope with the loss of precision problem.
709 the time is internally stored in a 64 bit hence a floating-point time would loss
710 precision, e.g., 0.00001388888888888889 seconds will become 13888888888 femtoseconds.*/
711 return Seconds(DoGetNrSymbols(size, modulationType) * GetSymbolDuration().GetSeconds()) +
712 NanoSeconds(3);
713}
714
715uint64_t
717{
718 Time transmissionTime =
719 Seconds((double)(GetNrBlocks(size, modulationType) * GetFecBlockSize(modulationType)) /
720 DoGetDataRate(modulationType));
721 return (uint64_t)std::ceil(transmissionTime.GetSeconds() / GetSymbolDuration().GetSeconds());
722}
723
724uint64_t
726{
727 Time transmissionTime = Seconds(symbols * GetSymbolDuration().GetSeconds());
728 return (uint64_t)std::floor((transmissionTime.GetSeconds() * DoGetDataRate(modulationType)) /
729 8);
730}
731
734{
735 uint32_t blockSize = 0;
736 switch (modulationType)
737 {
739 blockSize = 12;
740 break;
742 blockSize = 24;
743 break;
745 blockSize = 36;
746 break;
748 blockSize = 48;
749 break;
751 blockSize = 72;
752 break;
754 blockSize = 96;
755 break;
757 blockSize = 108;
758 break;
759 default:
760 NS_FATAL_ERROR("Invalid modulation type");
761 break;
762 }
763 return blockSize * 8; // in bits
764}
765
766// Channel coding block size, Table 215, page 434
769{
770 uint32_t blockSize = 0;
771 switch (modulationType)
772 {
774 blockSize = 24;
775 break;
778 blockSize = 48;
779 break;
782 blockSize = 96;
783 break;
786 blockSize = 144;
787 break;
788 default:
789 NS_FATAL_ERROR("Invalid modulation type");
790 break;
791 }
792 return blockSize * 8; // in bits
793}
794
795void
797{
798 m_blockSize = GetFecBlockSize(modulationType);
799 m_nrBlocks = GetNrBlocks(burstSize, modulationType);
800 m_paddingBits = (m_nrBlocks * m_blockSize) - (burstSize * 8);
802 NS_ASSERT_MSG(static_cast<uint32_t>(m_nrBlocks * m_blockSize) >= (burstSize * 8),
803 "Size of padding bytes < 0");
804}
805
806uint16_t
808{
809 // assumed equal to 2 symbols
810 return 2 * GetPsPerSymbol();
811}
812
813uint16_t
815{
816 // assumed equal to 2 symbols
817 return 2 * GetPsPerSymbol();
818}
819
820uint8_t
822{
823 uint16_t duration = 0;
824 duration = (uint16_t)(GetFrameDuration().GetSeconds() * 10000);
825 uint8_t retval = 0;
826 switch (duration)
827 {
828 case 25: {
830 break;
831 }
832 case 40: {
833 retval = FRAME_DURATION_4_MS;
834 break;
835 }
836 case 50: {
837 retval = FRAME_DURATION_5_MS;
838 break;
839 }
840 case 80: {
841 retval = FRAME_DURATION_8_MS;
842 break;
843 }
844 case 100: {
845 retval = FRAME_DURATION_10_MS;
846 break;
847 }
848 case 125: {
850 break;
851 }
852 case 200: {
853 retval = FRAME_DURATION_20_MS;
854 break;
855 }
856 default: {
857 NS_FATAL_ERROR("Invalid frame duration = " << duration);
858 retval = 0;
859 }
860 }
861 return retval;
862}
863
864Time
865SimpleOfdmWimaxPhy::DoGetFrameDuration(uint8_t frameDurationCode) const
866{
867 switch (frameDurationCode)
868 {
870 return Seconds(2.5);
872 return Seconds(4);
874 return Seconds(5);
876 return Seconds(8);
878 return Seconds(10);
880 return Seconds(12.5);
882 return Seconds(20);
883 default:
884 NS_FATAL_ERROR("Invalid modulation type");
885 }
886 return Seconds(0);
887}
888
889/*
890 Returns number of blocks (FEC blocks) the burst will be split in.
891 The size of the block is specific for each modulation type.
892 */
893uint16_t
895{
896 uint32_t blockSize = GetFecBlockSize(modulationType);
897 uint16_t nrBlocks = (burstSize * 8) / blockSize;
898
899 if ((burstSize * 8) % blockSize > 0)
900 {
901 nrBlocks += 1;
902 }
903
904 return nrBlocks;
905}
906
907/*---------------------PHY parameters functions-----------------------*/
908
909void
911{
912 /*Calculations as per section 8.3.2.
913 Currently assuming license-exempt 5 GHz band. For channel bandwidth 20 MHz (Table B.28, page
914 812) and frame duration 10 ms (Table 232, page 460) i.e, 100 frames per second, sampling
915 frequency is 23040000, symbol (OFDM symbol) duration is 1.388888888888889e-05 seconds, PS
916 duration is 1.7361111111111112e-07 seconds. Hence PSs per frame is 57600, symbols per frame is
917 720 and PSs per symbol is 80. Note that defining these parameters (symbol and PS duration) as
918 Time may not result in exactly these values therefore lrint has been used (otherwise should be
919 defined as double). For licensed bands set channel bandwidth according to Table B.26, page
920 810.*/
921
922 double samplingFrequency = DoGetSamplingFrequency();
923 Time psDuration = Seconds(4.0 / samplingFrequency);
924
925 SetPsDuration(psDuration);
926 uint16_t psPerFrame = (uint16_t)(GetFrameDuration().GetSeconds() / psDuration.GetSeconds());
927 SetPsPerFrame(psPerFrame);
928 double subcarrierSpacing = samplingFrequency / DoGetNfft();
929 double tb = 1.0 / subcarrierSpacing; // Tb (useful symbol time)
930 double tg = DoGetGValue() * tb; // Tg (cyclic prefix time)
931 Time symbolDuration = Seconds(tb + tg); // OFDM Symbol Time
932 SetSymbolDuration(symbolDuration);
933 uint16_t psPerSymbol = lrint(symbolDuration.GetSeconds() / psDuration.GetSeconds());
934 SetPsPerSymbol(psPerSymbol);
935 uint32_t symbolsPerFrame = lrint(GetFrameDuration().GetSeconds() / symbolDuration.GetSeconds());
936 SetSymbolsPerFrame(symbolsPerFrame);
937}
938
939void
941{
942 m_nfft = nfft;
943}
944
945uint16_t
947{
948 return m_nfft;
949}
950
951double
953{
954 // sampling factor (n), see Table 213, page 429
955
956 uint32_t channelBandwidth = GetChannelBandwidth();
957
958 if (channelBandwidth % 1750000 == 0)
959 {
960 return 8.0 / 7;
961 }
962 else if (channelBandwidth % 1500000 == 0)
963 {
964 return 86.0 / 75;
965 }
966 else if (channelBandwidth % 1250000 == 0)
967 {
968 return 144.0 / 125;
969 }
970 else if (channelBandwidth % 2750000 == 0)
971 {
972 return 316.0 / 275;
973 }
974 else if (channelBandwidth % 2000000 == 0)
975 {
976 return 57.0 / 50;
977 }
978 else
979 {
980 NS_LOG_DEBUG("Oops may be wrong channel bandwidth for OFDM PHY!");
981 NS_FATAL_ERROR("wrong channel bandwidth for OFDM PHY");
982 }
983
984 return 8.0 / 7;
985}
986
987double
989{
990 // sampling frequency (Fs), see 8.3.2.2
991
992 return (DoGetSamplingFactor() * GetChannelBandwidth() / 8000) * 8000;
993}
994
995double
997{
998 return m_g;
999}
1000
1001void
1003{
1004 m_g = g;
1005}
1006
1007void
1009{
1010 m_txGain = txGain;
1011}
1012
1013void
1015{
1016 m_rxGain = txRain;
1017}
1018
1019double
1021{
1022 return m_txGain;
1023}
1024
1025double
1027{
1028 return m_rxGain;
1029}
1030
1031std::string
1036
1037void
1043
1044void
1049
1050void
1055
1056void
1061
1062void
1067
1068void
1073
1074void
1079
1080int64_t
1082{
1083 NS_LOG_FUNCTION(this << stream);
1084 m_URNG->SetStream(stream);
1085 return 1;
1086}
1087
1088} // namespace ns3
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
OfdmSendParams class.
Definition send-params.h:57
Smart pointer class similar to boost::intrusive_ptr.
This class handles the SNR to BlcER traces.
void ActivateLoss(bool loss)
If activate loss is called with false, all the returned BlcER will be 0 (no losses)
void LoadTraces()
Loads the traces form the repository specified in the constructor or set by SetTraceFilePath function...
SNRToBlockErrorRateRecord * GetSNRToBlockErrorRateRecord(double SNR, uint8_t modulation)
returns a record of type SNRToBlockErrorRateRecord corresponding to a given modulation and SNR value
void SetTraceFilePath(char *traceFilePath)
Set the path of the repository containing the traces.
This class represents a record (handled by SnrToBlockErrorRate manager) that keeps a mapping between ...
The SendParams class defines the parameters with which Send() function of a particular PHY is called.
Definition send-params.h:31
SimpleOfdmWimaxChannel class.
SimpleOfdmWimaxPhy class.
std::string GetTraceFilePath() const
Get trace file path.
void GetModulationFecParams(WimaxPhy::ModulationType modulationType, uint8_t &bitsPerSymbol, double &fecCode) const
Get moduleation FEC parameters.
void NotifyRxBegin(Ptr< PacketBurst > burst)
Public method used to fire a PhyRxBegin trace.
double GetTxGain() const
Get transmit gain.
double DoGetSamplingFrequency() const override
Get sampling frequency.
void CreateFecBlocks(const Bvec &buffer, WimaxPhy::ModulationType modulationType)
Create FEC blocks.
static TypeId GetTypeId()
Get the type ID.
void NotifyRxEnd(Ptr< PacketBurst > burst)
Public method used to fire a PhyRxEnd trace.
TracedCallback< Ptr< PacketBurst > > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium.
double m_txPower
transmit power
void EndReceiveFecBlock(uint32_t burstSize, WimaxPhy::ModulationType modulationType, uint8_t direction, bool drop, Ptr< PacketBurst > burst)
End receive FEC block.
void EndReceive(Ptr< const PacketBurst > burst)
End receive.
double DoGetGValue() const override
Get G value.
void DoSetGValue(double g)
Set G value.
uint32_t CalculateDataRate(WimaxPhy::ModulationType modulationType) const
Calculate data rate.
void StartSendDummyFecBlock(bool isFirstBlock, WimaxPhy::ModulationType modulationType, uint8_t direction)
Start end dummy FEC block.
void DoAttach(Ptr< WimaxChannel > channel) override
Attach the physical layer to a channel.
uint16_t DoGetTtg() const override
Get TTG.
uint8_t DoGetFrameDurationCode() const override
Get frame duration code.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
void ActivateLoss(bool loss)
if called with true it will enable the loss model
uint32_t m_dataRateQam16_34
data rate
uint16_t m_nbErroneousBlock
erroneous blocks
uint16_t m_nrBlocks
number of blocks
WimaxPhy::PhyType GetPhyType() const override
returns the type this physical layer
void SetTraceFilePath(std::string path)
Set trace file path.
void SetNoiseFigure(double nf)
set the noise figure of the device
uint16_t m_nrReceivedFecBlocks
number received FEC blocks
void SetRxGain(double rxgain)
Set receive gsain.
Ptr< PacketBurst > ConvertBitsToBurst(Bvec buffer)
Convert bits to burst.
void EndSendFecBlock(WimaxPhy::ModulationType modulationType, uint8_t direction)
End send FEC block.
Ptr< PacketBurst > m_currentBurst
current burst
Ptr< UniformRandomVariable > m_URNG
Provides uniform random variables.
void DoSetNfft(uint16_t nfft)
Set NFFT.
void NotifyRxDrop(Ptr< PacketBurst > burst)
Public method used to fire a PhyRxDrop trace.
uint16_t GetNrBlocks(uint32_t burstSize, WimaxPhy::ModulationType modulationType) const
Get number of blocks.
Bvec RecreateBuffer()
Recreate buffer.
TracedCallback< Ptr< PacketBurst > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
TracedCallback< Ptr< PacketBurst > > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
void NotifyTxEnd(Ptr< PacketBurst > burst)
Public method used to fire a PhyTxEnd trace.
void SetBlockParameters(uint32_t burstSize, WimaxPhy::ModulationType modulationType)
Set block parameters.
uint32_t m_dataRateQam64_34
data rate
double DoGetSamplingFactor() const override
Get sampling factor.
void SetTxPower(double txPower)
set the transmission power
uint64_t DoGetNrBytes(uint32_t symbols, WimaxPhy::ModulationType modulationType) const override
Get number of bytes.
SNRToBlockErrorRateManager * m_snrToBlockErrorRateManager
SNR to block error rate manager.
TracedCallback< Ptr< const PacketBurst > > m_traceTx
trace transmit callback
void DoSetDataRates() override
Set data rates.
uint16_t DoGetNfft() const override
Get NFFT.
void DoSetPhyParameters() override
Set Phy parameters.
uint32_t m_dataRateQam16_12
data rate
uint16_t DoGetRtg() const override
Get RTG.
uint32_t GetCodedFecBlockSize(WimaxPhy::ModulationType modulationType) const
Get coded FEC block size.
std::list< Bvec > * m_receivedFecBlocks
a list of received FEC blocks until they are combined to recreate the full burst buffer
uint32_t GetFecBlockSize(WimaxPhy::ModulationType type) const
Get FEC block size.
void SetTxGain(double txgain)
Set transmit gain.
uint16_t m_nrRemainingBlocksToSend
number of remaining blocks to send
void SetBandwidth(uint32_t BW)
Set the bandwidth.
TracedCallback< Ptr< PacketBurst > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
Time GetBlockTransmissionTime(WimaxPhy::ModulationType modulationType) const
Get block transmission time.
void Send(Ptr< PacketBurst > burst, WimaxPhy::ModulationType modulationType, uint8_t direction)
Sends a burst on the channel.
Time DoGetTransmissionTime(uint32_t size, WimaxPhy::ModulationType modulationType) const override
Get transmission time.
TracedCallback< Ptr< PacketBurst > > m_phyRxDropTrace
The trace source fired when the phy layer drops a packet it has received.
Time DoGetFrameDuration(uint8_t frameDurationCode) const override
Get frame duration.
void SetSNRToBlockErrorRateTracesPath(char *tracesPath)
Set the path of the repository containing the traces.
uint32_t m_currentBurstSize
current burst size
uint32_t DoGetDataRate(WimaxPhy::ModulationType modulationType) const override
Get data rate.
void NotifyTxDrop(Ptr< PacketBurst > burst)
Public method used to fire a PhyTxDrop trace.
uint64_t DoGetNrSymbols(uint32_t size, WimaxPhy::ModulationType modulationType) const override
Get number of symbols.
void InitSimpleOfdmWimaxPhy()
Initialize simple OFDM WIMAX Phy.
void NotifyTxBegin(Ptr< PacketBurst > burst)
Public method used to fire a PhyTxBegin trace.
TracedCallback< Ptr< PacketBurst > > m_phyTxDropTrace
The trace source fired when the phy layer drops a packet as it tries to transmit it.
uint32_t m_paddingBits
padding bits
std::list< Bvec > * m_fecBlocks
the FEC blocks
double GetRxGain() const
Get receive gain.
uint16_t m_fecBlockSize
in bits, size of FEC block transmitted after PHY operations
TracedCallback< Ptr< const PacketBurst > > m_traceRx
trace receive callback
Bvec ConvertBurstToBits(Ptr< const PacketBurst > burst)
Convert burst to bits.
uint32_t m_dataRateQam64_23
data rate
void DoDispose() override
Destructor implementation.
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
uint32_t m_nrFecBlocksSent
counting the number of FEC blocks sent (within a burst)
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:560
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
Definition simulator.cc:274
Hold variables of type string.
Definition string.h:45
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:392
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
Hold an unsigned integer type.
Definition uinteger.h:34
WiMAX PHY entity.
Definition wimax-phy.h:39
Time GetFrameDuration() const
Get the frame duration.
Definition wimax-phy.cc:297
ModulationType
ModulationType enumeration.
Definition wimax-phy.h:43
@ MODULATION_TYPE_QPSK_12
Definition wimax-phy.h:45
@ MODULATION_TYPE_QAM16_12
Definition wimax-phy.h:47
@ MODULATION_TYPE_QAM64_34
Definition wimax-phy.h:50
@ MODULATION_TYPE_QAM16_34
Definition wimax-phy.h:48
@ MODULATION_TYPE_QAM64_23
Definition wimax-phy.h:49
@ MODULATION_TYPE_QPSK_34
Definition wimax-phy.h:46
@ MODULATION_TYPE_BPSK_12
Definition wimax-phy.h:44
void SetSymbolDuration(Time symbolDuration)
set the OFDM symbol duration
Definition wimax-phy.cc:363
Ptr< WimaxChannel > GetChannel() const
Definition wimax-phy.cc:106
void SetChannelBandwidth(uint32_t channelBandwidth)
Set the channel bandwidth.
Definition wimax-phy.cc:321
uint64_t GetRxFrequency() const
Get the reception frequency.
Definition wimax-phy.cc:169
PhyType
PhyType enumeration.
Definition wimax-phy.h:64
Time GetSymbolDuration() const
Get the OFDM symbol duration.
Definition wimax-phy.cc:369
uint8_t GetNrCarriers() const
Get the number of carriers in the physical frame.
Definition wimax-phy.cc:285
PhyState GetState() const
Get the state of the device.
Definition wimax-phy.cc:193
void SetSymbolsPerFrame(uint32_t symbolsPerFrame)
set the number of symbols per frame
Definition wimax-phy.cc:405
void SetScanningCallback() const
calls the scanning call back function
Definition wimax-phy.cc:211
void SetNrCarriers(uint8_t nrCarriers)
Set the number of carriers in the physical frame.
Definition wimax-phy.cc:279
void DoDispose() override
Destructor implementation.
Definition wimax-phy.cc:92
void SetPsPerFrame(uint16_t psPerFrame)
set the number of physical slots per frame
Definition wimax-phy.cc:393
void SetSimplex(uint64_t frequency)
configure the physical layer in simplex mode
Definition wimax-phy.cc:162
uint64_t GetScanningFrequency() const
Get the scanning frequency.
Definition wimax-phy.cc:181
void SetPsDuration(Time psDuration)
set the physical slot duration
Definition wimax-phy.cc:351
uint16_t GetPsPerSymbol() const
Get the number of physical slots per symbol.
Definition wimax-phy.cc:387
void SetState(PhyState state)
set the state of the device
Definition wimax-phy.cc:187
uint32_t GetChannelBandwidth() const
Get the channel bandwidth.
Definition wimax-phy.cc:327
EventId GetChnlSrchTimeoutEvent() const
Get channel search timeout event.
Definition wimax-phy.cc:205
bool IsDuplex() const
Check if configured in duplex mode.
Definition wimax-phy.cc:199
Callback< void, Ptr< const PacketBurst > > GetReceiveCallback() const
Definition wimax-phy.cc:149
void SetPsPerSymbol(uint16_t psPerSymbol)
set the number of physical slots per symbol
Definition wimax-phy.cc:381
uint64_t GetTxFrequency() const
Get the transmission frequency.
Definition wimax-phy.cc:175
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition assert.h:75
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1344
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
Definition ptr.h:443
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
std::vector< bool > Bvec
boolean vector typedef
Definition bvec.h:18
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition double.h:82
Ptr< const AttributeChecker > MakeStringChecker()
Definition string.cc:19
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Definition string.h:46
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition double.h:32
constexpr double BW
static const uint32_t packetSize
Packet size generated at the AP.