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>
48 NS_LOG_COMPONENT_DEFINE(
"SatOrbiterFeederPhy");
53 NS_OBJECT_ENSURE_REGISTERED(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");
163 NS_LOG_FUNCTION(
this);
169 : m_extNoisePowerDensityDbwHz(-207.0),
170 m_imInterferenceCOverIDb(27.0),
171 m_imInterferenceCOverI(
SatUtils::DbToLinear(m_imInterferenceCOverIDb)),
172 m_fixedAmplificationGainDb(82.0),
174 m_queueSizePackets(0)
176 NS_LOG_FUNCTION(
this);
177 NS_FATAL_ERROR(
"SatOrbiterFeederPhy default constructor is not allowed to use");
181 Ptr<SatLinkResults> linkResults,
182 SatPhyRxCarrierConf::RxCarrierCreateParams_s parameters,
183 Ptr<SatSuperframeConf> superFrameConf)
186 NS_LOG_FUNCTION(
this);
196 m_queue = std::queue<std::tuple<Ptr<SatSignalParameters>, uint32_t, uint32_t>>();
208 ObjectBase::ConstructSelf(AttributeConstructionList());
217 parameters.m_aciIfWrtNoiseFactor = 0.0;
229 Ptr<SatPhyRxCarrierConf> carrierConf = CreateObject<SatPhyRxCarrierConf>(parameters);
233 carrierConf->SetLinkResults(linkResults);
236 carrierConf->SetAdditionalInterferenceCb(
244 NS_LOG_FUNCTION(
this);
250 NS_LOG_FUNCTION(
this);
257 NS_LOG_FUNCTION(
this);
258 Object::DoInitialize();
264 NS_LOG_FUNCTION(
this << txParams);
265 NS_LOG_INFO(
this <<
" sending a packet with carrierId: " << txParams->m_carrierId
266 <<
" duration: " << txParams->m_duration);
289 txParams->m_txPower_W =
304 uint32_t nbBytes = 0;
305 for (Ptr<Packet> pkt : txParams->m_packetsInBurst)
307 nbBytes += pkt->GetSize();
309 uint32_t nbPackets = txParams->m_packetsInBurst.size();
313 m_queue.push(std::make_tuple(txParams, nbBytes, nbPackets));
330 NS_LOG_INFO(
"Packet dropped because REGENERATION_PHY queue is full");
355 NS_FATAL_ERROR(
"Trying to deque an empty queue");
358 std::tuple<Ptr<SatSignalParameters>, uint32_t, uint32_t> element =
m_queue.front();
361 Ptr<SatSignalParameters> txParams = std::get<0>(element);
396 NS_LOG_FUNCTION(
this);
400 SatSignalParameters::PacketsInBurst_t::iterator it1;
401 for (it1 = packets.begin(); it1 != packets.end(); ++it1)
406 if ((*it1)->PeekPacketTag(addressE2ETag))
408 NS_LOG_DEBUG(
this <<
" contains a SatMac tag");
415 if ((*it1)->RemovePacketTag(linkTimeTag))
417 NS_LOG_DEBUG(
this <<
" contains a SatPhyLinkTimeTag tag");
436 NS_LOG_FUNCTION(
this << rxParams);
453 NS_LOG_INFO(
this <<
" dropped " << rxParams->m_packetsInBurst.size()
454 <<
" packets because of PHY error.");
466 SatSignalParameters::PacketsInBurst_t::iterator it;
467 for (it = rxParams->m_packetsInBurst.begin(); it != rxParams->m_packetsInBurst.end();
471 (*it)->RemovePacketTag(satUplinkInfoTag);
472 satUplinkInfoTag.
SetSatId(rxParams->m_satId);
473 satUplinkInfoTag.
SetBeamId(rxParams->m_beamId);
474 (*it)->AddPacketTag(satUplinkInfoTag);
477 RxTraces(rxParams->m_packetsInBurst);
484 NS_FATAL_ERROR(
"Unknown regeneration mode");
494 NS_LOG_FUNCTION(
this);
514 SatSignalParameters::PacketsInBurst_t::iterator it1;
515 for (it1 = packets.begin(); it1 != packets.end(); ++it1)
518 ByteTagIterator it2 = (*it1)->GetByteTagIterator();
520 while (it2.HasNext())
522 ByteTagIterator::Item item = it2.Next();
527 item.GetTag(addrTag);
532 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
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.
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.
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.
TypeId GetInstanceTypeId(void) const
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.
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.
The SatPhy models the basic physical layer of the satellite system.
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.
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.
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.