satellite-phy-rx-carrier.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Magister Solutions Ltd.
4  * Copyright (c) 2018 CNES
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Jani Puttonen <jani.puttonen@magister.fi>
20  * Author: Mathias Ettinger <mettinger@toulouse.viveris.fr>
21  */
22 
24 
25 #include "../stats/satellite-phy-rx-carrier-packet-probe.h"
30 #include "satellite-mac-tag.h"
34 #include "satellite-phy.h"
39 #include "satellite-utils.h"
40 
41 #include <ns3/address.h>
42 #include <ns3/boolean.h>
43 #include <ns3/log.h>
44 #include <ns3/simulator.h>
45 #include <ns3/singleton.h>
46 
47 #include <algorithm>
48 #include <limits>
49 #include <ostream>
50 #include <utility>
51 #include <vector>
52 
53 NS_LOG_COMPONENT_DEFINE("SatPhyRxCarrier");
54 
55 namespace ns3
56 {
57 
58 NS_OBJECT_ENSURE_REGISTERED(SatPhyRxCarrier);
59 
61  Ptr<SatPhyRxCarrierConf> carrierConf,
62  Ptr<SatWaveformConf> waveformConf,
63  bool isRandomAccessEnabled)
64  : m_randomAccessEnabled(isRandomAccessEnabled),
65  m_state(IDLE),
66  m_satId(),
67  m_beamId(),
68  m_carrierId(carrierId),
69  m_receivingDedicatedAccess(false),
70  m_satInterference(),
71  m_satInterferenceElimination(),
72  m_enableCompositeSinrOutputTrace(false),
73  m_numOfOngoingRx(0),
74  m_rxPacketCounter(0),
75  m_waveformConf(waveformConf)
76 {
77  NS_LOG_FUNCTION(this << carrierId);
78 
79  m_rxBandwidthHz = carrierConf->GetCarrierBandwidthHz(carrierId, SatEnums::EFFECTIVE_BANDWIDTH);
80 
81  // Set channel type
82  SetChannelType(carrierConf->GetChannelType());
83 
84  // Set link regeneration mode
85  SetLinkRegenerationMode(carrierConf->GetLinkRegenerationMode());
86 
87  // Create proper interference object for carrier i
88  DoCreateInterferenceModel(carrierConf, carrierId, m_rxBandwidthHz);
89  DoCreateInterferenceEliminationModel(carrierConf, carrierId, waveformConf);
90 
91  m_rxExtNoisePowerW = carrierConf->GetExtPowerDensityWhz() * m_rxBandwidthHz;
92 
93  m_errorModel = carrierConf->GetErrorModel();
94 
96  {
97  NS_LOG_INFO(this << " link results in use in carrier: " << carrierId);
98  m_linkResults = carrierConf->GetLinkResults();
99  }
100 
101  m_rxTemperatureK = carrierConf->GetRxTemperatureK();
102 
103  // calculate RX noise
105 
106  // calculate RX ACI power
107  m_rxAciIfPowerW = m_rxNoisePowerW * carrierConf->GetRxAciInterferenceWrtNoiseFactor();
108 
109  m_additionalInterferenceCallback = carrierConf->GetAdditionalInterferenceCb();
110 
111  // Constant error rate for dedicated access.
112  m_constantErrorRate = carrierConf->GetConstantDaErrorRate();
113 
118  m_uniformVariable = CreateObject<UniformRandomVariable>();
119 
120  // Configured channel estimation error
121  m_channelEstimationError = carrierConf->GetChannelEstimatorErrorContainer();
122 
123  NS_LOG_INFO("Carrier ID: " << m_carrierId << ", channel type: "
125 }
126 
127 void
128 SatPhyRxCarrier::DoCreateInterferenceModel(Ptr<SatPhyRxCarrierConf> carrierConf,
129  uint32_t carrierId,
130  double rxBandwidthHz)
131 {
132  switch (carrierConf->GetInterferenceModel(m_randomAccessEnabled))
133  {
135  NS_LOG_INFO(this << " Constant interference model created for carrier: " << carrierId);
136  m_satInterference = CreateObject<SatConstantInterference>();
137  break;
138  }
140  NS_LOG_INFO(this << " Per packet interference model created for carrier: " << carrierId);
141  if (carrierConf->IsIntfOutputTraceEnabled())
142  {
144  CreateObject<SatPerPacketInterference>(GetChannelType(), rxBandwidthHz);
145  }
146  else
147  {
148  m_satInterference = CreateObject<SatPerPacketInterference>();
149  }
150  break;
151  }
153  NS_LOG_INFO(this << " Per fragment interference model created for carrier: " << carrierId);
154  if (carrierConf->IsIntfOutputTraceEnabled())
155  {
157  CreateObject<SatPerFragmentInterference>(GetChannelType(), rxBandwidthHz);
158  }
159  else
160  {
161  m_satInterference = CreateObject<SatPerFragmentInterference>();
162  }
163  break;
164  }
166  NS_LOG_INFO(this << " Traced interference model created for carrier: " << carrierId);
167  m_satInterference = CreateObject<SatTracedInterference>(GetChannelType(), rxBandwidthHz);
168  break;
169  }
170  default: {
171  NS_LOG_ERROR(this << " Not a valid interference model!");
172  break;
173  }
174  }
175 }
176 
177 void
178 SatPhyRxCarrier::DoCreateInterferenceEliminationModel(Ptr<SatPhyRxCarrierConf> carrierConf,
179  uint32_t carrierId,
180  Ptr<SatWaveformConf> waveformConf)
181 {
182  switch (carrierConf->GetInterferenceEliminationModel(m_randomAccessEnabled))
183  {
185  NS_LOG_INFO(this << " Perfect interference elimination model created for carrier: "
186  << carrierId);
187  m_satInterferenceElimination = CreateObject<SatPerfectInterferenceElimination>();
188  break;
189  }
191  NS_LOG_INFO(this << " Residual interference elimination model created for carrier: "
192  << carrierId);
194  CreateObject<SatResidualInterferenceElimination>(waveformConf);
195  break;
196  }
197  default: {
198  NS_LOG_ERROR(this << " Not a valid interference elimination model!");
199  break;
200  }
201  }
202 }
203 
205 {
206  NS_LOG_FUNCTION(this);
207 }
208 
209 void
211 {
212 }
213 
214 TypeId
216 {
217  static TypeId tid =
218  TypeId("ns3::SatPhyRxCarrier")
219  .SetParent<Object>()
220  .AddAttribute("EnableCompositeSinrOutputTrace",
221  "Enable composite SINR output trace.",
222  BooleanValue(false),
224  MakeBooleanChecker())
225  .AddTraceSource("LinkBudgetTrace",
226  "The trace for link budget related quantities",
227  MakeTraceSourceAccessor(&SatPhyRxCarrier::m_linkBudgetTrace),
228  "ns3::SatPhyRxCarrier::LinkBudgetTraceCallback")
229  .AddTraceSource("RxPowerTrace",
230  "The trace for received signal power in dBW",
231  MakeTraceSourceAccessor(&SatPhyRxCarrier::m_rxPowerTrace),
232  "ns3::SatPhyRxCarrier::RxPowerTraceCallback")
233  .AddTraceSource("Sinr",
234  "The trace for composite SINR in dB",
235  MakeTraceSourceAccessor(&SatPhyRxCarrier::m_sinrTrace),
236  "ns3::SatPhyRxCarrier::SinrTraceCallback")
237  .AddTraceSource("LinkSinr",
238  "The trace for link specific SINR in dB",
239  MakeTraceSourceAccessor(&SatPhyRxCarrier::m_linkSinrTrace),
240  "ns3::SatPhyRxCarrier::LinkSinrTraceCallback")
241  .AddTraceSource("DaRx",
242  "Received a packet burst through Dedicated Channel",
243  MakeTraceSourceAccessor(&SatPhyRxCarrier::m_daRxTrace),
244  "ns3::SatPhyRxCarrierPacketProbe::RxStatusCallback")
245  .AddTraceSource("DaRxCarrierId",
246  "Received a packet burst though DAMA",
247  MakeTraceSourceAccessor(&SatPhyRxCarrier::m_daRxCarrierIdTrace),
248  "ns3::SatTypedefs::DataSenderAddressCallback");
249  return tid;
250 }
251 
252 void
254 {
255  NS_LOG_FUNCTION(this);
256 
257  m_rxCallback.Nullify();
258  m_cnoCallback.Nullify();
261  m_satInterference = nullptr;
263  m_uniformVariable = nullptr;
264 
265  Object::DoDispose();
266 }
267 
268 std::ostream&
269 operator<<(std::ostream& os, SatPhyRxCarrier::State s)
270 {
271  switch (s)
272  {
274  os << "IDLE";
275  break;
276  case SatPhyRxCarrier::RX:
277  os << "RX";
278  break;
279  default:
280  os << "UNKNOWN";
281  break;
282  }
283  return os;
284 }
285 
286 void
288 {
289  NS_LOG_FUNCTION(this);
290  m_rxCallback = cb;
291 }
292 
293 void
295 {
296  NS_LOG_FUNCTION(this);
297  m_cnoCallback = cb;
298 }
299 
300 void
302 {
303  NS_LOG_FUNCTION(this << newState);
304  NS_LOG_INFO(this << " state: " << m_state << " -> " << newState);
305  m_state = newState;
306 }
307 
308 std::pair<bool, SatPhyRxCarrier::rxParams_s>
309 SatPhyRxCarrier::GetReceiveParams(Ptr<SatSignalParameters> rxParams)
310 {
312  params.rxParams = rxParams;
313  // Receive packet by default in satellite, discard in UT
314  bool receivePacket = GetDefaultReceiveMode();
315  bool ownAddressFound = false;
316 
317  // If satellite and regeneration_phy -> do not check MAC address, but store it for stat purposes
318  if ((rxParams->m_channelType == SatEnums::FORWARD_FEEDER_CH ||
319  rxParams->m_channelType == SatEnums::RETURN_USER_CH) &&
321  {
322  if (!rxParams->m_packetsInBurst.empty())
323  {
324  SatMacTag mTag;
325  rxParams->m_packetsInBurst[0]->PeekPacketTag(mTag);
326  SatAddressE2ETag addressE2ETag;
327  rxParams->m_packetsInBurst[0]->PeekPacketTag(addressE2ETag);
328 
329  params.destAddress = mTag.GetDestAddress();
330  params.sourceAddress = mTag.GetSourceAddress();
331  params.finalDestAddress = addressE2ETag.GetE2EDestAddress();
332  params.finalSourceAddress = addressE2ETag.GetE2ESourceAddress();
333  }
334  receivePacket = true;
335  }
336  else
337  {
338  for (SatSignalParameters::PacketsInBurst_t::const_iterator i =
339  rxParams->m_packetsInBurst.begin();
340  ((i != rxParams->m_packetsInBurst.end()) && (ownAddressFound == false));
341  i++)
342  {
343  SatMacTag mTag;
344  (*i)->PeekPacketTag(mTag);
345  SatAddressE2ETag addressE2ETag;
346  (*i)->PeekPacketTag(addressE2ETag);
347 
348  params.destAddress = mTag.GetDestAddress();
349  params.sourceAddress = mTag.GetSourceAddress();
350  params.finalDestAddress = addressE2ETag.GetE2EDestAddress();
351  params.finalSourceAddress = addressE2ETag.GetE2ESourceAddress();
352 
353  if ((params.destAddress == GetOwnAddress()))
354  {
355  NS_LOG_INFO("Packet intended for this specific receiver: " << params.destAddress);
356 
357  receivePacket = true;
358  ownAddressFound = true;
359  }
360  else if (params.destAddress.IsBroadcast())
361  {
362  NS_LOG_INFO("Destination is broadcast address: " << params.destAddress);
363  receivePacket = true;
364  }
365  else if (params.destAddress.IsGroup())
366  {
367  NS_LOG_INFO("Destination is multicast address: " << params.destAddress);
368  receivePacket = true;
369  }
370  }
371  }
372  return std::make_pair(receivePacket, params);
373 }
374 
375 bool
376 SatPhyRxCarrier::StartRx(Ptr<SatSignalParameters> rxParams)
377 {
378  NS_LOG_FUNCTION(this << rxParams);
379  NS_LOG_INFO("State: " << m_state);
380  NS_ASSERT(rxParams->m_carrierId == m_carrierId);
381 
382  uint32_t key;
383 
384  NS_LOG_INFO("Node: " << m_nodeInfo->GetMacAddress()
385  << " starts receiving packet at: " << Simulator::Now().GetSeconds()
386  << " in carrier: " << rxParams->m_carrierId);
387  NS_LOG_INFO("Sender: " << rxParams->m_phyTx);
388 
389  switch (m_state)
390  {
391  case IDLE:
392  case RX: {
393  std::pair<bool, SatPhyRxCarrier::rxParams_s> receiveParamTuple = GetReceiveParams(rxParams);
394 
395  bool receivePacket = receiveParamTuple.first;
396  rxParams_s rxParamsStruct = receiveParamTuple.second;
397 
398  // add interference in any case
399  rxParamsStruct.interferenceEvent =
400  CreateInterference(rxParams, rxParamsStruct.sourceAddress);
401 
402  // Check whether the packet is sent to our beam.
403  // In case that RX mode is something else than transparent
404  // additionally check that whether the packet was intended for this specific receiver
405 
406  bool isGoodBeam = (rxParams->m_beamId == GetBeamId());
410  {
411  isGoodBeam = true;
412  }
413 
414  if (receivePacket && isGoodBeam)
415  {
417  rxParams->m_txInfo.packetType == SatEnums::PACKET_TYPE_DEDICATED_ACCESS)
418  {
419  NS_LOG_WARN("Starting reception of a packet when receiving DA transmission! "
420  "This may be due to a clock drift in UTs too important, or an "
421  "update period for SGP4 too important.");
422  return false;
423  }
424 
425  GetInterferenceModel()->NotifyRxStart(rxParamsStruct.interferenceEvent);
426 
427  key = m_rxPacketCounter;
429 
430  StoreRxParams(key, rxParamsStruct);
431 
432  NS_LOG_INFO(this << " scheduling EndRx with delay " << rxParams->m_duration.GetSeconds()
433  << "s");
434 
435  // Update link specific received signal power
438  {
439  m_rxPowerTrace(SatUtils::LinearToDb(rxParams->m_rxPower_W),
440  rxParamsStruct.finalDestAddress);
441  }
444  {
445  m_rxPowerTrace(SatUtils::LinearToDb(rxParams->m_rxPower_W),
446  rxParamsStruct.finalSourceAddress);
447  }
448  else
449  {
450  NS_FATAL_ERROR("Incorrect channel for satPhyRxCarrierUplink: "
452  }
453 
454  Simulator::Schedule(rxParams->m_duration, &SatPhyRxCarrier::EndRxData, this, key);
455 
456  IncreaseNumOfRxState(rxParams->m_txInfo.packetType);
457 
458  return true;
459  }
460  break;
461  }
462  default: {
463  NS_FATAL_ERROR("SatPhyRxCarrier::StartRx - Unknown state");
464  break;
465  }
466  }
467 
468  return false;
469 }
470 
471 void
473 {
474  NS_LOG_FUNCTION(this);
475 
476  std::vector<double> tempVector;
477  tempVector.push_back(Now().GetSeconds());
478  tempVector.push_back(cSinr);
479 
480  Singleton<SatCompositeSinrOutputTraceContainer>::Get()->AddToContainer(
481  std::make_pair(GetOwnAddress(), GetChannelType()),
482  tempVector);
483 }
484 
485 bool
486 SatPhyRxCarrier::CheckAgainstLinkResults(double cSinr, Ptr<SatSignalParameters> rxParams)
487 {
488  NS_LOG_FUNCTION(this);
489 
491  bool error = false;
492 
493  switch (m_errorModel)
494  {
496  error = CheckAgainstLinkResultsErrorModelAvi(cSinr, rxParams);
497  break;
498  }
500  double r = GetUniformRandomValue(0, 1);
501  if (r < m_constantErrorRate)
502  {
503  error = true;
504  }
505  break;
506  }
509  break;
510  }
511  default: {
512  NS_FATAL_ERROR("SatPhyRxCarrier::EndRxData - Error model not defined");
513  break;
514  }
515  }
516  return error;
517 }
518 
519 bool
521  Ptr<SatSignalParameters> rxParams)
522 {
523  bool error = false;
524 
525  switch (GetChannelType())
526  {
545  double ber = (GetLinkResults()->GetObject<SatLinkResultsFwd>())
546  ->GetBler(rxParams->m_txInfo.modCod,
547  rxParams->m_txInfo.frameType,
548  SatUtils::LinearToDb(cSinr));
549  double r = GetUniformRandomValue(0, 1);
550 
551  if (r < ber)
552  {
553  error = true;
554  }
555 
556  NS_LOG_INFO("FORWARD cSinr (dB): " << SatUtils::LinearToDb(cSinr) << " esNo (dB): "
557  << SatUtils::LinearToDb(cSinr) << " rand: " << r
558  << " ber: " << ber << " error: " << error);
559  break;
560  }
561 
580  double ebNo = cSinr / (SatUtils::GetCodingRate(rxParams->m_txInfo.modCod) *
581  SatUtils::GetModulatedBits(rxParams->m_txInfo.modCod));
582 
583  double ber;
587  {
588  ber = (GetLinkResults()->GetObject<SatLinkResultsFwd>())
589  ->GetBler(rxParams->m_txInfo.modCod,
590  rxParams->m_txInfo.frameType,
591  SatUtils::LinearToDb(cSinr));
592  }
593  else
594  {
595  ber = (GetLinkResults()->GetObject<SatLinkResultsRtn>())
596  ->GetBler(rxParams->m_txInfo.waveformId, SatUtils::LinearToDb(ebNo));
597  }
598  double r = GetUniformRandomValue(0, 1);
599 
600  if (r < ber)
601  {
602  error = true;
603  }
604 
605  NS_LOG_INFO("RETURN cSinr (dB): "
606  << SatUtils::LinearToDb(cSinr) << " ebNo (dB): " << SatUtils::LinearToDb(ebNo)
607  << " modulated bits: " << SatUtils::GetModulatedBits(rxParams->m_txInfo.modCod)
608  << " rand: " << r << " ber: " << ber << " error: " << error);
609  break;
610  }
612  default: {
613  NS_FATAL_ERROR(
614  "SatPhyRxCarrier::CheckAgainstLinkResultsErrorModelAvi - Invalid channel type!");
615  break;
616  }
617  }
618  return error;
619 }
620 
621 void
622 SatPhyRxCarrier::SetNodeInfo(const Ptr<SatNodeInfo> nodeInfo)
623 {
624  NS_LOG_FUNCTION(this << nodeInfo);
625 
626  m_ownAddress = nodeInfo->GetMacAddress();
627  m_nodeInfo = nodeInfo;
628 }
629 
630 double
632  double ifPowerW,
633  double rxNoisePowerW,
634  double rxAciIfPowerW,
635  double rxExtNoisePowerW,
636  double additionalInterference)
637 {
638  NS_LOG_FUNCTION(this << rxPowerW << ifPowerW);
639 
640  if (rxNoisePowerW <= 0.0)
641  {
642  NS_FATAL_ERROR("Noise power must be greater than zero!!! Current value is "
643  << rxNoisePowerW);
644  }
645 
646  // Calculate first SINR based on co-channel interference, Adjacent channel interference, noise
647  // and external noise NOTE! ACI noise power and Ext noise power are set 0 by default and given
648  // as attributes by PHY object when used.
649  double sinr = rxPowerW / (ifPowerW + rxNoisePowerW + rxAciIfPowerW + rxExtNoisePowerW);
650 
651  // Call PHY calculator to composite C over I interference configured to PHY.
652  double finalSinr = (1 / (1 / sinr + 1 / additionalInterference));
653 
654  return finalSinr;
655 }
656 
657 double
658 SatPhyRxCarrier::CalculateSinr(double sinr, double otherInterference)
659 {
660  NS_LOG_FUNCTION(this << sinr << otherInterference);
661 
662  if (sinr <= 0)
663  {
664  NS_FATAL_ERROR("Calculated own SINR is expected to be greater than zero!!!");
665  }
666 
667  if (otherInterference <= 0)
668  {
669  NS_FATAL_ERROR("Interference is expected to be greater than zero!!!");
670  }
671 
672  double finalSinr = 1 / ((1 / sinr) + (1 / otherInterference));
673 
674  return finalSinr;
675 }
676 
677 double
678 SatPhyRxCarrier::CalculateCompositeSinr(double sinr1, double sinr2)
679 {
680  NS_LOG_FUNCTION(this << sinr1 << sinr2);
681 
682  if (sinr1 <= 0.0)
683  {
684  NS_FATAL_ERROR("SINR 1 must be greater than zero!!!");
685  }
686 
687  if (sinr2 <= 0.0)
688  {
689  NS_FATAL_ERROR("SINR 2 must be greater than zero!!!");
690  }
691 
692  return 1.0 / ((1.0 / sinr1) + (1.0 / sinr2));
693 }
694 
695 double
696 SatPhyRxCarrier::GetWorstSinr(double sinr1, double sinr2)
697 {
698  NS_LOG_FUNCTION(this << sinr1 << sinr2);
699 
700  if (sinr1 <= 0.0)
701  {
702  NS_FATAL_ERROR("SINR 1 must be greater than zero!!! Current value is " << sinr1);
703  }
704 
705  if (sinr2 <= 0.0)
706  {
707  NS_FATAL_ERROR("SINR 2 must be greater than zero!!! Current value is " << sinr2);
708  }
709 
710  return std::min(sinr1, sinr2);
711 }
712 
713 void
715 {
716  NS_LOG_FUNCTION(this);
717 
719  ChangeState(RX);
720 
721  if (packetType == SatEnums::PACKET_TYPE_DEDICATED_ACCESS)
722  {
724  }
725 
727 }
728 
729 void
731 {
732  NS_LOG_FUNCTION(this);
733 
734  if (m_numOfOngoingRx > 0)
735  {
737  }
738 
739  if (m_numOfOngoingRx < 1)
740  {
741  ChangeState(IDLE);
742  }
743 
744  if (packetType == SatEnums::PACKET_TYPE_DEDICATED_ACCESS)
745  {
747  }
748 
750 }
751 
752 void
754 {
755  NS_LOG_FUNCTION(this);
756 
757  if (m_numOfOngoingRx > 0 && m_state == IDLE)
758  {
759  NS_FATAL_ERROR("SatPhyRxCarrier::CheckStateSanity - State mismatch");
760  }
761 
762  if (m_numOfOngoingRx < 1 && m_state == RX)
763  {
764  NS_FATAL_ERROR("SatPhyRxCarrier::CheckStateSanity - State mismatch");
765  }
766 }
767 
768 void
771 {
772  NS_LOG_FUNCTION(this << &callback);
773 
775 }
776 
777 } // namespace ns3
This class implements a tag that carries the satellite MAC of GW and UT.
Mac48Address GetE2ESourceAddress(void) const
Get E2E source MAC address.
Mac48Address GetE2EDestAddress(void) const
Get E2E destination MAC address.
static std::string GetChannelTypeName(ChannelType_t channelType)
PacketType_t
Packet types.
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.
SatPhy::AverageNormalizedOfferedLoadCallback m_avgNormalizedOfferedLoadCallback
Average normalized offered load callback.
void SetNodeInfo(const Ptr< SatNodeInfo > nodeInfo)
Function for setting the node info class.
Ptr< SatInterference > GetInterferenceModel()
Get pointer to the current interference model.
void DoCompositeSinrOutputTrace(double cSinr)
Function for composite SINR output tracing.
double m_rxExtNoisePowerW
External noise power system RX noise.
void SetLinkRegenerationMode(SatEnums::RegenerationMode_t linkRegenerationMode)
Set the link regeneration mode.
void CheckRxStateSanity()
Function for checking the Rx state sanity.
void SetCnoCb(SatPhyRx::CnoCallback cb)
Function for settign the C/NO callback.
TracedCallback< double, const Address & > m_linkSinrTrace
A callback for link specific SINR in dB.
Ptr< SatInterferenceElimination > m_satInterferenceElimination
static TypeId GetTypeId(void)
Function for gettign the NS-3 type ID.
TracedCallback< uint32_t, const Address & > m_daRxCarrierIdTrace
TracedCallback< Ptr< SatSignalParameters >, Mac48Address, Mac48Address, double, double > m_linkBudgetTrace
The trace source on packet receptiong.
void SetAverageNormalizedOfferedLoadCallback(SatPhyRx::AverageNormalizedOfferedLoadCallback callback)
Function for setting the AverageNormalizedOfferedLoadCallback callback.
SatPhyRxCarrierConf::AdditionalInterferenceCallback m_additionalInterferenceCallback
Callback to get additional interference.
TracedCallback< double, const Address & > m_rxPowerTrace
A callback for received signal power in dBW.
void DecreaseNumOfRxState(SatEnums::PacketType_t packetType)
Function for decreasing the number of ongoing transmissions.
virtual Ptr< SatInterference::InterferenceChangeEvent > CreateInterference(Ptr< SatSignalParameters > rxParams, Address rxAddress)=0
Create an interference event based on Rx parameters and address.
Ptr< SatLinkResults > m_linkResults
virtual SatEnums::ChannelType_t GetChannelType()
Get the channel type.
uint32_t GetBeamId()
Get ID the ID of the beam this carrier is attached to.
virtual void DoCreateInterferenceEliminationModel(Ptr< SatPhyRxCarrierConf > carrierConf, uint32_t carrierId, Ptr< SatWaveformConf > waveformConf)
Create an interference cancelation model for this carrier.
double CalculateSinr(double rxPowerW, double ifPowerW, double rxNoisePowerW, double rxAciIfPowerW, double rxExtNoisePowerW, double otherInterference)
Function for calculating the SINR.
SatPhyRx::ReceiveCallback m_rxCallback
The upper layer package receive callback.
TracedCallback< uint32_t, const Address &, bool > m_daRxTrace
DaRx trace source.
double m_rxAciIfPowerW
RX Adjacent channel interference.
virtual bool StartRx(Ptr< SatSignalParameters > rxParams)
Function for starting packet reception from the SatChannel.
TracedCallback< double, const Address & > m_sinrTrace
A callback for transmission composite SINR at UT (BBFrame) or GW (time slot).
Ptr< SatChannelEstimationErrorContainer > m_channelEstimationError
Channel estimation error container.
bool IsReceivingDedicatedAccess()
Check if the carrier is receiving a dedicated access packet.
void SetReceiveCb(SatPhyRx::ReceiveCallback cb)
Function for setting the receive callback.
bool CheckAgainstLinkResults(double cSinr, Ptr< SatSignalParameters > rxParams)
Function for checking the SINR against the link results.
SatPhy::CnoCallback m_cnoCallback
The upper layer C/N0 receive callback.
bool CheckAgainstLinkResultsErrorModelAvi(double cSinr, Ptr< SatSignalParameters > rxParams)
Function for checking the SINR against the link results.
virtual void DoCreateInterferenceModel(Ptr< SatPhyRxCarrierConf > carrierConf, uint32_t carrierId, double rxBandwidthHz)
Create an interference model for this carrier.
double CalculateCompositeSinr(double sinr1, double sinr2)
Function for calculating the composite SINR.
double GetWorstSinr(double sinr1, double sinr2)
Function for calculating the worst sinr between uplink and downlink.
SatPhyRxCarrierConf::ErrorModel m_errorModel
uint32_t m_numOfOngoingRx
Contains information about how many ongoing Rx events there are.
const bool m_randomAccessEnabled
Is random access enabled for this carrier.
virtual void BeginEndScheduling()
Function for initializing the frame/window end scheduling.
virtual void DoDispose()
Dispose.
double GetUniformRandomValue(double min, double max)
A helper method for getting values form a uniform random variable in child classes.
void ChangeState(State newState)
Function for changing the receiver state.
SatPhyRxCarrier(uint32_t carrierId, Ptr< SatPhyRxCarrierConf > carrierConf, Ptr< SatWaveformConf > waveformConf, bool isRandomAccessEnabled)
Constructor.
void SetChannelType(SatEnums::ChannelType_t channelType)
Set the channel type for the carrier.
Ptr< UniformRandomVariable > m_uniformVariable
Ptr< SatInterference > m_satInterference
SatEnums::RegenerationMode_t m_linkRegenerationMode
Link regeneration mode.
virtual const bool GetDefaultReceiveMode()
Get the default receive mode for the carrier.
std::pair< bool, SatPhyRxCarrier::rxParams_s > GetReceiveParams(Ptr< SatSignalParameters > rxParams)
Rx parameter storage methods.
Ptr< SatLinkResults > GetLinkResults()
Get pointer to the link results given by the carrier creation configuration.
virtual void EndRxData(uint32_t key)=0
Function for ending the packet reception from the SatChannel.
void IncreaseNumOfRxState(SatEnums::PacketType_t packetType)
Function for increasing the number of ongoing transmissions.
uint32_t m_rxPacketCounter
Running counter for received packets.
virtual ~SatPhyRxCarrier()
Destructor.
double m_rxBandwidthHz
RX Bandwidth in Hz.
void StoreRxParams(uint32_t key, rxParams_s rxParams)
Store rxParams under a key.
Mac48Address GetOwnAddress()
Get the MAC address of the carrier.
double m_rxTemperatureK
RX noise temperature in K.
Callback< void, uint32_t, uint32_t, Address, Address, double, bool > CnoCallback
Callback< void, Ptr< SatSignalParameters >, bool > ReceiveCallback
Callback< void, uint32_t, uint32_t, uint32_t, uint8_t, double > AverageNormalizedOfferedLoadCallback
static T LinearToDb(T linear)
Converts linear to decibels.
static uint32_t GetModulatedBits(SatEnums::SatModcod_t modcod)
Get the modulated bits of a certain MODCOD.
static double GetCodingRate(SatEnums::SatModcod_t modcod)
Gets the coding rate of a certain MODCOD.
constexpr double BOLTZMANN_CONSTANT
Boltzmann Constant.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
std::ostream & operator<<(std::ostream &os, const GeoCoordinate &coordinate)
Struct for storing the packet specific Rx parameters.
Ptr< SatInterference::InterferenceChangeEvent > interferenceEvent