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 #include <cstddef>
38 #include <stdint.h>
39 #include <vector>
40 
41 namespace ns3
42 {
43 
66 class SatChannel : public Channel
67 {
68  public:
72  SatChannel();
73 
77  virtual ~SatChannel();
78 
85  {
88  ALL_BEAMS
89  };
90 
95  static TypeId GetTypeId(void);
96 
100  typedef std::vector<Ptr<SatPhyRx>> PhyRxContainer;
101 
109  typedef Callback<double, SatEnums::ChannelType_t, uint32_t, uint32_t> CarrierFreqConverter;
110 
115  virtual void SetPropagationDelayModel(Ptr<PropagationDelayModel> delay);
116 
121  virtual Ptr<PropagationDelayModel> GetPropagationDelayModel();
122 
127  virtual void SetChannelType(SatEnums::ChannelType_t chType);
128 
133  virtual void SetFrequencyId(uint32_t freqId);
134 
140  virtual void SetFrequencyConverter(CarrierFreqConverter converter);
141 
148 
154 
159  virtual void SetFreeSpaceLoss(Ptr<SatFreeSpaceLoss> delay);
160 
165  virtual Ptr<SatFreeSpaceLoss> GetFreeSpaceLoss() const;
166 
171  virtual void StartTx(Ptr<SatSignalParameters> params);
172 
178  virtual void AddRx(Ptr<SatPhyRx> phyRx);
179 
185  virtual void RemoveRx(Ptr<SatPhyRx> phyRx);
186 
190  virtual std::size_t GetNDevices(void) const;
191 
197  virtual Ptr<NetDevice> GetDevice(std::size_t i) const;
198 
199  private:
206 
211 
216 
221 
226 
230  uint32_t m_freqId;
231 
235  Ptr<PropagationDelayModel> m_propagationDelay;
236 
240  Ptr<SatFreeSpaceLoss> m_freeSpaceLoss;
241 
246 
251 
256 
261 
265  virtual void DoDispose();
266 
272  void ScheduleRx(Ptr<SatSignalParameters> txParams, Ptr<SatPhyRx> phyRx);
273 
280  void StartRx(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx);
281 
287  void DoRxPowerOutputTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx);
288 
294  void DoRxPowerInputTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx);
295 
301  void DoRxCnoInputTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx);
302 
309  void DoFadingOutputTrace(Ptr<SatSignalParameters> rxParams,
310  Ptr<SatPhyRx> phyRx,
311  double fadingValue);
312 
318  void DoRxPowerCalculation(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx);
319 
326  double GetExternalFadingTrace(Ptr<SatSignalParameters> rxParams, Ptr<SatPhyRx> phyRx);
327 
333  Mac48Address GetSourceAddress(Ptr<SatSignalParameters> rxParams);
334 };
335 
336 } // namespace ns3
337 
338 #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.