Loading...
Searching...
No Matches
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
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
42namespace ns3
43{
44
45class SatPhyTx;
46class SatPhyRx;
47class SatChannel;
48class SatMac;
49
61class 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;
118
122 SatPhy(void);
123
127 SatPhy(CreateParam_t params);
128
137 virtual void NotifyConstructionCompleted() override;
138
142 virtual ~SatPhy();
143
147 static TypeId GetTypeId(void);
148
152 virtual void DoInitialize(void);
153
157 virtual void DoDispose(void);
158
164 virtual double GetAdditionalInterference() = 0;
165
174 double CalculateSinr(double sinr, double otherInterference);
175
179 void Initialize();
180
185 inline double GetRxNoiseTemperatureDbk() const
186 {
188 }
189
194 inline void SetRxNoiseTemperatureDbk(double temperatureDbk)
195 {
196 m_rxNoiseTemperatureDbk = temperatureDbk;
197 }
198
203 inline double GetRxAntennaGainDb() const
204 {
206 }
207
212 inline void SetRxAntennaGainDb(double gainDb)
213 {
214 m_rxMaxAntennaGainDb = gainDb;
215 }
216
221 inline double GetRxAntennaLossDb() const
222 {
223 return m_rxAntennaLossDb;
224 }
225
230 inline void SetRxAntennaLossDb(double lossDb)
231 {
232 m_rxAntennaLossDb = lossDb;
233 }
234
239 inline double GetTxAntennaGainDb() const
240 {
242 }
243
248 inline void SetTxAntennaGainDb(double gainDb)
249 {
250 m_txMaxAntennaGainDb = gainDb;
251 }
252
257 inline double GetTxMaxPowerDbw() const
258 {
259 return m_txMaxPowerDbw;
260 }
261
266 inline void SetTxMaxPowerDbw(double powerDb)
267 {
268 m_txMaxPowerDbw = powerDb;
269 }
270
275 inline double GetTxOutputLossDb() const
276 {
277 return m_txOutputLossDb;
278 }
279
284 inline void SetTxOutputLossDb(double lossDb)
285 {
286 m_txOutputLossDb = lossDb;
287 }
288
293 inline double GetTxPointingLossDb() const
294 {
295 return m_txPointingLossDb;
296 }
297
302 inline void SetTxPointingLossDb(double lossDb)
303 {
304 m_txPointingLossDb = lossDb;
305 }
306
311 inline double GetTxOboLossDb() const
312 {
313 return m_txOboLossDb;
314 }
315
320 inline void SetTxOboLossDb(double lossDb)
321 {
322 m_txOboLossDb = lossDb;
323 }
324
329 inline double GetTxAntennaLossDb() const
330 {
331 return m_txAntennaLossDb;
332 }
333
338 inline void SetTxAntennaLossDb(double lossDb)
339 {
340 m_txAntennaLossDb = lossDb;
341 }
342
347 inline double GetDefaultFading() const
348 {
350 }
351
356 inline void SetDefaultFading(double fading)
357 {
358 m_defaultFadingValue = fading;
359 }
360
366 virtual void SetTxAntennaGainPattern(Ptr<SatAntennaGainPattern> agp,
367 Ptr<SatMobilityModel> satelliteMobility);
368
374 virtual void SetRxAntennaGainPattern(Ptr<SatAntennaGainPattern> agp,
375 Ptr<SatMobilityModel> satelliteMobility);
376
382 void ConfigureRxCarriers(Ptr<SatPhyRxCarrierConf> carrierConf,
383 Ptr<SatSuperframeConf> superFrameConf);
384
389 void SetRxFadingContainer(Ptr<SatBaseFading> fadingContainer);
390
395 void SetTxFadingContainer(Ptr<SatBaseFading> fadingContainer);
396
401 virtual Ptr<SatPhyTx> GetPhyTx() const;
402
407 virtual Ptr<SatPhyRx> GetPhyRx() const;
408
413 virtual void SetPhyTx(Ptr<SatPhyTx> phyTx);
414
419 virtual void SetPhyRx(Ptr<SatPhyRx> phyRx);
420
425 Ptr<SatChannel> GetTxChannel();
426
434 virtual void SendPdu(PacketContainer_t,
435 uint32_t carrierId,
436 Time duration,
438
443 virtual void SendPduWithParams(Ptr<SatSignalParameters> rxParams);
444
449 void SetSatId(uint32_t satId);
450
455 bool SetBeamId(uint32_t beamId);
456
463 virtual void Receive(Ptr<SatSignalParameters> rxParams, bool phyError);
464
474 void CnoInfo(uint32_t satId,
475 uint32_t beamId,
476 Address source,
477 Address destination,
478 double cno,
479 bool isSatelliteMac);
480
489 uint32_t beamId,
490 uint32_t carrierId,
491 uint8_t allocationChannelId,
492 double averageNormalizedOfferedLoad);
493
498 void SetNodeInfo(const Ptr<SatNodeInfo> nodeInfo);
499
503 void BeginEndScheduling();
504
510 typedef Callback<SatChannelPair::ChannelPair_t, uint32_t, uint32_t> ChannelPairGetterCallback;
511
517
518 protected:
523 virtual void RxTraces(SatPhy::PacketContainer_t packets);
524
529 void ModcodTrace(Ptr<SatSignalParameters> rxParams);
530
536
542
548
553
558
562 TracedCallback<Time,
565 uint32_t,
566 Mac48Address,
569 std::string>
571
576 TracedCallback<Ptr<const Packet>, const Address&> m_rxTrace;
577
582 TracedCallback<const Time&, const Address&> m_rxDelayTrace;
583
588 TracedCallback<const Time&, const Address&> m_rxLinkDelayTrace;
589
594 TracedCallback<const Time&, const Address&> m_rxJitterTrace;
595
600 TracedCallback<const Time&, const Address&> m_rxLinkJitterTrace;
601
606 TracedCallback<uint32_t, const Address&> m_rxLinkModcodTrace;
607
612 Ptr<SatNodeInfo> m_nodeInfo;
613
617 Ptr<SatPhyTx> m_phyTx;
618
622 Ptr<SatPhyRx> m_phyRx;
623
628
632 uint32_t m_satId;
633
637 uint32_t m_beamId;
638
643
648
653
658
659 private:
664
669
674
679
684
689
694
699
704
709
714
719};
720
721} // namespace ns3
722
723#endif /* SATELLITE_PHY_H */
Satellite channel implementation.
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.
Base MAC class for SatNetDevices.
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.
CreateParam_t m_params
Satellite physical layer construction parameters.
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.
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
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.
virtual void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
SatPhyRxCarrierConf::InterferenceEliminationModel InterferenceEliminationModel
Define InterferenceEliminationModel in SatPhy.
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
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.
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.
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.
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.
The SatPhyRx models the physical layer receiver of satellite system.
The SatellitePhyTx models the physical layer transmitter of satellite system.
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.
SatEnums::SatLoraNodeType_t m_standard
Struct for storing the packet specific Tx information.