satellite-channel.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  *
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: Jani Puttonen <jani.puttonen@magister.fi>
19  */
20 
21 #ifndef SATELLITE_CHANNEL_H
22 #define SATELLITE_CHANNEL_H
23 
24 #include "satellite-enums.h"
27 #include "satellite-phy-rx.h"
29 #include "satellite-typedefs.h"
30 
31 #include <ns3/channel.h>
32 #include <ns3/nstime.h>
33 #include <ns3/object.h>
34 #include <ns3/propagation-delay-model.h>
35 #include <ns3/traced-callback.h>
36 
37 namespace ns3
38 {
39 
62 class SatChannel : public Channel
63 {
64  public:
68  SatChannel();
69 
73  virtual ~SatChannel();
74 
81  {
84  ALL_BEAMS
85  };
86 
91  static TypeId GetTypeId(void);
92 
96  typedef std::vector<Ptr<SatPhyRx>> PhyRxContainer;
97 
105  typedef Callback<double, SatEnums::ChannelType_t, uint32_t, uint32_t> CarrierFreqConverter;
106 
111  virtual void SetPropagationDelayModel(Ptr<PropagationDelayModel> delay);
112 
117  virtual Ptr<PropagationDelayModel> GetPropagationDelayModel();
118 
123  virtual void SetChannelType(SatEnums::ChannelType_t chType);
124 
129  virtual void SetFrequencyId(uint32_t freqId);
130 
136  virtual void SetFrequencyConverter(CarrierFreqConverter converter);
137 
144 
150 
155  virtual void SetFreeSpaceLoss(Ptr<SatFreeSpaceLoss> delay);
156 
161  virtual Ptr<SatFreeSpaceLoss> GetFreeSpaceLoss() const;
162 
167  virtual void StartTx(Ptr<SatSignalParameters> params);
168 
174  virtual void AddRx(Ptr<SatPhyRx> phyRx);
175 
181  virtual void RemoveRx(Ptr<SatPhyRx> phyRx);
182 
186  virtual std::size_t GetNDevices(void) const;
187 
193  virtual Ptr<NetDevice> GetDevice(std::size_t i) const;
194 
195  private:
202 
207 
212 
217 
222 
226  uint32_t m_freqId;
227 
231  Ptr<PropagationDelayModel> m_propagationDelay;
232 
236  Ptr<SatFreeSpaceLoss> m_freeSpaceLoss;
237 
242 
247 
252 
257 
261  virtual void DoDispose();
262 
268  void ScheduleRx(Ptr<SatSignalParameters> txParams, Ptr<SatPhyRx> phyRx);
269 
276  void StartRx(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx);
277 
283  void DoRxPowerOutputTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx);
284 
290  void DoRxPowerInputTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx);
291 
297  void DoRxCnoInputTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx);
298 
305  void DoFadingOutputTrace(Ptr<SatSignalParameters> rxParams,
306  Ptr<SatPhyRx> phyRx,
307  double fadingValue);
308 
314  void DoRxPowerCalculation(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx);
315 
322  double GetExternalFadingTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx);
323 
329  Mac48Address GetSourceAddress(Ptr<SatSignalParameters> rxParams);
330 };
331 
332 } // namespace ns3
333 
334 #endif /* SATELLITE_CHANNEL_H */
Satellite channel implementation.
void DoRxPowerOutputTrace(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx)
Function for Rx power output trace.
void DoRxCnoInputTrace(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx)
Function for Rx power input trace from C/N0 values.
SatChannelFwdMode_e m_fwdMode
Forwarding mode of the SatChannel: SINGLE_RX = only the proper receiver of the packet shall receive t...
virtual Ptr< PropagationDelayModel > GetPropagationDelayModel()
Get the propagation delay model to be used in the SatChannel.
virtual void DoDispose()
Dispose SatChannel.
Callback< double, SatEnums::ChannelType_t, uint32_t, uint32_t > CarrierFreqConverter
Ptr< SatFreeSpaceLoss > m_freeSpaceLoss
Free space loss model to be used with this channel.
bool m_enableFadingOutputTrace
Defines whether fading output tracing is in use or not.
SatChannel()
Default constructor.
double GetExternalFadingTrace(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx)
Function for getting the external source fading value.
void DoRxPowerCalculation(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx)
Function for calculating the Rx power.
static TypeId GetTypeId(void)
Get the type ID.
virtual void SetFrequencyId(uint32_t freqId)
Set the frequency id of the channel.
void DoRxPowerInputTrace(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx)
Function for Rx power input trace.
SatTypedefs::CarrierBandwidthConverter_t m_carrierBandwidthConverter
Bandwidth converter callback.
virtual void SetChannelType(SatEnums::ChannelType_t chType)
Set the type of the channel.
bool m_enableRxPowerOutputTrace
Defines whether Rx power output tracing is in use or not.
std::vector< Ptr< SatPhyRx > > PhyRxContainer
Define type PhyRxContainer.
uint32_t m_freqId
Frequency id of the channel.
virtual void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
Set the propagation delay model to be used in the SatChannel.
virtual void RemoveRx(Ptr< SatPhyRx > phyRx)
This method is used to remove a SatPhyRx instance from a SatChannel instance, e.g.
Mac48Address GetSourceAddress(Ptr< SatSignalParameters > rxParams)
Function for getting the source MAC address from Rx parameters.
void DoFadingOutputTrace(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx, double fadingValue)
Function for fading output trace.
virtual Ptr< NetDevice > GetDevice(std::size_t i) const
Get a device for a certain receiver index.
virtual void SetBandwidthConverter(SatTypedefs::CarrierBandwidthConverter_t converter)
Set the bandwidth converter callback.
virtual SatEnums::ChannelType_t GetChannelType()
Get the type of the channel.
PhyRxContainer m_phyRxContainer
Container of SatPhyRx instances attached to the channel.
void ScheduleRx(Ptr< SatSignalParameters > txParams, Ptr< SatPhyRx > phyRx)
Used internally to schedule the StartRx method call after the propagation delay.
void StartRx(Ptr< SatSignalParameters > rxParams, Ptr< SatPhyRx > phyRx)
Used internally to start the packet reception of at the phyRx.
virtual void StartTx(Ptr< SatSignalParameters > params)
Used by attached SatPhyTx instances to transmit signals to the channel.
virtual ~SatChannel()
Destructor for SatChannel.
virtual void SetFreeSpaceLoss(Ptr< SatFreeSpaceLoss > delay)
Set the propagation delay model to be used in the SatChannel.
CarrierFreqConverter m_carrierFreqConverter
Frequency converter callback.
SatEnums::ChannelType_t m_channelType
Type of the channel.
virtual void AddRx(Ptr< SatPhyRx > phyRx)
This method is used to attach the receiver entity SatPhyRx instance to a SatChannel instance,...
Ptr< PropagationDelayModel > m_propagationDelay
Propagation delay model to be used with this channel.
virtual void SetFrequencyConverter(CarrierFreqConverter converter)
Set the frequency converter callback.
bool m_enableExternalFadingInputTrace
Defines whether external fading input tracing is in use or not.
virtual std::size_t GetNDevices(void) const
virtual Ptr< SatFreeSpaceLoss > GetFreeSpaceLoss() const
Get the propagation delay model used in the SatChannel.
SatEnums::RxPowerCalculationMode_t m_rxPowerCalculationMode
Defines the mode used for Rx power calculation.
SatChannelFwdMode_e
ONLY_DEST_NODE = only the receivers to which this transmission is intended to shall receive the packe...
ChannelType_t
Types of channel.
RxPowerCalculationMode_t
Modes of Rx power calculation.
Callback< double, SatEnums::ChannelType_t, uint32_t, SatEnums::CarrierBandwidthType_t > CarrierBandwidthConverter_t
Callback for carrier bandwidths.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.