A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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/log.h"
30 #include "ns3/ptr.h"
31 #include "ns3/traced-callback.h"
32 #include "ns3/trace-source-accessor.h"
33 #include "ns3/simulator.h"
34 #include "uan-header-common.h"
35 #include "uan-mac-rc.h"
36 
37 #include <cmath>
38 
39 
40 NS_LOG_COMPONENT_DEFINE ("UanPhyDual");
41 
42 namespace ns3 {
43 
44 NS_OBJECT_ENSURE_REGISTERED (UanPhyDual)
45  ;
46 NS_OBJECT_ENSURE_REGISTERED (UanPhyCalcSinrDual)
47  ;
48 
50 {
51 
52 }
54 {
55 
56 }
57 
58 TypeId
60 {
61  static TypeId tid = TypeId ("ns3::UanPhyCalcSinrDual")
62  .SetParent<Object> ()
63  .AddConstructor<UanPhyCalcSinrDual> ()
64  ;
65  return tid;
66 }
67 
68 double
70  Time arrTime,
71  double rxPowerDb,
72  double ambNoiseDb,
73  UanTxMode mode,
74  UanPdp pdp,
75  const UanTransducer::ArrivalList &arrivalList) const
76 {
77 
78  if (mode.GetModType () != UanTxMode::OTHER)
79  {
80  NS_LOG_WARN ("Calculating SINR for unsupported modulation type");
81  }
82 
83  double intKp = -DbToKp (rxPowerDb); // This packet is in the arrivalList
84  UanTransducer::ArrivalList::const_iterator it = arrivalList.begin ();
85  for (; it != arrivalList.end (); it++)
86  {
87  // Only count interference if there is overlap in incoming frequency
88  if (std::abs ( (double) it->GetTxMode ().GetCenterFreqHz () - (double) mode.GetCenterFreqHz ())
89  < (double)(it->GetTxMode ().GetBandwidthHz () / 2 + mode.GetBandwidthHz () / 2) - 0.5)
90  {
91  UanHeaderCommon ch, ch2;
92  if (pkt)
93  {
94  pkt->PeekHeader (ch);
95  }
96  it->GetPacket ()->PeekHeader (ch2);
97 
98  if (pkt)
99  {
100  if (ch.GetType () == UanMacRc::TYPE_DATA)
101  {
102  NS_LOG_DEBUG ("Adding interferer from " << ch2.GetSrc () << " against " << ch.GetSrc () << ": PktRxMode: "
103  << mode.GetName () << " Int mode: " << it->GetTxMode ().GetName () << " Separation: "
104  << std::abs ( (double) it->GetTxMode ().GetCenterFreqHz () - (double) mode.GetCenterFreqHz ())
105  << " Combined bandwidths: " << (double)(it->GetTxMode ().GetBandwidthHz () / 2 + mode.GetBandwidthHz () / 2) - 0.5);
106  }
107  }
108  intKp += DbToKp (it->GetRxPowerDb ());
109  }
110  }
111 
112  double totalIntDb = KpToDb (intKp + DbToKp (ambNoiseDb));
113 
114  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.");
115  return rxPowerDb - totalIntDb;
116 }
117 
119  : UanPhy ()
120 {
121 
122  m_phy1 = CreateObject<UanPhyGen> ();
123  m_phy2 = CreateObject<UanPhyGen> ();
124 
125  m_phy1->SetReceiveOkCallback (m_recOkCb);
126  m_phy2->SetReceiveOkCallback (m_recOkCb);
127 
128  m_phy1->SetReceiveErrorCallback (m_recErrCb);
129  m_phy2->SetReceiveErrorCallback (m_recErrCb);
130 
131 }
132 
134 {
135 }
136 
137 void
139 {
140  if (m_phy1)
141  {
142  m_phy1->Clear ();
143  m_phy1 = 0;
144  }
145  if (m_phy2)
146  {
147  m_phy2->Clear ();
148  m_phy2 = 0;
149  }
150 }
151 void
153 {
154  Clear ();
156 }
157 
158 TypeId
160 {
161  static TypeId tid = TypeId ("ns3::UanPhyDual")
162  .SetParent<UanPhy> ()
163  .AddConstructor<UanPhyDual> ()
164  .AddAttribute ("CcaThresholdPhy1",
165  "Aggregate energy of incoming signals to move to CCA Busy state dB of Phy1.",
166  DoubleValue (10),
168  MakeDoubleChecker<double> ())
169  .AddAttribute ("CcaThresholdPhy2",
170  "Aggregate energy of incoming signals to move to CCA Busy state dB of Phy2.",
171  DoubleValue (10),
173  MakeDoubleChecker<double> ())
174  .AddAttribute ("TxPowerPhy1",
175  "Transmission output power in dB of Phy1.",
176  DoubleValue (190),
178  MakeDoubleChecker<double> ())
179  .AddAttribute ("TxPowerPhy2",
180  "Transmission output power in dB of Phy2.",
181  DoubleValue (190),
183  MakeDoubleChecker<double> ())
184  .AddAttribute ("RxGainPhy1",
185  "Gain added to incoming signal at receiver of Phy1.",
186  DoubleValue (0),
188  MakeDoubleChecker<double> ())
189  .AddAttribute ("RxGainPhy2",
190  "Gain added to incoming signal at receiver of Phy2.",
191  DoubleValue (0),
193  MakeDoubleChecker<double> ())
194  .AddAttribute ("SupportedModesPhy1",
195  "List of modes supported by Phy1.",
197  MakeUanModesListAccessor (&UanPhyDual::GetModesPhy1, &UanPhyDual::SetModesPhy1),
198  MakeUanModesListChecker () )
199  .AddAttribute ("SupportedModesPhy2",
200  "List of modes supported by Phy2.",
202  MakeUanModesListAccessor (&UanPhyDual::GetModesPhy2, &UanPhyDual::SetModesPhy2),
203  MakeUanModesListChecker () )
204  .AddAttribute ("PerModelPhy1",
205  "Functor to calculate PER based on SINR and TxMode for Phy1.",
206  PointerValue (CreateObject<UanPhyPerGenDefault> ()),
208  MakePointerChecker<UanPhyPer> ())
209  .AddAttribute ("PerModelPhy2",
210  "Functor to calculate PER based on SINR and TxMode for Phy2.",
211  PointerValue (CreateObject<UanPhyPerGenDefault> ()),
213  MakePointerChecker<UanPhyPer> ())
214  .AddAttribute ("SinrModelPhy1",
215  "Functor to calculate SINR based on pkt arrivals and modes for Phy1.",
216  PointerValue (CreateObject<UanPhyCalcSinrDual> ()),
218  MakePointerChecker<UanPhyCalcSinr> ())
219  .AddAttribute ("SinrModelPhy2",
220  "Functor to calculate SINR based on pkt arrivals and modes for Phy2.",
221  PointerValue (CreateObject<UanPhyCalcSinrDual> ()),
223  MakePointerChecker<UanPhyCalcSinr> ())
224  .AddTraceSource ("RxOk",
225  "A packet was received successfully.",
227  .AddTraceSource ("RxError",
228  "A packet was received unsuccessfully.",
230  .AddTraceSource ("Tx",
231  "Packet transmission beginning.",
233 
234  ;
235 
236  return tid;
237 }
238 
239 void
241 {
242  NS_LOG_DEBUG ("Not Implemented");
243 }
244 
245 void
247 {
248  NS_LOG_DEBUG ("Not Implemented");
249 }
250 
251 void
252 UanPhyDual::SendPacket (Ptr<Packet> pkt, uint32_t modeNum)
253 {
254  if (modeNum <= m_phy1->GetNModes () - 1)
255  {
256  NS_LOG_DEBUG (Simulator::Now ().GetSeconds () << " Sending packet on Phy1 with mode number " << modeNum);
257  m_txLogger (pkt, m_phy1->GetTxPowerDb (), m_phy1->GetMode (modeNum));
258  m_phy1->SendPacket (pkt, modeNum);
259 
260  }
261  else
262  {
263  NS_LOG_DEBUG (Simulator::Now ().GetSeconds () << " Sending packet on Phy2 with mode number " << modeNum - m_phy1->GetNModes ());
264  m_txLogger (pkt, m_phy2->GetTxPowerDb (), m_phy2->GetMode (modeNum - m_phy1->GetNModes ()));
265  m_phy2->SendPacket (pkt, modeNum - m_phy1->GetNModes ());
266  }
267 }
268 void
270 {
271  m_phy1->RegisterListener (listener);
272  m_phy2->RegisterListener (listener);
273 }
274 
275 void
276 UanPhyDual::StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
277 {
278  // Not called. StartRxPacket in m_phy1 and m_phy2 are called directly from Transducer.
279 }
280 
281 void
283 {
284  m_phy1->SetReceiveOkCallback (cb);
285  m_phy2->SetReceiveOkCallback (cb);
286 }
287 
288 void
290 {
291  m_phy1->SetReceiveErrorCallback (cb);
292  m_phy2->SetReceiveErrorCallback (cb);
293 }
294 
295 void
297 {
298  m_phy1->SetRxGainDb (gain);
299  m_phy2->SetRxGainDb (gain);
300 }
301 void
303 {
304  m_phy1->SetRxGainDb (gain);
305 }
306 
307 void
309 {
310  m_phy2->SetRxGainDb (gain);
311 }
312 
313 void
315 {
316  m_phy1->SetTxPowerDb (txpwr);
317  m_phy2->SetTxPowerDb (txpwr);
318 }
319 
320 void
322 {
323  m_phy1->SetTxPowerDb (txpwr);
324 }
325 void
327 {
328  m_phy2->SetTxPowerDb (txpwr);
329 }
330 
331 void
333 {
334  NS_LOG_WARN ("SetRxThresholdDb is deprecated and has no effect. Look at PER Functor attribute");
335  m_phy1->SetRxThresholdDb (thresh);
336  m_phy2->SetRxThresholdDb (thresh);
337 }
338 void
340 {
341  m_phy1->SetCcaThresholdDb (thresh);
342  m_phy2->SetCcaThresholdDb (thresh);
343 }
344 
345 void
347 {
348  m_phy1->SetCcaThresholdDb (thresh);
349 }
350 void
352 {
353  m_phy2->SetCcaThresholdDb (thresh);
354 }
355 
356 double
358 {
359  NS_LOG_WARN ("Warning: UanPhyDual::GetRxGainDb returns RxGain of Phy 1");
360  return m_phy1->GetRxGainDb ();
361 }
362 double
364 {
365  return m_phy1->GetRxGainDb ();
366 }
367 double
369 {
370  return m_phy2->GetRxGainDb ();
371 }
372 
373 double
375 {
376  NS_LOG_WARN ("Warning: Dual Phy only returns TxPowerDb of Phy 1");
377  return m_phy1->GetTxPowerDb ();
378 }
379 
380 double
382 {
383  return m_phy1->GetTxPowerDb ();
384 }
385 
386 double
388 {
389  return m_phy2->GetTxPowerDb ();
390 }
391 
392 double
394 {
395  return m_phy1->GetRxThresholdDb ();
396 }
397 
398 double
400 {
401  NS_LOG_WARN ("Dual Phy only returns CCAThreshold of Phy 1");
402  return m_phy1->GetCcaThresholdDb ();
403 }
404 double
406 {
407  return m_phy1->GetCcaThresholdDb ();
408 }
409 double
411 {
412  return m_phy2->GetCcaThresholdDb ();
413 }
414 
415 bool
417 {
418  return m_phy1->IsStateIdle ();
419 }
420 bool
422 {
423  return m_phy2->IsStateIdle ();
424 }
425 
426 bool
428 {
429  return m_phy1->IsStateRx ();
430 }
431 
432 bool
434 {
435  return m_phy2->IsStateRx ();
436 }
437 
438 bool
440 {
441  return m_phy1->IsStateTx ();
442 }
443 
446 {
447  return m_phy1->GetPacketRx ();
448 }
449 
452 {
453  return m_phy2->GetPacketRx ();
454 }
455 
456 bool
458 {
459  return m_phy2->IsStateTx ();
460 }
461 bool
463 {
464  return m_phy1->IsStateSleep () && m_phy2->IsStateSleep ();
465 }
466 bool
468 {
469  return m_phy1->IsStateIdle () && m_phy2->IsStateIdle ();
470 }
471 bool
473 {
474  return !IsStateIdle () || !IsStateSleep ();
475 }
476 bool
478 {
479  return m_phy1->IsStateRx () || m_phy2->IsStateRx ();
480 }
481 bool
483 {
484  return m_phy1->IsStateTx () || m_phy2->IsStateTx ();
485 }
486 bool
488 {
489  return m_phy1->IsStateCcaBusy () || m_phy2->IsStateCcaBusy ();
490 }
493 {
494  return m_phy1->GetChannel ();
495 }
498 {
499  return m_phy1->GetDevice ();
500 }
501 void
503 {
504  m_phy1->SetChannel (channel);
505  m_phy2->SetChannel (channel);
506 }
507 void
509 {
510  m_phy1->SetDevice (device);
511  m_phy2->SetDevice (device);
512 }
513 void
515 {
516  m_phy1->SetMac (mac);
517  m_phy2->SetMac (mac);
518 }
519 void
520 UanPhyDual::NotifyTransStartTx (Ptr<Packet> packet, double txPowerDb, UanTxMode txMode)
521 {
522 
523 }
524 void
526 {
527  m_phy1->NotifyIntChange ();
528  m_phy2->NotifyIntChange ();
529 
530 }
531 void
533 {
534  m_phy1->SetTransducer (trans);
535  m_phy2->SetTransducer (trans);
536 }
539 {
540  NS_LOG_WARN ("DualPhy Returning transducer of Phy1");
541  return m_phy1->GetTransducer ();
542 }
543 uint32_t
545 {
546  return m_phy1->GetNModes () + m_phy2->GetNModes ();
547 }
548 UanTxMode
550 {
551  if (n < m_phy1->GetNModes ())
552  {
553  return m_phy1->GetMode (n);
554  }
555  else
556  {
557  return m_phy2->GetMode (n - m_phy1->GetNModes ());
558  }
559 }
560 
563 {
564 
565  UanModesListValue modeValue;
566  m_phy1->GetAttribute ("SupportedModes", modeValue);
567  return modeValue.Get ();
568 }
569 
572 {
573  UanModesListValue modeValue;
574  m_phy2->GetAttribute ("SupportedModes", modeValue);
575  return modeValue.Get ();
576 }
577 
578 void
580 {
581  m_phy1->SetAttribute ("SupportedModes", UanModesListValue (modes));
582 }
583 
584 void
586 {
587  m_phy2->SetAttribute ("SupportedModes", UanModesListValue (modes));
588 }
589 
592 {
593  PointerValue perValue;
594  m_phy1->GetAttribute ("PerModel", perValue);
595  return perValue;
596 }
597 
600 {
601  PointerValue perValue;
602  m_phy2->GetAttribute ("PerModel", perValue);
603  return perValue;
604 }
605 
606 void
608 {
609  m_phy1->SetAttribute ("PerModel", PointerValue (per));
610 }
611 
612 void
614 {
615  m_phy2->SetAttribute ("PerModel", PointerValue (per));
616 }
617 
620 {
621  PointerValue sinrValue;
622  m_phy1->GetAttribute ("SinrModel", sinrValue);
623  return sinrValue;
624 }
625 
628 {
629  PointerValue sinrValue;
630  m_phy2->GetAttribute ("SinrModel", sinrValue);
631  return sinrValue;
632 }
633 
634 void
636 {
637  m_phy1->SetAttribute ("SinrModel", PointerValue (sinr));
638 }
639 
640 void
642 {
643  m_phy2->SetAttribute ("SinrModel", PointerValue (sinr));
644 }
645 
646 void
648 {
649  NS_LOG_DEBUG (Simulator::Now ().GetSeconds () << " Received packet");
650  m_recOkCb (pkt, sinr, mode);
651  m_rxOkLogger (pkt, sinr, mode);
652 }
653 
654 void
656 {
657  m_recErrCb (pkt, sinr);
658  m_rxErrLogger (pkt, sinr, m_phy1->GetMode (0));
659 }
660 
663 {
664  NS_FATAL_ERROR ("GetPacketRx not valid for UanPhyDual. Must specify GetPhy1PacketRx or GetPhy2PacketRx");
665  return Create<Packet> ();
666 }
667 
668 int64_t
670 {
671  NS_LOG_FUNCTION (this << stream);
672  return 0;
673 }
674 
675 }
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:345
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
std::string GetName(void) const
Get the mode name.
Definition: uan-tx-mode.cc:75
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
static TypeId GetTypeId(void)
Register this type.
Definition: uan-phy-dual.cc:59
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:53
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
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
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.
virtual bool IsStateSleep(void)
double GetCcaThresholdPhy2(void) const
Get the CCA threshold signal strength required to detect channel busy.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: object.cc:336
Container for UanTxModes.
Definition: uan-tx-mode.h:255
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)
Unspecified/undefined.
Definition: uan-tx-mode.h:54
bool IsPhy2Rx(void)
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:72
virtual void SetDevice(Ptr< UanNetDevice > device)
Set the device hosting this Phy.
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.
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:69
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
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)
TracedCallback< Ptr< const Packet >, double, UanTxMode > m_txLogger
A packet was sent from this Phy.
Definition: uan-phy-dual.h:261
UanModesList GetModesPhy2(void) const
Get the list of available modes.
Common packet header fields.
hold objects of type Ptr
Definition: pointer.h:33
virtual void SetRxGainDb(double gain)
Set the receiver gain.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
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.
static Time Now(void)
Return the "current simulation time".
Definition: simulator.cc:180
void RxErrFromSubPhy(Ptr< Packet > pkt, double sinr)
Handle callback and logger for packets received with error.
void SetModesPhy2(UanModesList modes)
Set the available modes.
Base class for UAN Phy models.
Definition: uan-phy.h:175
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)
Definition: log.h:280
double GetTxPowerDbPhy1(void) const
Get the current transmit power, in dB.
#define NS_LOG_DEBUG(msg)
Definition: log.h:289
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.
TracedCallback< Ptr< const Packet >, double, UanTxMode > m_rxErrLogger
A packet was received unsuccessfully.
Definition: uan-phy-dual.h:259
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:63
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:49
Hold a floating point type.
Definition: double.h:41
TracedCallback< Ptr< const Packet >, double, UanTxMode > m_rxOkLogger
A packet was received successfully.
Definition: uan-phy-dual.h:257
bool IsPhy1Idle(void)
static UanModesList GetDefaultModes(void)
Get the default transmission modes.
Definition: uan-phy-gen.cc:425
virtual Ptr< UanNetDevice > GetDevice(void)
Get the device hosting this Phy.
a unique identifier for an interface.
Definition: type-id.h:49
bool IsPhy2Tx(void)
TypeId SetParent(TypeId tid)
Definition: type-id.cc:611
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.
Attribute Value class for UanTxModes.
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.
NS_LOG_COMPONENT_DEFINE("UanPhyDual")