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 
52 NS_LOG_COMPONENT_DEFINE("SatPhyRxCarrier");
53 
54 namespace ns3
55 {
56 
57 NS_OBJECT_ENSURE_REGISTERED(SatPhyRxCarrier);
58 
60  Ptr<SatPhyRxCarrierConf> carrierConf,
61  Ptr<SatWaveformConf> waveformConf,
62  bool isRandomAccessEnabled)
63  : m_randomAccessEnabled(isRandomAccessEnabled),
64  m_state(IDLE),
65  m_satId(),
66  m_beamId(),
67  m_carrierId(carrierId),
68  m_receivingDedicatedAccess(false),
69  m_satInterference(),
70  m_satInterferenceElimination(),
71  m_enableCompositeSinrOutputTrace(false),
72  m_numOfOngoingRx(0),
73  m_rxPacketCounter(0),
74  m_waveformConf(waveformConf)
75 {
76  NS_LOG_FUNCTION(this << carrierId);
77 
78  m_rxBandwidthHz = carrierConf->GetCarrierBandwidthHz(carrierId, SatEnums::EFFECTIVE_BANDWIDTH);
79 
80  // Set channel type
81  SetChannelType(carrierConf->GetChannelType());
82 
83  // Set link regeneration mode
84  SetLinkRegenerationMode(carrierConf->GetLinkRegenerationMode());
85 
86  // Create proper interference object for carrier i
87  DoCreateInterferenceModel(carrierConf, carrierId, m_rxBandwidthHz);
88  DoCreateInterferenceEliminationModel(carrierConf, carrierId, waveformConf);
89 
90  m_rxExtNoisePowerW = carrierConf->GetExtPowerDensityWhz() * m_rxBandwidthHz;
91 
92  m_errorModel = carrierConf->GetErrorModel();
93 
95  {
96  NS_LOG_INFO(this << " link results in use in carrier: " << carrierId);
97  m_linkResults = carrierConf->GetLinkResults();
98  }
99 
100  m_rxTemperatureK = carrierConf->GetRxTemperatureK();
101 
102  // calculate RX noise
104 
105  // calculate RX ACI power
106  m_rxAciIfPowerW = m_rxNoisePowerW * carrierConf->GetRxAciInterferenceWrtNoiseFactor();
107 
108  m_additionalInterferenceCallback = carrierConf->GetAdditionalInterferenceCb();
109 
110  // Constant error rate for dedicated access.
111  m_constantErrorRate = carrierConf->GetConstantDaErrorRate();
112 
117  m_uniformVariable = CreateObject<UniformRandomVariable>();
118 
119  // Configured channel estimation error
120  m_channelEstimationError = carrierConf->GetChannelEstimatorErrorContainer();
121 
122  NS_LOG_INFO("Carrier ID: " << m_carrierId << ", channel type: "
124 }
125 
126 void
127 SatPhyRxCarrier::DoCreateInterferenceModel(Ptr<SatPhyRxCarrierConf> carrierConf,
128  uint32_t carrierId,
129  double rxBandwidthHz)
130 {
131  switch (carrierConf->GetInterferenceModel(m_randomAccessEnabled))
132  {
134  NS_LOG_INFO(this << " Constant interference model created for carrier: " << carrierId);
135  m_satInterference = CreateObject<SatConstantInterference>();
136  break;
137  }
139  NS_LOG_INFO(this << " Per packet interference model created for carrier: " << carrierId);
140  if (carrierConf->IsIntfOutputTraceEnabled())
141  {
143  CreateObject<SatPerPacketInterference>(GetChannelType(), rxBandwidthHz);
144  }
145  else
146  {
147  m_satInterference = CreateObject<SatPerPacketInterference>();
148  }
149  break;
150  }
152  NS_LOG_INFO(this << " Per fragment interference model created for carrier: " << carrierId);
153  if (carrierConf->IsIntfOutputTraceEnabled())
154  {
156  CreateObject<SatPerFragmentInterference>(GetChannelType(), rxBandwidthHz);
157  }
158  else
159  {
160  m_satInterference = CreateObject<SatPerFragmentInterference>();
161  }
162  break;
163  }
165  NS_LOG_INFO(this << " Traced interference model created for carrier: " << carrierId);
166  m_satInterference = CreateObject<SatTracedInterference>(GetChannelType(), rxBandwidthHz);
167  break;
168  }
169  default: {
170  NS_LOG_ERROR(this << " Not a valid interference model!");
171  break;
172  }
173  }
174 }
175 
176 void
177 SatPhyRxCarrier::DoCreateInterferenceEliminationModel(Ptr<SatPhyRxCarrierConf> carrierConf,
178  uint32_t carrierId,
179  Ptr<SatWaveformConf> waveformConf)
180 {
181  switch (carrierConf->GetInterferenceEliminationModel(m_randomAccessEnabled))
182  {
184  NS_LOG_INFO(this << " Perfect interference elimination model created for carrier: "
185  << carrierId);
186  m_satInterferenceElimination = CreateObject<SatPerfectInterferenceElimination>();
187  break;
188  }
190  NS_LOG_INFO(this << " Residual interference elimination model created for carrier: "
191  << carrierId);
193  CreateObject<SatResidualInterferenceElimination>(waveformConf);
194  break;
195  }
196  default: {
197  NS_LOG_ERROR(this << " Not a valid interference elimination model!");
198  break;
199  }
200  }
201 }
202 
204 {
205  NS_LOG_FUNCTION(this);
206 }
207 
208 void
210 {
211 }
212 
213 TypeId
215 {
216  static TypeId tid =
217  TypeId("ns3::SatPhyRxCarrier")
218  .SetParent<Object>()
219  .AddAttribute("EnableCompositeSinrOutputTrace",
220  "Enable composite SINR output trace.",
221  BooleanValue(false),
223  MakeBooleanChecker())
224  .AddTraceSource("LinkBudgetTrace",
225  "The trace for link budget related quantities",
226  MakeTraceSourceAccessor(&SatPhyRxCarrier::m_linkBudgetTrace),
227  "ns3::SatPhyRxCarrier::LinkBudgetTraceCallback")
228  .AddTraceSource("RxPowerTrace",
229  "The trace for received signal power in dBW",
230  MakeTraceSourceAccessor(&SatPhyRxCarrier::m_rxPowerTrace),
231  "ns3::SatPhyRxCarrier::RxPowerTraceCallback")
232  .AddTraceSource("Sinr",
233  "The trace for composite SINR in dB",
234  MakeTraceSourceAccessor(&SatPhyRxCarrier::m_sinrTrace),
235  "ns3::SatPhyRxCarrier::SinrTraceCallback")
236  .AddTraceSource("LinkSinr",
237  "The trace for link specific SINR in dB",
238  MakeTraceSourceAccessor(&SatPhyRxCarrier::m_linkSinrTrace),
239  "ns3::SatPhyRxCarrier::LinkSinrTraceCallback")
240  .AddTraceSource("DaRx",
241  "Received a packet burst through Dedicated Channel",
242  MakeTraceSourceAccessor(&SatPhyRxCarrier::m_daRxTrace),
243  "ns3::SatPhyRxCarrierPacketProbe::RxStatusCallback")
244  .AddTraceSource("DaRxCarrierId",
245  "Received a packet burst though DAMA",
246  MakeTraceSourceAccessor(&SatPhyRxCarrier::m_daRxCarrierIdTrace),
247  "ns3::SatTypedefs::DataSenderAddressCallback");
248  return tid;
249 }
250 
251 void
253 {
254  NS_LOG_FUNCTION(this);
255 
256  m_rxCallback.Nullify();
257  m_cnoCallback.Nullify();
260  m_satInterference = NULL;
262  m_uniformVariable = NULL;
263 
264  Object::DoDispose();
265 }
266 
267 std::ostream&
268 operator<<(std::ostream& os, SatPhyRxCarrier::State s)
269 {
270  switch (s)
271  {
273  os << "IDLE";
274  break;
275  case SatPhyRxCarrier::RX:
276  os << "RX";
277  break;
278  default:
279  os << "UNKNOWN";
280  break;
281  }
282  return os;
283 }
284 
285 void
287 {
288  NS_LOG_FUNCTION(this);
289  m_rxCallback = cb;
290 }
291 
292 void
294 {
295  NS_LOG_FUNCTION(this);
296  m_cnoCallback = cb;
297 }
298 
299 void
301 {
302  NS_LOG_FUNCTION(this << newState);
303  NS_LOG_INFO(this << " state: " << m_state << " -> " << newState);
304  m_state = newState;
305 }
306 
307 std::pair<bool, SatPhyRxCarrier::rxParams_s>
308 SatPhyRxCarrier::GetReceiveParams(Ptr<SatSignalParameters> rxParams)
309 {
311  params.rxParams = rxParams;
312  // Receive packet by default in satellite, discard in UT
313  bool receivePacket = GetDefaultReceiveMode();
314  bool ownAddressFound = false;
315 
316  // If satellite and regeneration_phy -> do not check MAC address, but store it for stat purposes
317  if ((rxParams->m_channelType == SatEnums::FORWARD_FEEDER_CH ||
318  rxParams->m_channelType == SatEnums::RETURN_USER_CH) &&
320  {
321  if (!rxParams->m_packetsInBurst.empty())
322  {
323  SatMacTag mTag;
324  rxParams->m_packetsInBurst[0]->PeekPacketTag(mTag);
325  SatAddressE2ETag addressE2ETag;
326  rxParams->m_packetsInBurst[0]->PeekPacketTag(addressE2ETag);
327 
328  params.destAddress = mTag.GetDestAddress();
329  params.sourceAddress = mTag.GetSourceAddress();
330  params.finalDestAddress = addressE2ETag.GetE2EDestAddress();
331  params.finalSourceAddress = addressE2ETag.GetE2ESourceAddress();
332  }
333  receivePacket = true;
334  }
335  else
336  {
337  for (SatSignalParameters::PacketsInBurst_t::const_iterator i =
338  rxParams->m_packetsInBurst.begin();
339  ((i != rxParams->m_packetsInBurst.end()) && (ownAddressFound == false));
340  i++)
341  {
342  SatMacTag mTag;
343  (*i)->PeekPacketTag(mTag);
344  SatAddressE2ETag addressE2ETag;
345  (*i)->PeekPacketTag(addressE2ETag);
346 
347  params.destAddress = mTag.GetDestAddress();
348  params.sourceAddress = mTag.GetSourceAddress();
349  params.finalDestAddress = addressE2ETag.GetE2EDestAddress();
350  params.finalSourceAddress = addressE2ETag.GetE2ESourceAddress();
351 
352  if ((params.destAddress == GetOwnAddress()))
353  {
354  NS_LOG_INFO("Packet intended for this specific receiver: " << params.destAddress);
355 
356  receivePacket = true;
357  ownAddressFound = true;
358  }
359  else if (params.destAddress.IsBroadcast())
360  {
361  NS_LOG_INFO("Destination is broadcast address: " << params.destAddress);
362  receivePacket = true;
363  }
364  else if (params.destAddress.IsGroup())
365  {
366  NS_LOG_INFO("Destination is multicast address: " << params.destAddress);
367  receivePacket = true;
368  }
369  }
370  }
371  return std::make_pair(receivePacket, params);
372 }
373 
374 bool
375 SatPhyRxCarrier::StartRx(Ptr<SatSignalParameters> rxParams)
376 {
377  NS_LOG_FUNCTION(this << rxParams);
378  NS_LOG_INFO("State: " << m_state);
379  NS_ASSERT(rxParams->m_carrierId == m_carrierId);
380 
381  uint32_t key;
382 
383  NS_LOG_INFO("Node: " << m_nodeInfo->GetMacAddress()
384  << " starts receiving packet at: " << Simulator::Now().GetSeconds()
385  << " in carrier: " << rxParams->m_carrierId);
386  NS_LOG_INFO("Sender: " << rxParams->m_phyTx);
387 
388  switch (m_state)
389  {
390  case IDLE:
391  case RX: {
392  auto receiveParamTuple = GetReceiveParams(rxParams);
393 
394  bool receivePacket = receiveParamTuple.first;
395  rxParams_s rxParamsStruct = receiveParamTuple.second;
396 
397  // add interference in any case
398  rxParamsStruct.interferenceEvent =
399  CreateInterference(rxParams, rxParamsStruct.sourceAddress);
400 
401  // Check whether the packet is sent to our beam.
402  // In case that RX mode is something else than transparent
403  // additionally check that whether the packet was intended for this specific receiver
404 
405  bool isGoodBeam = (rxParams->m_beamId == GetBeamId());
409  {
410  isGoodBeam = true;
411  }
412 
413  if (receivePacket && isGoodBeam)
414  {
416  rxParams->m_txInfo.packetType == SatEnums::PACKET_TYPE_DEDICATED_ACCESS)
417  {
418  NS_FATAL_ERROR("Starting reception of a packet when receiving DA transmission! "
419  "This may be due to a clock drift in UTs too important, or an "
420  "update period for SGP4 too important.");
421  }
422 
423  GetInterferenceModel()->NotifyRxStart(rxParamsStruct.interferenceEvent);
424 
425  key = m_rxPacketCounter;
427 
428  StoreRxParams(key, rxParamsStruct);
429 
430  NS_LOG_INFO(this << " scheduling EndRx with delay " << rxParams->m_duration.GetSeconds()
431  << "s");
432 
433  // Update link specific received signal power
436  {
437  m_rxPowerTrace(SatUtils::LinearToDb(rxParams->m_rxPower_W),
438  rxParamsStruct.finalDestAddress);
439  }
442  {
443  m_rxPowerTrace(SatUtils::LinearToDb(rxParams->m_rxPower_W),
444  rxParamsStruct.finalSourceAddress);
445  }
446  else
447  {
448  NS_FATAL_ERROR("Incorrect channel for satPhyRxCarrierUplink: "
450  }
451 
452  Simulator::Schedule(rxParams->m_duration, &SatPhyRxCarrier::EndRxData, this, key);
453 
454  IncreaseNumOfRxState(rxParams->m_txInfo.packetType);
455 
456  return true;
457  }
458  break;
459  }
460  default: {
461  NS_FATAL_ERROR("SatPhyRxCarrier::StartRx - Unknown state");
462  break;
463  }
464  }
465 
466  return false;
467 }
468 
469 void
471 {
472  NS_LOG_FUNCTION(this);
473 
474  std::vector<double> tempVector;
475  tempVector.push_back(Now().GetSeconds());
476  tempVector.push_back(cSinr);
477 
478  Singleton<SatCompositeSinrOutputTraceContainer>::Get()->AddToContainer(
479  std::make_pair(GetOwnAddress(), GetChannelType()),
480  tempVector);
481 }
482 
483 bool
484 SatPhyRxCarrier::CheckAgainstLinkResults(double cSinr, Ptr<SatSignalParameters> rxParams)
485 {
486  NS_LOG_FUNCTION(this);
487 
489  bool error = false;
490 
491  switch (m_errorModel)
492  {
494  error = CheckAgainstLinkResultsErrorModelAvi(cSinr, rxParams);
495  break;
496  }
498  double r = GetUniformRandomValue(0, 1);
499  if (r < m_constantErrorRate)
500  {
501  error = true;
502  }
503  break;
504  }
507  break;
508  }
509  default: {
510  NS_FATAL_ERROR("SatPhyRxCarrier::EndRxData - Error model not defined");
511  break;
512  }
513  }
514  return error;
515 }
516 
517 bool
519  Ptr<SatSignalParameters> rxParams)
520 {
521  bool error = false;
522 
523  switch (GetChannelType())
524  {
543  double ber = (GetLinkResults()->GetObject<SatLinkResultsFwd>())
544  ->GetBler(rxParams->m_txInfo.modCod,
545  rxParams->m_txInfo.frameType,
546  SatUtils::LinearToDb(cSinr));
547  double r = GetUniformRandomValue(0, 1);
548 
549  if (r < ber)
550  {
551  error = true;
552  }
553 
554  NS_LOG_INFO("FORWARD cSinr (dB): " << SatUtils::LinearToDb(cSinr) << " esNo (dB): "
555  << SatUtils::LinearToDb(cSinr) << " rand: " << r
556  << " ber: " << ber << " error: " << error);
557  break;
558  }
559 
578  double ebNo = cSinr / (SatUtils::GetCodingRate(rxParams->m_txInfo.modCod) *
579  SatUtils::GetModulatedBits(rxParams->m_txInfo.modCod));
580 
581  double ber;
585  {
586  ber = (GetLinkResults()->GetObject<SatLinkResultsFwd>())
587  ->GetBler(rxParams->m_txInfo.modCod,
588  rxParams->m_txInfo.frameType,
589  SatUtils::LinearToDb(cSinr));
590  }
591  else
592  {
593  ber = (GetLinkResults()->GetObject<SatLinkResultsRtn>())
594  ->GetBler(rxParams->m_txInfo.waveformId, SatUtils::LinearToDb(ebNo));
595  }
596  double r = GetUniformRandomValue(0, 1);
597 
598  if (r < ber)
599  {
600  error = true;
601  }
602 
603  NS_LOG_INFO("RETURN cSinr (dB): "
604  << SatUtils::LinearToDb(cSinr) << " ebNo (dB): " << SatUtils::LinearToDb(ebNo)
605  << " modulated bits: " << SatUtils::GetModulatedBits(rxParams->m_txInfo.modCod)
606  << " rand: " << r << " ber: " << ber << " error: " << error);
607  break;
608  }
610  default: {
611  NS_FATAL_ERROR(
612  "SatPhyRxCarrier::CheckAgainstLinkResultsErrorModelAvi - Invalid channel type!");
613  break;
614  }
615  }
616  return error;
617 }
618 
619 void
620 SatPhyRxCarrier::SetNodeInfo(const Ptr<SatNodeInfo> nodeInfo)
621 {
622  NS_LOG_FUNCTION(this << nodeInfo);
623 
624  m_ownAddress = nodeInfo->GetMacAddress();
625  m_nodeInfo = nodeInfo;
626 }
627 
628 double
630  double ifPowerW,
631  double rxNoisePowerW,
632  double rxAciIfPowerW,
633  double rxExtNoisePowerW,
634  double additionalInterference)
635 {
636  NS_LOG_FUNCTION(this << rxPowerW << ifPowerW);
637 
638  if (rxNoisePowerW <= 0.0)
639  {
640  NS_FATAL_ERROR("Noise power must be greater than zero!!! Current value is "
641  << rxNoisePowerW);
642  }
643 
644  // Calculate first SINR based on co-channel interference, Adjacent channel interference, noise
645  // and external noise NOTE! ACI noise power and Ext noise power are set 0 by default and given
646  // as attributes by PHY object when used.
647  double sinr = rxPowerW / (ifPowerW + rxNoisePowerW + rxAciIfPowerW + rxExtNoisePowerW);
648 
649  // Call PHY calculator to composite C over I interference configured to PHY.
650  double finalSinr = (1 / (1 / sinr + 1 / additionalInterference));
651 
652  return finalSinr;
653 }
654 
655 double
656 SatPhyRxCarrier::CalculateSinr(double sinr, double otherInterference)
657 {
658  NS_LOG_FUNCTION(this << sinr << otherInterference);
659 
660  if (sinr <= 0)
661  {
662  NS_FATAL_ERROR("Calculated own SINR is expected to be greater than zero!!!");
663  }
664 
665  if (otherInterference <= 0)
666  {
667  NS_FATAL_ERROR("Interference is expected to be greater than zero!!!");
668  }
669 
670  double finalSinr = 1 / ((1 / sinr) + (1 / otherInterference));
671 
672  return finalSinr;
673 }
674 
675 double
676 SatPhyRxCarrier::CalculateCompositeSinr(double sinr1, double sinr2)
677 {
678  NS_LOG_FUNCTION(this << sinr1 << sinr2);
679 
680  if (sinr1 <= 0.0)
681  {
682  NS_FATAL_ERROR("SINR 1 must be greater than zero!!!");
683  }
684 
685  if (sinr2 <= 0.0)
686  {
687  NS_FATAL_ERROR("SINR 2 must be greater than zero!!!");
688  }
689 
690  return 1.0 / ((1.0 / sinr1) + (1.0 / sinr2));
691 }
692 
693 double
694 SatPhyRxCarrier::GetWorstSinr(double sinr1, double sinr2)
695 {
696  NS_LOG_FUNCTION(this << sinr1 << sinr2);
697 
698  if (sinr1 <= 0.0)
699  {
700  NS_FATAL_ERROR("SINR 1 must be greater than zero!!! Current value is " << sinr1);
701  }
702 
703  if (sinr2 <= 0.0)
704  {
705  NS_FATAL_ERROR("SINR 2 must be greater than zero!!! Current value is " << sinr2);
706  }
707 
708  return std::min(sinr1, sinr2);
709 }
710 
711 void
713 {
714  NS_LOG_FUNCTION(this);
715 
717  ChangeState(RX);
718 
719  if (packetType == SatEnums::PACKET_TYPE_DEDICATED_ACCESS)
720  {
722  }
723 
725 }
726 
727 void
729 {
730  NS_LOG_FUNCTION(this);
731 
732  if (m_numOfOngoingRx > 0)
733  {
735  }
736 
737  if (m_numOfOngoingRx < 1)
738  {
739  ChangeState(IDLE);
740  }
741 
742  if (packetType == SatEnums::PACKET_TYPE_DEDICATED_ACCESS)
743  {
745  }
746 
748 }
749 
750 void
752 {
753  NS_LOG_FUNCTION(this);
754 
755  if (m_numOfOngoingRx > 0 && m_state == IDLE)
756  {
757  NS_FATAL_ERROR("SatPhyRxCarrier::CheckStateSanity - State mismatch");
758  }
759 
760  if (m_numOfOngoingRx < 1 && m_state == RX)
761  {
762  NS_FATAL_ERROR("SatPhyRxCarrier::CheckStateSanity - State mismatch");
763  }
764 }
765 
766 void
769 {
770  NS_LOG_FUNCTION(this << &callback);
771 
773 }
774 
775 } // 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