satellite-phy-rx-carrier-per-slot.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_RX_CARRIER_PER_SLOT_H
24 #define SATELLITE_PHY_RX_CARRIER_PER_SLOT_H
25 
27 
28 #include <ns3/mac48-address.h>
29 #include <ns3/object.h>
30 #include <ns3/ptr.h>
31 #include <ns3/traced-callback.h>
32 
33 #include <deque>
34 #include <list>
35 #include <map>
36 #include <vector>
37 
38 namespace ns3
39 {
40 
41 class SatPhyRxCarrier;
42 
49 {
50  public:
58  SatPhyRxCarrierPerSlot(uint32_t carrierId,
59  Ptr<SatPhyRxCarrierConf> carrierConf,
60  Ptr<SatWaveformConf> waveformConf,
61  bool randomAccessEnabled);
62 
66  virtual ~SatPhyRxCarrierPerSlot();
67 
72  static TypeId GetTypeId(void);
73 
77  virtual void BeginEndScheduling();
78 
83  inline void SetRandomAccessAllocationChannelId(uint8_t randomAccessAllocationChannelId)
84  {
85  m_randomAccessAllocationChannelId = randomAccessAllocationChannelId;
86  }
87 
92  inline uint8_t GetRandomAccessAllocationChannelId() const
93  {
95  }
96 
100  inline virtual CarrierType GetCarrierType()
101  {
102  return m_randomAccessEnabled ? CarrierType::RA_SLOTTED_ALOHA
103  : CarrierType::DEDICATED_ACCESS;
104  }
105 
106  protected:
111  virtual void EndRxData(uint32_t key);
112 
116  virtual void DoDispose();
117 
121  virtual void ReceiveSlot(SatPhyRxCarrier::rxParams_s packetRxParams, const uint32_t nPackets);
122 
127  {
129  }
130 
135  {
137  }
138 
144 
149  void SaveMeasuredRandomAccessLoad(double measuredRandomAccessLoad);
150 
156  virtual Ptr<SatInterference::InterferenceChangeEvent> CreateInterference(
157  Ptr<SatSignalParameters> rxParams,
158  Address rxAddress);
159 
165 
167 
177  TracedCallback<uint32_t, const Address&, bool> m_slottedAlohaRxCollisionTrace;
178 
189  TracedCallback<uint32_t, const Address&, bool> m_slottedAlohaRxErrorTrace;
190 
191  private:
200  double cSinr,
201  Ptr<SatSignalParameters> rxParams,
202  Ptr<SatInterference::InterferenceChangeEvent> interferenceEvent);
203 
205 
206  uint8_t m_randomAccessAllocationChannelId; //< Random access allocation ID
208  m_randomAccessCollisionModel; //< Random access collision model
209  double m_randomAccessConstantErrorRate; //< Constant error rate if collision model is
210  // RA_CONSTANT_COLLISION_PROBABILITY
211  uint32_t
213  // normalized offered load
214  // measurement window size
215  bool m_enableRandomAccessDynamicLoadControl; //< Is random access dynamic load control enabled
216  std::deque<double>
218  // normalized offered loads
219 
220  bool m_disableErrorHighTransmissionTime; //< Disable fatal error when transmission time is
221  // higher than propagation time, but computations are
222  // less precise
223 };
224 
225 } // namespace ns3
226 
227 #endif /* SATELLITE_PHY_RX_CARRIER_PER_SLOT_H */
RandomAccessCollisionModel
Random access collision model enum.
Base class for all SatPhyRxCarriers.
CarrierType
Possible carrier types.
const bool m_randomAccessEnabled
Is random access enabled for this carrier.
Inherited the base functionality of SatPhyRxCarriers for ground station nodes.
uint8_t m_randomAccessAllocationChannelId
PRIVATE MEMBER VARIABLES.
TracedCallback< uint32_t, const Address &, bool > m_slottedAlohaRxCollisionTrace
SlottedAlohaRxCollision trace source.
uint8_t GetRandomAccessAllocationChannelId() const
Function for getting the random access allocation channel ID.
SatPhyRxCarrierPerSlot(uint32_t carrierId, Ptr< SatPhyRxCarrierConf > carrierConf, Ptr< SatWaveformConf > waveformConf, bool randomAccessEnabled)
Constructor.
static TypeId GetTypeId(void)
Get the TypeId of the class.
virtual void EndRxData(uint32_t key)
Function for ending the packet reception from the SatChannel.
bool ProcessSlottedAlohaCollisions(double cSinr, Ptr< SatSignalParameters > rxParams, Ptr< SatInterference::InterferenceChangeEvent > interferenceEvent)
Function for processing the Slotted ALOHA collisions.
TracedCallback< uint32_t, const Address &, bool > m_slottedAlohaRxErrorTrace
SlottedAlohaRxError trace source.
virtual void ReceiveSlot(SatPhyRxCarrier::rxParams_s packetRxParams, const uint32_t nPackets)
Receive a slot.
virtual void DoDispose()
Dispose implementation.
void SaveMeasuredRandomAccessLoad(double measuredRandomAccessLoad)
Function for saving the measured random access load.
void SetRandomAccessAllocationChannelId(uint8_t randomAccessAllocationChannelId)
Function for setting the random access allocation channel ID.
SatPhyRxCarrierConf::RandomAccessCollisionModel m_randomAccessCollisionModel
virtual CarrierType GetCarrierType()
Method for querying the type of the carrier.
virtual Ptr< SatInterference::InterferenceChangeEvent > CreateInterference(Ptr< SatSignalParameters > rxParams, Address rxAddress)
Create an interference event based on Rx parameters and address.
SatPhyRxCarrierConf::RandomAccessCollisionModel GetRandomAccessCollisionModel() const
Get the random access collision model of the carrier.
bool IsRandomAccessDynamicLoadControlEnabled() const
Check if random access dynamic load control is enabled.
uint32_t m_randomAccessBitsInFrame
The number of random access bits in current frame.
std::deque< double > m_randomAccessDynamicLoadControlNormalizedOfferedLoad
double CalculateAverageNormalizedOfferedRandomAccessLoad()
Function for calculating the average normalized offered random access load.
virtual void BeginEndScheduling()
Function for initializing the frame/window end scheduling.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Struct for storing the packet specific Rx parameters.