38 #include <ns3/antenna-model.h>
40 #include <ns3/object-factory.h>
41 #include <ns3/object-vector.h>
45 NS_LOG_COMPONENT_DEFINE(
"SatPhyRx");
50 NS_OBJECT_ENSURE_REGISTERED(SatPhyRx);
56 m_defaultFadingValue()
58 NS_LOG_FUNCTION(
this);
63 NS_LOG_FUNCTION(
this);
69 NS_LOG_FUNCTION(
this);
80 static TypeId tid = TypeId(
"ns3::SatPhyRx")
82 .AddAttribute(
"RxCarrierList",
83 "The list of RX carriers associated to this Phy RX.",
86 MakeObjectVectorChecker<SatPhyRxCarrier>());
93 NS_LOG_FUNCTION(
this);
102 NS_LOG_FUNCTION(
this << d);
111 NS_LOG_FUNCTION(
this << gain_Db);
119 NS_LOG_FUNCTION(
this);
127 Ptr<SatMobilityModel> m = DynamicCast<SatMobilityModel>(mobility);
142 NS_LOG_FUNCTION(
this << fadingValue);
149 NS_LOG_FUNCTION(
this << macAddress << channelType);
164 NS_LOG_FUNCTION(
this);
173 NS_LOG_FUNCTION(
this << gain_Db);
181 NS_LOG_FUNCTION(
this);
189 NS_LOG_FUNCTION(
this);
197 NS_LOG_FUNCTION(
this << nodeInfo->GetNodeId());
201 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
205 (*it)->SetNodeInfo(nodeInfo);
212 NS_LOG_FUNCTION(
this);
214 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
218 (*it)->BeginEndScheduling();
225 NS_LOG_FUNCTION(
this);
228 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
232 (*it)->SetReceiveCb(cb);
239 NS_LOG_FUNCTION(
this << &cb);
242 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
253 NS_LOG_FUNCTION(
this << &cb);
256 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
260 (*it)->SetAverageNormalizedOfferedLoadCallback(cb);
267 NS_LOG_FUNCTION(
this);
276 NS_LOG_FUNCTION(
this << m);
283 NS_LOG_FUNCTION(
this << agp);
292 Ptr<SatSuperframeConf> superFrameConf)
294 NS_LOG_FUNCTION(
this);
297 Ptr<SatPhyRxCarrier> rxc(
nullptr);
298 bool isRandomAccessCarrier(
false);
303 for (uint32_t i = 0; i < carrierConf->GetCarrierCount(); ++i)
305 NS_LOG_INFO(
this <<
" Create carrier: " << i);
306 Ptr<SatWaveformConf> waveformConf =
307 superFrameConf->GetCarrierFrameConf(i)->GetWaveformConf();
311 switch (carrierConf->GetChannelType())
315 rxc = CreateObject<SatPhyRxCarrierUplink>(i, carrierConf, waveformConf,
false);
320 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
false);
324 isRandomAccessCarrier = superFrameConf->IsRandomAccessCarrier(i);
327 rxc = CreateObject<SatPhyRxCarrierUplink>(i,
330 isRandomAccessCarrier);
334 isRandomAccessCarrier = superFrameConf->IsRandomAccessCarrier(i);
337 if (!isRandomAccessCarrier)
339 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
false);
344 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
true);
345 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
346 superFrameConf->GetRaChannel(i));
355 rxc = CreateObject<SatPhyRxCarrierPerFrame>(i, carrierConf, waveformConf,
true);
356 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
357 superFrameConf->GetRaChannel(i));
361 rxc = CreateObject<SatPhyRxCarrierMarsala>(i, carrierConf, waveformConf,
true);
362 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
363 superFrameConf->GetRaChannel(i));
368 CreateObject<SatPhyRxCarrierPerWindow>(i, carrierConf, waveformConf,
true);
369 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
370 superFrameConf->GetRaChannel(i));
376 NS_FATAL_ERROR(
"SatPhyRx::ConfigurePhyRxCarriers - Invalid channel type!");
384 switch (carrierConf->GetChannelType())
388 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
false);
393 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
false);
397 isRandomAccessCarrier = superFrameConf->IsRandomAccessCarrier(i);
400 if (!isRandomAccessCarrier)
402 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
false);
407 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
true);
408 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
409 superFrameConf->GetRaChannel(i));
418 rxc = CreateObject<SatPhyRxCarrierPerFrame>(i, carrierConf, waveformConf,
true);
419 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
420 superFrameConf->GetRaChannel(i));
424 rxc = CreateObject<SatPhyRxCarrierMarsala>(i, carrierConf, waveformConf,
true);
425 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
426 superFrameConf->GetRaChannel(i));
431 CreateObject<SatPhyRxCarrierPerWindow>(i, carrierConf, waveformConf,
true);
432 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
433 superFrameConf->GetRaChannel(i));
438 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
false);
443 NS_FATAL_ERROR(
"SatPhyRx::ConfigurePhyRxCarriers - Invalid channel type!");
449 NS_FATAL_ERROR(
"SatPhyRx::ConfigurePhyRxCarriers - Unknown RX mode!");
452 NS_LOG_INFO(
this <<
" added carrier " << rxc <<
" on channel "
453 << carrierConf->GetChannelType() <<
" being random access "
454 << superFrameConf->IsRandomAccessCarrier(i));
462 NS_LOG_FUNCTION(
this << satId);
463 NS_ASSERT(satId >= 0);
468 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
472 (*it)->SetSatId(satId);
479 NS_LOG_FUNCTION(
this);
487 NS_LOG_FUNCTION(
this << beamId);
488 NS_ASSERT(beamId >= 0);
493 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
497 (*it)->SetBeamId(beamId);
504 NS_LOG_FUNCTION(
this);
512 NS_LOG_FUNCTION(
this << rxParams);
514 uint32_t cId = rxParams->m_carrierId;
518 NS_FATAL_ERROR(
"SatPhyRx::GetRxTemperatureK - unvalid carrier id: " << cId);
527 NS_LOG_FUNCTION(
this << rxParams);
529 uint32_t cId = rxParams->m_carrierId;
533 NS_FATAL_ERROR(
"SatPhyRx::StartRx - unvalid carrier id: " << cId);
ChannelType_t
Types of channel.
RandomAccessModel_t
The defined random access models.
@ RA_MODEL_RCS2_SPECIFICATION
RegenerationMode_t
The regeneration mode used in satellites.
void ConfigurePhyRxCarriers(Ptr< SatPhyRxCarrierConf > carrierConf, Ptr< SatSuperframeConf > superFrameConf)
uint32_t GetSatId() const
Get satellite id of this receiver.
Ptr< SatAntennaGainPattern > m_antennaGainPattern
virtual void DoDispose()
Dispose of this class instance.
SatPhyRx()
Default constructor.
void SetFadingContainer(Ptr< SatBaseFading > fadingContainer)
Set fading container.
void SetAntennaLoss_Db(double loss_Db)
Set the Antenna loss in Db.
void SetAntennaGainPattern(Ptr< SatAntennaGainPattern > agp, Ptr< SatMobilityModel > mobility)
void SetMaxAntennaGain_Db(double gain_Db)
Set the maximum Antenna gain in Db.
void SetDevice(Ptr< NetDevice > d)
Callback< void, uint32_t, uint32_t, Address, Address, double, bool > CnoCallback
virtual ~SatPhyRx()
Destructor for SatPhyRx.
double GetFadingValue(Address macAddress, SatEnums::ChannelType_t channelType)
Get fading value.
double GetRxTemperatureK(Ptr< SatSignalParameters > rxParams)
Method for querying the temperature of the chosen carrier.
void BeginEndScheduling()
Begin frame/window end scheduling for processes utilizing frame length as interval.
double m_maxAntennaGain
Configured maximum antenna gain in linear.
void SetSatId(uint32_t satId)
Set the satellite id for all the transmissions from this SatPhyTx.
void SetMobility(Ptr< MobilityModel > m)
Mac48Address m_macAddress
Mac48Address GetAddress() const
Get MAC address of this PHY/MAC.
void SetAverageNormalizedOfferedLoadCallback(SatPhyRx::AverageNormalizedOfferedLoadCallback cb)
Set average normalized offered load callback.
void SetCnoCallback(SatPhyRx::CnoCallback cb)
Set C/N0 receiver.
std::vector< Ptr< SatPhyRxCarrier > > m_rxCarriers
void SetDefaultFadingValue(double fadingValue)
Function for setting the default fading value.
double GetAntennaGain(Ptr< MobilityModel > mobility)
Get antenna gain based on position or in case that antenna pattern is not configured,...
Ptr< NetDevice > m_device
double m_defaultFadingValue
Default fading value.
Ptr< MobilityModel > m_mobility
Callback< void, Ptr< SatSignalParameters >, bool > ReceiveCallback
void SetReceiveCallback(SatPhyRx::ReceiveCallback cb)
Set the upper layer receive callback.
virtual void StartRx(Ptr< SatSignalParameters > rxParams)
Start packet reception from the SatChannel.
double GetLosses()
Get configures RX losses, currently only antenna loss used.
Ptr< MobilityModel > GetMobility()
void SetBeamId(uint32_t beamId)
Set the beam id for all the transmissions from this SatPhyTx.
Ptr< SatBaseFading > m_fadingContainer
Fading container for fading model.
void SetNodeInfo(const Ptr< SatNodeInfo > nodeInfo)
Set the node info class.
double m_antennaLoss
Configured antenna loss in linear.
Callback< void, uint32_t, uint32_t, uint32_t, uint8_t, double > AverageNormalizedOfferedLoadCallback
Ptr< SatMobilityModel > m_satMobility
uint32_t GetBeamId() const
Get beam id of this receiver.
Ptr< NetDevice > GetDevice()
static TypeId GetTypeId(void)
inherited from Object
static T DbWToW(T dbw)
Converts Decibel Watts to Watts.
static T DbToLinear(T db)
Converts decibels to linear.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.