satellite-phy.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 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 
23 #ifndef SATELLITE_PHY_H
24 #define SATELLITE_PHY_H
25 
28 #include "satellite-frame-conf.h"
29 #include "satellite-node-info.h"
32 
33 #include <ns3/address.h>
34 #include <ns3/nstime.h>
35 #include <ns3/object.h>
36 #include <ns3/packet.h>
37 #include <ns3/ptr.h>
38 
39 #include <string>
40 
41 namespace ns3
42 {
43 
44 class SatPhyTx;
45 class SatPhyRx;
46 class SatChannel;
47 class SatMac;
48 
60 class SatPhy : public Object
61 {
62  public:
79 
84  typedef Callback<void, PacketContainer_t, Ptr<SatSignalParameters>> ReceiveCallback;
85 
93  typedef Callback<void, uint32_t, uint32_t, Address, Address, double, bool> CnoCallback;
94 
102  typedef Callback<void, uint32_t, uint32_t, uint32_t, uint8_t, double>
104 
108  typedef struct
109  {
110  Ptr<NetDevice> m_device;
111  Ptr<SatChannel> m_txCh;
112  Ptr<SatChannel> m_rxCh;
113  uint32_t m_satId;
114  uint32_t m_beamId;
116  } CreateParam_t;
117 
121  SatPhy(void);
122 
126  SatPhy(CreateParam_t& params);
127 
131  virtual ~SatPhy();
132 
136  static TypeId GetTypeId(void);
140  TypeId GetInstanceTypeId(void) const;
144  virtual void DoInitialize(void);
145 
149  virtual void DoDispose(void);
150 
156  virtual double GetAdditionalInterference() = 0;
157 
166  double CalculateSinr(double sinr, double otherInterference);
167 
171  void Initialize();
172 
177  inline double GetRxNoiseTemperatureDbk() const
178  {
180  }
181 
186  inline void SetRxNoiseTemperatureDbk(double temperatureDbk)
187  {
188  m_rxNoiseTemperatureDbk = temperatureDbk;
189  }
190 
195  inline double GetRxAntennaGainDb() const
196  {
197  return m_rxMaxAntennaGainDb;
198  }
199 
204  inline void SetRxAntennaGainDb(double gainDb)
205  {
206  m_rxMaxAntennaGainDb = gainDb;
207  }
208 
213  inline double GetRxAntennaLossDb() const
214  {
215  return m_rxAntennaLossDb;
216  }
217 
222  inline void SetRxAntennaLossDb(double lossDb)
223  {
224  m_rxAntennaLossDb = lossDb;
225  }
226 
231  inline double GetTxAntennaGainDb() const
232  {
233  return m_txMaxAntennaGainDb;
234  }
235 
240  inline void SetTxAntennaGainDb(double gainDb)
241  {
242  m_txMaxAntennaGainDb = gainDb;
243  }
244 
249  inline double GetTxMaxPowerDbw() const
250  {
251  return m_txMaxPowerDbw;
252  }
253 
258  inline void SetTxMaxPowerDbw(double powerDb)
259  {
260  m_txMaxPowerDbw = powerDb;
261  }
262 
267  inline double GetTxOutputLossDb() const
268  {
269  return m_txOutputLossDb;
270  }
271 
276  inline void SetTxOutputLossDb(double lossDb)
277  {
278  m_txOutputLossDb = lossDb;
279  }
280 
285  inline double GetTxPointingLossDb() const
286  {
287  return m_txPointingLossDb;
288  }
289 
294  inline void SetTxPointingLossDb(double lossDb)
295  {
296  m_txPointingLossDb = lossDb;
297  }
298 
303  inline double GetTxOboLossDb() const
304  {
305  return m_txOboLossDb;
306  }
307 
312  inline void SetTxOboLossDb(double lossDb)
313  {
314  m_txOboLossDb = lossDb;
315  }
316 
321  inline double GetTxAntennaLossDb() const
322  {
323  return m_txAntennaLossDb;
324  }
325 
330  inline void SetTxAntennaLossDb(double lossDb)
331  {
332  m_txAntennaLossDb = lossDb;
333  }
334 
339  inline double GetDefaultFading() const
340  {
341  return m_defaultFadingValue;
342  }
343 
348  inline void SetDefaultFading(double fading)
349  {
350  m_defaultFadingValue = fading;
351  }
352 
358  virtual void SetTxAntennaGainPattern(Ptr<SatAntennaGainPattern> agp,
359  Ptr<SatMobilityModel> satelliteMobility);
360 
366  virtual void SetRxAntennaGainPattern(Ptr<SatAntennaGainPattern> agp,
367  Ptr<SatMobilityModel> satelliteMobility);
368 
374  void ConfigureRxCarriers(Ptr<SatPhyRxCarrierConf> carrierConf,
375  Ptr<SatSuperframeConf> superFrameConf);
376 
381  void SetRxFadingContainer(Ptr<SatBaseFading> fadingContainer);
382 
387  void SetTxFadingContainer(Ptr<SatBaseFading> fadingContainer);
388 
393  virtual Ptr<SatPhyTx> GetPhyTx() const;
394 
399  virtual Ptr<SatPhyRx> GetPhyRx() const;
400 
405  virtual void SetPhyTx(Ptr<SatPhyTx> phyTx);
406 
411  virtual void SetPhyRx(Ptr<SatPhyRx> phyRx);
412 
417  Ptr<SatChannel> GetTxChannel();
418 
426  virtual void SendPdu(PacketContainer_t,
427  uint32_t carrierId,
428  Time duration,
430 
435  virtual void SendPduWithParams(Ptr<SatSignalParameters> rxParams);
436 
441  void SetSatId(uint32_t satId);
442 
447  void SetBeamId(uint32_t beamId);
448 
455  virtual void Receive(Ptr<SatSignalParameters> rxParams, bool phyError);
456 
466  void CnoInfo(uint32_t satId,
467  uint32_t beamId,
468  Address source,
469  Address destination,
470  double cno,
471  bool isSatelliteMac);
472 
481  uint32_t beamId,
482  uint32_t carrierId,
483  uint8_t allocationChannelId,
484  double averageNormalizedOfferedLoad);
485 
490  void SetNodeInfo(const Ptr<SatNodeInfo> nodeInfo);
491 
495  void BeginEndScheduling();
496 
502  typedef Callback<SatChannelPair::ChannelPair_t, uint32_t, uint32_t> ChannelPairGetterCallback;
503 
509 
510  protected:
515  virtual void RxTraces(SatPhy::PacketContainer_t packets);
516 
521  void ModcodTrace(Ptr<SatSignalParameters> rxParams);
522 
528 
534 
540 
545 
550 
554  TracedCallback<Time,
557  uint32_t,
558  Mac48Address,
561  std::string>
563 
568  TracedCallback<Ptr<const Packet>, const Address&> m_rxTrace;
569 
574  TracedCallback<const Time&, const Address&> m_rxDelayTrace;
575 
580  TracedCallback<const Time&, const Address&> m_rxLinkDelayTrace;
581 
586  TracedCallback<const Time&, const Address&> m_rxJitterTrace;
587 
592  TracedCallback<const Time&, const Address&> m_rxLinkJitterTrace;
593 
598  TracedCallback<uint32_t, const Address&> m_rxLinkModcodTrace;
599 
604  Ptr<SatNodeInfo> m_nodeInfo;
605 
609  Ptr<SatPhyTx> m_phyTx;
610 
614  Ptr<SatPhyRx> m_phyRx;
615 
619  uint32_t m_satId;
620 
624  uint32_t m_beamId;
625 
630 
635 
640 
645 
646  private:
651 
656 
661 
666 
671 
676 
681 
686 
691 
696 
701 
706 };
707 
708 } // namespace ns3
709 
710 #endif /* SATELLITE_PHY_H */
SatLinkDir_t
Link direction used for packet tracing.
SatLoraNodeType_t
Specifies standard used and the king of node.
SatNodeType_t
Node type used for packet tracing.
SatPacketEvent_t
Packet event used for packet tracing.
SatLogLevel_t
Log level used for packet tracing.
The SatPhy models the basic physical layer of the satellite system.
Definition: satellite-phy.h:61
void SetTxPointingLossDb(double lossDb)
Set the pointing loss of the transmitter in dB.
void SetBeamId(uint32_t beamId)
Set the beamId this PHY is connected with.
virtual void SetTxAntennaGainPattern(Ptr< SatAntennaGainPattern > agp, Ptr< SatMobilityModel > satelliteMobility)
Set the transmit antenna gain pattern.
double m_txMaxAntennaGainDb
Configured maximum transmitter antenna gain in dBi.
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 SetNodeInfo(const Ptr< SatNodeInfo > nodeInfo)
Set the node info class.
void SetTimeTag(SatPhy::PacketContainer_t packets)
Set SatPhyTimeTag of packets.
virtual double GetAdditionalInterference()=0
Get additional interference, used to compute final SINR at RX.
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.
void Initialize()
Initialize phy.
virtual Ptr< SatPhyTx > GetPhyTx() const
Get the SatPhyTx pointer.
virtual void SetRxAntennaGainPattern(Ptr< SatAntennaGainPattern > agp, Ptr< SatMobilityModel > satelliteMobility)
Set the receive antenna gain pattern.
TracedCallback< const Time &, const Address & > m_rxDelayTrace
Traced callback for all received packets, including delay information and the address of the senders.
TracedCallback< const Time &, const Address & > m_rxJitterTrace
Traced callback for all received packets, including jitter information and the address of the senders...
void SetTxOboLossDb(double lossDb)
Set the OBO loss of the transmitter in dB.
void CnoInfo(uint32_t satId, uint32_t beamId, Address source, Address destination, double cno, bool isSatelliteMac)
Function for getting the C/NO information.
void SetSatId(uint32_t satId)
Set the satId this PHY is connected with.
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.
Ptr< SatPhyRx > m_phyRx
Pointer to internal SatPhyRx instance.
virtual SatEnums::SatLinkDir_t GetSatLinkTxDir()
Get the link TX direction.
virtual SatEnums::SatLinkDir_t GetSatLinkRxDir()
Get the link RX direction.
double GetTxOutputLossDb() const
Get the output loss of the transmitter in dB.
uint32_t m_satId
Satellite ID.
void BeginEndScheduling()
Begin frame/window end scheduling for processes utilizing frame length as interval.
TypeId GetInstanceTypeId(void) const
Derived from Object.
virtual void SendPduWithParams(Ptr< SatSignalParameters > rxParams)
Send Pdu to the PHY tx module (for GEO satellite switch packet forwarding)
double GetTxAntennaGainDb() const
Get the maximum antenna gain of the transmitter in dB.
Callback< void, uint32_t, uint32_t, Address, Address, double, bool > CnoCallback
Definition: satellite-phy.h:93
uint32_t m_beamId
Beam ID.
double m_rxAntennaLossDb
Configured receiver antenna loss in Dbs.
double m_defaultFadingValue
Default fading value.
virtual Ptr< SatPhyRx > GetPhyRx() const
Get the SatPhyRx pointer.
void SetTxOutputLossDb(double lossDb)
Set the output loss of the transmitter in dB.
static TypeId GetTypeId(void)
Derived from Object.
double GetTxPointingLossDb() const
Get the pointing loss of the transmitter in dB.
double m_txMaxPowerDbw
Configured maximum transmitter power in DbWs.
void SetRxFadingContainer(Ptr< SatBaseFading > fadingContainer)
Set fading container.
void AverageNormalizedOfferedRandomAccessLoadInfo(uint32_t satId, uint32_t beamId, uint32_t carrierId, uint8_t allocationChannelId, double averageNormalizedOfferedLoad)
Function for getting the normalized offered load of the specific random access allocation channel.
Ptr< SatChannel > GetTxChannel()
Get the Tx satellite channel.
Ptr< SatNodeInfo > m_nodeInfo
Node info containing node related information, such as node type, node id and MAC address (of the Sat...
TracedCallback< uint32_t, const Address & > m_rxLinkModcodTrace
Traced callback for all received packets, including link MODCOD information and the address of the se...
double m_rxNoiseTemperatureDbk
Configured receiver noise temperature in dBK.
double m_rxMaxAntennaGainDb
Configured maximum receiver antenna gain in dBi.
virtual void SendPdu(PacketContainer_t, uint32_t carrierId, Time duration, SatSignalParameters::txInfo_s txInfo)
Send Pdu to the PHY tx module (for initial transmissions from either UT or GW)
void SetChannelPairGetterCallback(SatPhy::ChannelPairGetterCallback cb)
Set the channel pair getter callback.
double GetDefaultFading() const
Get the default fading of the PHY.
virtual void RxTraces(SatPhy::PacketContainer_t packets)
Invoke the Rx trace source for each received packet.
virtual void Receive(Ptr< SatSignalParameters > rxParams, bool phyError)
Receives packets from lower layer.
double m_txOutputLossDb
Configured transmitter output loss in Dbs.
Callback< void, uint32_t, uint32_t, uint32_t, uint8_t, double > AverageNormalizedOfferedLoadCallback
double GetTxMaxPowerDbw() const
Get the maximum transmit power of the transmitter in dB.
SatPhyRxCarrierConf::InterferenceEliminationModel InterferenceEliminationModel
Define InterferenceEliminationModel in SatPhy.
Definition: satellite-phy.h:70
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.
SatPhy::ChannelPairGetterCallback m_retrieveChannelPair
Callback for retrieving SatChannel pairs by beam.
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.
SatPhy::AverageNormalizedOfferedLoadCallback m_avgNormalizedOfferedLoadCallback
Average normalized offered load callback.
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.
Time m_lastDelay
Last delay measurement.
Callback< void, PacketContainer_t, Ptr< SatSignalParameters > > ReceiveCallback
Definition: satellite-phy.h:84
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 m_txPointingLossDb
Configured transmitter pointing loss in Dbs.
SatPhyRxCarrierConf::ErrorModel ErrorModel
Define ErrorModel in SatPhy.
Definition: satellite-phy.h:74
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.
double m_txAntennaLossDb
Configured transmitter antenna loss in Dbs.
bool m_isStatisticsTagsEnabled
EnableStatisticsTags attribute.
virtual void DoDispose(void)
Dispose of SatPhy.
virtual ~SatPhy()
Destructor.
Time m_lastLinkDelay
Last delay measurement for link.
void SetTxFadingContainer(Ptr< SatBaseFading > fadingContainer)
Set fading container.
double CalculateSinr(double sinr, double otherInterference)
Calculate final SINR with PHY specific parameters and given calculated SINR.
SatSignalParameters::PacketsInBurst_t PacketContainer_t
Define PacketContainer in SatPhy.
Definition: satellite-phy.h:78
void SetTxAntennaLossDb(double lossDb)
Set the antenna loss of the transmitter in dB.
double m_txOboLossDb
Configured transmitter OBO loss in Dbs.
virtual void SetPhyRx(Ptr< SatPhyRx > phyRx)
Set the SatPhyRx module.
SatPhyRxCarrierConf::InterferenceModel InterferenceModel
Define InterferenceModel in SatPhy.
Definition: satellite-phy.h:66
SatPhy::CnoCallback m_cnoCallback
The C/N0 info callback.
Callback< SatChannelPair::ChannelPair_t, uint32_t, uint32_t > ChannelPairGetterCallback
Callback for retrieving a pair of SatChannel associated to a beam.
virtual void DoInitialize(void)
Initialization of SatPhy.
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.
InterferenceEliminationModel
Interference cancelation model enum.
InterferenceModel
Interference model enum.
std::vector< Ptr< Packet > > PacketsInBurst_t
Buffer for transmissions.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Creation parameters for base PHY object.
Ptr< SatChannel > m_rxCh
Ptr< NetDevice > m_device
Ptr< SatChannel > m_txCh
SatEnums::SatLoraNodeType_t m_standard
Struct for storing the packet specific Tx information.