38 #include <ns3/antenna-model.h>
40 #include <ns3/object-factory.h>
41 #include <ns3/object-vector.h>
43 NS_LOG_COMPONENT_DEFINE(
"SatPhyRx");
48 NS_OBJECT_ENSURE_REGISTERED(SatPhyRx);
54 m_defaultFadingValue()
56 NS_LOG_FUNCTION(
this);
61 NS_LOG_FUNCTION(
this);
67 NS_LOG_FUNCTION(
this);
78 static TypeId tid = TypeId(
"ns3::SatPhyRx")
80 .AddAttribute(
"RxCarrierList",
81 "The list of RX carriers associated to this Phy RX.",
84 MakeObjectVectorChecker<SatPhyRxCarrier>());
91 NS_LOG_FUNCTION(
this);
100 NS_LOG_FUNCTION(
this << d);
109 NS_LOG_FUNCTION(
this << gain_Db);
117 NS_LOG_FUNCTION(
this);
125 Ptr<SatMobilityModel> m = DynamicCast<SatMobilityModel>(mobility);
140 NS_LOG_FUNCTION(
this << fadingValue);
147 NS_LOG_FUNCTION(
this << macAddress << channelType);
162 NS_LOG_FUNCTION(
this);
171 NS_LOG_FUNCTION(
this << gain_Db);
179 NS_LOG_FUNCTION(
this);
187 NS_LOG_FUNCTION(
this);
195 NS_LOG_FUNCTION(
this << nodeInfo->GetNodeId());
199 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
203 (*it)->SetNodeInfo(nodeInfo);
210 NS_LOG_FUNCTION(
this);
212 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
216 (*it)->BeginEndScheduling();
223 NS_LOG_FUNCTION(
this);
226 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
230 (*it)->SetReceiveCb(cb);
237 NS_LOG_FUNCTION(
this << &cb);
240 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
251 NS_LOG_FUNCTION(
this << &cb);
254 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
258 (*it)->SetAverageNormalizedOfferedLoadCallback(cb);
265 NS_LOG_FUNCTION(
this);
274 NS_LOG_FUNCTION(
this << m);
281 NS_LOG_FUNCTION(
this << agp);
290 Ptr<SatSuperframeConf> superFrameConf)
292 NS_LOG_FUNCTION(
this);
295 Ptr<SatPhyRxCarrier> rxc(
nullptr);
296 bool isRandomAccessCarrier(
false);
301 for (uint32_t i = 0; i < carrierConf->GetCarrierCount(); ++i)
303 NS_LOG_INFO(
this <<
" Create carrier: " << i);
304 Ptr<SatWaveformConf> waveformConf =
305 superFrameConf->GetCarrierFrameConf(i)->GetWaveformConf();
309 switch (carrierConf->GetChannelType())
313 rxc = CreateObject<SatPhyRxCarrierUplink>(i, carrierConf, waveformConf,
false);
318 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
false);
322 isRandomAccessCarrier = superFrameConf->IsRandomAccessCarrier(i);
325 rxc = CreateObject<SatPhyRxCarrierUplink>(i,
328 isRandomAccessCarrier);
332 isRandomAccessCarrier = superFrameConf->IsRandomAccessCarrier(i);
335 if (!isRandomAccessCarrier)
337 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
false);
342 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
true);
343 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
344 superFrameConf->GetRaChannel(i));
353 rxc = CreateObject<SatPhyRxCarrierPerFrame>(i, carrierConf, waveformConf,
true);
354 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
355 superFrameConf->GetRaChannel(i));
359 rxc = CreateObject<SatPhyRxCarrierMarsala>(i, carrierConf, waveformConf,
true);
360 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
361 superFrameConf->GetRaChannel(i));
366 CreateObject<SatPhyRxCarrierPerWindow>(i, carrierConf, waveformConf,
true);
367 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
368 superFrameConf->GetRaChannel(i));
374 NS_FATAL_ERROR(
"SatPhyRx::ConfigurePhyRxCarriers - Invalid channel type!");
382 switch (carrierConf->GetChannelType())
386 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
false);
391 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
false);
395 isRandomAccessCarrier = superFrameConf->IsRandomAccessCarrier(i);
398 if (!isRandomAccessCarrier)
400 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
false);
405 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
true);
406 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
407 superFrameConf->GetRaChannel(i));
416 rxc = CreateObject<SatPhyRxCarrierPerFrame>(i, carrierConf, waveformConf,
true);
417 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
418 superFrameConf->GetRaChannel(i));
422 rxc = CreateObject<SatPhyRxCarrierMarsala>(i, carrierConf, waveformConf,
true);
423 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
424 superFrameConf->GetRaChannel(i));
429 CreateObject<SatPhyRxCarrierPerWindow>(i, carrierConf, waveformConf,
true);
430 DynamicCast<SatPhyRxCarrierPerSlot>(rxc)->SetRandomAccessAllocationChannelId(
431 superFrameConf->GetRaChannel(i));
436 rxc = CreateObject<SatPhyRxCarrierPerSlot>(i, carrierConf, waveformConf,
false);
441 NS_FATAL_ERROR(
"SatPhyRx::ConfigurePhyRxCarriers - Invalid channel type!");
447 NS_FATAL_ERROR(
"SatPhyRx::ConfigurePhyRxCarriers - Unknown RX mode!");
450 NS_LOG_INFO(
this <<
" added carrier " << rxc <<
" on channel "
451 << carrierConf->GetChannelType() <<
" being random access "
452 << superFrameConf->IsRandomAccessCarrier(i));
460 NS_LOG_FUNCTION(
this << satId);
461 NS_ASSERT(satId >= 0);
466 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
470 (*it)->SetSatId(satId);
477 NS_LOG_FUNCTION(
this);
485 NS_LOG_FUNCTION(
this << beamId);
486 NS_ASSERT(beamId >= 0);
491 for (std::vector<Ptr<SatPhyRxCarrier>>::iterator it =
m_rxCarriers.begin();
495 (*it)->SetBeamId(beamId);
502 NS_LOG_FUNCTION(
this);
510 NS_LOG_FUNCTION(
this << rxParams);
512 uint32_t cId = rxParams->m_carrierId;
516 NS_FATAL_ERROR(
"SatPhyRx::GetRxTemperatureK - unvalid carrier id: " << cId);
525 NS_LOG_FUNCTION(
this << rxParams);
527 uint32_t cId = rxParams->m_carrierId;
531 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.