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 <stdint.h>
40 #include <string>
41 
42 namespace ns3
43 {
44 
45 class SatPhyTx;
46 class SatPhyRx;
47 class SatChannel;
48 class SatMac;
49 
61 class SatPhy : public Object
62 {
63  public:
80 
85  typedef Callback<void, PacketContainer_t, Ptr<SatSignalParameters>> ReceiveCallback;
86 
94  typedef Callback<void, uint32_t, uint32_t, Address, Address, double, bool> CnoCallback;
95 
103  typedef Callback<void, uint32_t, uint32_t, uint32_t, uint8_t, double>
105 
109  typedef struct
110  {
111  Ptr<NetDevice> m_device;
112  Ptr<SatChannel> m_txCh;
113  Ptr<SatChannel> m_rxCh;
114  uint32_t m_satId;
115  uint32_t m_beamId;
117  } CreateParam_t;
118 
122  SatPhy(void);
123 
127  SatPhy(CreateParam_t& params);
128 
132  virtual ~SatPhy();
133 
137  static TypeId GetTypeId(void);
141  TypeId GetInstanceTypeId(void) const;
145  virtual void DoInitialize(void);
146 
150  virtual void DoDispose(void);
151 
157  virtual double GetAdditionalInterference() = 0;
158 
167  double CalculateSinr(double sinr, double otherInterference);
168 
172  void Initialize();
173 
178  inline double GetRxNoiseTemperatureDbk() const
179  {
181  }
182 
187  inline void SetRxNoiseTemperatureDbk(double temperatureDbk)
188  {
189  m_rxNoiseTemperatureDbk = temperatureDbk;
190  }
191 
196  inline double GetRxAntennaGainDb() const
197  {
198  return m_rxMaxAntennaGainDb;
199  }
200 
205  inline void SetRxAntennaGainDb(double gainDb)
206  {
207  m_rxMaxAntennaGainDb = gainDb;
208  }
209 
214  inline double GetRxAntennaLossDb() const
215  {
216  return m_rxAntennaLossDb;
217  }
218 
223  inline void SetRxAntennaLossDb(double lossDb)
224  {
225  m_rxAntennaLossDb = lossDb;
226  }
227 
232  inline double GetTxAntennaGainDb() const
233  {
234  return m_txMaxAntennaGainDb;
235  }
236 
241  inline void SetTxAntennaGainDb(double gainDb)
242  {
243  m_txMaxAntennaGainDb = gainDb;
244  }
245 
250  inline double GetTxMaxPowerDbw() const
251  {
252  return m_txMaxPowerDbw;
253  }
254 
259  inline void SetTxMaxPowerDbw(double powerDb)
260  {
261  m_txMaxPowerDbw = powerDb;
262  }
263 
268  inline double GetTxOutputLossDb() const
269  {
270  return m_txOutputLossDb;
271  }
272 
277  inline void SetTxOutputLossDb(double lossDb)
278  {
279  m_txOutputLossDb = lossDb;
280  }
281 
286  inline double GetTxPointingLossDb() const
287  {
288  return m_txPointingLossDb;
289  }
290 
295  inline void SetTxPointingLossDb(double lossDb)
296  {
297  m_txPointingLossDb = lossDb;
298  }
299 
304  inline double GetTxOboLossDb() const
305  {
306  return m_txOboLossDb;
307  }
308 
313  inline void SetTxOboLossDb(double lossDb)
314  {
315  m_txOboLossDb = lossDb;
316  }
317 
322  inline double GetTxAntennaLossDb() const
323  {
324  return m_txAntennaLossDb;
325  }
326 
331  inline void SetTxAntennaLossDb(double lossDb)
332  {
333  m_txAntennaLossDb = lossDb;
334  }
335 
340  inline double GetDefaultFading() const
341  {
342  return m_defaultFadingValue;
343  }
344 
349  inline void SetDefaultFading(double fading)
350  {
351  m_defaultFadingValue = fading;
352  }
353 
359  virtual void SetTxAntennaGainPattern(Ptr<SatAntennaGainPattern> agp,
360  Ptr<SatMobilityModel> satelliteMobility);
361 
367  virtual void SetRxAntennaGainPattern(Ptr<SatAntennaGainPattern> agp,
368  Ptr<SatMobilityModel> satelliteMobility);
369 
375  void ConfigureRxCarriers(Ptr<SatPhyRxCarrierConf> carrierConf,
376  Ptr<SatSuperframeConf> superFrameConf);
377 
382  void SetRxFadingContainer(Ptr<SatBaseFading> fadingContainer);
383 
388  void SetTxFadingContainer(Ptr<SatBaseFading> fadingContainer);
389 
394  virtual Ptr<SatPhyTx> GetPhyTx() const;
395 
400  virtual Ptr<SatPhyRx> GetPhyRx() const;
401 
406  virtual void SetPhyTx(Ptr<SatPhyTx> phyTx);
407 
412  virtual void SetPhyRx(Ptr<SatPhyRx> phyRx);
413 
418  Ptr<SatChannel> GetTxChannel();
419 
427  virtual void SendPdu(PacketContainer_t,
428  uint32_t carrierId,
429  Time duration,
431 
436  virtual void SendPduWithParams(Ptr<SatSignalParameters> rxParams);
437 
442  void SetSatId(uint32_t satId);
443 
448  bool SetBeamId(uint32_t beamId);
449 
456  virtual void Receive(Ptr<SatSignalParameters> rxParams, bool phyError);
457 
467  void CnoInfo(uint32_t satId,
468  uint32_t beamId,
469  Address source,
470  Address destination,
471  double cno,
472  bool isSatelliteMac);
473 
482  uint32_t beamId,
483  uint32_t carrierId,
484  uint8_t allocationChannelId,
485  double averageNormalizedOfferedLoad);
486 
491  void SetNodeInfo(const Ptr<SatNodeInfo> nodeInfo);
492 
496  void BeginEndScheduling();
497 
503  typedef Callback<SatChannelPair::ChannelPair_t, uint32_t, uint32_t> ChannelPairGetterCallback;
504 
510 
511  protected:
516  virtual void RxTraces(SatPhy::PacketContainer_t packets);
517 
522  void ModcodTrace(Ptr<SatSignalParameters> rxParams);
523 
529 
535 
541 
546 
551 
555  TracedCallback<Time,
558  uint32_t,
559  Mac48Address,
562  std::string>
564 
569  TracedCallback<Ptr<const Packet>, const Address&> m_rxTrace;
570 
575  TracedCallback<const Time&, const Address&> m_rxDelayTrace;
576 
581  TracedCallback<const Time&, const Address&> m_rxLinkDelayTrace;
582 
587  TracedCallback<const Time&, const Address&> m_rxJitterTrace;
588 
593  TracedCallback<const Time&, const Address&> m_rxLinkJitterTrace;
594 
599  TracedCallback<uint32_t, const Address&> m_rxLinkModcodTrace;
600 
605  Ptr<SatNodeInfo> m_nodeInfo;
606 
610  Ptr<SatPhyTx> m_phyTx;
611 
615  Ptr<SatPhyRx> m_phyRx;
616 
620  uint32_t m_satId;
621 
625  uint32_t m_beamId;
626 
631 
636 
641 
646 
647  private:
652 
657 
662 
667 
672 
677 
682 
687 
692 
697 
702 
707 };
708 
709 } // namespace ns3
710 
711 #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:62
void SetTxPointingLossDb(double lossDb)
Set the pointing loss of the transmitter in dB.
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 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:94
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:71
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:85
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:75
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:79
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:67
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...
bool SetBeamId(uint32_t beamId)
Set the beamId this PHY is connected with.
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.