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")
62  .SetGroupName ("Uan")
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 (Now ().As (Time::S) << " 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  .SetGroupName ("Uan")
164  .AddConstructor<UanPhyDual> ()
165  .AddAttribute ("CcaThresholdPhy1",
166  "Aggregate energy of incoming signals to move to CCA Busy state dB of Phy1.",
167  DoubleValue (10),
169  MakeDoubleChecker<double> ())
170  .AddAttribute ("CcaThresholdPhy2",
171  "Aggregate energy of incoming signals to move to CCA Busy state dB of Phy2.",
172  DoubleValue (10),
174  MakeDoubleChecker<double> ())
175  .AddAttribute ("TxPowerPhy1",
176  "Transmission output power in dB of Phy1.",
177  DoubleValue (190),
179  MakeDoubleChecker<double> ())
180  .AddAttribute ("TxPowerPhy2",
181  "Transmission output power in dB of Phy2.",
182  DoubleValue (190),
184  MakeDoubleChecker<double> ())
185  .AddAttribute ("SupportedModesPhy1",
186  "List of modes supported by Phy1.",
190  .AddAttribute ("SupportedModesPhy2",
191  "List of modes supported by Phy2.",
195  .AddAttribute ("PerModelPhy1",
196  "Functor to calculate PER based on SINR and TxMode for Phy1.",
197  StringValue ("ns3::UanPhyPerGenDefault"),
199  MakePointerChecker<UanPhyPer> ())
200  .AddAttribute ("PerModelPhy2",
201  "Functor to calculate PER based on SINR and TxMode for Phy2.",
202  StringValue ("ns3::UanPhyPerGenDefault"),
204  MakePointerChecker<UanPhyPer> ())
205  .AddAttribute ("SinrModelPhy1",
206  "Functor to calculate SINR based on pkt arrivals and modes for Phy1.",
207  StringValue ("ns3::UanPhyCalcSinrDual"),
209  MakePointerChecker<UanPhyCalcSinr> ())
210  .AddAttribute ("SinrModelPhy2",
211  "Functor to calculate SINR based on pkt arrivals and modes for Phy2.",
212  StringValue ("ns3::UanPhyCalcSinrDual"),
214  MakePointerChecker<UanPhyCalcSinr> ())
215  .AddTraceSource ("RxOk",
216  "A packet was received successfully.",
218  "ns3::UanPhy::TracedCallback")
219  .AddTraceSource ("RxError",
220  "A packet was received unsuccessfully.",
222  "ns3::UanPhy::TracedCallback")
223  .AddTraceSource ("Tx",
224  "Packet transmission beginning.",
226  "ns3::UanPhy::TracedCallback")
227 
228  ;
229 
230  return tid;
231 }
232 
233 void
235 {
236  NS_LOG_DEBUG ("Not Implemented");
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 (Now ().As (Time::S) << " 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 (Now ().As (Time::S) << " 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  NS_UNUSED (rxPowerDb);
279  // Not called. StartRxPacket in m_phy1 and m_phy2 are called directly from Transducer.
280 }
281 
282 void
284 {
285  m_phy1->SetReceiveOkCallback (cb);
286  m_phy2->SetReceiveOkCallback (cb);
287 }
288 
289 void
291 {
292  m_phy1->SetReceiveErrorCallback (cb);
293  m_phy2->SetReceiveErrorCallback (cb);
294 }
295 
296 
297 void
299 {
300  m_phy1->SetTxPowerDb (txpwr);
301  m_phy2->SetTxPowerDb (txpwr);
302 }
303 
304 void
306 {
307  m_phy1->SetTxPowerDb (txpwr);
308 }
309 void
311 {
312  m_phy2->SetTxPowerDb (txpwr);
313 }
314 
315 void
317 {
318  m_phy1->SetRxThresholdDb (thresh);
319  m_phy2->SetRxThresholdDb (thresh);
320 }
321 void
323 {
324  m_phy1->SetCcaThresholdDb (thresh);
325  m_phy2->SetCcaThresholdDb (thresh);
326 }
327 
328 void
330 {
331  m_phy1->SetCcaThresholdDb (thresh);
332 }
333 void
335 {
336  m_phy2->SetCcaThresholdDb (thresh);
337 }
338 
339 
340 double
342 {
343  NS_LOG_WARN ("Warning: Dual Phy only returns TxPowerDb of Phy 1");
344  return m_phy1->GetTxPowerDb ();
345 }
346 
347 double
349 {
350  return m_phy1->GetTxPowerDb ();
351 }
352 
353 double
355 {
356  return m_phy2->GetTxPowerDb ();
357 }
358 
359 double
361 {
362  return m_phy1->GetRxThresholdDb ();
363 }
364 
365 double
367 {
368  NS_LOG_WARN ("Dual Phy only returns CCAThreshold of Phy 1");
369  return m_phy1->GetCcaThresholdDb ();
370 }
371 double
373 {
374  return m_phy1->GetCcaThresholdDb ();
375 }
376 double
378 {
379  return m_phy2->GetCcaThresholdDb ();
380 }
381 
382 bool
384 {
385  return m_phy1->IsStateIdle ();
386 }
387 bool
389 {
390  return m_phy2->IsStateIdle ();
391 }
392 
393 bool
395 {
396  return m_phy1->IsStateRx ();
397 }
398 
399 bool
401 {
402  return m_phy2->IsStateRx ();
403 }
404 
405 bool
407 {
408  return m_phy1->IsStateTx ();
409 }
410 
413 {
414  return m_phy1->GetPacketRx ();
415 }
416 
419 {
420  return m_phy2->GetPacketRx ();
421 }
422 
423 bool
425 {
426  return m_phy2->IsStateTx ();
427 }
428 bool
430 {
431  return m_phy1->IsStateSleep () && m_phy2->IsStateSleep ();
432 }
433 bool
435 {
436  return m_phy1->IsStateIdle () && m_phy2->IsStateIdle ();
437 }
438 bool
440 {
441  return !IsStateIdle () || !IsStateSleep ();
442 }
443 bool
445 {
446  return m_phy1->IsStateRx () || m_phy2->IsStateRx ();
447 }
448 bool
450 {
451  return m_phy1->IsStateTx () || m_phy2->IsStateTx ();
452 }
453 bool
455 {
456  return m_phy1->IsStateCcaBusy () || m_phy2->IsStateCcaBusy ();
457 }
460 {
461  return m_phy1->GetChannel ();
462 }
465 {
466  return m_phy1->GetDevice ();
467 }
468 void
470 {
471  m_phy1->SetChannel (channel);
472  m_phy2->SetChannel (channel);
473 }
474 void
476 {
477  m_phy1->SetDevice (device);
478  m_phy2->SetDevice (device);
479 }
480 void
482 {
483  m_phy1->SetMac (mac);
484  m_phy2->SetMac (mac);
485 }
486 void
487 UanPhyDual::NotifyTransStartTx (Ptr<Packet> packet, double txPowerDb, UanTxMode txMode)
488 {
489  NS_UNUSED (txPowerDb);
490 }
491 void
493 {
494  m_phy1->NotifyIntChange ();
495  m_phy2->NotifyIntChange ();
496 
497 }
498 void
500 {
501  m_phy1->SetTransducer (trans);
502  m_phy2->SetTransducer (trans);
503 }
506 {
507  NS_LOG_WARN ("DualPhy Returning transducer of Phy1");
508  return m_phy1->GetTransducer ();
509 }
510 uint32_t
512 {
513  return m_phy1->GetNModes () + m_phy2->GetNModes ();
514 }
515 UanTxMode
517 {
518  if (n < m_phy1->GetNModes ())
519  {
520  return m_phy1->GetMode (n);
521  }
522  else
523  {
524  return m_phy2->GetMode (n - m_phy1->GetNModes ());
525  }
526 }
527 
530 {
531 
532  UanModesListValue modeValue;
533  m_phy1->GetAttribute ("SupportedModes", modeValue);
534  return modeValue.Get ();
535 }
536 
539 {
540  UanModesListValue modeValue;
541  m_phy2->GetAttribute ("SupportedModes", modeValue);
542  return modeValue.Get ();
543 }
544 
545 void
547 {
548  m_phy1->SetAttribute ("SupportedModes", UanModesListValue (modes));
549 }
550 
551 void
553 {
554  m_phy2->SetAttribute ("SupportedModes", UanModesListValue (modes));
555 }
556 
559 {
560  PointerValue perValue;
561  m_phy1->GetAttribute ("PerModel", perValue);
562  return perValue;
563 }
564 
567 {
568  PointerValue perValue;
569  m_phy2->GetAttribute ("PerModel", perValue);
570  return perValue;
571 }
572 
573 void
575 {
576  m_phy1->SetAttribute ("PerModel", PointerValue (per));
577 }
578 
579 void
581 {
582  m_phy2->SetAttribute ("PerModel", PointerValue (per));
583 }
584 
587 {
588  PointerValue sinrValue;
589  m_phy1->GetAttribute ("SinrModel", sinrValue);
590  return sinrValue;
591 }
592 
595 {
596  PointerValue sinrValue;
597  m_phy2->GetAttribute ("SinrModel", sinrValue);
598  return sinrValue;
599 }
600 
601 void
603 {
604  m_phy1->SetAttribute ("SinrModel", PointerValue (sinr));
605 }
606 
607 void
609 {
610  m_phy2->SetAttribute ("SinrModel", PointerValue (sinr));
611 }
612 
613 void
615 {
616  NS_LOG_DEBUG (Now ().As (Time::S) << " Received packet");
617  m_recOkCb (pkt, sinr, mode);
618  m_rxOkLogger (pkt, sinr, mode);
619 }
620 
621 void
623 {
624  m_recErrCb (pkt, sinr);
625  m_rxErrLogger (pkt, sinr, m_phy1->GetMode (0));
626 }
627 
630 {
631  NS_FATAL_ERROR ("GetPacketRx not valid for UanPhyDual. Must specify GetPhy1PacketRx or GetPhy2PacketRx");
632  return Create<Packet> ();
633 }
634 
635 int64_t
637 {
638  NS_LOG_FUNCTION (this << stream);
639  return 0;
640 }
641 
642 }
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::UanMacRc::TYPE_DATA
@ TYPE_DATA
Data.
Definition: uan-mac-rc.h:168
ns3::UanPhyDual::GetSinrModelPhy2
Ptr< UanPhyCalcSinr > GetSinrModelPhy2(void) const
Get the SINR calculator.
Definition: uan-phy-dual.cc:594
ns3::UanPhyDual::GetCcaThresholdPhy1
double GetCcaThresholdPhy1(void) const
Get the CCA threshold signal strength required to detect channel busy.
Definition: uan-phy-dual.cc:372
ns3::UanPhyDual::GetTxPowerDbPhy2
double GetTxPowerDbPhy2(void) const
Get the current transmit power, in dB.
Definition: uan-phy-dual.cc:354
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
uan-channel.h
ns3::Packet::PeekHeader
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:290
ns3::UanPdp
The power delay profile returned by propagation models.
Definition: uan-prop-model.h:92
ns3::UanPhyDual::DoDispose
virtual void DoDispose()
Destructor implementation.
Definition: uan-phy-dual.cc:152
ns3::UanPhyDual::SetModesPhy1
void SetModesPhy1(UanModesList modes)
Set the available modes.
Definition: uan-phy-dual.cc:546
ns3::UanPhyDual::SetTxPowerDbPhy1
void SetTxPowerDbPhy1(double txpwr)
Set the transmit power.
Definition: uan-phy-dual.cc:305
ns3::Callback< void, int >
ns3::UanPhyDual::SetMac
virtual void SetMac(Ptr< UanMac > mac)
Set the MAC forwarding messages to this Phy.
Definition: uan-phy-dual.cc:481
ns3::UanPhyDual::NotifyTransStartTx
virtual void NotifyTransStartTx(Ptr< Packet > packet, double txPowerDb, UanTxMode txMode)
Called when a transmission is beginning on the attached transducer.
Definition: uan-phy-dual.cc:487
ns3::UanPhyDual::m_rxErrLogger
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_rxErrLogger
A packet was received unsuccessfully.
Definition: uan-phy-dual.h:250
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::UanPhyDual::GetCcaThresholdDb
virtual double GetCcaThresholdDb(void)
Get the CCA threshold signal strength required to detect channel busy.
Definition: uan-phy-dual.cc:366
ns3::UanPhyDual::GetMode
virtual UanTxMode GetMode(uint32_t n)
Get a specific transmission mode.
Definition: uan-phy-dual.cc:516
ns3::UanPhyDual::GetNModes
virtual uint32_t GetNModes(void)
Get the number of transmission modes supported by this Phy.
Definition: uan-phy-dual.cc:511
ns3::UanPhyDual::SetTxPowerDbPhy2
void SetTxPowerDbPhy2(double txpwr)
Set the transmit power.
Definition: uan-phy-dual.cc:310
ns3::UanPhyDual::RxErrFromSubPhy
void RxErrFromSubPhy(Ptr< Packet > pkt, double sinr)
Handle callback and logger for packets received with error.
Definition: uan-phy-dual.cc:622
ns3::UanPhyDual::StartRxPacket
virtual void StartRxPacket(Ptr< Packet > pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
Packet arriving from channel: i.e.
Definition: uan-phy-dual.cc:276
third.channel
channel
Definition: third.py:92
ns3::UanPhyDual::IsStateCcaBusy
virtual bool IsStateCcaBusy(void)
Definition: uan-phy-dual.cc:454
NS_LOG_WARN
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:265
ns3::UanPhyDual::SetEnergyModelCallback
virtual void SetEnergyModelCallback(DeviceEnergyModel::ChangeStateCallback callback)
Set the DeviceEnergyModel callback for UanPhy device.
Definition: uan-phy-dual.cc:234
ns3::UanPhyCalcSinrDual::CalcSinrDb
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
ns3::UanPhyDual
Two channel Phy.
Definition: uan-phy-dual.h:82
ns3::UanPhyCalcSinrDual::UanPhyCalcSinrDual
UanPhyCalcSinrDual()
Constructor.
Definition: uan-phy-dual.cc:48
ns3::UanTxMode::GetBandwidthHz
uint32_t GetBandwidthHz(void) const
Get the transmission signal bandwidth.
Definition: uan-tx-mode.cc:63
ns3::PointerValue
Hold objects of type Ptr<T>.
Definition: pointer.h:37
ns3::UanPhyDual::SetDevice
virtual void SetDevice(Ptr< UanNetDevice > device)
Set the device hosting this Phy.
Definition: uan-phy-dual.cc:475
third.mac
mac
Definition: third.py:99
ns3::UanPhyDual::SetPerModelPhy1
void SetPerModelPhy1(Ptr< UanPhyPer > per)
Set the error probability model.
Definition: uan-phy-dual.cc:574
ns3::UanPhyDual::IsStateTx
virtual bool IsStateTx(void)
Definition: uan-phy-dual.cc:449
ns3::UanModesList
Container for UanTxModes.
Definition: uan-tx-mode.h:258
ns3::UanPhyDual::SetCcaThresholdPhy1
void SetCcaThresholdPhy1(double thresh)
Set the threshold for detecting channel busy.
Definition: uan-phy-dual.cc:329
ns3::UanModesListValue
AttributeValue implementation for UanModesList.
Definition: uan-tx-mode.h:314
ns3::UanHeaderCommon
Common packet header fields.
Definition: uan-header-common.h:65
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
ns3::MakeTraceSourceAccessor
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Definition: trace-source-accessor.h:202
ns3::UanPhyDual::SetChannel
virtual void SetChannel(Ptr< UanChannel > channel)
Attach to a channel.
Definition: uan-phy-dual.cc:469
ns3::UanPhy
Base class for UAN Phy models.
Definition: uan-phy.h:179
ns3::UanPhyDual::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: uan-phy-dual.cc:636
ns3::UanTxMode::GetCenterFreqHz
uint32_t GetCenterFreqHz(void) const
Get the transmission center frequency.
Definition: uan-tx-mode.cc:57
ns3::UanHeaderCommon::GetSrc
Mac8Address GetSrc(void) const
Get the source address.
Definition: uan-header-common.cc:104
ns3::Ptr< Packet >
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
ns3::UanPhyDual::SetCcaThresholdPhy2
void SetCcaThresholdPhy2(double thresh)
Set the threshold for detecting channel busy.
Definition: uan-phy-dual.cc:334
ns3::UanPhyDual::m_rxOkLogger
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_rxOkLogger
A packet was received successfully.
Definition: uan-phy-dual.h:248
ns3::UanPhyDual::GetPhy2PacketRx
Ptr< Packet > GetPhy2PacketRx(void) const
Get the packet currently being received.
Definition: uan-phy-dual.cc:418
ns3::UanPhyDual::GetRxThresholdDb
virtual double GetRxThresholdDb(void)
Get the minimum received signal strength required to receive a packet without errors.
Definition: uan-phy-dual.cc:360
ns3::UanPhyDual::GetModesPhy1
UanModesList GetModesPhy1(void) const
Get the list of available modes.
Definition: uan-phy-dual.cc:529
ns3::UanPhyDual::SendPacket
virtual void SendPacket(Ptr< Packet > pkt, uint32_t modeNum)
Send a packet using a specific transmission mode.
Definition: uan-phy-dual.cc:252
ns3::UanPhyDual::SetRxThresholdDb
virtual void SetRxThresholdDb(double thresh)
Set the minimum SINR threshold to receive a packet without errors.
Definition: uan-phy-dual.cc:316
ns3::Now
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
uan-phy.h
ns3::UanPhyDual::Clear
virtual void Clear(void)
Clear all pointer references.
Definition: uan-phy-dual.cc:138
ns3::UanPhyDual::GetCcaThresholdPhy2
double GetCcaThresholdPhy2(void) const
Get the CCA threshold signal strength required to detect channel busy.
Definition: uan-phy-dual.cc:377
uan-tx-mode.h
ns3::UanPhyDual::GetSinrModelPhy1
Ptr< UanPhyCalcSinr > GetSinrModelPhy1(void) const
Get the SINR calculator.
Definition: uan-phy-dual.cc:586
ns3::UanPhyDual::GetPerModelPhy2
Ptr< UanPhyPer > GetPerModelPhy2(void) const
Get the error probability model.
Definition: uan-phy-dual.cc:566
ns3::UanPhyDual::SetSinrModelPhy1
void SetSinrModelPhy1(Ptr< UanPhyCalcSinr > calcSinr)
Set the SINR calculator.
Definition: uan-phy-dual.cc:602
ns3::UanPhyDual::UanPhyDual
UanPhyDual()
Constructor.
Definition: uan-phy-dual.cc:118
ns3::UanPhyDual::~UanPhyDual
virtual ~UanPhyDual()
Dummy destructor.
Definition: uan-phy-dual.cc:133
ns3::UanPhyDual::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition: uan-phy-dual.cc:159
ns3::UanPhyDual::SetPerModelPhy2
void SetPerModelPhy2(Ptr< UanPhyPer > per)
Set the error probability model.
Definition: uan-phy-dual.cc:580
ns3::UanPhyDual::RegisterListener
virtual void RegisterListener(UanPhyListener *listener)
Register a UanPhyListener to be notified of common UanPhy events.
Definition: uan-phy-dual.cc:269
ns3::UanPhyDual::GetPhy1PacketRx
Ptr< Packet > GetPhy1PacketRx(void) const
Get the packet currently being received.
Definition: uan-phy-dual.cc:412
NS_UNUSED
#define NS_UNUSED(x)
Mark a local variable as unused.
Definition: unused.h:36
uan-mac-rc.h
ns3::UanModesListValue::Get
UanModesList Get(void) const
Definition: uan-tx-mode.cc:303
ns3::UanPhyCalcSinrDual::~UanPhyCalcSinrDual
virtual ~UanPhyCalcSinrDual()
Destructor.
Definition: uan-phy-dual.cc:52
ns3::UanTxMode::OTHER
@ OTHER
Unspecified/undefined.
Definition: uan-tx-mode.h:54
ns3::UanPhyDual::GetDevice
virtual Ptr< UanNetDevice > GetDevice(void) const
Get the device hosting this Phy.
Definition: uan-phy-dual.cc:464
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::UanPhyDual::SetReceiveOkCallback
virtual void SetReceiveOkCallback(RxOkCallback cb)
Set the callback to be used when a packet is received without error.
Definition: uan-phy-dual.cc:283
ns3::UanTxMode
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:42
ns3::UanPhyDual::IsStateBusy
virtual bool IsStateBusy(void)
Definition: uan-phy-dual.cc:439
ns3::UanPhyGen::GetDefaultModes
static UanModesList GetDefaultModes(void)
Get the default transmission modes.
Definition: uan-phy-gen.cc:569
ns3::UanPhyDual::EnergyDepletionHandler
virtual void EnergyDepletionHandler(void)
Handle the energy depletion event.
Definition: uan-phy-dual.cc:240
ns3::UanPhyDual::m_txLogger
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_txLogger
A packet was sent from this Phy.
Definition: uan-phy-dual.h:252
ns3::UanPhyCalcSinrDual::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: uan-phy-dual.cc:58
ns3::UanPhyDual::m_recErrCb
RxErrCallback m_recErrCb
Callback when packet received with errors.
Definition: uan-phy-dual.h:256
ns3::UanPhyDual::SetTxPowerDb
virtual void SetTxPowerDb(double txpwr)
Set the transmit power.
Definition: uan-phy-dual.cc:298
ns3::UanPhyDual::NotifyIntChange
virtual void NotifyIntChange(void)
Called when there has been a change in the amount of interference this node is experiencing from othe...
Definition: uan-phy-dual.cc:492
ns3::UanPhyDual::GetPerModelPhy1
Ptr< UanPhyPer > GetPerModelPhy1(void) const
Get the error probability model.
Definition: uan-phy-dual.cc:558
ns3::UanPhyCalcSinr::KpToDb
double KpToDb(double kp) const
Convert kilopascals to dB re 1 uPa.
Definition: uan-phy.h:92
ns3::MakePointerAccessor
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:227
ns3::StringValue
Hold variables of type string.
Definition: string.h:41
uan-net-device.h
ns3::UanPhyDual::GetTxPowerDb
virtual double GetTxPowerDb(void)
Get the current transmit power, in dB.
Definition: uan-phy-dual.cc:341
uan-phy-gen.h
ns3::MakeDoubleAccessor
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
ns3::UanPhyDual::GetTxPowerDbPhy1
double GetTxPowerDbPhy1(void) const
Get the current transmit power, in dB.
Definition: uan-phy-dual.cc:348
ns3::MakeUanModesListChecker
Ptr< const AttributeChecker > MakeUanModesListChecker(void)
Definition: uan-tx-mode.cc:303
ns3::UanPhyListener
Interface for PHY event listener.
Definition: uan-phy.h:147
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::UanPhyDual::SetModesPhy2
void SetModesPhy2(UanModesList modes)
Set the available modes.
Definition: uan-phy-dual.cc:552
ns3::UanPhyDual::RxOkFromSubPhy
void RxOkFromSubPhy(Ptr< Packet > pkt, double sinr, UanTxMode mode)
Handle callback and logger for packets received without error.
Definition: uan-phy-dual.cc:614
ns3::UanPhyDual::GetChannel
virtual Ptr< UanChannel > GetChannel(void) const
Get the attached channel.
Definition: uan-phy-dual.cc:459
ns3::UanPhyDual::IsPhy2Idle
bool IsPhy2Idle(void)
Definition: uan-phy-dual.cc:388
ns3::UanPhyDual::IsStateRx
virtual bool IsStateRx(void)
Definition: uan-phy-dual.cc:444
uan-phy-dual.h
ns3::UanTransducer::ArrivalList
std::list< UanPacketArrival > ArrivalList
List of arriving packets overlapping in time.
Definition: uan-transducer.h:154
ns3::Time::S
@ S
second
Definition: nstime.h:115
ns3::UanPhyDual::m_recOkCb
RxOkCallback m_recOkCb
Callback when packet received without errors.
Definition: uan-phy-dual.h:254
ns3::UanPhyDual::GetTransducer
virtual Ptr< UanTransducer > GetTransducer(void)
Get the attached transducer.
Definition: uan-phy-dual.cc:505
ns3::UanPhyDual::IsStateSleep
virtual bool IsStateSleep(void)
Definition: uan-phy-dual.cc:429
uan-header-common.h
ns3::UanPhyDual::IsPhy1Tx
bool IsPhy1Tx(void)
Definition: uan-phy-dual.cc:406
ns3::UanHeaderCommon::GetType
uint8_t GetType(void) const
Get the header type value.
Definition: uan-header-common.cc:109
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::UanTxMode::GetName
std::string GetName(void) const
Get the mode name.
Definition: uan-tx-mode.cc:75
ns3::UanPhyCalcSinr
Class used for calculating SINR of packet in UanPhy.
Definition: uan-phy.h:45
ns3::UanTxMode::GetModType
ModulationType GetModType(void) const
Get the modulation type of the mode.
Definition: uan-tx-mode.cc:39
ns3::UanPhyDual::m_phy2
Ptr< UanPhy > m_phy2
Second Phy layer.
Definition: uan-phy-dual.h:245
ns3::UanPhyDual::IsPhy1Rx
bool IsPhy1Rx(void)
Definition: uan-phy-dual.cc:394
ns3::UanPhyDual::SetSinrModelPhy2
void SetSinrModelPhy2(Ptr< UanPhyCalcSinr > calcSinr)
Set the SINR calculator.
Definition: uan-phy-dual.cc:608
ns3::UanPhyDual::IsPhy1Idle
bool IsPhy1Idle(void)
Definition: uan-phy-dual.cc:383
ns3::UanPhyDual::IsPhy2Tx
bool IsPhy2Tx(void)
Definition: uan-phy-dual.cc:424
ns3::UanPhyDual::IsPhy2Rx
bool IsPhy2Rx(void)
Definition: uan-phy-dual.cc:400
ns3::UanPhyDual::m_phy1
Ptr< UanPhy > m_phy1
First Phy layer.
Definition: uan-phy-dual.h:243
ns3::UanPhyDual::SetCcaThresholdDb
virtual void SetCcaThresholdDb(double thresh)
Set the threshold for detecting channel busy.
Definition: uan-phy-dual.cc:322
ns3::Object::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
ns3::UanPhyDual::IsStateIdle
virtual bool IsStateIdle(void)
Definition: uan-phy-dual.cc:434
sample-rng-plot.n
n
Definition: sample-rng-plot.py:37
ns3::UanPhyDual::SetReceiveErrorCallback
virtual void SetReceiveErrorCallback(RxErrCallback cb)
Set the callback to be used when a packet is received with errors.
Definition: uan-phy-dual.cc:290
ns3::UanPhyDual::GetPacketRx
Ptr< Packet > GetPacketRx(void) const
Get the packet currently being received.
Definition: uan-phy-dual.cc:629
ns3::UanPhyDual::SetTransducer
virtual void SetTransducer(Ptr< UanTransducer > trans)
Attach a transducer to this Phy.
Definition: uan-phy-dual.cc:499
ns3::UanPhyDual::EnergyRechargeHandler
virtual void EnergyRechargeHandler(void)
Handle the energy recharge event.
Definition: uan-phy-dual.cc:246
ns3::UanPhyCalcSinrDual
Default SINR model for UanPhyDual.
Definition: uan-phy-dual.h:42
ns3::UanPhyCalcSinr::DbToKp
double DbToKp(double db) const
Convert dB re 1 uPa to kilopascals.
Definition: uan-phy.h:82
ns3::UanPhyDual::GetModesPhy2
UanModesList GetModesPhy2(void) const
Get the list of available modes.
Definition: uan-phy-dual.cc:538
ns3::MakeUanModesListAccessor
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