Loading...
Searching...
No Matches
satellite-gw-phy.cc
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 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Sami Rantanen <sami.rantanen@magister.fi>
19 */
20
21#include "satellite-gw-phy.h"
22
24#include "satellite-channel.h"
25#include "satellite-mac.h"
26#include "satellite-phy-rx.h"
27#include "satellite-phy-tx.h"
29#include "satellite-topology.h"
30#include "satellite-utils.h"
31
32#include "ns3/double.h"
33#include "ns3/log.h"
34#include "ns3/pointer.h"
35#include "ns3/simulator.h"
36#include "ns3/singleton.h"
37#include "ns3/uinteger.h"
38
39NS_LOG_COMPONENT_DEFINE("SatGwPhy");
40
41namespace ns3
42{
43
44NS_OBJECT_ENSURE_REGISTERED(SatGwPhy);
45
46TypeId
48{
49 static TypeId tid =
50 TypeId("ns3::SatGwPhy")
51 .SetParent<SatPhy>()
52 .AddConstructor<SatGwPhy>()
53 .AddAttribute("PhyRx",
54 "The PhyRx layer attached to this phy.",
55 PointerValue(),
56 MakePointerAccessor(&SatPhy::GetPhyRx, &SatPhy::SetPhyRx),
57 MakePointerChecker<SatPhyRx>())
58 .AddAttribute("PhyTx",
59 "The PhyTx layer attached to this phy.",
60 PointerValue(),
61 MakePointerAccessor(&SatPhy::GetPhyTx, &SatPhy::SetPhyTx),
62 MakePointerChecker<SatPhyTx>())
63 .AddAttribute("RxTemperatureDbk",
64 "RX noise temperature in GW in dBK.",
65 DoubleValue(24.62), // ~290K
66 MakeDoubleAccessor(&SatPhy::GetRxNoiseTemperatureDbk,
68 MakeDoubleChecker<double>())
69 .AddAttribute(
70 "RxMaxAntennaGainDb",
71 "Maximum RX gain in dB",
72 DoubleValue(61.50),
74 MakeDoubleChecker<double_t>())
75 .AddAttribute(
76 "TxMaxAntennaGainDb",
77 "Maximum TX gain in dB",
78 DoubleValue(65.20),
80 MakeDoubleChecker<double_t>())
81 .AddAttribute("TxMaxPowerDbw",
82 "Maximum TX power in dB",
83 DoubleValue(8.97),
85 MakeDoubleChecker<double>())
86 .AddAttribute(
87 "TxOutputLossDb",
88 "TX Output loss in dB",
89 DoubleValue(2.00),
91 MakeDoubleChecker<double>())
92 .AddAttribute(
93 "TxPointingLossDb",
94 "TX Pointing loss in dB",
95 DoubleValue(1.10),
97 MakeDoubleChecker<double>())
98 .AddAttribute("TxOboLossDb",
99 "TX OBO loss in dB",
100 DoubleValue(6.00),
101 MakeDoubleAccessor(&SatPhy::GetTxOboLossDb, &SatPhy::SetTxOboLossDb),
102 MakeDoubleChecker<double>())
103 .AddAttribute(
104 "TxAntennaLossDb",
105 "TX Antenna loss in dB",
106 DoubleValue(0.00),
108 MakeDoubleChecker<double>())
109 .AddAttribute(
110 "RxAntennaLossDb",
111 "RX Antenna loss in dB",
112 DoubleValue(0.00),
114 MakeDoubleChecker<double>())
115 .AddAttribute("DefaultFadingValue",
116 "Default value for fading",
117 DoubleValue(1.00),
119 MakeDoubleChecker<double_t>())
120 .AddAttribute("ImIfCOverIDb",
121 "Intermodulation interference, C over I in dB.",
122 DoubleValue(22.0),
123 MakeDoubleAccessor(&SatGwPhy::m_imInterferenceCOverIDb),
124 MakeDoubleChecker<double>())
125 .AddAttribute("AciIfWrtNoisePercent",
126 "Adjacent channel interference wrt white noise in percents.",
127 DoubleValue(10.0),
128 MakeDoubleAccessor(&SatGwPhy::m_aciIfWrtNoisePercent),
129 MakeDoubleChecker<double>(0, 100))
130 .AddAttribute("AntennaReconfigurationDelay",
131 "Delay of antenna reconfiguration when performing handover",
132 TimeValue(Seconds(0.0)),
134 MakeTimeChecker());
135 return tid;
136}
137
143{
144 NS_LOG_FUNCTION(this);
145 NS_FATAL_ERROR("SatGwPhy default constructor is not allowed to use");
146}
147
149 Ptr<SatLinkResults> linkResults,
150 SatPhyRxCarrierConf::RxCarrierCreateParams_s parameters,
151 Ptr<SatSuperframeConf> superFrameConf)
152 : SatPhy(params),
153 m_linkResults(linkResults),
154 m_parameters(parameters),
155 m_superFrameConf(superFrameConf),
160{
161 NS_LOG_FUNCTION(this << linkResults << superFrameConf);
162}
163
164void
166{
167 NS_LOG_FUNCTION(this);
168
170
172
174 m_parameters.m_aciIfWrtNoiseFactor = m_aciIfWrtNoisePercent / 100.0;
175 m_parameters.m_extNoiseDensityWhz = 0.0;
177 m_parameters.m_linkRegenerationMode =
178 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode();
180
181 Ptr<SatPhyRxCarrierConf> carrierConf = CreateObject<SatPhyRxCarrierConf>(m_parameters);
182
183 if (m_linkResults)
184 {
185 carrierConf->SetLinkResults(m_linkResults);
186 }
187
188 carrierConf->SetAdditionalInterferenceCb(
189 MakeCallback(&SatGwPhy::GetAdditionalInterference, this));
190
192}
193
195{
196 NS_LOG_FUNCTION(this);
197}
198
199void
201{
202 NS_LOG_FUNCTION(this);
204}
205
206void
208{
209 NS_LOG_FUNCTION(this);
211}
212
213double
215{
216 NS_LOG_FUNCTION(this);
217
219}
220
226
232
233void
234SatGwPhy::PerformHandover(uint32_t satId, uint32_t beamId)
235{
236 NS_LOG_FUNCTION(this << satId << beamId);
237
238 // disconnect current SatChannels
240 Ptr<SatChannel> returnLink = channels.second;
241 m_phyTx->ClearChannel();
242 returnLink->RemoveRx(m_phyRx);
243
244 // perform "physical" beam handover
245 SetSatId(satId);
246 SetBeamId(beamId);
248}
249
250void
252{
253 NS_LOG_FUNCTION(this);
254
255 // Fetch channels for current beam
257 Ptr<SatChannel> forwardLink = channels.first;
258 Ptr<SatChannel> returnLink = channels.second;
259
260 // Assign channels
261 NS_LOG_INFO("Setting new Tx on channel " << forwardLink);
262 m_phyTx->SetChannel(forwardLink);
263 returnLink->AddRx(m_phyRx);
264}
265
266} // namespace ns3
std::pair< Ptr< SatChannel >, Ptr< SatChannel > > ChannelPair_t
SatLinkDir_t
Link direction used for packet tracing.
The SatGwPhy models the physical layer of the satellite system (UT, GW, satellite).
virtual double GetAdditionalInterference()
Get additional interference, used to compute final SINR at RX.
double m_imInterferenceCOverI
Intermodulation interference in linear.
SatGwPhy(void)
Default constructor.
SatPhyRxCarrierConf::RxCarrierCreateParams_s m_parameters
RX carrier configuration parameters.
virtual void DoInitialize(void)
Initialization of SatPhy.
double m_aciIfWrtNoisePercent
Configured adjacent channel interference wrt noise (percent).
virtual void DoDispose(void)
Dispose of this class instance.
virtual void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
Ptr< SatSuperframeConf > m_superFrameConf
Super frame cofiguration.
void PerformHandover(uint32_t satId, uint32_t beamId)
Change underlying SatChannel to send and receive data from a new satellite and beam.
virtual ~SatGwPhy()
Destructor for SatGwPhy.
void AssignNewSatChannels()
Update the underlying SatChannel to send and receive data from the current beam (as described in the ...
double m_imInterferenceCOverIDb
Configured intermodulation interference in dB.
Time m_antennaReconfigurationDelay
Delay of antenna reconfiguration when performing handover.
virtual SatEnums::SatLinkDir_t GetSatLinkTxDir()
Get the link TX direction.
virtual SatEnums::SatLinkDir_t GetSatLinkRxDir()
Get the link RX direction.
Ptr< SatLinkResults > m_linkResults
Link results used for this physical layer.
static TypeId GetTypeId(void)
inherited from Object
void SetTxPointingLossDb(double lossDb)
Set the pointing loss of the transmitter in dB.
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.
void SetSatId(uint32_t satId)
Set the satId this PHY is connected with.
void SetDefaultFading(double fading)
Set the default fading of the PHY.
Ptr< SatPhyRx > m_phyRx
Pointer to internal SatPhyRx instance.
double GetTxOutputLossDb() const
Get the output loss of the transmitter in dB.
uint32_t m_satId
Satellite ID.
double GetTxAntennaGainDb() const
Get the maximum antenna gain of the transmitter in dB.
uint32_t m_beamId
Beam ID.
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.
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.
SatPhy::ChannelPairGetterCallback m_retrieveChannelPair
Callback for retrieving SatChannel pairs by beam.
double GetRxAntennaGainDb() const
Get the maximum antenna gain of the receiver in dB.
SatPhy(void)
Default constructor.
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 SetTxAntennaGainDb(double gainDb)
Set the maximum antenna gain of the transmitter in dB.
virtual void DoDispose(void)
Dispose of SatPhy.
void SetTxAntennaLossDb(double lossDb)
Set the antenna loss of the transmitter in dB.
virtual void SetPhyRx(Ptr< SatPhyRx > phyRx)
Set the SatPhyRx module.
virtual void DoInitialize(void)
Initialization of SatPhy.
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.
SatUtils class is for general conversions used in satellite module.
static T DbToLinear(T db)
Converts decibels to linear.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Creation parameters for base PHY object.