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-utils.h"
30 
31 #include <ns3/double.h>
32 #include <ns3/log.h>
33 #include <ns3/pointer.h>
34 #include <ns3/simulator.h>
35 #include <ns3/uinteger.h>
36 
37 NS_LOG_COMPONENT_DEFINE("SatGwPhy");
38 
39 namespace ns3
40 {
41 
42 NS_OBJECT_ENSURE_REGISTERED(SatGwPhy);
43 
44 TypeId
46 {
47  static TypeId tid =
48  TypeId("ns3::SatGwPhy")
49  .SetParent<SatPhy>()
50  .AddConstructor<SatGwPhy>()
51  .AddAttribute("PhyRx",
52  "The PhyRx layer attached to this phy.",
53  PointerValue(),
54  MakePointerAccessor(&SatPhy::GetPhyRx, &SatPhy::SetPhyRx),
55  MakePointerChecker<SatPhyRx>())
56  .AddAttribute("PhyTx",
57  "The PhyTx layer attached to this phy.",
58  PointerValue(),
59  MakePointerAccessor(&SatPhy::GetPhyTx, &SatPhy::SetPhyTx),
60  MakePointerChecker<SatPhyTx>())
61  .AddAttribute("RxTemperatureDbk",
62  "RX noise temperature in GW in dBK.",
63  DoubleValue(24.62), // ~290K
64  MakeDoubleAccessor(&SatPhy::GetRxNoiseTemperatureDbk,
66  MakeDoubleChecker<double>())
67  .AddAttribute(
68  "RxMaxAntennaGainDb",
69  "Maximum RX gain in dB",
70  DoubleValue(61.50),
72  MakeDoubleChecker<double_t>())
73  .AddAttribute(
74  "TxMaxAntennaGainDb",
75  "Maximum TX gain in dB",
76  DoubleValue(65.20),
78  MakeDoubleChecker<double_t>())
79  .AddAttribute("TxMaxPowerDbw",
80  "Maximum TX power in dB",
81  DoubleValue(8.97),
83  MakeDoubleChecker<double>())
84  .AddAttribute(
85  "TxOutputLossDb",
86  "TX Output loss in dB",
87  DoubleValue(2.00),
89  MakeDoubleChecker<double>())
90  .AddAttribute(
91  "TxPointingLossDb",
92  "TX Pointing loss in dB",
93  DoubleValue(1.10),
95  MakeDoubleChecker<double>())
96  .AddAttribute("TxOboLossDb",
97  "TX OBO loss in dB",
98  DoubleValue(6.00),
99  MakeDoubleAccessor(&SatPhy::GetTxOboLossDb, &SatPhy::SetTxOboLossDb),
100  MakeDoubleChecker<double>())
101  .AddAttribute(
102  "TxAntennaLossDb",
103  "TX Antenna loss in dB",
104  DoubleValue(0.00),
106  MakeDoubleChecker<double>())
107  .AddAttribute(
108  "RxAntennaLossDb",
109  "RX Antenna loss in dB",
110  DoubleValue(0.00),
112  MakeDoubleChecker<double>())
113  .AddAttribute("DefaultFadingValue",
114  "Default value for fading",
115  DoubleValue(1.00),
116  MakeDoubleAccessor(&SatPhy::GetDefaultFading, &SatPhy::SetDefaultFading),
117  MakeDoubleChecker<double_t>())
118  .AddAttribute("ImIfCOverIDb",
119  "Intermodulation interference, C over I in dB.",
120  DoubleValue(22.0),
121  MakeDoubleAccessor(&SatGwPhy::m_imInterferenceCOverIDb),
122  MakeDoubleChecker<double>())
123  .AddAttribute("AciIfWrtNoisePercent",
124  "Adjacent channel interference wrt white noise in percents.",
125  DoubleValue(10.0),
126  MakeDoubleAccessor(&SatGwPhy::m_aciIfWrtNoisePercent),
127  MakeDoubleChecker<double>(0, 100));
128  return tid;
129 }
130 
131 TypeId
133 {
134  NS_LOG_FUNCTION(this);
135 
136  return GetTypeId();
137 }
138 
140  : m_aciIfWrtNoisePercent(10.0),
141  m_imInterferenceCOverIDb(22.0),
142  m_imInterferenceCOverI(SatUtils::DbToLinear(m_imInterferenceCOverIDb))
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  SatEnums::RegenerationMode_t returnLinkRegenerationMode)
153  : SatPhy(params),
154  m_aciIfWrtNoisePercent(10.0),
155  m_imInterferenceCOverIDb(22.0),
156  m_imInterferenceCOverI(SatUtils::DbToLinear(m_imInterferenceCOverIDb))
157 {
158  NS_LOG_FUNCTION(this);
159 
160  ObjectBase::ConstructSelf(AttributeConstructionList());
161 
163 
164  parameters.m_rxTemperatureK = SatUtils::DbToLinear(SatPhy::GetRxNoiseTemperatureDbk());
165  parameters.m_aciIfWrtNoiseFactor = m_aciIfWrtNoisePercent / 100.0;
166  parameters.m_extNoiseDensityWhz = 0.0;
167  parameters.m_rxMode = SatPhyRxCarrierConf::NORMAL;
168  parameters.m_linkRegenerationMode = returnLinkRegenerationMode;
169  parameters.m_chType = SatEnums::RETURN_FEEDER_CH;
170 
171  Ptr<SatPhyRxCarrierConf> carrierConf = CreateObject<SatPhyRxCarrierConf>(parameters);
172 
173  if (linkResults)
174  {
175  carrierConf->SetLinkResults(linkResults);
176  }
177 
178  carrierConf->SetAdditionalInterferenceCb(
179  MakeCallback(&SatGwPhy::GetAdditionalInterference, this));
180 
181  SatPhy::ConfigureRxCarriers(carrierConf, superFrameConf);
182 }
183 
185 {
186  NS_LOG_FUNCTION(this);
187 }
188 
189 void
191 {
192  NS_LOG_FUNCTION(this);
194 }
195 
196 void
198 {
199  NS_LOG_FUNCTION(this);
201 }
202 
203 double
205 {
206  NS_LOG_FUNCTION(this);
207 
208  return m_imInterferenceCOverI;
209 }
210 
213 {
214  return SatEnums::LD_FORWARD;
215 }
216 
219 {
220  return SatEnums::LD_RETURN;
221 }
222 
223 } // namespace ns3
SatLinkDir_t
Link direction used for packet tracing.
RegenerationMode_t
The regeneration mode used in satellites.
TypeId GetInstanceTypeId(void) const
virtual double GetAdditionalInterference()
Get additional interference, used to compute final SINR at RX.
double m_imInterferenceCOverI
Intermodulation interference in linear.
SatGwPhy(void)
Default constructor.
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 ~SatGwPhy()
Destructor for SatGwPhy.
double m_imInterferenceCOverIDb
Configured intermodulation interference in dB.
virtual SatEnums::SatLinkDir_t GetSatLinkTxDir()
Get the link TX direction.
virtual SatEnums::SatLinkDir_t GetSatLinkRxDir()
Get the link RX direction.
static TypeId GetTypeId(void)
inherited from Object
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 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 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.
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.
double GetRxAntennaGainDb() const
Get the maximum antenna gain of the receiver in dB.
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.
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.
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.