satellite-channel.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd.
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: Jani Puttonen <jani.puttonen@magister.fi>
19  */
20 
21 #include "satellite-channel.h"
22 
25 #include "satellite-id-mapper.h"
26 #include "satellite-mac-tag.h"
27 #include "satellite-phy-rx.h"
28 #include "satellite-phy-tx.h"
32 #include "satellite-utils.h"
33 
34 #include <ns3/boolean.h>
35 #include <ns3/enum.h>
36 #include <ns3/log.h>
37 #include <ns3/mobility-model.h>
38 #include <ns3/net-device.h>
39 #include <ns3/node.h>
40 #include <ns3/object.h>
41 #include <ns3/packet.h>
42 #include <ns3/propagation-delay-model.h>
43 #include <ns3/simulator.h>
44 #include <ns3/singleton.h>
45 
46 #include <algorithm>
47 
48 NS_LOG_COMPONENT_DEFINE("SatChannel");
49 
50 namespace ns3
51 {
52 
53 NS_OBJECT_ENSURE_REGISTERED(SatChannel);
54 
56  : m_fwdMode(SatChannel::ONLY_DEST_BEAM),
57  m_phyRxContainer(),
58  m_channelType(SatEnums::UNKNOWN_CH),
59  m_carrierFreqConverter(),
60  m_freqId(),
61  m_propagationDelay(),
62  m_freeSpaceLoss(),
63  m_rxPowerCalculationMode(SatEnums::RX_PWR_CALCULATION),
64  /*
65  * Currently, the Rx power calculation mode is fully independent of other
66  * possible satellite network configurations, e.g. fading, antenna patterns.
67  * TODO optimization: Tie Rx power calculation mode to other PHY/channel level
68  * configurations. If using input Rx trace, there is no need to enable e.g. Markov
69  * fading, nor antenna patterns.
70  */
71  m_enableRxPowerOutputTrace(false),
72  m_enableFadingOutputTrace(false),
73  m_enableExternalFadingInputTrace(false)
74 {
75  NS_LOG_FUNCTION(this);
76 }
77 
79 {
80  NS_LOG_FUNCTION(this);
81 }
82 
83 void
85 {
86  NS_LOG_FUNCTION(this);
87  m_phyRxContainer.clear();
89  Channel::DoDispose();
90 }
91 
92 TypeId
94 {
95  static TypeId tid =
96  TypeId("ns3::SatChannel")
97  .SetParent<Channel>()
98  .AddConstructor<SatChannel>()
99  .AddAttribute("EnableRxPowerOutputTrace",
100  "Enable Rx power output trace.",
101  BooleanValue(false),
102  MakeBooleanAccessor(&SatChannel::m_enableRxPowerOutputTrace),
103  MakeBooleanChecker())
104  .AddAttribute("EnableFadingOutputTrace",
105  "Enable fading output trace.",
106  BooleanValue(false),
107  MakeBooleanAccessor(&SatChannel::m_enableFadingOutputTrace),
108  MakeBooleanChecker())
109  .AddAttribute("EnableExternalFadingInputTrace",
110  "Enable external fading input trace.",
111  BooleanValue(false),
112  MakeBooleanAccessor(&SatChannel::m_enableExternalFadingInputTrace),
113  MakeBooleanChecker())
114  .AddAttribute("RxPowerCalculationMode",
115  "Rx Power calculation mode",
116  EnumValue(SatEnums::RX_PWR_CALCULATION),
117  MakeEnumAccessor(&SatChannel::m_rxPowerCalculationMode),
118  MakeEnumChecker(SatEnums::RX_PWR_CALCULATION,
119  "RxPowerCalculation",
121  "RxPowerInputTrace",
123  "RxCnoInputTrace"))
124  .AddAttribute("ForwardingMode",
125  "Channel forwarding mode.",
126  EnumValue(SatChannel::ALL_BEAMS),
127  MakeEnumAccessor(&SatChannel::m_fwdMode),
128  MakeEnumChecker(SatChannel::ONLY_DEST_NODE,
129  "OnlyDestNode",
131  "OnlyDestBeam",
133  "AllBeams"));
134  return tid;
135 }
136 
137 void
138 SatChannel::AddRx(Ptr<SatPhyRx> phyRx)
139 {
140  NS_LOG_FUNCTION(this << phyRx);
141  m_phyRxContainer.push_back(phyRx);
142 }
143 
144 void
145 SatChannel::RemoveRx(Ptr<SatPhyRx> phyRx)
146 {
147  NS_LOG_FUNCTION(this << phyRx);
148 
149  PhyRxContainer::iterator phyIter =
150  std::find(m_phyRxContainer.begin(), m_phyRxContainer.end(), phyRx);
151 
152  if (phyIter != m_phyRxContainer.end()) // == vector.end() means the element was not found
153  {
154  m_phyRxContainer.erase(phyIter);
155  }
156 }
157 
158 void
159 SatChannel::StartTx(Ptr<SatSignalParameters> txParams)
160 {
161  NS_LOG_FUNCTION(this << txParams);
162  NS_ASSERT_MSG(txParams->m_phyTx, "NULL phyTx");
163 
164  switch (m_fwdMode)
165  {
173  // For all receivers
174  for (PhyRxContainer::const_iterator rxPhyIterator = m_phyRxContainer.begin();
175  rxPhyIterator != m_phyRxContainer.end();
176  ++rxPhyIterator)
177  {
178  // If the same beam
179  if ((*rxPhyIterator)->GetBeamId() == txParams->m_beamId)
180  {
181  switch (m_channelType)
182  {
183  // If the destination is satellite
186  // The packet burst is passed on to the satellite receiver
187  ScheduleRx(txParams, *rxPhyIterator);
188  break;
189  }
190  // If the destination is terrestrial node
193  // Go through the packets and check their destination address by peeking the MAC
194  // tag
195  SatSignalParameters::PacketsInBurst_t::const_iterator it =
196  txParams->m_packetsInBurst.begin();
197  for (; it != txParams->m_packetsInBurst.end(); ++it)
198  {
199  SatMacTag macTag;
200  bool mSuccess = (*it)->PeekPacketTag(macTag);
201  if (!mSuccess)
202  {
203  NS_FATAL_ERROR("MAC tag was not found from the packet!");
204  }
205 
206  Mac48Address dest = macTag.GetDestAddress();
207 
208  // If the packet destination is the same as the receiver MAC
209  if (dest == (*rxPhyIterator)->GetAddress() || dest.IsBroadcast() ||
210  dest.IsGroup())
211  {
212  ScheduleRx(txParams, *rxPhyIterator);
213 
214  // Remember to break the packet loop, so that the transmission
215  // is not received several times!
216  break;
217  }
218  }
219  break;
220  }
221  default: {
222  NS_FATAL_ERROR("Unsupported channel type!");
223  break;
224  }
225  }
226  }
227  }
228  break;
229  }
236  for (PhyRxContainer::const_iterator rxPhyIterator = m_phyRxContainer.begin();
237  rxPhyIterator != m_phyRxContainer.end();
238  ++rxPhyIterator)
239  {
240  // If the same beam
241  if ((*rxPhyIterator)->GetBeamId() == txParams->m_beamId)
242  {
243  ScheduleRx(txParams, *rxPhyIterator);
244  }
245  }
246  break;
247  }
254  case SatChannel::ALL_BEAMS: {
255  for (PhyRxContainer::const_iterator rxPhyIterator = m_phyRxContainer.begin();
256  rxPhyIterator != m_phyRxContainer.end();
257  ++rxPhyIterator)
258  {
259  ScheduleRx(txParams, *rxPhyIterator);
260  }
261  break;
262  }
263  default: {
264  NS_FATAL_ERROR("Unsupported SatChannel FwdMode!");
265  break;
266  }
267  }
268 }
269 
270 void
271 SatChannel::ScheduleRx(Ptr<SatSignalParameters> txParams, Ptr<SatPhyRx> receiver)
272 {
273  NS_LOG_FUNCTION(this << txParams << receiver);
274 
275  Time delay = Seconds(0);
276 
277  Ptr<MobilityModel> senderMobility = txParams->m_phyTx->GetMobility();
278  Ptr<MobilityModel> receiverMobility = receiver->GetMobility();
279 
280  NS_LOG_INFO("copying signal parameters " << txParams);
281  Ptr<SatSignalParameters> rxParams = txParams->Copy();
282 
283  if (m_propagationDelay)
284  {
290  delay = m_propagationDelay->GetDelay(senderMobility, receiverMobility);
291  }
292  else
293  {
298  NS_FATAL_ERROR("SatChannel::ScheduleRx - propagation delay model not set!");
299  }
300 
301  NS_LOG_INFO("Setting propagation delay: " << delay);
302 
303  Ptr<NetDevice> netDev = receiver->GetDevice();
304  uint32_t dstNodeId = netDev->GetNode()->GetId();
305  Simulator::ScheduleWithContext(dstNodeId,
306  delay,
308  this,
309  rxParams,
310  receiver);
311 }
312 
313 void
314 SatChannel::StartRx(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx)
315 {
316  NS_LOG_FUNCTION(this << rxParams << phyRx);
317 
318  rxParams->m_channelType = m_channelType;
319 
320  double frequency_hz = m_carrierFreqConverter(m_channelType, m_freqId, rxParams->m_carrierId);
321  rxParams->m_carrierFreq_hz = frequency_hz;
322 
323  switch (m_rxPowerCalculationMode)
324  {
326  DoRxPowerCalculation(rxParams, phyRx);
327 
329  {
330  DoRxPowerOutputTrace(rxParams, phyRx);
331  }
332  break;
333  }
335  DoRxPowerInputTrace(rxParams, phyRx);
336  break;
337  }
339  DoRxCnoInputTrace(rxParams, phyRx);
340  break;
341  }
342  default: {
343  NS_FATAL_ERROR("SatChannel::StartRx - Invalid Rx power calculation mode");
344  break;
345  }
346  }
347 
348  phyRx->StartRx(rxParams);
349 }
350 
351 void
352 SatChannel::DoRxPowerOutputTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx)
353 {
354  NS_LOG_FUNCTION(this << rxParams << phyRx);
355 
356  // Get the bandwidth of the currently used carrier
357  double carrierBandwidthHz = m_carrierBandwidthConverter(m_channelType,
358  rxParams->m_carrierId,
360 
361  NS_LOG_INFO("Carrier bw: " << carrierBandwidthHz
362  << ", rxPower: " << SatUtils::LinearToDb(rxParams->m_rxPower_W)
363  << ", carrierId: " << rxParams->m_carrierId
364  << ", channelType: " << SatEnums::GetChannelTypeName(m_channelType));
365 
366  std::vector<double> tempVector;
367  tempVector.push_back(Now().GetSeconds());
368 
369  // Output the Rx power density (W / Hz)
370  tempVector.push_back(rxParams->m_rxPower_W / carrierBandwidthHz);
371 
372  switch (m_channelType)
373  {
376  Singleton<SatRxPowerOutputTraceContainer>::Get()->AddToContainer(
377  std::make_pair(phyRx->GetDevice()->GetAddress(), m_channelType),
378  tempVector);
379  break;
380  }
383  Singleton<SatRxPowerOutputTraceContainer>::Get()->AddToContainer(
384  std::make_pair(GetSourceAddress(rxParams), m_channelType),
385  tempVector);
386  break;
387  }
388  default: {
389  NS_FATAL_ERROR("SatChannel::DoRxPowerOutputTrace - Invalid channel type");
390  break;
391  }
392  }
393 }
394 
395 void
396 SatChannel::DoRxPowerInputTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx)
397 {
398  NS_LOG_FUNCTION(this << rxParams << phyRx);
399 
400  // Get the bandwidth of the currently used carrier
401  double carrierBandwidthHz = m_carrierBandwidthConverter(m_channelType,
402  rxParams->m_carrierId,
404 
405  switch (m_channelType)
406  {
409  // Calculate the Rx power from Rx power density
410  rxParams->m_rxPower_W =
411  carrierBandwidthHz *
412  Singleton<SatRxPowerInputTraceContainer>::Get()->GetRxPowerDensity(
413  std::make_pair(phyRx->GetDevice()->GetAddress(), m_channelType));
414 
415  break;
416  }
419  // Calculate the Rx power from Rx power density
420  rxParams->m_rxPower_W =
421  carrierBandwidthHz * Singleton<SatRxPowerInputTraceContainer>::Get()->GetRxPowerDensity(
422  std::make_pair(GetSourceAddress(rxParams), m_channelType));
423  break;
424  }
425  default: {
426  NS_FATAL_ERROR("SatChannel::DoRxPowerInputTrace - Invalid channel type");
427  break;
428  }
429  }
430 
431  NS_LOG_INFO("Carrier bw: " << carrierBandwidthHz
432  << ", rxPower: " << SatUtils::LinearToDb(rxParams->m_rxPower_W)
433  << ", carrierId: " << rxParams->m_carrierId
434  << ", channelType: " << SatEnums::GetChannelTypeName(m_channelType));
435 
436  // get external fading input trace
438  {
439  rxParams->m_rxPower_W /= GetExternalFadingTrace(rxParams, phyRx);
440  }
441 }
442 
443 void
444 SatChannel::DoRxCnoInputTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx)
445 {
446  NS_LOG_FUNCTION(this << rxParams << phyRx);
447 
448  /* Get the required parameters
449  *
450  * We have C/N0 = B*P/N
451  * So P = N/B * C/N0
452  * Where:
453  * B is the carrier bandwidth
454  * N is the noise
455  * P is the required power to get the selected C/N0
456  */
457  double cno;
458  double carrierBandwidthHz = m_carrierBandwidthConverter(m_channelType,
459  rxParams->m_carrierId,
461  double rxTemperatureK = phyRx->GetRxTemperatureK(rxParams);
462  ;
463  double rxNoisePowerW =
464  SatConstVariables::BOLTZMANN_CONSTANT * rxTemperatureK * carrierBandwidthHz;
465 
466  switch (m_channelType)
467  {
470  // Calculate the Rx power from C/N0
471  cno = Singleton<SatRxCnoInputTraceContainer>::Get()->GetRxCno(
472  std::make_pair(phyRx->GetDevice()->GetAddress(), m_channelType));
473  if (cno == 0)
474  {
475  DoRxPowerCalculation(rxParams, phyRx);
476  NS_LOG_INFO("Use calculation downlink \t" << cno << " " << carrierBandwidthHz << " "
477  << rxNoisePowerW << " "
478  << rxParams->m_rxPower_W);
479  return;
480  }
481  rxParams->m_rxPower_W = rxNoisePowerW * cno / carrierBandwidthHz;
482  NS_LOG_INFO("Channel downlink \t" << cno << " " << carrierBandwidthHz << " "
483  << rxNoisePowerW << " "
484  << rxNoisePowerW * cno / carrierBandwidthHz);
485  break;
486  }
489  // Calculate the Rx power from C/N0
490  cno = Singleton<SatRxCnoInputTraceContainer>::Get()->GetRxCno(
491  std::make_pair(GetSourceAddress(rxParams), m_channelType));
492  if (cno == 0)
493  {
494  DoRxPowerCalculation(rxParams, phyRx);
495  NS_LOG_INFO("Use calculation uplink \t" << cno << " " << carrierBandwidthHz << " "
496  << rxNoisePowerW << " "
497  << rxParams->m_rxPower_W);
498  return;
499  }
500  rxParams->m_rxPower_W = rxNoisePowerW * cno / carrierBandwidthHz;
501  NS_LOG_INFO("Channel uplink \t" << cno << " " << carrierBandwidthHz << " "
502  << rxNoisePowerW << " "
503  << rxNoisePowerW * cno / carrierBandwidthHz);
504  break;
505  }
506  default: {
507  NS_FATAL_ERROR("SatChannel::DoRxCnoInputTrace - Invalid channel type");
508  break;
509  }
510  }
511 
512  NS_LOG_INFO("Target C/N0: " << cno << ", carrier bw: " << carrierBandwidthHz
513  << ", rxPower: " << SatUtils::LinearToDb(rxParams->m_rxPower_W)
514  << ", carrierId: " << rxParams->m_carrierId << ", channelType: "
516 
517  // get external fading input trace
519  {
520  rxParams->m_rxPower_W /= GetExternalFadingTrace(rxParams, phyRx);
521  }
522 }
523 
524 void
525 SatChannel::DoFadingOutputTrace(Ptr<SatSignalParameters> rxParams,
526  Ptr<SatPhyRx> phyRx,
527  double fadingValue)
528 {
529  NS_LOG_FUNCTION(this << rxParams << phyRx << fadingValue);
530 
531  std::vector<double> tempVector;
532  tempVector.push_back(Now().GetSeconds());
533  tempVector.push_back(fadingValue);
534 
535  switch (m_channelType)
536  {
539  Singleton<SatFadingOutputTraceContainer>::Get()->AddToContainer(
540  std::make_pair(phyRx->GetDevice()->GetAddress(), m_channelType),
541  tempVector);
542  break;
543  }
546  Singleton<SatFadingOutputTraceContainer>::Get()->AddToContainer(
547  std::make_pair(GetSourceAddress(rxParams), m_channelType),
548  tempVector);
549  break;
550  }
551  default: {
552  NS_FATAL_ERROR("SatChannel::DoFadingOutputTrace - Invalid channel type");
553  break;
554  }
555  }
556 }
557 
558 void
559 SatChannel::DoRxPowerCalculation(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx)
560 {
561  NS_LOG_FUNCTION(this << rxParams << phyRx);
562 
563  Ptr<MobilityModel> txMobility = rxParams->m_phyTx->GetMobility();
564  Ptr<MobilityModel> rxMobility = phyRx->GetMobility();
565 
566  double txAntennaGain_W = 0.0;
567  double rxAntennaGain_W = 0.0;
568  double markovFading = 0.0;
569  double extFading = 1.0;
570 
571  // use always UT's or GW's position when getting antenna gain
572  switch (m_channelType)
573  {
576  txAntennaGain_W = rxParams->m_phyTx->GetAntennaGain(rxMobility);
577  rxAntennaGain_W = phyRx->GetAntennaGain(rxMobility);
578  markovFading = phyRx->GetFadingValue(phyRx->GetDevice()->GetAddress(), m_channelType);
579  break;
580  }
583  txAntennaGain_W = rxParams->m_phyTx->GetAntennaGain(txMobility);
584  rxAntennaGain_W = phyRx->GetAntennaGain(txMobility);
585  markovFading = rxParams->m_phyTx->GetFadingValue(GetSourceAddress(rxParams), m_channelType);
586  break;
587  }
588  default: {
589  NS_FATAL_ERROR("SatChannel::DoRxPowerCalculation - Invalid channel type");
590  break;
591  }
592  }
593 
601  {
602  extFading = GetExternalFadingTrace(rxParams, phyRx);
603  }
604 
611  {
612  DoFadingOutputTrace(rxParams, phyRx, markovFading);
613  }
614 
615  // get (calculate) free space loss and RX power and set it to RX params
616  double rxPower_W = (rxParams->m_txPower_W * txAntennaGain_W) /
617  m_freeSpaceLoss->GetFsl(txMobility, rxMobility, rxParams->m_carrierFreq_hz);
618  rxParams->m_rxPower_W =
619  rxPower_W * rxAntennaGain_W / phyRx->GetLosses() * markovFading / extFading;
620 }
621 
622 double
623 SatChannel::GetExternalFadingTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx)
624 {
625  NS_LOG_FUNCTION(this << rxParams << phyRx);
626 
627  int32_t nodeId;
628  Ptr<MobilityModel> mobility;
629 
630  switch (m_channelType)
631  {
633  nodeId = Singleton<SatIdMapper>::Get()->GetGwIdWithMac(phyRx->GetDevice()->GetAddress());
634  mobility = phyRx->GetMobility();
635  break;
636  }
638  nodeId = Singleton<SatIdMapper>::Get()->GetUtIdWithMac(phyRx->GetDevice()->GetAddress());
639  mobility = phyRx->GetMobility();
640  break;
641  }
643  nodeId = Singleton<SatIdMapper>::Get()->GetUtIdWithMac(GetSourceAddress(rxParams));
644  mobility = rxParams->m_phyTx->GetMobility();
645  break;
646  }
648  nodeId = Singleton<SatIdMapper>::Get()->GetGwIdWithMac(GetSourceAddress(rxParams));
649  mobility = rxParams->m_phyTx->GetMobility();
650  break;
651  }
652  default: {
653  NS_FATAL_ERROR("SatChannel::GetExternalFadingTrace - Invalid channel type");
654  break;
655  }
656  }
657 
658  if (nodeId < 0)
659  {
660  NS_FATAL_ERROR("SatChannel::GetExternalFadingTrace - Invalid node ID");
661  }
662 
663  return (Singleton<SatFadingExternalInputTraceContainer>::Get()->GetFadingTrace((uint32_t)nodeId,
665  mobility))
666  ->GetFading();
667 }
668 
670 Mac48Address
671 SatChannel::GetSourceAddress(Ptr<SatSignalParameters> rxParams)
672 {
673  NS_LOG_FUNCTION(this << rxParams);
674 
675  SatMacTag tag;
676 
677  SatSignalParameters::PacketsInBurst_t::const_iterator i = rxParams->m_packetsInBurst.begin();
678 
679  if (*i == NULL)
680  {
681  NS_FATAL_ERROR("SatChannel::GetSourceAddress - Empty packet list");
682  }
683 
684  (*i)->PeekPacketTag(tag);
685 
686  return tag.GetSourceAddress();
687 }
688 
689 void
691 {
692  NS_LOG_FUNCTION(this << chType);
693  NS_ASSERT(chType != SatEnums::UNKNOWN_CH);
694 
695  m_channelType = chType;
696 }
697 
698 void
700 {
701  NS_LOG_FUNCTION(this << freqId);
702 
703  m_freqId = freqId;
704 }
705 
706 void
708 {
709  NS_LOG_FUNCTION(this << &converter);
710 
711  m_carrierFreqConverter = converter;
712 }
713 
714 void
716 {
717  NS_LOG_FUNCTION(this << &converter);
718 
719  m_carrierBandwidthConverter = converter;
720 }
721 
724 {
725  NS_LOG_FUNCTION(this);
726  NS_ASSERT(m_channelType != SatEnums::UNKNOWN_CH);
727 
728  return m_channelType;
729 }
730 
731 void
732 SatChannel::SetPropagationDelayModel(Ptr<PropagationDelayModel> delay)
733 {
734  NS_LOG_FUNCTION(this << delay);
735  NS_ASSERT(m_propagationDelay == nullptr);
736  m_propagationDelay = delay;
737 }
738 
739 Ptr<PropagationDelayModel>
741 {
742  NS_LOG_FUNCTION(this);
743  NS_ASSERT(m_propagationDelay != nullptr);
744 
745  return m_propagationDelay;
746 }
747 
748 void
749 SatChannel::SetFreeSpaceLoss(Ptr<SatFreeSpaceLoss> loss)
750 {
751  NS_LOG_FUNCTION(this << loss);
752  NS_ASSERT(m_freeSpaceLoss == nullptr);
753  m_freeSpaceLoss = loss;
754 }
755 
756 Ptr<SatFreeSpaceLoss>
758 {
759  NS_LOG_FUNCTION(this);
760  NS_ASSERT(m_freeSpaceLoss != nullptr);
761  return m_freeSpaceLoss;
762 }
763 
764 std::size_t
766 {
767  NS_LOG_FUNCTION(this);
768  return m_phyRxContainer.size();
769 }
770 
771 Ptr<NetDevice>
772 SatChannel::GetDevice(std::size_t i) const
773 {
774  NS_LOG_FUNCTION(this << i);
775  return m_phyRxContainer.at(i)->GetDevice()->GetObject<NetDevice>();
776 }
777 
778 } // namespace ns3
Satellite channel implementation.
void DoRxPowerOutputTrace(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx)
Function for Rx power output trace.
void DoRxCnoInputTrace(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx)
Function for Rx power input trace from C/N0 values.
SatChannelFwdMode_e m_fwdMode
Forwarding mode of the SatChannel: SINGLE_RX = only the proper receiver of the packet shall receive t...
virtual Ptr< PropagationDelayModel > GetPropagationDelayModel()
Get the propagation delay model to be used in the SatChannel.
virtual void DoDispose()
Dispose SatChannel.
Callback< double, SatEnums::ChannelType_t, uint32_t, uint32_t > CarrierFreqConverter
Ptr< SatFreeSpaceLoss > m_freeSpaceLoss
Free space loss model to be used with this channel.
bool m_enableFadingOutputTrace
Defines whether fading output tracing is in use or not.
SatChannel()
Default constructor.
double GetExternalFadingTrace(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx)
Function for getting the external source fading value.
void DoRxPowerCalculation(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx)
Function for calculating the Rx power.
static TypeId GetTypeId(void)
Get the type ID.
virtual void SetFrequencyId(uint32_t freqId)
Set the frequency id of the channel.
void DoRxPowerInputTrace(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx)
Function for Rx power input trace.
SatTypedefs::CarrierBandwidthConverter_t m_carrierBandwidthConverter
Bandwidth converter callback.
virtual void SetChannelType(SatEnums::ChannelType_t chType)
Set the type of the channel.
bool m_enableRxPowerOutputTrace
Defines whether Rx power output tracing is in use or not.
uint32_t m_freqId
Frequency id of the channel.
virtual void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
Set the propagation delay model to be used in the SatChannel.
virtual void RemoveRx(Ptr< SatPhyRx > phyRx)
This method is used to remove a SatPhyRx instance from a SatChannel instance, e.g.
Mac48Address GetSourceAddress(Ptr< SatSignalParameters > rxParams)
Function for getting the source MAC address from Rx parameters.
void DoFadingOutputTrace(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx, double fadingValue)
Function for fading output trace.
virtual Ptr< NetDevice > GetDevice(std::size_t i) const
Get a device for a certain receiver index.
virtual void SetBandwidthConverter(SatTypedefs::CarrierBandwidthConverter_t converter)
Set the bandwidth converter callback.
virtual SatEnums::ChannelType_t GetChannelType()
Get the type of the channel.
PhyRxContainer m_phyRxContainer
Container of SatPhyRx instances attached to the channel.
void ScheduleRx(Ptr< SatSignalParameters > txParams, Ptr< SatPhyRx > phyRx)
Used internally to schedule the StartRx method call after the propagation delay.
void StartRx(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx)
Used internally to start the packet reception of at the phyRx.
virtual void StartTx(Ptr< SatSignalParameters > params)
Used by attached SatPhyTx instances to transmit signals to the channel.
virtual ~SatChannel()
Destructor for SatChannel.
virtual void SetFreeSpaceLoss(Ptr< SatFreeSpaceLoss > delay)
Set the propagation delay model to be used in the SatChannel.
CarrierFreqConverter m_carrierFreqConverter
Frequency converter callback.
SatEnums::ChannelType_t m_channelType
Type of the channel.
virtual void AddRx(Ptr< SatPhyRx > phyRx)
This method is used to attach the receiver entity SatPhyRx instance to a SatChannel instance,...
Ptr< PropagationDelayModel > m_propagationDelay
Propagation delay model to be used with this channel.
virtual void SetFrequencyConverter(CarrierFreqConverter converter)
Set the frequency converter callback.
bool m_enableExternalFadingInputTrace
Defines whether external fading input tracing is in use or not.
virtual std::size_t GetNDevices(void) const
virtual Ptr< SatFreeSpaceLoss > GetFreeSpaceLoss() const
Get the propagation delay model used in the SatChannel.
SatEnums::RxPowerCalculationMode_t m_rxPowerCalculationMode
Defines the mode used for Rx power calculation.
SatEnums class is for simplifying the use of enumerators in the satellite module.
ChannelType_t
Types of channel.
static std::string GetChannelTypeName(ChannelType_t channelType)
This class implements a tag that carries the satellite MAC specific information, such as source and d...
Mac48Address GetSourceAddress(void) const
Get source MAC address.
Mac48Address GetDestAddress(void) const
Get destination MAC address.
Callback< double, SatEnums::ChannelType_t, uint32_t, SatEnums::CarrierBandwidthType_t > CarrierBandwidthConverter_t
Callback for carrier bandwidths.
static T LinearToDb(T linear)
Converts linear to decibels.
constexpr double BOLTZMANN_CONSTANT
Boltzmann Constant.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.