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 #include <cstddef>
48 #include <utility>
49 #include <vector>
50 
51 NS_LOG_COMPONENT_DEFINE("SatChannel");
52 
53 namespace ns3
54 {
55 
56 NS_OBJECT_ENSURE_REGISTERED(SatChannel);
57 
59  : m_fwdMode(SatChannel::ONLY_DEST_BEAM),
60  m_phyRxContainer(),
61  m_channelType(SatEnums::UNKNOWN_CH),
62  m_carrierFreqConverter(),
63  m_freqId(),
64  m_propagationDelay(),
65  m_freeSpaceLoss(),
66  m_rxPowerCalculationMode(SatEnums::RX_PWR_CALCULATION),
67  /*
68  * Currently, the Rx power calculation mode is fully independent of other
69  * possible satellite network configurations, e.g. fading, antenna patterns.
70  * TODO optimization: Tie Rx power calculation mode to other PHY/channel level
71  * configurations. If using input Rx trace, there is no need to enable e.g. Markov
72  * fading, nor antenna patterns.
73  */
74  m_enableRxPowerOutputTrace(false),
75  m_enableFadingOutputTrace(false),
76  m_enableExternalFadingInputTrace(false)
77 {
78  NS_LOG_FUNCTION(this);
79 }
80 
82 {
83  NS_LOG_FUNCTION(this);
84 }
85 
86 void
88 {
89  NS_LOG_FUNCTION(this);
90  m_phyRxContainer.clear();
92  Channel::DoDispose();
93 }
94 
95 TypeId
97 {
98  static TypeId tid =
99  TypeId("ns3::SatChannel")
100  .SetParent<Channel>()
101  .AddConstructor<SatChannel>()
102  .AddAttribute("EnableRxPowerOutputTrace",
103  "Enable Rx power output trace.",
104  BooleanValue(false),
105  MakeBooleanAccessor(&SatChannel::m_enableRxPowerOutputTrace),
106  MakeBooleanChecker())
107  .AddAttribute("EnableFadingOutputTrace",
108  "Enable fading output trace.",
109  BooleanValue(false),
110  MakeBooleanAccessor(&SatChannel::m_enableFadingOutputTrace),
111  MakeBooleanChecker())
112  .AddAttribute("EnableExternalFadingInputTrace",
113  "Enable external fading input trace.",
114  BooleanValue(false),
115  MakeBooleanAccessor(&SatChannel::m_enableExternalFadingInputTrace),
116  MakeBooleanChecker())
117  .AddAttribute("RxPowerCalculationMode",
118  "Rx Power calculation mode",
119  EnumValue(SatEnums::RX_PWR_CALCULATION),
120  MakeEnumAccessor<SatEnums::RxPowerCalculationMode_t>(
122  MakeEnumChecker(SatEnums::RX_PWR_CALCULATION,
123  "RxPowerCalculation",
125  "RxPowerInputTrace",
127  "RxCnoInputTrace"))
128  .AddAttribute("ForwardingMode",
129  "Channel forwarding mode.",
130  EnumValue(SatChannel::ALL_BEAMS),
131  MakeEnumAccessor<SatChannel::SatChannelFwdMode_e>(&SatChannel::m_fwdMode),
132  MakeEnumChecker(SatChannel::ONLY_DEST_NODE,
133  "OnlyDestNode",
135  "OnlyDestBeam",
137  "AllBeams"));
138  return tid;
139 }
140 
141 void
142 SatChannel::AddRx(Ptr<SatPhyRx> phyRx)
143 {
144  NS_LOG_FUNCTION(this << phyRx);
145 
146  m_phyRxContainer.push_back(phyRx);
147 }
148 
149 void
150 SatChannel::RemoveRx(Ptr<SatPhyRx> phyRx)
151 {
152  NS_LOG_FUNCTION(this << phyRx);
153 
154  PhyRxContainer::iterator phyIter =
155  std::find(m_phyRxContainer.begin(), m_phyRxContainer.end(), phyRx);
156 
157  if (phyIter != m_phyRxContainer.end()) // == vector.end() means the element was not found
158  {
159  m_phyRxContainer.erase(phyIter);
160  }
161 }
162 
163 void
164 SatChannel::StartTx(Ptr<SatSignalParameters> txParams)
165 {
166  NS_LOG_FUNCTION(this << txParams);
167  NS_ASSERT_MSG(txParams->m_phyTx, "NULL phyTx");
168 
169  switch (m_fwdMode)
170  {
178  // For all receivers
179  for (PhyRxContainer::const_iterator rxPhyIterator = m_phyRxContainer.begin();
180  rxPhyIterator != m_phyRxContainer.end();
181  ++rxPhyIterator)
182  {
183  // If the same beam
184  if ((*rxPhyIterator)->GetBeamId() == txParams->m_beamId)
185  {
186  switch (m_channelType)
187  {
188  // If the destination is satellite
191  // The packet burst is passed on to the satellite receiver
192  ScheduleRx(txParams, *rxPhyIterator);
193  break;
194  }
195  // If the destination is terrestrial node
198  // Go through the packets and check their destination address by peeking the MAC
199  // tag
200  SatSignalParameters::PacketsInBurst_t::const_iterator it =
201  txParams->m_packetsInBurst.begin();
202  for (; it != txParams->m_packetsInBurst.end(); ++it)
203  {
204  SatMacTag macTag;
205  bool mSuccess = (*it)->PeekPacketTag(macTag);
206  if (!mSuccess)
207  {
208  NS_FATAL_ERROR("MAC tag was not found from the packet!");
209  }
210 
211  Mac48Address dest = macTag.GetDestAddress();
212 
213  // If the packet destination is the same as the receiver MAC
214  if (dest == (*rxPhyIterator)->GetAddress() || dest.IsBroadcast() ||
215  dest.IsGroup())
216  {
217  ScheduleRx(txParams, *rxPhyIterator);
218 
219  // Remember to break the packet loop, so that the transmission
220  // is not received several times!
221  break;
222  }
223  }
224  break;
225  }
226  default: {
227  NS_FATAL_ERROR("Unsupported channel type!");
228  break;
229  }
230  }
231  }
232  }
233  break;
234  }
241  for (PhyRxContainer::const_iterator rxPhyIterator = m_phyRxContainer.begin();
242  rxPhyIterator != m_phyRxContainer.end();
243  ++rxPhyIterator)
244  {
245  // If the same beam
246  if ((*rxPhyIterator)->GetBeamId() == txParams->m_beamId)
247  {
248  ScheduleRx(txParams, *rxPhyIterator);
249  }
250  }
251  break;
252  }
259  case SatChannel::ALL_BEAMS: {
260  for (PhyRxContainer::const_iterator rxPhyIterator = m_phyRxContainer.begin();
261  rxPhyIterator != m_phyRxContainer.end();
262  ++rxPhyIterator)
263  {
264  ScheduleRx(txParams, *rxPhyIterator);
265  }
266  break;
267  }
268  default: {
269  NS_FATAL_ERROR("Unsupported SatChannel FwdMode!");
270  break;
271  }
272  }
273 }
274 
275 void
276 SatChannel::ScheduleRx(Ptr<SatSignalParameters> txParams, Ptr<SatPhyRx> receiver)
277 {
278  NS_LOG_FUNCTION(this << txParams << receiver);
279 
280  Time delay = Seconds(0);
281 
282  Ptr<MobilityModel> senderMobility = txParams->m_phyTx->GetMobility();
283  Ptr<MobilityModel> receiverMobility = receiver->GetMobility();
284 
285  NS_LOG_INFO("copying signal parameters " << txParams);
286  Ptr<SatSignalParameters> rxParams = txParams->Copy();
287 
288  if (m_propagationDelay)
289  {
295  delay = m_propagationDelay->GetDelay(senderMobility, receiverMobility);
296  }
297  else
298  {
303  NS_FATAL_ERROR("SatChannel::ScheduleRx - propagation delay model not set!");
304  }
305 
306  NS_LOG_INFO("Setting propagation delay: " << delay);
307 
308  Ptr<NetDevice> netDev = receiver->GetDevice();
309  uint32_t dstNodeId = netDev->GetNode()->GetId();
310  Simulator::ScheduleWithContext(dstNodeId,
311  delay,
313  this,
314  rxParams,
315  receiver);
316 }
317 
318 void
319 SatChannel::StartRx(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx)
320 {
321  NS_LOG_FUNCTION(this << rxParams << phyRx);
322 
323  rxParams->m_channelType = m_channelType;
324 
325  double frequency_hz = m_carrierFreqConverter(m_channelType, m_freqId, rxParams->m_carrierId);
326  rxParams->m_carrierFreq_hz = frequency_hz;
327 
328  switch (m_rxPowerCalculationMode)
329  {
331  DoRxPowerCalculation(rxParams, phyRx);
332 
334  {
335  DoRxPowerOutputTrace(rxParams, phyRx);
336  }
337  break;
338  }
340  DoRxPowerInputTrace(rxParams, phyRx);
341  break;
342  }
344  DoRxCnoInputTrace(rxParams, phyRx);
345  break;
346  }
347  default: {
348  NS_FATAL_ERROR("SatChannel::StartRx - Invalid Rx power calculation mode");
349  break;
350  }
351  }
352 
353  phyRx->StartRx(rxParams);
354 }
355 
356 void
357 SatChannel::DoRxPowerOutputTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx)
358 {
359  NS_LOG_FUNCTION(this << rxParams << phyRx);
360 
361  // Get the bandwidth of the currently used carrier
362  double carrierBandwidthHz = m_carrierBandwidthConverter(m_channelType,
363  rxParams->m_carrierId,
365 
366  NS_LOG_INFO("Carrier bw: " << carrierBandwidthHz
367  << ", rxPower: " << SatUtils::LinearToDb(rxParams->m_rxPower_W)
368  << ", carrierId: " << rxParams->m_carrierId
369  << ", channelType: " << SatEnums::GetChannelTypeName(m_channelType));
370 
371  std::vector<double> tempVector;
372  tempVector.push_back(Now().GetSeconds());
373 
374  // Output the Rx power density (W / Hz)
375  tempVector.push_back(rxParams->m_rxPower_W / carrierBandwidthHz);
376 
377  switch (m_channelType)
378  {
381  Singleton<SatRxPowerOutputTraceContainer>::Get()->AddToContainer(
382  std::make_pair(phyRx->GetDevice()->GetAddress(), m_channelType),
383  tempVector);
384  break;
385  }
388  Singleton<SatRxPowerOutputTraceContainer>::Get()->AddToContainer(
389  std::make_pair(GetSourceAddress(rxParams), m_channelType),
390  tempVector);
391  break;
392  }
393  default: {
394  NS_FATAL_ERROR("SatChannel::DoRxPowerOutputTrace - Invalid channel type");
395  break;
396  }
397  }
398 }
399 
400 void
401 SatChannel::DoRxPowerInputTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx)
402 {
403  NS_LOG_FUNCTION(this << rxParams << phyRx);
404 
405  // Get the bandwidth of the currently used carrier
406  double carrierBandwidthHz = m_carrierBandwidthConverter(m_channelType,
407  rxParams->m_carrierId,
409 
410  switch (m_channelType)
411  {
414  // Calculate the Rx power from Rx power density
415  rxParams->m_rxPower_W =
416  carrierBandwidthHz *
417  Singleton<SatRxPowerInputTraceContainer>::Get()->GetRxPowerDensity(
418  std::make_pair(phyRx->GetDevice()->GetAddress(), m_channelType));
419 
420  break;
421  }
424  // Calculate the Rx power from Rx power density
425  rxParams->m_rxPower_W =
426  carrierBandwidthHz * Singleton<SatRxPowerInputTraceContainer>::Get()->GetRxPowerDensity(
427  std::make_pair(GetSourceAddress(rxParams), m_channelType));
428  break;
429  }
430  default: {
431  NS_FATAL_ERROR("SatChannel::DoRxPowerInputTrace - Invalid channel type");
432  break;
433  }
434  }
435 
436  NS_LOG_INFO("Carrier bw: " << carrierBandwidthHz
437  << ", rxPower: " << SatUtils::LinearToDb(rxParams->m_rxPower_W)
438  << ", carrierId: " << rxParams->m_carrierId
439  << ", channelType: " << SatEnums::GetChannelTypeName(m_channelType));
440 
441  // get external fading input trace
443  {
444  rxParams->m_rxPower_W /= GetExternalFadingTrace(rxParams, phyRx);
445  }
446 }
447 
448 void
449 SatChannel::DoRxCnoInputTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx)
450 {
451  NS_LOG_FUNCTION(this << rxParams << phyRx);
452 
453  /* Get the required parameters
454  *
455  * We have C/N0 = B*P/N
456  * So P = N/B * C/N0
457  * Where:
458  * B is the carrier bandwidth
459  * N is the noise
460  * P is the required power to get the selected C/N0
461  */
462  double cno;
463  double carrierBandwidthHz = m_carrierBandwidthConverter(m_channelType,
464  rxParams->m_carrierId,
466  double rxTemperatureK = phyRx->GetRxTemperatureK(rxParams);
467  ;
468  double rxNoisePowerW =
469  SatConstVariables::BOLTZMANN_CONSTANT * rxTemperatureK * carrierBandwidthHz;
470 
471  switch (m_channelType)
472  {
475  // Calculate the Rx power from C/N0
476  cno = Singleton<SatRxCnoInputTraceContainer>::Get()->GetRxCno(
477  std::make_pair(phyRx->GetDevice()->GetAddress(), m_channelType));
478  if (cno == 0)
479  {
480  DoRxPowerCalculation(rxParams, phyRx);
481  NS_LOG_INFO("Use calculation downlink \t" << cno << " " << carrierBandwidthHz << " "
482  << rxNoisePowerW << " "
483  << rxParams->m_rxPower_W);
484  return;
485  }
486  rxParams->m_rxPower_W = rxNoisePowerW * cno / carrierBandwidthHz;
487  NS_LOG_INFO("Channel downlink \t" << cno << " " << carrierBandwidthHz << " "
488  << rxNoisePowerW << " "
489  << rxNoisePowerW * cno / carrierBandwidthHz);
490  break;
491  }
494  // Calculate the Rx power from C/N0
495  cno = Singleton<SatRxCnoInputTraceContainer>::Get()->GetRxCno(
496  std::make_pair(GetSourceAddress(rxParams), m_channelType));
497  if (cno == 0)
498  {
499  DoRxPowerCalculation(rxParams, phyRx);
500  NS_LOG_INFO("Use calculation uplink \t" << cno << " " << carrierBandwidthHz << " "
501  << rxNoisePowerW << " "
502  << rxParams->m_rxPower_W);
503  return;
504  }
505  rxParams->m_rxPower_W = rxNoisePowerW * cno / carrierBandwidthHz;
506  NS_LOG_INFO("Channel uplink \t" << cno << " " << carrierBandwidthHz << " "
507  << rxNoisePowerW << " "
508  << rxNoisePowerW * cno / carrierBandwidthHz);
509  break;
510  }
511  default: {
512  NS_FATAL_ERROR("SatChannel::DoRxCnoInputTrace - Invalid channel type");
513  break;
514  }
515  }
516 
517  NS_LOG_INFO("Target C/N0: " << cno << ", carrier bw: " << carrierBandwidthHz
518  << ", rxPower: " << SatUtils::LinearToDb(rxParams->m_rxPower_W)
519  << ", carrierId: " << rxParams->m_carrierId << ", channelType: "
521 
522  // get external fading input trace
524  {
525  rxParams->m_rxPower_W /= GetExternalFadingTrace(rxParams, phyRx);
526  }
527 }
528 
529 void
530 SatChannel::DoFadingOutputTrace(Ptr<SatSignalParameters> rxParams,
531  Ptr<SatPhyRx> phyRx,
532  double fadingValue)
533 {
534  NS_LOG_FUNCTION(this << rxParams << phyRx << fadingValue);
535 
536  std::vector<double> tempVector;
537  tempVector.push_back(Now().GetSeconds());
538  tempVector.push_back(fadingValue);
539 
540  switch (m_channelType)
541  {
544  Singleton<SatFadingOutputTraceContainer>::Get()->AddToContainer(
545  std::make_pair(phyRx->GetDevice()->GetAddress(), m_channelType),
546  tempVector);
547  break;
548  }
551  Singleton<SatFadingOutputTraceContainer>::Get()->AddToContainer(
552  std::make_pair(GetSourceAddress(rxParams), m_channelType),
553  tempVector);
554  break;
555  }
556  default: {
557  NS_FATAL_ERROR("SatChannel::DoFadingOutputTrace - Invalid channel type");
558  break;
559  }
560  }
561 }
562 
563 void
564 SatChannel::DoRxPowerCalculation(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx)
565 {
566  NS_LOG_FUNCTION(this << rxParams << phyRx);
567 
568  Ptr<MobilityModel> txMobility = rxParams->m_phyTx->GetMobility();
569  Ptr<MobilityModel> rxMobility = phyRx->GetMobility();
570 
571  double txAntennaGain_W = 0.0;
572  double rxAntennaGain_W = 0.0;
573  double markovFading = 0.0;
574  double extFading = 1.0;
575 
576  // use always UT's or GW's position when getting antenna gain
577  switch (m_channelType)
578  {
581  txAntennaGain_W = rxParams->m_phyTx->GetAntennaGain(rxMobility);
582  rxAntennaGain_W = phyRx->GetAntennaGain(rxMobility);
583  markovFading = phyRx->GetFadingValue(phyRx->GetDevice()->GetAddress(), m_channelType);
584  break;
585  }
588  txAntennaGain_W = rxParams->m_phyTx->GetAntennaGain(txMobility);
589  rxAntennaGain_W = phyRx->GetAntennaGain(txMobility);
590  markovFading = rxParams->m_phyTx->GetFadingValue(GetSourceAddress(rxParams), m_channelType);
591  break;
592  }
593  default: {
594  NS_FATAL_ERROR("SatChannel::DoRxPowerCalculation - Invalid channel type");
595  break;
596  }
597  }
598 
606  {
607  extFading = GetExternalFadingTrace(rxParams, phyRx);
608  }
609 
616  {
617  DoFadingOutputTrace(rxParams, phyRx, markovFading);
618  }
619 
620  // get (calculate) free space loss and RX power and set it to RX params
621  double rxPower_W = (rxParams->m_txPower_W * txAntennaGain_W) /
622  m_freeSpaceLoss->GetFsl(txMobility, rxMobility, rxParams->m_carrierFreq_hz);
623  rxParams->m_rxPower_W =
624  rxPower_W * rxAntennaGain_W / phyRx->GetLosses() * markovFading / extFading;
625 }
626 
627 double
628 SatChannel::GetExternalFadingTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx)
629 {
630  NS_LOG_FUNCTION(this << rxParams << phyRx);
631 
632  int32_t nodeId;
633  Ptr<MobilityModel> mobility;
634 
635  switch (m_channelType)
636  {
638  nodeId = Singleton<SatIdMapper>::Get()->GetGwIdWithMac(phyRx->GetDevice()->GetAddress());
639  mobility = phyRx->GetMobility();
640  break;
641  }
643  nodeId = Singleton<SatIdMapper>::Get()->GetUtIdWithMac(phyRx->GetDevice()->GetAddress());
644  mobility = phyRx->GetMobility();
645  break;
646  }
648  nodeId = Singleton<SatIdMapper>::Get()->GetUtIdWithMac(GetSourceAddress(rxParams));
649  mobility = rxParams->m_phyTx->GetMobility();
650  break;
651  }
653  nodeId = Singleton<SatIdMapper>::Get()->GetGwIdWithMac(GetSourceAddress(rxParams));
654  mobility = rxParams->m_phyTx->GetMobility();
655  break;
656  }
657  default: {
658  NS_FATAL_ERROR("SatChannel::GetExternalFadingTrace - Invalid channel type");
659  break;
660  }
661  }
662 
663  if (nodeId < 0)
664  {
665  NS_FATAL_ERROR("SatChannel::GetExternalFadingTrace - Invalid node ID");
666  }
667 
668  return (Singleton<SatFadingExternalInputTraceContainer>::Get()->GetFadingTrace((uint32_t)nodeId,
670  mobility))
671  ->GetFading();
672 }
673 
675 Mac48Address
676 SatChannel::GetSourceAddress(Ptr<SatSignalParameters> rxParams)
677 {
678  NS_LOG_FUNCTION(this << rxParams);
679 
680  SatMacTag tag;
681 
682  SatSignalParameters::PacketsInBurst_t::const_iterator i = rxParams->m_packetsInBurst.begin();
683 
684  if (*i == nullptr)
685  {
686  NS_FATAL_ERROR("SatChannel::GetSourceAddress - Empty packet list");
687  }
688 
689  (*i)->PeekPacketTag(tag);
690 
691  return tag.GetSourceAddress();
692 }
693 
694 void
696 {
697  NS_LOG_FUNCTION(this << chType);
698  NS_ASSERT(chType != SatEnums::UNKNOWN_CH);
699 
700  m_channelType = chType;
701 }
702 
703 void
705 {
706  NS_LOG_FUNCTION(this << freqId);
707 
708  m_freqId = freqId;
709 }
710 
711 void
713 {
714  NS_LOG_FUNCTION(this << &converter);
715 
716  m_carrierFreqConverter = converter;
717 }
718 
719 void
721 {
722  NS_LOG_FUNCTION(this << &converter);
723 
724  m_carrierBandwidthConverter = converter;
725 }
726 
729 {
730  NS_LOG_FUNCTION(this);
731  NS_ASSERT(m_channelType != SatEnums::UNKNOWN_CH);
732 
733  return m_channelType;
734 }
735 
736 void
737 SatChannel::SetPropagationDelayModel(Ptr<PropagationDelayModel> delay)
738 {
739  NS_LOG_FUNCTION(this << delay);
740  NS_ASSERT(m_propagationDelay == nullptr);
741  m_propagationDelay = delay;
742 }
743 
744 Ptr<PropagationDelayModel>
746 {
747  NS_LOG_FUNCTION(this);
748  NS_ASSERT(m_propagationDelay != nullptr);
749 
750  return m_propagationDelay;
751 }
752 
753 void
754 SatChannel::SetFreeSpaceLoss(Ptr<SatFreeSpaceLoss> loss)
755 {
756  NS_LOG_FUNCTION(this << loss);
757  NS_ASSERT(m_freeSpaceLoss == nullptr);
758  m_freeSpaceLoss = loss;
759 }
760 
761 Ptr<SatFreeSpaceLoss>
763 {
764  NS_LOG_FUNCTION(this);
765  NS_ASSERT(m_freeSpaceLoss != nullptr);
766  return m_freeSpaceLoss;
767 }
768 
769 std::size_t
771 {
772  NS_LOG_FUNCTION(this);
773  return m_phyRxContainer.size();
774 }
775 
776 Ptr<NetDevice>
777 SatChannel::GetDevice(std::size_t i) const
778 {
779  NS_LOG_FUNCTION(this << i);
780  return m_phyRxContainer.at(i)->GetDevice()->GetObject<NetDevice>();
781 }
782 
783 } // 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.