36#include "ns3/double.h"
39#include "ns3/pointer.h"
40#include "ns3/simulator.h"
41#include "ns3/singleton.h"
42#include "ns3/uinteger.h"
48NS_LOG_COMPONENT_DEFINE(
"SatOrbiterFeederPhy");
59 TypeId(
"ns3::SatOrbiterFeederPhy")
61 .AddConstructor<SatOrbiterFeederPhy>()
62 .AddAttribute(
"PhyRx",
63 "The PhyRx layer attached to this phy.",
66 MakePointerChecker<SatPhyRx>())
67 .AddAttribute(
"PhyTx",
68 "The PhyTx layer attached to this phy.",
71 MakePointerChecker<SatPhyTx>())
72 .AddAttribute(
"RxTemperatureDbk",
73 "RX noise temperature in orbiter Feeder in dBK.",
77 MakeDoubleChecker<double>())
80 "Maximum RX gain in dB",
83 MakeDoubleChecker<double_t>())
86 "Maximum TX gain in dB",
89 MakeDoubleChecker<double_t>())
90 .AddAttribute(
"TxMaxPowerDbw",
91 "Maximum TX power in dB",
94 MakeDoubleChecker<double>())
97 "TX Output loss in dB",
100 MakeDoubleChecker<double>())
103 "TX Pointing loss in dB",
106 MakeDoubleChecker<double>())
107 .AddAttribute(
"TxOboLossDb",
111 MakeDoubleChecker<double>())
114 "TX Antenna loss in dB",
117 MakeDoubleChecker<double>())
120 "RX Antenna loss in dB",
123 MakeDoubleChecker<double>())
124 .AddAttribute(
"DefaultFadingValue",
125 "Default value for fading",
128 MakeDoubleChecker<double_t>())
129 .AddAttribute(
"ExtNoisePowerDensityDbwhz",
130 "Other system interference, C over I in dB.",
133 MakeDoubleChecker<double>())
134 .AddAttribute(
"ImIfCOverIDb",
135 "Adjacent channel interference, C over I in dB.",
138 MakeDoubleChecker<double>())
139 .AddAttribute(
"FixedAmplificationGainDb",
140 "Fixed amplification gain used in RTN link at the satellite.",
143 MakeDoubleChecker<double>())
144 .AddAttribute(
"QueueSize",
145 "Maximum size of FIFO m_queue in bytes.",
146 UintegerValue(100000),
148 MakeUintegerChecker<uint32_t>())
149 .AddTraceSource(
"QueueSizeBytes",
150 "Send number of bytes in FIFO return feeder queue",
152 "ns3::SatStatsRtnFeederQueueHelper::QueueSizeCallback")
153 .AddTraceSource(
"QueueSizePackets",
154 "Send number of packets in FIFO return feeder queue",
156 "ns3::SatStatsRtnFeederQueueHelper::QueueSizeCallback");
168 NS_LOG_FUNCTION(
this);
169 NS_FATAL_ERROR(
"SatOrbiterFeederPhy default constructor is not allowed to use");
173 Ptr<SatLinkResults> linkResults,
174 SatPhyRxCarrierConf::RxCarrierCreateParams_s parameters,
175 Ptr<SatSuperframeConf> superFrameConf)
181 NS_LOG_FUNCTION(
this << linkResults << superFrameConf);
191 m_queue = std::queue<std::tuple<Ptr<SatSignalParameters>, uint32_t, uint32_t>>();
207 NS_LOG_FUNCTION(
this);
230 Ptr<SatPhyRxCarrierConf> carrierConf = CreateObject<SatPhyRxCarrierConf>(
m_parameters);
237 carrierConf->SetAdditionalInterferenceCb(
245 NS_LOG_FUNCTION(
this);
251 NS_LOG_FUNCTION(
this);
258 NS_LOG_FUNCTION(
this);
259 Object::DoInitialize();
265 NS_LOG_FUNCTION(
this << txParams);
266 NS_LOG_INFO(
this <<
" sending a packet with carrierId: " << txParams->m_carrierId
267 <<
" duration: " << txParams->m_duration);
290 txParams->m_txPower_W =
305 uint32_t nbBytes = 0;
306 for (Ptr<Packet> pkt : txParams->m_packetsInBurst)
308 nbBytes += pkt->GetSize();
310 uint32_t nbPackets = txParams->m_packetsInBurst.size();
314 m_queue.push(std::make_tuple(txParams, nbBytes, nbPackets));
331 NS_LOG_INFO(
"Packet dropped because REGENERATION_PHY queue is full");
356 NS_FATAL_ERROR(
"Trying to deque an empty queue");
359 std::tuple<Ptr<SatSignalParameters>, uint32_t, uint32_t> element =
m_queue.front();
362 Ptr<SatSignalParameters> txParams = std::get<0>(element);
397 NS_LOG_FUNCTION(
this);
401 SatSignalParameters::PacketsInBurst_t::iterator it1;
402 for (it1 = packets.begin(); it1 != packets.end(); ++it1)
407 if ((*it1)->PeekPacketTag(addressE2ETag))
409 NS_LOG_DEBUG(
this <<
" contains a SatMac tag");
416 if ((*it1)->RemovePacketTag(linkTimeTag))
418 NS_LOG_DEBUG(
this <<
" contains a SatPhyLinkTimeTag tag");
437 NS_LOG_FUNCTION(
this << rxParams);
454 NS_LOG_INFO(
this <<
" dropped " << rxParams->m_packetsInBurst.size()
455 <<
" packets because of PHY error.");
467 SatSignalParameters::PacketsInBurst_t::iterator it;
468 for (it = rxParams->m_packetsInBurst.begin(); it != rxParams->m_packetsInBurst.end();
472 (*it)->RemovePacketTag(satUplinkInfoTag);
473 satUplinkInfoTag.
SetSatId(rxParams->m_satId);
474 satUplinkInfoTag.
SetBeamId(rxParams->m_beamId);
475 (*it)->AddPacketTag(satUplinkInfoTag);
478 RxTraces(rxParams->m_packetsInBurst);
485 NS_FATAL_ERROR(
"Unknown regeneration mode");
495 NS_LOG_FUNCTION(
this);
515 SatSignalParameters::PacketsInBurst_t::iterator it1;
516 for (it1 = packets.begin(); it1 != packets.end(); ++it1)
519 ByteTagIterator it2 = (*it1)->GetByteTagIterator();
521 while (it2.HasNext())
523 ByteTagIterator::Item item = it2.Next();
528 item.GetTag(addrTag);
533 return Mac48Address();
This class implements a tag that carries the satellite MAC of GW and UT.
Mac48Address GetE2EDestAddress(void) const
Get E2E destination MAC address.
This class implements a tag that carries the MAC address of the sender of the packet.
static TypeId GetTypeId()
Inherited from ObjectBase base class.
Address GetSourceAddress() const
Get the source address.
SatLinkDir_t
Link direction used for packet tracing.
SatPacketEvent_t
Packet event used for packet tracing.
@ PACKET_TYPE_DEDICATED_ACCESS
The SatOrbiterFeederPhy models the feeder link physical layer of the satellite node.
virtual void DoInitialize(void)
Initialization of SatPhy.
virtual double GetAdditionalInterference()
Get additional interference, used to compute final SINR at RX.
std::queue< std::tuple< Ptr< SatSignalParameters >, uint32_t, uint32_t > > m_queue
Simple FIFO queue to avoid collisions on TX in case of REGENERATION_PHY.
virtual ~SatOrbiterFeederPhy()
Destructor for SatOrbiterFeederPhy.
virtual void RxTraces(SatPhy::PacketContainer_t packets)
Invoke the Rx trace source for each received packet.
Ptr< SatLinkResults > m_linkResults
Link results used for this physical layer.
virtual SatEnums::SatLinkDir_t GetSatLinkTxDir()
Get the link TX direction.
double m_extNoisePowerDensityDbwHz
Configured external noise power.
static TypeId GetTypeId(void)
inherited from Object
double m_fixedAmplificationGainDb
Fixed amplification gain used in RTN link at the satellite.
virtual SatEnums::SatLinkDir_t GetSatLinkRxDir()
Get the link RX direction.
double m_imInterferenceCOverI
Intermodulation interference in linear.
Ptr< SatSuperframeConf > m_superFrameConf
Super frame cofiguration.
TracedCallback< uint32_t, const Address & > m_queueSizeBytesTrace
Traced callback to monitor RTN feeder queue size in bytes.
TracedCallback< uint32_t, const Address & > m_queueSizePacketsTrace
Traced callback to monitor RTN feeder queue size in packets.
Address GetE2ESourceAddress(SatPhy::PacketContainer_t packets)
Get source address of packets.
bool m_isSending
Indicates if a packet is already being sent.
void SendFromQueue()
Send a packet from the queue.
virtual void Receive(Ptr< SatSignalParameters > rxParams, bool phyError)
Receives packets from lower layer.
uint32_t m_queueSizeBytes
Size of FIFO queue in bytes.
virtual void SendPduWithParams(Ptr< SatSignalParameters > rxParams)
Send Pdu to the PHY tx module (for satellite switch packet forwarding).
SatEnums::RegenerationMode_t m_forwardLinkRegenerationMode
Regeneration mode on forward link.
SatPhyRxCarrierConf::RxCarrierCreateParams_s m_parameters
RX carrier configuration parameters.
double m_imInterferenceCOverIDb
Configured Intermodulation interference in dB.
uint32_t m_queueSizePackets
Size of FIFO queue in packets.
uint32_t m_queueSizeMax
Maximum size of FIFO m_queue in bytes.
virtual void DoDispose(void)
Dispose of this class instance.
SatEnums::RegenerationMode_t m_returnLinkRegenerationMode
Regeneration mode on return link.
SatOrbiterFeederPhy(void)
Default constructor.
void EndTx()
Notify a packet has finished being sent.
virtual void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
void SetTxPointingLossDb(double lossDb)
Set the pointing loss of the transmitter in dB.
TracedCallback< Time, SatEnums::SatPacketEvent_t, SatEnums::SatNodeType_t, uint32_t, Mac48Address, SatEnums::SatLogLevel_t, SatEnums::SatLinkDir_t, std::string > m_packetTrace
Trace callback used for packet tracing:
void SetTimeTag(SatPhy::PacketContainer_t packets)
Set SatPhyTimeTag of packets.
void SetRxAntennaGainDb(double gainDb)
Set the maximum antenna gain of the receiver in dB.
void ConfigureRxCarriers(Ptr< SatPhyRxCarrierConf > carrierConf, Ptr< SatSuperframeConf > superFrameConf)
Configure Rx carriers.
virtual Ptr< SatPhyTx > GetPhyTx() const
Get the SatPhyTx pointer.
void SetTxOboLossDb(double lossDb)
Set the OBO loss of the transmitter in dB.
TracedCallback< const Time &, const Address & > m_rxLinkDelayTrace
Traced callback for all received packets, including link delay information and the address of the sen...
void SetDefaultFading(double fading)
Set the default fading of the PHY.
double GetTxOutputLossDb() const
Get the output loss of the transmitter in dB.
double GetTxAntennaGainDb() const
Get the maximum antenna gain of the transmitter in dB.
virtual Ptr< SatPhyRx > GetPhyRx() const
Get the SatPhyRx pointer.
void SetTxOutputLossDb(double lossDb)
Set the output loss of the transmitter in dB.
double GetTxPointingLossDb() const
Get the pointing loss of the transmitter in dB.
Ptr< SatNodeInfo > m_nodeInfo
Node info containing node related information, such as node type, node id and MAC address (of the Sat...
double GetDefaultFading() const
Get the default fading of the PHY.
double GetTxMaxPowerDbw() const
Get the maximum transmit power of the transmitter in dB.
virtual void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
double GetTxOboLossDb() const
Get the OBO loss of the transmitter in dB.
void SetTxMaxPowerDbw(double powerDb)
Set the maximum transmit power of the transmitter in dB.
TracedCallback< Ptr< const Packet >, const Address & > m_rxTrace
Traced callback for all received packets, including the address of the senders.
double GetRxAntennaGainDb() const
Get the maximum antenna gain of the receiver in dB.
SatPhy(void)
Default constructor.
double m_eirpWoGainW
Calculated EIRP without gain in W.
virtual void SetPhyTx(Ptr< SatPhyTx > phyTx)
Set the SatPhyTx module.
void SetRxAntennaLossDb(double lossDb)
Set the antenna loss of the receiver in dB.
void SetRxNoiseTemperatureDbk(double temperatureDbk)
Set the noise temperature of the receiver in dbK.
double GetRxNoiseTemperatureDbk() const
Get the noise temperature of the receiver in dbK.
double GetRxAntennaLossDb() const
Get the antenna loss of the receiver in dB.
Ptr< SatPhyTx > m_phyTx
Pointer to internal SatPhyTx instance.
void ModcodTrace(Ptr< SatSignalParameters > rxParams)
Invoke the RxLinkModcod trace source for each received packet.
void SetTxAntennaGainDb(double gainDb)
Set the maximum antenna gain of the transmitter in dB.
bool m_isStatisticsTagsEnabled
EnableStatisticsTags attribute.
Time m_lastLinkDelay
Last delay measurement for link.
SatSignalParameters::PacketsInBurst_t PacketContainer_t
Define PacketContainer in SatPhy.
void SetTxAntennaLossDb(double lossDb)
Set the antenna loss of the transmitter in dB.
virtual void SetPhyRx(Ptr< SatPhyRx > phyRx)
Set the SatPhyRx module.
SatPhy::ReceiveCallback m_rxCallback
The upper layer package receive callback.
TracedCallback< const Time &, const Address & > m_rxLinkJitterTrace
Traced callback for all received packets, including link jitter information and the address of the se...
double GetTxAntennaLossDb() const
Get the antenna loss of the transmitter in dB.
Time tag used to identify the time when packet is enqueued at PHY on current link level.
Time GetSenderLinkTimestamp(void) const
Get sender time stamp of this tag.
Tag to store uplink phy info that need to be forwarded to the downlink.
void SetBeamId(uint32_t beamId)
Set the UT beam ID.
void SetSatId(uint32_t satId)
Set the UT sat ID.
SatUtils class is for general conversions used in satellite module.
static T DbToLinear(T db)
Converts decibels to linear.
static T LinearToDb(T linear)
Converts linear to decibels.
static std::string GetPacketInfo(const Ptr< const Packet > p)
Get packet information in std::string for printing purposes.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Creation parameters for base PHY object.