A Discrete-Event Network Simulator
API
uan-phy-dual.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.h"
23 #include "uan-phy-dual.h"
24 #include "uan-phy-gen.h"
25 #include "uan-tx-mode.h"
26 #include "uan-net-device.h"
27 #include "uan-channel.h"
28 #include "ns3/double.h"
29 #include "ns3/string.h"
30 #include "ns3/log.h"
31 #include "ns3/ptr.h"
32 #include "ns3/traced-callback.h"
33 #include "ns3/trace-source-accessor.h"
34 #include "ns3/simulator.h"
35 #include "uan-header-common.h"
36 #include "uan-mac-rc.h"
37 
38 #include <cmath>
39 
40 
41 namespace ns3 {
42 
43 NS_LOG_COMPONENT_DEFINE ("UanPhyDual");
44 
45 NS_OBJECT_ENSURE_REGISTERED (UanPhyDual);
46 NS_OBJECT_ENSURE_REGISTERED (UanPhyCalcSinrDual);
47 
49 {
50 
51 }
53 {
54 
55 }
56 
57 TypeId
59 {
60  static TypeId tid = TypeId ("ns3::UanPhyCalcSinrDual")
61  .SetParent<Object> ()
62  .AddConstructor<UanPhyCalcSinrDual> ()
63  ;
64  return tid;
65 }
66 
67 double
69  Time arrTime,
70  double rxPowerDb,
71  double ambNoiseDb,
72  UanTxMode mode,
73  UanPdp pdp,
74  const UanTransducer::ArrivalList &arrivalList) const
75 {
76 
77  if (mode.GetModType () != UanTxMode::OTHER)
78  {
79  NS_LOG_WARN ("Calculating SINR for unsupported modulation type");
80  }
81 
82  double intKp = -DbToKp (rxPowerDb); // This packet is in the arrivalList
83  UanTransducer::ArrivalList::const_iterator it = arrivalList.begin ();
84  for (; it != arrivalList.end (); it++)
85  {
86  // Only count interference if there is overlap in incoming frequency
87  if (std::abs ( (double) it->GetTxMode ().GetCenterFreqHz () - (double) mode.GetCenterFreqHz ())
88  < (double)(it->GetTxMode ().GetBandwidthHz () / 2 + mode.GetBandwidthHz () / 2) - 0.5)
89  {
90  UanHeaderCommon ch, ch2;
91  if (pkt)
92  {
93  pkt->PeekHeader (ch);
94  }
95  it->GetPacket ()->PeekHeader (ch2);
96 
97  if (pkt)
98  {
99  if (ch.GetType () == UanMacRc::TYPE_DATA)
100  {
101  NS_LOG_DEBUG ("Adding interferer from " << ch2.GetSrc () << " against " << ch.GetSrc () << ": PktRxMode: "
102  << mode.GetName () << " Int mode: " << it->GetTxMode ().GetName () << " Separation: "
103  << std::abs ( (double) it->GetTxMode ().GetCenterFreqHz () - (double) mode.GetCenterFreqHz ())
104  << " Combined bandwidths: " << (double)(it->GetTxMode ().GetBandwidthHz () / 2 + mode.GetBandwidthHz () / 2) - 0.5);
105  }
106  }
107  intKp += DbToKp (it->GetRxPowerDb ());
108  }
109  }
110 
111  double totalIntDb = KpToDb (intKp + DbToKp (ambNoiseDb));
112 
113  NS_LOG_DEBUG (Simulator::Now ().GetSeconds () << " Calculating SINR: RxPower = " << rxPowerDb << " dB. Number of interferers = " << arrivalList.size () << " Interference + noise power = " << totalIntDb << " dB. SINR = " << rxPowerDb - totalIntDb << " dB.");
114  return rxPowerDb - totalIntDb;
115 }
116 
118  : UanPhy ()
119 {
120 
121  m_phy1 = CreateObject<UanPhyGen> ();
122  m_phy2 = CreateObject<UanPhyGen> ();
123 
124  m_phy1->SetReceiveOkCallback (m_recOkCb);
125  m_phy2->SetReceiveOkCallback (m_recOkCb);
126 
127  m_phy1->SetReceiveErrorCallback (m_recErrCb);
128  m_phy2->SetReceiveErrorCallback (m_recErrCb);
129 
130 }
131 
133 {
134 }
135 
136 void
138 {
139  if (m_phy1)
140  {
141  m_phy1->Clear ();
142  m_phy1 = 0;
143  }
144  if (m_phy2)
145  {
146  m_phy2->Clear ();
147  m_phy2 = 0;
148  }
149 }
150 void
152 {
153  Clear ();
155 }
156 
157 TypeId
159 {
160  static TypeId tid = TypeId ("ns3::UanPhyDual")
161  .SetParent<UanPhy> ()
162  .AddConstructor<UanPhyDual> ()
163  .AddAttribute ("CcaThresholdPhy1",
164  "Aggregate energy of incoming signals to move to CCA Busy state dB of Phy1.",
165  DoubleValue (10),
167  MakeDoubleChecker<double> ())
168  .AddAttribute ("CcaThresholdPhy2",
169  "Aggregate energy of incoming signals to move to CCA Busy state dB of Phy2.",
170  DoubleValue (10),
172  MakeDoubleChecker<double> ())
173  .AddAttribute ("TxPowerPhy1",
174  "Transmission output power in dB of Phy1.",
175  DoubleValue (190),
177  MakeDoubleChecker<double> ())
178  .AddAttribute ("TxPowerPhy2",
179  "Transmission output power in dB of Phy2.",
180  DoubleValue (190),
182  MakeDoubleChecker<double> ())
183  .AddAttribute ("RxGainPhy1",
184  "Gain added to incoming signal at receiver of Phy1.",
185  DoubleValue (0),
187  MakeDoubleChecker<double> ())
188  .AddAttribute ("RxGainPhy2",
189  "Gain added to incoming signal at receiver of Phy2.",
190  DoubleValue (0),
192  MakeDoubleChecker<double> ())
193  .AddAttribute ("SupportedModesPhy1",
194  "List of modes supported by Phy1.",
198  .AddAttribute ("SupportedModesPhy2",
199  "List of modes supported by Phy2.",
203  .AddAttribute ("PerModelPhy1",
204  "Functor to calculate PER based on SINR and TxMode for Phy1.",
205  StringValue ("ns3::UanPhyPerGenDefault"),
207  MakePointerChecker<UanPhyPer> ())
208  .AddAttribute ("PerModelPhy2",
209  "Functor to calculate PER based on SINR and TxMode for Phy2.",
210  StringValue ("ns3::UanPhyPerGenDefault"),
212  MakePointerChecker<UanPhyPer> ())
213  .AddAttribute ("SinrModelPhy1",
214  "Functor to calculate SINR based on pkt arrivals and modes for Phy1.",
215  StringValue ("ns3::UanPhyCalcSinrDual"),
217  MakePointerChecker<UanPhyCalcSinr> ())
218  .AddAttribute ("SinrModelPhy2",
219  "Functor to calculate SINR based on pkt arrivals and modes for Phy2.",
220  StringValue ("ns3::UanPhyCalcSinrDual"),
222  MakePointerChecker<UanPhyCalcSinr> ())
223  .AddTraceSource ("RxOk",
224  "A packet was received successfully.",
226  "ns3::UanPhy::TracedCallback")
227  .AddTraceSource ("RxError",
228  "A packet was received unsuccessfully.",
230  "ns3::UanPhy::TracedCallback")
231  .AddTraceSource ("Tx",
232  "Packet transmission beginning.",
234  "ns3::UanPhy::TracedCallback")
235 
236  ;
237 
238  return tid;
239 }
240 
241 void
243 {
244  NS_LOG_DEBUG ("Not Implemented");
245 }
246 
247 void
249 {
250  NS_LOG_DEBUG ("Not Implemented");
251 }
252 
253 void
254 UanPhyDual::SendPacket (Ptr<Packet> pkt, uint32_t modeNum)
255 {
256  if (modeNum <= m_phy1->GetNModes () - 1)
257  {
258  NS_LOG_DEBUG (Simulator::Now ().GetSeconds () << " Sending packet on Phy1 with mode number " << modeNum);
259  m_txLogger (pkt, m_phy1->GetTxPowerDb (), m_phy1->GetMode (modeNum));
260  m_phy1->SendPacket (pkt, modeNum);
261 
262  }
263  else
264  {
265  NS_LOG_DEBUG (Simulator::Now ().GetSeconds () << " Sending packet on Phy2 with mode number " << modeNum - m_phy1->GetNModes ());
266  m_txLogger (pkt, m_phy2->GetTxPowerDb (), m_phy2->GetMode (modeNum - m_phy1->GetNModes ()));
267  m_phy2->SendPacket (pkt, modeNum - m_phy1->GetNModes ());
268  }
269 }
270 void
272 {
273  m_phy1->RegisterListener (listener);
274  m_phy2->RegisterListener (listener);
275 }
276 
277 void
278 UanPhyDual::StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
279 {
280  // Not called. StartRxPacket in m_phy1 and m_phy2 are called directly from Transducer.
281 }
282 
283 void
285 {
286  m_phy1->SetReceiveOkCallback (cb);
287  m_phy2->SetReceiveOkCallback (cb);
288 }
289 
290 void
292 {
293  m_phy1->SetReceiveErrorCallback (cb);
294  m_phy2->SetReceiveErrorCallback (cb);
295 }
296 
297 void
299 {
300  m_phy1->SetRxGainDb (gain);
301  m_phy2->SetRxGainDb (gain);
302 }
303 void
305 {
306  m_phy1->SetRxGainDb (gain);
307 }
308 
309 void
311 {
312  m_phy2->SetRxGainDb (gain);
313 }
314 
315 void
317 {
318  m_phy1->SetTxPowerDb (txpwr);
319  m_phy2->SetTxPowerDb (txpwr);
320 }
321 
322 void
324 {
325  m_phy1->SetTxPowerDb (txpwr);
326 }
327 void
329 {
330  m_phy2->SetTxPowerDb (txpwr);
331 }
332 
333 void
335 {
336  NS_LOG_WARN ("SetRxThresholdDb is deprecated and has no effect. Look at PER Functor attribute");
337  m_phy1->SetRxThresholdDb (thresh);
338  m_phy2->SetRxThresholdDb (thresh);
339 }
340 void
342 {
343  m_phy1->SetCcaThresholdDb (thresh);
344  m_phy2->SetCcaThresholdDb (thresh);
345 }
346 
347 void
349 {
350  m_phy1->SetCcaThresholdDb (thresh);
351 }
352 void
354 {
355  m_phy2->SetCcaThresholdDb (thresh);
356 }
357 
358 double
360 {
361  NS_LOG_WARN ("Warning: UanPhyDual::GetRxGainDb returns RxGain of Phy 1");
362  return m_phy1->GetRxGainDb ();
363 }
364 double
366 {
367  return m_phy1->GetRxGainDb ();
368 }
369 double
371 {
372  return m_phy2->GetRxGainDb ();
373 }
374 
375 double
377 {
378  NS_LOG_WARN ("Warning: Dual Phy only returns TxPowerDb of Phy 1");
379  return m_phy1->GetTxPowerDb ();
380 }
381 
382 double
384 {
385  return m_phy1->GetTxPowerDb ();
386 }
387 
388 double
390 {
391  return m_phy2->GetTxPowerDb ();
392 }
393 
394 double
396 {
397  return m_phy1->GetRxThresholdDb ();
398 }
399 
400 double
402 {
403  NS_LOG_WARN ("Dual Phy only returns CCAThreshold of Phy 1");
404  return m_phy1->GetCcaThresholdDb ();
405 }
406 double
408 {
409  return m_phy1->GetCcaThresholdDb ();
410 }
411 double
413 {
414  return m_phy2->GetCcaThresholdDb ();
415 }
416 
417 bool
419 {
420  return m_phy1->IsStateIdle ();
421 }
422 bool
424 {
425  return m_phy2->IsStateIdle ();
426 }
427 
428 bool
430 {
431  return m_phy1->IsStateRx ();
432 }
433 
434 bool
436 {
437  return m_phy2->IsStateRx ();
438 }
439 
440 bool
442 {
443  return m_phy1->IsStateTx ();
444 }
445 
448 {
449  return m_phy1->GetPacketRx ();
450 }
451 
454 {
455  return m_phy2->GetPacketRx ();
456 }
457 
458 bool
460 {
461  return m_phy2->IsStateTx ();
462 }
463 bool
465 {
466  return m_phy1->IsStateSleep () && m_phy2->IsStateSleep ();
467 }
468 bool
470 {
471  return m_phy1->IsStateIdle () && m_phy2->IsStateIdle ();
472 }
473 bool
475 {
476  return !IsStateIdle () || !IsStateSleep ();
477 }
478 bool
480 {
481  return m_phy1->IsStateRx () || m_phy2->IsStateRx ();
482 }
483 bool
485 {
486  return m_phy1->IsStateTx () || m_phy2->IsStateTx ();
487 }
488 bool
490 {
491  return m_phy1->IsStateCcaBusy () || m_phy2->IsStateCcaBusy ();
492 }
495 {
496  return m_phy1->GetChannel ();
497 }
500 {
501  return m_phy1->GetDevice ();
502 }
503 void
505 {
506  m_phy1->SetChannel (channel);
507  m_phy2->SetChannel (channel);
508 }
509 void
511 {
512  m_phy1->SetDevice (device);
513  m_phy2->SetDevice (device);
514 }
515 void
517 {
518  m_phy1->SetMac (mac);
519  m_phy2->SetMac (mac);
520 }
521 void
522 UanPhyDual::NotifyTransStartTx (Ptr<Packet> packet, double txPowerDb, UanTxMode txMode)
523 {
524 
525 }
526 void
528 {
529  m_phy1->NotifyIntChange ();
530  m_phy2->NotifyIntChange ();
531 
532 }
533 void
535 {
536  m_phy1->SetTransducer (trans);
537  m_phy2->SetTransducer (trans);
538 }
541 {
542  NS_LOG_WARN ("DualPhy Returning transducer of Phy1");
543  return m_phy1->GetTransducer ();
544 }
545 uint32_t
547 {
548  return m_phy1->GetNModes () + m_phy2->GetNModes ();
549 }
550 UanTxMode
552 {
553  if (n < m_phy1->GetNModes ())
554  {
555  return m_phy1->GetMode (n);
556  }
557  else
558  {
559  return m_phy2->GetMode (n - m_phy1->GetNModes ());
560  }
561 }
562 
565 {
566 
567  UanModesListValue modeValue;
568  m_phy1->GetAttribute ("SupportedModes", modeValue);
569  return modeValue.Get ();
570 }
571 
574 {
575  UanModesListValue modeValue;
576  m_phy2->GetAttribute ("SupportedModes", modeValue);
577  return modeValue.Get ();
578 }
579 
580 void
582 {
583  m_phy1->SetAttribute ("SupportedModes", UanModesListValue (modes));
584 }
585 
586 void
588 {
589  m_phy2->SetAttribute ("SupportedModes", UanModesListValue (modes));
590 }
591 
594 {
595  PointerValue perValue;
596  m_phy1->GetAttribute ("PerModel", perValue);
597  return perValue;
598 }
599 
602 {
603  PointerValue perValue;
604  m_phy2->GetAttribute ("PerModel", perValue);
605  return perValue;
606 }
607 
608 void
610 {
611  m_phy1->SetAttribute ("PerModel", PointerValue (per));
612 }
613 
614 void
616 {
617  m_phy2->SetAttribute ("PerModel", PointerValue (per));
618 }
619 
622 {
623  PointerValue sinrValue;
624  m_phy1->GetAttribute ("SinrModel", sinrValue);
625  return sinrValue;
626 }
627 
630 {
631  PointerValue sinrValue;
632  m_phy2->GetAttribute ("SinrModel", sinrValue);
633  return sinrValue;
634 }
635 
636 void
638 {
639  m_phy1->SetAttribute ("SinrModel", PointerValue (sinr));
640 }
641 
642 void
644 {
645  m_phy2->SetAttribute ("SinrModel", PointerValue (sinr));
646 }
647 
648 void
650 {
651  NS_LOG_DEBUG (Simulator::Now ().GetSeconds () << " Received packet");
652  m_recOkCb (pkt, sinr, mode);
653  m_rxOkLogger (pkt, sinr, mode);
654 }
655 
656 void
658 {
659  m_recErrCb (pkt, sinr);
660  m_rxErrLogger (pkt, sinr, m_phy1->GetMode (0));
661 }
662 
665 {
666  NS_FATAL_ERROR ("GetPacketRx not valid for UanPhyDual. Must specify GetPhy1PacketRx or GetPhy2PacketRx");
667  return Create<Packet> ();
668 }
669 
670 int64_t
672 {
673  NS_LOG_FUNCTION (this << stream);
674  return 0;
675 }
676 
677 }
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:95
Ptr< const AttributeChecker > MakeUanModesListChecker(void)
Definition: uan-tx-mode.cc:303
UanModesList Get(void) const
Definition: uan-tx-mode.cc:303
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual void DoDispose()
Destructor implementation.
std::string GetName(void) const
Get the mode name.
Definition: uan-tx-mode.cc:75
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
virtual uint32_t GetNModes(void)
Get the number of transmission modes supported by this Phy.
RxOkCallback m_recOkCb
Callback when packet received without errors.
Definition: uan-phy-dual.h:263
Hold variables of type string.
Definition: string.h:41
static TypeId GetTypeId(void)
Register this type.
Definition: uan-phy-dual.cc:58
virtual Ptr< UanTransducer > GetTransducer(void)
Get the attached transducer.
virtual void SetEnergyModelCallback(DeviceEnergyModel::ChangeStateCallback callback)
Set the DeviceEnergyModel callback for UanPhy device.
virtual ~UanPhyCalcSinrDual()
Destructor.
Definition: uan-phy-dual.cc:52
Ptr< UanPhy > m_phy1
First Phy layer.
Definition: uan-phy-dual.h:252
Ptr< UanPhy > m_phy2
Second Phy layer.
Definition: uan-phy-dual.h:254
Ptr< Packet > GetPacketRx(void) const
Get the packet currently being received.
virtual void SetMac(Ptr< UanMac > mac)
Set the MAC forwarding messages to this Phy.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
virtual bool IsStateSleep(void)
double GetCcaThresholdPhy2(void) const
Get the CCA threshold signal strength required to detect channel busy.
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:338
Container for UanTxModes.
Definition: uan-tx-mode.h:257
#define NS_FATAL_ERROR(msg)
Fatal error handling.
Definition: fatal-error.h:100
ModulationType GetModType(void) const
Get the modulation type of the mode.
Definition: uan-tx-mode.cc:39
virtual bool IsStateTx(void)
virtual void SetCcaThresholdDb(double thresh)
Set the threshold for detecting channel busy.
uint8_t GetType(void) const
Get the header type value.
bool IsPhy1Rx(void)
bool IsPhy2Rx(void)
virtual void SetDevice(Ptr< UanNetDevice > device)
Set the device hosting this Phy.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
virtual Ptr< UanChannel > GetChannel(void) const
Get the attached channel.
virtual ~UanPhyDual()
Dummy destructor.
virtual void SetTxPowerDb(double txpwr)
Set the transmit power.
virtual bool IsStateBusy(void)
virtual double GetRxThresholdDb(void)
Get the minimum received signal strength required to receive a packet without errors.
void SetCcaThresholdPhy1(double thresh)
Set the threshold for detecting channel busy.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: pointer.h:210
virtual bool IsStateIdle(void)
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-dual.cc:68
double GetRxGainDbPhy1(void) const
Get the receiver gain added to signal at receiver in dB.
UanPhyDual()
Constructor.
virtual void NotifyTransStartTx(Ptr< Packet > packet, double txPowerDb, UanTxMode txMode)
Called when a transmission is beginning on the attched transducer.
double KpToDb(double kp) const
Convert kilopascals to dB re 1 uPa.
Definition: uan-phy.h:92
virtual void SendPacket(Ptr< Packet > pkt, uint32_t modeNum)
Send a packet using a specific transmission mode.
Ptr< Packet > GetPhy1PacketRx(void) const
Get the packet currently being received.
The power delay profile returned by propagation models.
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:41
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_txLogger
A packet was sent from this Phy.
Definition: uan-phy-dual.h:261
virtual void Clear(void)
Clear all pointer references.
std::list< UanPacketArrival > ArrivalList
List of arriving packets overlapping in time.
virtual void NotifyIntChange(void)
Called when there has been a change in the ammount of interference this node is experiencing from oth...
virtual void SetChannel(Ptr< UanChannel > channel)
Attach to a channel.
Ptr< UanPhyPer > GetPerModelPhy2(void) const
Get the error probability model.
UanModesList GetModesPhy1(void) const
Get the list of available modes.
void SetModesPhy1(UanModesList modes)
Set the available modes.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:277
Ptr< UanPhyCalcSinr > GetSinrModelPhy2(void) const
Get the SINR calculator.
bool IsPhy2Idle(void)
UanModesList GetModesPhy2(void) const
Get the list of available modes.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Common packet header fields.
Hold objects of type Ptr.
Definition: pointer.h:36
virtual void SetRxGainDb(double gain)
Set the receiver gain.
RxErrCallback m_recErrCb
Callback when packet received with errors.
Definition: uan-phy-dual.h:265
void SetPerModelPhy1(Ptr< UanPhyPer > per)
Set the error probability model.
uint32_t GetCenterFreqHz(void) const
Get the transmission center frequency.
Definition: uan-tx-mode.cc:57
Interface for PHY event listener.
Definition: uan-phy.h:146
virtual void SetRxThresholdDb(double thresh) NS_DEPRECATED
Set the minimum SINR threshold to receive a packet without errors.
virtual void StartRxPacket(Ptr< Packet > pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
Packet arriving from channel: i.e.
void RxOkFromSubPhy(Ptr< Packet > pkt, double sinr, UanTxMode mode)
Handle callback and logger for packets received without error.
void SetTxPowerDbPhy1(double txpwr)
Set the transmit power.
virtual bool IsStateRx(void)
void SetTxPowerDbPhy2(double txpwr)
Set the transmit power.
double DbToKp(double db) const
Convert dB re 1 uPa to kilopascals.
Definition: uan-phy.h:82
double GetCcaThresholdPhy1(void) const
Get the CCA threshold signal strength required to detect channel busy.
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_rxErrLogger
A packet was received unsuccessfully.
Definition: uan-phy-dual.h:259
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:223
void RxErrFromSubPhy(Ptr< Packet > pkt, double sinr)
Handle callback and logger for packets received with error.
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_rxOkLogger
A packet was received successfully.
Definition: uan-phy-dual.h:257
void SetModesPhy2(UanModesList modes)
Set the available modes.
Base class for UAN Phy models.
Definition: uan-phy.h:175
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: double.h:42
void SetSinrModelPhy2(Ptr< UanPhyCalcSinr > calcSinr)
Set the SINR calculator.
void SetSinrModelPhy1(Ptr< UanPhyCalcSinr > calcSinr)
Set the SINR calculator.
virtual void SetReceiveOkCallback(RxOkCallback cb)
Set the callback to be used when a packet is received without error.
bool IsPhy1Tx(void)
virtual void SetTransducer(Ptr< UanTransducer > trans)
Attach a transducer to this Phy.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:228
double GetTxPowerDbPhy1(void) const
Get the current transmit power, in dB.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:236
Unspecified/undefined.
Definition: uan-tx-mode.h:54
virtual void RegisterListener(UanPhyListener *listener)
Register a UanPhyListener to be notified of common UanPhy events.
static TypeId GetTypeId()
Register this type.
Ptr< UanPhyCalcSinr > GetSinrModelPhy1(void) const
Get the SINR calculator.
virtual void SetReceiveErrorCallback(RxErrCallback cb)
Set the callback to be used when a packet is received with errors.
double GetTxPowerDbPhy2(void) const
Get the current transmit power, in dB.
UanAddress GetSrc(void) const
Get the source address.
Ptr< const AttributeAccessor > MakeUanModesListAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: uan-tx-mode.h:314
virtual double GetRxGainDb(void)
Get the receiver gain added to signal at receiver in dB.
A base class which provides memory management and object aggregation.
Definition: object.h:87
virtual bool IsStateCcaBusy(void)
uint32_t GetBandwidthHz(void) const
Get the transmission signal bandwidth.
Definition: uan-tx-mode.cc:63
UanPhyCalcSinrDual()
Constructor.
Definition: uan-phy-dual.cc:48
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition: double.h:41
bool IsPhy1Idle(void)
static UanModesList GetDefaultModes(void)
Get the default transmission modes.
Definition: uan-phy-gen.cc:421
virtual Ptr< UanNetDevice > GetDevice(void)
Get the device hosting this Phy.
a unique identifier for an interface.
Definition: type-id.h:51
bool IsPhy2Tx(void)
TypeId SetParent(TypeId tid)
Definition: type-id.cc:631
Ptr< Packet > GetPhy2PacketRx(void) const
Get the packet currently being received.
double GetRxGainDbPhy2(void) const
Get the receiver gain added to signal at receiver in dB.
void SetPerModelPhy2(Ptr< UanPhyPer > per)
Set the error probability model.
virtual double GetCcaThresholdDb(void)
Get the CCA threshold signal strength required to detect channel busy.
void SetRxGainDbPhy2(double gain)
Set the receiver gain.
void SetRxGainDbPhy1(double gain)
Set the receiver gain.
void SetCcaThresholdPhy2(double thresh)
Set the threshold for detecting channel busy.
AttributeValue implementation for UanModesList.
Definition: uan-tx-mode.h:314
Ptr< UanPhyPer > GetPerModelPhy1(void) const
Get the error probability model.
virtual UanTxMode GetMode(uint32_t n)
Get a specific transmission mode.
virtual void EnergyDepletionHandler(void)
Handle the energy depletion event.
virtual double GetTxPowerDb(void)
Get the current transmit power, in dB.