A Discrete-Event Network Simulator
API
uan-phy-gen.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2009 University of Washington
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Leonard Tracy <lentracy@gmail.com>
19 * Andrea Sacco <andrea.sacco85@gmail.com>
20 */
21
22#include "uan-phy-gen.h"
23#include "uan-transducer.h"
24#include "uan-channel.h"
25#include "uan-net-device.h"
26#include "ns3/simulator.h"
27#include "ns3/traced-callback.h"
28#include "ns3/ptr.h"
29#include "ns3/trace-source-accessor.h"
30#include "ns3/double.h"
31#include "ns3/string.h"
32#include "ns3/log.h"
33#include "ns3/uan-tx-mode.h"
34#include "ns3/node.h"
35#include "ns3/uinteger.h"
36#include "ns3/energy-source-container.h"
37#include "ns3/acoustic-modem-energy-model.h"
38
39
40namespace ns3 {
41
42NS_LOG_COMPONENT_DEFINE ("UanPhyGen");
43
45NS_OBJECT_ENSURE_REGISTERED (UanPhyPerGenDefault);
46NS_OBJECT_ENSURE_REGISTERED (UanPhyCalcSinrDefault);
47NS_OBJECT_ENSURE_REGISTERED (UanPhyCalcSinrFhFsk);
48NS_OBJECT_ENSURE_REGISTERED (UanPhyPerUmodem);
49NS_OBJECT_ENSURE_REGISTERED (UanPhyPerCommonModes);
50
51
52/*************** UanPhyCalcSinrDefault definition *****************/
54{
55
56}
58{
59
60}
61
64{
65 static TypeId tid = TypeId ("ns3::UanPhyCalcSinrDefault")
67 .SetGroupName ("Uan")
68 .AddConstructor<UanPhyCalcSinrDefault> ()
69 ;
70 return tid;
71}
72
73double
75 Time arrTime,
76 double rxPowerDb,
77 double ambNoiseDb,
78 UanTxMode mode,
79 UanPdp pdp,
80 const UanTransducer::ArrivalList &arrivalList) const
81{
82 if (mode.GetModType () == UanTxMode::OTHER)
83 {
84 NS_LOG_WARN ("Calculating SINR for unsupported modulation type");
85 }
86
87 double intKp = -DbToKp (rxPowerDb); // This packet is in the arrivalList
88 UanTransducer::ArrivalList::const_iterator it = arrivalList.begin ();
89 for (; it != arrivalList.end (); it++)
90 {
91 intKp += DbToKp (it->GetRxPowerDb ());
92 }
93
94 double totalIntDb = KpToDb (intKp + DbToKp (ambNoiseDb));
95
96 NS_LOG_DEBUG ("Calculating SINR: RxPower = " << rxPowerDb << " dB. Number of interferers = " << arrivalList.size () << " Interference + noise power = " << totalIntDb << " dB. SINR = " << rxPowerDb - totalIntDb << " dB.");
97 return rxPowerDb - totalIntDb;
98}
99
100/*************** UanPhyCalcSinrFhFsk definition *****************/
102{
103
104}
106{
107
108}
109
110TypeId
112{
113 static TypeId tid = TypeId ("ns3::UanPhyCalcSinrFhFsk")
115 .SetGroupName ("Uan")
116 .AddConstructor<UanPhyCalcSinrFhFsk> ()
117 .AddAttribute ("NumberOfHops",
118 "Number of frequencies in hopping pattern.",
119 UintegerValue (13),
121 MakeUintegerChecker<uint32_t> ())
122 ;
123 return tid;
124}
125double
127 Time arrTime,
128 double rxPowerDb,
129 double ambNoiseDb,
130 UanTxMode mode,
131 UanPdp pdp,
132 const UanTransducer::ArrivalList &arrivalList) const
133{
134 if ((mode.GetModType () != UanTxMode::FSK) && (mode.GetConstellationSize () != 13))
135 {
136 NS_FATAL_ERROR ("Calculating SINR for unsupported mode type");
137 }
138
139 Time ts = Seconds (1.0 / mode.GetPhyRateSps ());
140 Time clearingTime = (m_hops - 1.0) * ts;
141 double csp = pdp.SumTapsFromMaxNc (Time (), ts);
142
143 // Get maximum arrival offset
144 double maxAmp = -1;
145 Time maxTapDelay (0);
146 UanPdp::Iterator pit = pdp.GetBegin ();
147 for (; pit != pdp.GetEnd (); pit++)
148 {
149 if (std::abs (pit->GetAmp ()) > maxAmp)
150 {
151 maxAmp = std::abs (pit->GetAmp ());
152 // Modified in order to subtract delay of first tap (maxTapDelay appears to be used later in code
153 // as delay from first reception, not from TX time)
154 maxTapDelay = pit->GetDelay () - pdp.GetTap(0).GetDelay();
155 }
156 }
157
158
159 double effRxPowerDb = rxPowerDb + KpToDb (csp);
160 //It appears to be just the first elements of the sum in Parrish paper,
161 // "System Design Considerations for Undersea Networks: Link and Multiple Access Protocols", eq. 14
162 double isiUpa = DbToKp(rxPowerDb) * pdp.SumTapsFromMaxNc (ts + clearingTime, ts); // added DpToKp()
163 UanTransducer::ArrivalList::const_iterator it = arrivalList.begin ();
164 double intKp = -DbToKp (effRxPowerDb);
165 for (; it != arrivalList.end (); it++)
166 {
167 UanPdp intPdp = it->GetPdp ();
168 Time tDelta = Abs (arrTime + maxTapDelay - it->GetArrivalTime ());
169 // We want tDelta in terms of a single symbol (i.e. if tDelta = 7.3 symbol+clearing
170 // times, the offset in terms of the arriving symbol power is
171 // 0.3 symbol+clearing times.
172
173 tDelta = Rem (tDelta, ts + clearingTime);
174
175 // Align to pktRx
176 if (arrTime + maxTapDelay > it->GetArrivalTime ())
177 {
178 tDelta = ts + clearingTime - tDelta;
179 }
180
181 double intPower = 0.0;
182 if (tDelta < ts) // Case where there is overlap of a symbol due to interferer arriving just after desired signal
183 {
184 //Appears to be just the first two elements of the sum in Parrish paper, eq. 14
185 intPower += intPdp.SumTapsNc (Time (), ts - tDelta);
186 intPower += intPdp.SumTapsNc (ts - tDelta + clearingTime,
187 2 * ts - tDelta + clearingTime);
188 }
189 else // Account for case where there's overlap of a symbol due to interferer arriving with a tDelta of a symbol + clearing time later
190 {
191 // Appears to be just the first two elements of the sum in Parrish paper, eq. 14
192 Time start = ts + clearingTime - tDelta;
193 Time end = /*start +*/ ts; // Should only sum over portion of ts that overlaps, not entire ts
194 intPower += intPdp.SumTapsNc (start, end);
195
196 start = start + ts + clearingTime;
197 //Should only sum over portion of ts that overlaps, not entire ts
198 end = end + ts + clearingTime; //start + Seconds (ts);
199 intPower += intPdp.SumTapsNc (start, end);
200 }
201 intKp += DbToKp (it->GetRxPowerDb ()) * intPower;
202 }
203
204 double totalIntDb = KpToDb (isiUpa + intKp + DbToKp (ambNoiseDb));
205
206 NS_LOG_DEBUG ("Calculating SINR: RxPower = " << rxPowerDb << " dB. Effective Rx power " << effRxPowerDb << " dB. Number of interferers = " << arrivalList.size () << " Interference + noise power = " << totalIntDb << " dB. SINR = " << effRxPowerDb - totalIntDb << " dB.");
207 return effRxPowerDb - totalIntDb;
208}
209
210/*************** UanPhyPerGenDefault definition *****************/
212{
213
214}
215
217{
218
219}
220TypeId
222{
223 static TypeId tid = TypeId ("ns3::UanPhyPerGenDefault")
225 .SetGroupName ("Uan")
226 .AddConstructor<UanPhyPerGenDefault> ()
227 .AddAttribute ("Threshold", "SINR cutoff for good packet reception.",
228 DoubleValue (8),
230 MakeDoubleChecker<double> ());
231 return tid;
232}
233
234
235// Default PER calculation simply compares SINR to a threshold which is configurable
236// via an attribute.
237double
239{
240 if (sinrDb >= m_thresh)
241 {
242 return 0;
243 }
244 else
245 {
246 return 1;
247 }
248}
249
250/*************** UanPhyPerCommonModes definition *****************/
252 : UanPhyPer ()
253{
254
255}
256
258{
259
260}
261
262TypeId
264{
265 static TypeId tid = TypeId ("ns3::UanPhyPerCommonModes")
267 .SetGroupName ("Uan")
268 .AddConstructor<UanPhyPerCommonModes> ();
269
270 return tid;
271}
272
273double
275{
276 NS_LOG_FUNCTION (this);
277
278 double EbNo = std::pow (10.0, sinrDb / 10.0);
279 double BER = 1.0;
280 double PER = 0.0;
281
282 switch (mode.GetModType ())
283 {
284 case UanTxMode::PSK:
285 switch (mode.GetConstellationSize ())
286 {
287 case 2: // BPSK
288 {
289 BER = 0.5 * erfc (sqrt (EbNo));
290 break;
291 }
292 case 4: // QPSK, half BPSK EbNo
293 {
294 BER = 0.5 * erfc (sqrt (0.5 * EbNo));
295 break;
296 }
297
298 default:
299 NS_FATAL_ERROR ("constellation " << mode.GetConstellationSize () << " not supported");
300 break;
301 }
302 break;
303
304 // taken from Ronell B. Sicat, "Bit Error Probability Computations for M-ary Quadrature Amplitude Modulation",
305 // EE 242 Digital Communications and Codings, 2009
306 case UanTxMode::QAM:
307 {
308 // generic EbNo
309 EbNo *= mode.GetDataRateBps () / mode.GetBandwidthHz ();
310
311 double M = (double) mode.GetConstellationSize ();
312
313 // standard squared quantized QAM, even number of bits per symbol supported
314 int log2sqrtM = (int) ::std::log2 ( sqrt (M));
315
316 double log2M = ::std::log2 (M);
317
318 if ((int)log2M % 2)
319 {
320 NS_FATAL_ERROR ("constellation " << M << " not supported");
321 }
322
323 double sqrtM = ::std::sqrt (M);
324
325 NS_LOG_DEBUG ("M=" << M << "; log2sqrtM=" << log2sqrtM << "; log2M=" << log2M << "; sqrtM=" << sqrtM);
326
327 BER = 0.0;
328
329 // Eq (75)
330 for (int k = 0; k < log2sqrtM; k++)
331 {
332 int sum_items = (int) ((1.0 - ::std::pow ( 2.0, (-1.0) * (double) k)) * ::std::sqrt (M) - 1.0);
333 double pow2k = ::std::pow (2.0, (double) k - 1.0);
334
335 NS_LOG_DEBUG ("k=" << k << "; sum_items=" << sum_items << "; pow2k=" << pow2k);
336
337 double PbK = 0;
338
339 // Eq (74)
340 for (int j = 0; j < sum_items; ++j)
341 {
342 PbK += ::std::pow (-1.0, (double) j * pow2k / sqrtM)
343 * (pow2k - ::std::floor ( (double) (j * pow2k / sqrtM) - 0.5))
344 * erfc ((2.0 * (double)j + 1.0) * ::std::sqrt (3.0 * (log2M * EbNo) / (2.0 * (M - 1.0))));
345
346 NS_LOG_DEBUG ("j=" << j << "; PbK=" << PbK);
347
348 }
349 PbK *= 1.0 / sqrtM;
350
351 BER += PbK;
352
353 NS_LOG_DEBUG ("k=" << k << "; PbK=" << PbK << "; BER=" << BER);
354 }
355
356 BER *= 1.0 / (double) log2sqrtM;
357
358 break;
359 }
360
361 case UanTxMode::FSK:
362 switch (mode.GetConstellationSize ())
363 {
364 case 2:
365 {
366 BER = 0.5 * erfc (sqrt (0.5 * EbNo));
367 break;
368 }
369
370 default:
371 NS_FATAL_ERROR ("constellation " << mode.GetConstellationSize () << " not supported");
372 }
373 break;
374
375 default: // OTHER and error
376 NS_FATAL_ERROR ("Mode " << mode.GetModType () << " not supported");
377 break;
378 }
379
380 PER = (1.0 - pow (1.0 - BER, (double) pkt->GetSize () * 8.0));
381
382 NS_LOG_DEBUG ("BER=" << BER << "; PER=" << PER);
383
384 return PER;
385}
386
387/*************** UanPhyPerUmodem definition *****************/
389{
390
391}
393{
394
395}
396
398{
399 static TypeId tid = TypeId ("ns3::UanPhyPerUmodem")
401 .SetGroupName ("Uan")
402 .AddConstructor<UanPhyPerUmodem> ()
403 ;
404 return tid;
405}
406
407double
409{
410 double result;
411
412 result = 1.0;
413
414 for (uint32_t i = std::max (k,n - k) + 1; i <= n; ++i)
415 {
416 result *= i;
417 }
418
419 for (uint32_t i = 2; i <= std::min (k,n - k); ++i)
420 {
421 result /= i;
422 }
423
424 return result;
425}
426
427double
429{
430 uint32_t d[] =
431 { 12, 14, 16, 18, 20, 22, 24, 26, 28 };
432 double Bd[] =
433 {
434 33, 281, 2179, 15035LLU, 105166LLU, 692330LLU, 4580007LLU, 29692894LLU,
435 190453145LLU
436 };
437
438 // double Rc = 1.0 / 2.0;
439 double ebno = std::pow (10.0, sinr / 10.0);
440 double perror = 1.0 / (2.0 + ebno);
441 double P[9];
442
443 if ((mode.GetModType () != UanTxMode::FSK) && (mode.GetConstellationSize () != 13))
444 {
445 NS_FATAL_ERROR ("Calculating SINR for unsupported mode type");
446 }
447 if (sinr >= 10)
448 {
449 return 0;
450 }
451 if (sinr <= 6)
452 {
453 return 1;
454 }
455
456 for (uint32_t r = 0; r < 9; r++)
457 {
458 double sumd = 0;
459 for (uint32_t k = 0; k < d[r]; k++)
460 {
461 sumd = sumd + NChooseK (d[r] - 1 + k, k) * std::pow (1 - perror, (double) k);
462 }
463 P[r] = std::pow (perror, (double) d[r]) * sumd;
464
465 }
466
467 double Pb = 0;
468 for (uint32_t r = 0; r < 8; r++)
469 {
470 Pb = Pb + Bd[r] * P[r];
471 }
472
473 // cout << "Pb = " << Pb << endl;
474 uint32_t bits = pkt->GetSize () * 8;
475
476 double Ppacket = 1;
477 double temp = NChooseK (bits, 0);
478 temp *= std::pow ( (1 - Pb), (double) bits);
479 Ppacket -= temp;
480 temp = NChooseK (288, 1) * Pb * std::pow ( (1 - Pb), bits - 1.0);
481 Ppacket -= temp;
482
483 if (Ppacket > 1)
484 {
485 return 1;
486 }
487 else
488 {
489 return Ppacket;
490 }
491}
492
493/*************** UanPhyGen definition *****************/
495 : UanPhy (),
496 m_state (IDLE),
497 m_channel (0),
498 m_transducer (0),
499 m_device (0),
500 m_mac (0),
501 m_txPwrDb (0),
502 m_rxThreshDb (0),
503 m_ccaThreshDb (0),
504 m_pktRx (0),
505 m_pktTx (0),
506 m_cleared (false)
507{
508 m_pg = CreateObject<UniformRandomVariable> ();
509
511}
512
514{
515
516}
517
518void
520{
521 if (m_cleared)
522 {
523 return;
524 }
525 m_cleared = true;
526 m_listeners.clear ();
527 if (m_channel)
528 {
529 m_channel->Clear ();
530 m_channel = 0;
531 }
532 if (m_transducer)
533 {
534 m_transducer->Clear ();
535 m_transducer = 0;
536 }
537 if (m_device)
538 {
539 m_device->Clear ();
540 m_device = 0;
541 }
542 if (m_mac)
543 {
544 m_mac->Clear ();
545 m_mac = 0;
546 }
547 if (m_per)
548 {
549 m_per->Clear ();
550 m_per = 0;
551 }
552 if (m_sinr)
553 {
554 m_sinr->Clear ();
555 m_sinr = 0;
556 }
557 m_pktRx = 0;
558}
559
560void
562{
563 Clear ();
566}
567
570{
571 UanModesList l;
572 l.AppendMode (UanTxModeFactory::CreateMode (UanTxMode::FSK, 80, 80, 22000, 4000, 13, "FH-FSK")); // micromodem only
573 l.AppendMode (UanTxModeFactory::CreateMode (UanTxMode::PSK, 200, 200, 22000, 4000, 4, "QPSK"));
574 l.AppendMode (UanTxModeFactory::CreateMode (UanTxMode::PSK, 5000, 5000, 25000, 5000, 4, "QPSK")); // micromodem2
575
576 return l;
577}
578
579TypeId
581{
582
583 static TypeId tid = TypeId ("ns3::UanPhyGen")
584 .SetParent<UanPhy> ()
585 .SetGroupName ("Uan")
586 .AddConstructor<UanPhyGen> ()
587 .AddAttribute ("CcaThreshold",
588 "Aggregate energy of incoming signals to move to CCA Busy state dB.",
589 DoubleValue (10),
591 MakeDoubleChecker<double> ())
592 .AddAttribute ("RxThreshold",
593 "Required SNR for signal acquisition in dB.",
594 DoubleValue (10),
596 MakeDoubleChecker<double> ())
597 .AddAttribute ("TxPower",
598 "Transmission output power in dB.",
599 DoubleValue (190),
601 MakeDoubleChecker<double> ())
602 .AddAttribute ("SupportedModes",
603 "List of modes supported by this PHY.",
605 MakeUanModesListAccessor (&UanPhyGen::m_modes),
606 MakeUanModesListChecker () )
607 .AddAttribute ("PerModel",
608 "Functor to calculate PER based on SINR and TxMode.",
609 StringValue ("ns3::UanPhyPerGenDefault"),
611 MakePointerChecker<UanPhyPer> ())
612 .AddAttribute ("SinrModel",
613 "Functor to calculate SINR based on pkt arrivals and modes.",
614 StringValue ("ns3::UanPhyCalcSinrDefault"),
616 MakePointerChecker<UanPhyCalcSinr> ())
617 .AddTraceSource ("RxOk",
618 "A packet was received successfully.",
620 "ns3::UanPhy::TracedCallback")
621 .AddTraceSource ("RxError",
622 "A packet was received unsuccessfully.",
624 "ns3::UanPhy::TracedCallback")
625 .AddTraceSource ("Tx",
626 "Packet transmission beginning.",
628 "ns3::UanPhy::TracedCallback")
629 ;
630 return tid;
631
632}
633
634void
636{
637 NS_LOG_FUNCTION (this);
638 m_energyCallback = cb;
639}
640
641void
643{
644 NS_LOG_FUNCTION (this);
645
646 if (!m_energyCallback.IsNull ())
647 {
648 m_energyCallback (state);
649 }
650}
651
652void
654{
655 NS_LOG_FUNCTION (this);
656 NS_LOG_DEBUG ("Energy depleted at node " << m_device->GetNode ()->GetId () <<
657 ", stopping rx/tx activities");
658
660 if (m_txEndEvent.IsRunning ())
661 {
664 m_pktTx = 0;
665 }
666 if (m_rxEndEvent.IsRunning ())
667 {
670 m_pktRx = 0;
671 }
672}
673
674void
676{
677 NS_LOG_FUNCTION (this);
678 NS_LOG_DEBUG ("Energy recharged at node " << m_device->GetNode ()->GetId () <<
679 ", restoring rx/tx activities");
680
681 m_state = IDLE;
682}
683
684void
686{
687 NS_LOG_DEBUG ("PHY " << m_mac->GetAddress () << ": Transmitting packet");
688 if (m_state == DISABLED)
689 {
690 NS_LOG_DEBUG ("Energy depleted, node cannot transmit any packet. Dropping.");
691 return;
692 }
693
694 if (m_state == TX)
695 {
696 NS_LOG_DEBUG ("PHY requested to TX while already Transmitting. Dropping packet.");
697 return;
698 }
699 else if (m_state == SLEEP)
700 {
701 NS_LOG_DEBUG ("PHY requested to TX while sleeping. Dropping packet.");
702 return;
703 }
704
705 UanTxMode txMode = GetMode (modeNum);
706
707 if (m_pktRx != 0)
708 {
709 m_minRxSinrDb = -1e30;
710 m_pktRx = 0;
711 }
712
713 m_transducer->Transmit (Ptr<UanPhy> (this), pkt, m_txPwrDb, txMode);
714 m_state = TX;
716 double txdelay = pkt->GetSize () * 8.0 / txMode.GetDataRateBps ();
717 m_pktTx = pkt;
719 NS_LOG_DEBUG ("PHY " << m_mac->GetAddress () << " notifying listeners");
721 m_txLogger (pkt, m_txPwrDb, txMode);
722}
723
724void
726{
727 if (m_state == SLEEP || m_state == DISABLED)
728 {
729 NS_LOG_DEBUG ("Transmission ended but node sleeping or dead");
730 return;
731 }
732
733 NS_ASSERT (m_state == TX);
735 {
738 }
739 else
740 {
741 m_state = IDLE;
742 }
744
746}
747
748void
750{
751 m_listeners.push_back (listener);
752}
753
754
755void
756UanPhyGen::StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
757{
758 NS_LOG_DEBUG ("PHY " << m_mac->GetAddress () << ": rx power after RX gain = " << rxPowerDb << " dB re uPa");
759
760 switch (m_state)
761 {
762 case DISABLED:
763 NS_LOG_DEBUG ("Energy depleted, node cannot receive any packet. Dropping.");
764 NotifyRxDrop (pkt); // traced source netanim
765 return;
766 case TX:
767 NotifyRxDrop (pkt); // traced source netanim
768 NS_ASSERT (false);
769 break;
770 case RX:
771 {
774 m_minRxSinrDb = (newSinrDb < m_minRxSinrDb) ? newSinrDb : m_minRxSinrDb;
775 NS_LOG_DEBUG ("PHY " << m_mac->GetAddress () << ": Starting RX in RX mode. SINR of pktRx = " << m_minRxSinrDb);
776 NotifyRxBegin (pkt); // traced source netanim
777 }
778 break;
779
780 case CCABUSY:
781 case IDLE:
782 {
784 bool hasmode = false;
785 for (uint32_t i = 0; i < GetNModes (); i++)
786 {
787 if (txMode.GetUid () == GetMode (i).GetUid ())
788 {
789 hasmode = true;
790 break;
791 }
792 }
793 if (!hasmode)
794 {
795 break;
796 }
797
798
799 double newsinr = CalculateSinrDb (pkt, Simulator::Now (), rxPowerDb, txMode, pdp);
800 NS_LOG_DEBUG ("PHY " << m_mac->GetAddress () << ": Starting RX in IDLE mode. SINR = " << newsinr);
801 if (newsinr > m_rxThreshDb)
802 {
803 m_state = RX;
805 NotifyRxBegin (pkt); // traced source netanim
806 m_rxRecvPwrDb = rxPowerDb;
807 m_minRxSinrDb = newsinr;
808 m_pktRx = pkt;
810 m_pktRxMode = txMode;
811 m_pktRxPdp = pdp;
812 double txdelay = pkt->GetSize () * 8.0 / txMode.GetDataRateBps ();
813 m_rxEndEvent = Simulator::Schedule (Seconds (txdelay), &UanPhyGen::RxEndEvent, this, pkt, rxPowerDb, txMode);
815 }
816
817 }
818 break;
819 case SLEEP:
820 NS_LOG_DEBUG ("Sleep mode. Dropping packet.");
821 NotifyRxDrop (pkt); // traced source netanim
822 break;
823 }
824
826 {
829 }
830
831}
832
833void
834UanPhyGen::RxEndEvent (Ptr<Packet> pkt, [[maybe_unused]] double rxPowerDb, UanTxMode txMode)
835{
836 if (pkt != m_pktRx)
837 {
838 return;
839 }
840
841 if (m_state == DISABLED || m_state == SLEEP)
842 {
843 NS_LOG_DEBUG ("Sleep mode or dead. Dropping packet");
844 m_pktRx = 0;
845 NotifyRxDrop (pkt); // traced source netanim
846 return;
847 }
848
849 NotifyRxEnd (pkt); // traced source netanim
851 {
854 }
855 else
856 {
857 m_state = IDLE;
859 }
860
861 if (m_pg->GetValue (0, 1) > m_per->CalcPer (m_pktRx, m_minRxSinrDb, txMode))
862 {
863 m_rxOkLogger (pkt, m_minRxSinrDb, txMode);
865 if (!m_recOkCb.IsNull ())
866 {
867 m_recOkCb (pkt, m_minRxSinrDb, txMode);
868 }
869
870 }
871 else
872 {
873 m_rxErrLogger (pkt, m_minRxSinrDb, txMode);
875 if (!m_recErrCb.IsNull ())
876 {
878 }
879 }
880
881 m_pktRx = 0;
882}
883
884void
886{
887 m_recOkCb = cb;
888}
889
890void
892{
893 m_recErrCb = cb;
894}
895bool
897{
898 return m_state == SLEEP;
899}
900bool
902{
903 return m_state == IDLE;
904}
905bool
907{
908 return !IsStateIdle () && !IsStateSleep ();
909}
910bool
912{
913 return m_state == RX;
914}
915bool
917{
918 return m_state == TX;
919}
920
921bool
923{
924 return m_state == CCABUSY;
925}
926
927
928void
930{
931 m_txPwrDb = txpwr;
932}
933void
935{
936 m_rxThreshDb = thresh;
937}
938void
940{
941 m_ccaThreshDb = thresh;
942}
943
944double
946{
947 return m_txPwrDb;
948
949}
950
951double
953{
954 return m_rxThreshDb;
955}
956double
958{
959 return m_ccaThreshDb;
960}
961
964{
965 return m_channel;
966}
967
970{
971 return m_device;
972}
973
976{
977 return m_transducer;
978}
979void
981{
983}
984
985void
987{
988 m_device = device;
989}
990
991void
993{
994 m_mac = mac;
995}
996
997void
999{
1000 m_transducer = trans;
1001 m_transducer->AddPhy (this);
1002}
1003
1004void
1006{
1007 if (sleep )
1008 {
1009 m_state = SLEEP;
1010 if (!m_energyCallback.IsNull ())
1011 {
1013 }
1014 }
1015 else if (m_state == SLEEP)
1016 {
1018 {
1019 m_state = CCABUSY;
1021 }
1022 else
1023 {
1024 m_state = IDLE;
1025 }
1026
1027 if (!m_energyCallback.IsNull ())
1028 {
1030 }
1031 }
1032}
1033
1034int64_t
1036{
1037 NS_LOG_FUNCTION (this << stream);
1038 m_pg->SetStream (stream);
1039 return 1;
1040}
1041
1042void
1043UanPhyGen::NotifyTransStartTx (Ptr<Packet> packet, [[maybe_unused]] double txPowerDb, UanTxMode txMode)
1044{
1045 if (m_pktRx)
1046 {
1047 m_minRxSinrDb = -1e30;
1048 }
1049}
1050
1051void
1053{
1055 {
1056 m_state = IDLE;
1058 }
1059}
1060
1061double
1062UanPhyGen::CalculateSinrDb (Ptr<Packet> pkt, Time arrTime, double rxPowerDb, UanTxMode mode, UanPdp pdp)
1063{
1064 double noiseDb = m_channel->GetNoiseDbHz ( (double) mode.GetCenterFreqHz () / 1000.0) + 10 * std::log10 (mode.GetBandwidthHz ());
1065 return m_sinr->CalcSinrDb (pkt, arrTime, rxPowerDb, noiseDb, mode, pdp, m_transducer->GetArrivalList ());
1066}
1067
1068double
1070{
1071
1072 const UanTransducer::ArrivalList &arrivalList = m_transducer->GetArrivalList ();
1073
1074 UanTransducer::ArrivalList::const_iterator it = arrivalList.begin ();
1075
1076 double interfPower = 0;
1077
1078 for (; it != arrivalList.end (); it++)
1079 {
1080 if (pkt != it->GetPacket ())
1081 {
1082 interfPower += DbToKp (it->GetRxPowerDb ());
1083 }
1084 }
1085
1086 return KpToDb (interfPower);
1087
1088}
1089
1090double
1092{
1093 return std::pow (10, db / 10.0);
1094}
1095double
1097{
1098 return 10 * std::log10 (kp);
1099}
1100
1101void
1103{
1104 ListenerList::const_iterator it = m_listeners.begin ();
1105 for (; it != m_listeners.end (); it++)
1106 {
1107 (*it)->NotifyRxStart ();
1108 }
1109
1110}
1111void
1113{
1114 ListenerList::const_iterator it = m_listeners.begin ();
1115 for (; it != m_listeners.end (); it++)
1116 {
1117 (*it)->NotifyRxEndOk ();
1118 }
1119}
1120void
1122{
1123 ListenerList::const_iterator it = m_listeners.begin ();
1124 for (; it != m_listeners.end (); it++)
1125 {
1126 (*it)->NotifyRxEndError ();
1127 }
1128}
1129void
1131{
1132 ListenerList::const_iterator it = m_listeners.begin ();
1133 for (; it != m_listeners.end (); it++)
1134 {
1135 (*it)->NotifyCcaStart ();
1136 }
1137}
1138void
1140{
1141 ListenerList::const_iterator it = m_listeners.begin ();
1142 for (; it != m_listeners.end (); it++)
1143 {
1144 (*it)->NotifyCcaEnd ();
1145 }
1146}
1147
1148void
1150{
1151 ListenerList::const_iterator it = m_listeners.begin ();
1152 for (; it != m_listeners.end (); it++)
1153 {
1154 (*it)->NotifyTxStart (duration);
1155 }
1156}
1157
1158void
1160{
1161 ListenerList::const_iterator it = m_listeners.begin ();
1162 for (; it != m_listeners.end (); it++)
1163 {
1164 (*it)->NotifyTxEnd ();
1165 }
1166}
1167
1170{
1171 return m_modes.GetNModes ();
1172}
1173
1176{
1177 NS_ASSERT (n < m_modes.GetNModes ());
1178
1179 return m_modes[n];
1180}
1181
1184{
1185 return m_pktRx;
1186}
1187
1188
1189} // namespace ns3
#define min(a, b)
Definition: 80211b.c:42
#define max(a, b)
Definition: 80211b.c:43
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1386
void Nullify(void)
Discard the implementation, set it to null.
Definition: callback.h:1391
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:71
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:856
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
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:268
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:556
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
Hold variables of type string.
Definition: string.h:41
Time GetDelay(void) const
Get the delay time, usually from first arrival of signal.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
Container for UanTxModes.
Definition: uan-tx-mode.h:258
uint32_t GetNModes(void) const
Get the number of modes in this list.
Definition: uan-tx-mode.cc:259
void AppendMode(UanTxMode mode)
Add mode to this list.
Definition: uan-tx-mode.cc:232
AttributeValue implementation for UanModesList.
The power delay profile returned by propagation models.
double SumTapsFromMaxNc(Time delay, Time duration) const
Compute the non-coherent sum of tap amplitudes starting after a delay from the maximum amplitude for ...
std::vector< Tap >::const_iterator Iterator
Convenience iterator typedef.
double SumTapsNc(Time begin, Time end) const
Compute the non-coherent sum of tap amplitudes between a start and end time.
Iterator GetBegin(void) const
Get the beginning of the tap vector.
Iterator GetEnd(void) const
Get the end of the tap list (one beyond the last entry).
const Tap & GetTap(uint32_t i) const
Get the Tap at the specified delay index.
Default SINR calculator for UanPhyGen.
Definition: uan-phy-gen.h:167
UanPhyCalcSinrDefault()
Constructor.
Definition: uan-phy-gen.cc:53
virtual double CalcSinrDb(Ptr< Packet > pkt, Time arrTime, double rxPowerDb, double ambNoiseDb, UanTxMode mode, UanPdp pdp, const UanTransducer::ArrivalList &arrivalList) const
Calculate the SINR value for a packet.
Definition: uan-phy-gen.cc:74
static TypeId GetTypeId(void)
Register this type.
Definition: uan-phy-gen.cc:63
virtual ~UanPhyCalcSinrDefault()
Destructor.
Definition: uan-phy-gen.cc:57
WHOI Micromodem like FH-FSK model.
Definition: uan-phy-gen.h:228
UanPhyCalcSinrFhFsk()
Constructor.
Definition: uan-phy-gen.cc:101
virtual double CalcSinrDb(Ptr< Packet > pkt, Time arrTime, double rxPowerDb, double ambNoiseDb, UanTxMode mode, UanPdp pdp, const UanTransducer::ArrivalList &arrivalList) const
Calculate the SINR value for a packet.
Definition: uan-phy-gen.cc:126
virtual ~UanPhyCalcSinrFhFsk()
Destructor.
Definition: uan-phy-gen.cc:105
static TypeId GetTypeId(void)
Register this type.
Definition: uan-phy-gen.cc:111
uint32_t m_hops
Number of hops.
Definition: uan-phy-gen.h:251
Class used for calculating SINR of packet in UanPhy.
Definition: uan-phy.h:45
double DbToKp(double db) const
Convert dB re 1 uPa to kilopascals.
Definition: uan-phy.h:82
double KpToDb(double kp) const
Convert kilopascals to dB re 1 uPa.
Definition: uan-phy.h:92
Generic PHY model.
Definition: uan-phy-gen.h:267
virtual Ptr< UanNetDevice > GetDevice(void) const
Get the device hosting this Phy.
Definition: uan-phy-gen.cc:969
void NotifyListenersRxStart(void)
Call UanListener::NotifyRxStart on all listeners.
double KpToDb(double kp)
Convert kilopascals to dB.
virtual Ptr< UanTransducer > GetTransducer(void)
Get the attached transducer.
Definition: uan-phy-gen.cc:975
Ptr< UanPhyPer > m_per
Error model.
Definition: uan-phy-gen.h:337
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_rxOkLogger
A packet destined for this Phy was received without error.
Definition: uan-phy-gen.h:363
virtual uint32_t GetNModes(void)
Get the number of transmission modes supported by this Phy.
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_txLogger
A packet was sent from this Phy.
Definition: uan-phy-gen.h:367
UanPhyGen()
Constructor.
Definition: uan-phy-gen.cc:494
virtual void SetRxThresholdDb(double thresh)
Set the minimum SINR threshold to receive a packet without errors.
Definition: uan-phy-gen.cc:934
virtual void EnergyRechargeHandler(void)
Handle the energy recharge event.
Definition: uan-phy-gen.cc:675
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_rxErrLogger
A packet destined for this Phy was received with error.
Definition: uan-phy-gen.h:365
void NotifyListenersTxStart(Time duration)
Call UanListener::NotifyTxStart on all listeners.
virtual bool IsStateRx(void)
Definition: uan-phy-gen.cc:911
Time m_pktRxArrTime
Packet arrival time.
Definition: uan-phy-gen.h:348
virtual void StartRxPacket(Ptr< Packet > pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
Packet arriving from channel: i.e.
Definition: uan-phy-gen.cc:756
virtual void SetSleepMode(bool sleep)
Set the Phy SLEEP mode.
void UpdatePowerConsumption(const State state)
Update energy source with new state.
Definition: uan-phy-gen.cc:642
void NotifyListenersTxEnd(void)
Call UanListener::NotifyTxEnd on all listeners.
ListenerList m_listeners
List of listeners.
Definition: uan-phy-gen.h:330
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
double m_rxRecvPwrDb
Receiver power.
Definition: uan-phy-gen.h:347
virtual void SetChannel(Ptr< UanChannel > channel)
Attach to a channel.
Definition: uan-phy-gen.cc:980
virtual Ptr< UanChannel > GetChannel(void) const
Get the attached channel.
Definition: uan-phy-gen.cc:963
Ptr< UanPhyCalcSinr > m_sinr
SINR calculator.
Definition: uan-phy-gen.h:338
Ptr< Packet > m_pktRx
Received packet.
Definition: uan-phy-gen.h:344
static UanModesList GetDefaultModes(void)
Get the default transmission modes.
Definition: uan-phy-gen.cc:569
virtual ~UanPhyGen()
Dummy destructor, see DoDispose.
Definition: uan-phy-gen.cc:513
DeviceEnergyModel::ChangeStateCallback m_energyCallback
Energy model callback.
Definition: uan-phy-gen.h:361
Ptr< UanTransducer > m_transducer
Associated transducer.
Definition: uan-phy-gen.h:334
double m_rxThreshDb
Receive SINR threshold.
Definition: uan-phy-gen.h:341
EventId m_rxEndEvent
Rx event.
Definition: uan-phy-gen.h:355
double m_ccaThreshDb
CCA busy threshold.
Definition: uan-phy-gen.h:342
virtual bool IsStateSleep(void)
Definition: uan-phy-gen.cc:896
virtual void RegisterListener(UanPhyListener *listener)
Register a UanPhyListener to be notified of common UanPhy events.
Definition: uan-phy-gen.cc:749
RxOkCallback m_recOkCb
Callback for packets received without error.
Definition: uan-phy-gen.h:331
virtual void SendPacket(Ptr< Packet > pkt, uint32_t modeNum)
Send a packet using a specific transmission mode.
Definition: uan-phy-gen.cc:685
State m_state
Phy state.
Definition: uan-phy-gen.h:329
virtual void SetDevice(Ptr< UanNetDevice > device)
Set the device hosting this Phy.
Definition: uan-phy-gen.cc:986
Ptr< UanMac > m_mac
MAC layer.
Definition: uan-phy-gen.h:336
virtual void SetTransducer(Ptr< UanTransducer > trans)
Attach a transducer to this Phy.
Definition: uan-phy-gen.cc:998
double GetInterferenceDb(Ptr< Packet > pkt)
Calculate interference power from overlapping packet arrivals, in dB.
double m_txPwrDb
Transmit power.
Definition: uan-phy-gen.h:340
double CalculateSinrDb(Ptr< Packet > pkt, Time arrTime, double rxPowerDb, UanTxMode mode, UanPdp pdp)
Calculate the SINR value for a packet.
void NotifyListenersCcaStart(void)
Call UanListener::NotifyCcaStart on all listeners.
static TypeId GetTypeId(void)
Register this type.
Definition: uan-phy-gen.cc:580
Ptr< UniformRandomVariable > m_pg
Provides uniform random variables.
Definition: uan-phy-gen.h:358
virtual void DoDispose()
Destructor implementation.
Definition: uan-phy-gen.cc:561
virtual void SetTxPowerDb(double txpwr)
Set the transmit power.
Definition: uan-phy-gen.cc:929
EventId m_txEndEvent
Tx event.
Definition: uan-phy-gen.h:354
virtual void NotifyTransStartTx(Ptr< Packet > packet, double txPowerDb, UanTxMode txMode)
Called when a transmission is beginning on the attached transducer.
virtual void SetReceiveOkCallback(RxOkCallback cb)
Set the callback to be used when a packet is received without error.
Definition: uan-phy-gen.cc:885
bool m_cleared
Flag when we've been cleared.
Definition: uan-phy-gen.h:352
virtual bool IsStateCcaBusy(void)
Definition: uan-phy-gen.cc:922
virtual void EnergyDepletionHandler(void)
Handle the energy depletion event.
Definition: uan-phy-gen.cc:653
virtual void SetMac(Ptr< UanMac > mac)
Set the MAC forwarding messages to this Phy.
Definition: uan-phy-gen.cc:992
virtual double GetTxPowerDb(void)
Get the current transmit power, in dB.
Definition: uan-phy-gen.cc:945
double m_minRxSinrDb
Minimum receive SINR during packet reception.
Definition: uan-phy-gen.h:346
void NotifyListenersRxBad(void)
Call UanListener::NotifyRxEndError on all listeners.
Ptr< UanChannel > m_channel
Attached channel.
Definition: uan-phy-gen.h:333
virtual Ptr< Packet > GetPacketRx(void) const
Get the packet currently being received.
double DbToKp(double db)
Convert dB to kilopascals.
UanTxMode m_pktRxMode
Packet transmission mode at receiver.
Definition: uan-phy-gen.h:350
void TxEndEvent()
Event to process end of packet transmission.
Definition: uan-phy-gen.cc:725
virtual bool IsStateTx(void)
Definition: uan-phy-gen.cc:916
virtual UanTxMode GetMode(uint32_t n)
Get a specific transmission mode.
virtual void SetCcaThresholdDb(double thresh)
Set the threshold for detecting channel busy.
Definition: uan-phy-gen.cc:939
RxErrCallback m_recErrCb
Callback for packets received with errors.
Definition: uan-phy-gen.h:332
virtual bool IsStateIdle(void)
Definition: uan-phy-gen.cc:901
void RxEndEvent(Ptr< Packet > pkt, double rxPowerDb, UanTxMode txMode)
Event to process end of packet reception.
Definition: uan-phy-gen.cc:834
virtual double GetCcaThresholdDb(void)
Get the CCA threshold signal strength required to detect channel busy.
Definition: uan-phy-gen.cc:957
Ptr< UanNetDevice > m_device
Device hosting this Phy.
Definition: uan-phy-gen.h:335
virtual void Clear(void)
Clear all pointer references.
Definition: uan-phy-gen.cc:519
virtual void SetReceiveErrorCallback(RxErrCallback cb)
Set the callback to be used when a packet is received with errors.
Definition: uan-phy-gen.cc:891
Ptr< Packet > m_pktTx
Sent packet.
Definition: uan-phy-gen.h:345
virtual void SetEnergyModelCallback(DeviceEnergyModel::ChangeStateCallback cb)
Set the DeviceEnergyModel callback for UanPhy device.
Definition: uan-phy-gen.cc:635
void NotifyListenersRxGood(void)
Call UanListener::NotifyRxEndOk on all listeners.
UanPdp m_pktRxPdp
Power delay profile of packet.
Definition: uan-phy-gen.h:349
virtual double GetRxThresholdDb(void)
Get the minimum received signal strength required to receive a packet without errors.
Definition: uan-phy-gen.cc:952
UanModesList m_modes
List of modes supported by this PHY.
Definition: uan-phy-gen.h:327
virtual bool IsStateBusy(void)
Definition: uan-phy-gen.cc:906
virtual void NotifyIntChange(void)
Called when there has been a change in the amount of interference this node is experiencing from othe...
void NotifyListenersCcaEnd(void)
Call UanListener::NotifyCcaEnd on all listeners.
Base class for UAN Phy models.
Definition: uan-phy.h:179
void NotifyTxDrop(Ptr< const Packet > packet)
Called when the transducer attempts to transmit a new packet while already transmitting a prior packe...
Definition: uan-phy.cc:126
void NotifyRxDrop(Ptr< const Packet > packet)
Called when the Phy drops a packet.
Definition: uan-phy.cc:144
void NotifyRxBegin(Ptr< const Packet > packet)
Called when the Phy begins to receive a packet.
Definition: uan-phy.cc:132
void NotifyRxEnd(Ptr< const Packet > packet)
Called when a packet is received without error.
Definition: uan-phy.cc:138
State
Enum defining possible Phy states.
Definition: uan-phy.h:183
@ RX
Receiving.
Definition: uan-phy.h:186
@ SLEEP
Sleeping.
Definition: uan-phy.h:188
@ IDLE
Idle state.
Definition: uan-phy.h:184
@ DISABLED
Disabled.
Definition: uan-phy.h:189
@ TX
Transmitting.
Definition: uan-phy.h:187
@ CCABUSY
Channel busy.
Definition: uan-phy.h:185
Interface for PHY event listener.
Definition: uan-phy.h:147
Packet error rate calculation for common tx modes based on UanPhyPerUmodem.
Definition: uan-phy-gen.h:127
virtual ~UanPhyPerCommonModes()
Destructor.
Definition: uan-phy-gen.cc:257
virtual double CalcPer(Ptr< Packet > pkt, double sinrDb, UanTxMode mode)
Calculate the Packet ERror probability based on SINR at the receiver and a tx mode.
Definition: uan-phy-gen.cc:274
static TypeId GetTypeId(void)
Register this type.
Definition: uan-phy-gen.cc:263
UanPhyPerCommonModes()
Constructor.
Definition: uan-phy-gen.cc:251
Default Packet Error Rate calculator for UanPhyGen.
Definition: uan-phy-gen.h:45
UanPhyPerGenDefault()
Constructor.
Definition: uan-phy-gen.cc:211
static TypeId GetTypeId(void)
Register this type.
Definition: uan-phy-gen.cc:221
virtual double CalcPer(Ptr< Packet > pkt, double sinrDb, UanTxMode mode)
Calculate the packet error probability based on SINR at the receiver and a tx mode.
Definition: uan-phy-gen.cc:238
virtual ~UanPhyPerGenDefault()
Destructor.
Definition: uan-phy-gen.cc:216
double m_thresh
SINR threshold.
Definition: uan-phy-gen.h:60
Calculate packet error probability, based on received SINR and modulation (mode).
Definition: uan-phy.h:111
Packet error rate calculation assuming WHOI Micromodem-like PHY (FH-FSK)
Definition: uan-phy-gen.h:75
static TypeId GetTypeId(void)
Register this type.
Definition: uan-phy-gen.cc:397
virtual double CalcPer(Ptr< Packet > pkt, double sinrDb, UanTxMode mode)
Calculate the packet error probability based on SINR at the receiver and a tx mode.
Definition: uan-phy-gen.cc:428
double NChooseK(uint32_t n, uint32_t k)
Binomial coefficient.
Definition: uan-phy-gen.cc:408
UanPhyPerUmodem()
Constructor.
Definition: uan-phy-gen.cc:388
virtual ~UanPhyPerUmodem()
Destructor.
Definition: uan-phy-gen.cc:392
std::list< UanPacketArrival > ArrivalList
List of arriving packets overlapping in time.
static UanTxMode CreateMode(UanTxMode::ModulationType type, uint32_t dataRateBps, uint32_t phyRateSps, uint32_t cfHz, uint32_t bwHz, uint32_t constSize, std::string name)
Definition: uan-tx-mode.cc:132
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:42
@ QAM
Quadrature amplitude modulation.
Definition: uan-tx-mode.h:52
@ OTHER
Unspecified/undefined.
Definition: uan-tx-mode.h:54
@ PSK
Phase shift keying.
Definition: uan-tx-mode.h:51
@ FSK
Frequency shift keying.
Definition: uan-tx-mode.h:53
uint32_t GetDataRateBps(void) const
Get the data rate of the transmit mode.
Definition: uan-tx-mode.cc:45
uint32_t GetCenterFreqHz(void) const
Get the transmission center frequency.
Definition: uan-tx-mode.cc:57
uint32_t GetBandwidthHz(void) const
Get the transmission signal bandwidth.
Definition: uan-tx-mode.cc:63
uint32_t GetConstellationSize(void) const
Get the number of constellation points in the modulation scheme.
Definition: uan-tx-mode.cc:69
uint32_t GetPhyRateSps(void) const
Get the physical signaling rate.
Definition: uan-tx-mode.cc:51
uint32_t GetUid(void) const
Get a unique id for the mode.
Definition: uan-tx-mode.cc:81
ModulationType GetModType(void) const
Get the modulation type of the mode.
Definition: uan-tx-mode.cc:39
Hold an unsigned integer type.
Definition: uinteger.h:44
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:42
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Definition: pointer.h:227
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:45
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
int64x64_t Abs(const int64x64_t &value)
Absolute value.
Definition: int64x64.h:205
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:265
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
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.
Time Rem(const Time &lhs, const Time &rhs)
Remainder (modulus) from the quotient of two Times.
Definition: nstime.h:1078
@ IDLE
Channel is IDLE, no packet is being transmitted.
Definition: csma-channel.h:75
channel
Definition: third.py:92
mac
Definition: third.py:96
def start()
Definition: core.py:1853