satellite-phy-rx-carrier-per-window.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2018 CNES
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: Joaquin Muguerza <jmuguerza@toulouse.viveris.fr>
19  */
20 
21 #ifndef SATELLITE_PHY_RX_CARRIER_PER_WINDOW_H
22 #define SATELLITE_PHY_RX_CARRIER_PER_WINDOW_H
23 
28 
29 #include <ns3/singleton.h>
30 
31 namespace ns3
32 {
33 
34 class Address;
35 class SatPhy;
36 class SatSignalParameters;
37 class SatLinkResults;
38 class SatChannelEstimationErrorContainer;
39 class SatNodeInfo;
40 class SatPhyRxCarrier;
41 class SatPhyRxCarrierPerSlot;
42 class SatCrdsaReplicaTag;
43 
50 {
51  public:
55  typedef struct
56  {
57  Ptr<SatSignalParameters> rxParams;
58  Mac48Address destAddress;
59  Mac48Address sourceAddress;
62  bool failedSic;
65  double meanSinr;
67  std::vector<std::pair<double, double>> gamma;
69  Time duration;
71 
79  SatPhyRxCarrierPerWindow(uint32_t carrierId,
80  Ptr<SatPhyRxCarrierConf> carrierConf,
81  Ptr<SatWaveformConf> waveformConf,
82  bool randomAccessEnabled);
83 
87  virtual ~SatPhyRxCarrierPerWindow();
88 
93  static TypeId GetTypeId(void);
94 
98  void BeginEndScheduling();
99 
103  inline virtual CarrierType GetCarrierType()
104  {
105  return CarrierType::RA_ESSA;
106  }
107 
111  typedef void (*WindowLoadTraceCallback)(double windowLoad);
112 
113  protected:
117  virtual void ReceiveSlot(SatPhyRxCarrier::rxParams_s packetRxParams, const uint32_t nPackets);
118 
120 
130  TracedCallback<uint32_t, const Address&, bool> m_essaRxErrorTrace;
131 
142  TracedCallback<uint32_t, const Address&, bool> m_essaRxCollisionTrace;
143 
152  TracedCallback<double> m_windowLoadTrace;
153 
157  virtual void DoDispose();
158 
159  private:
160  typedef std::list<SatPhyRxCarrierPerWindow::essaPacketRxParams_s> packetList_t;
165 
171 
176 
181 
186 
190  void CleanOldPackets(const Time windowStartTime);
191 
195  void DoWindowEnd();
196 
200  void DoSic(packetList_t::iterator processedPacket,
201  std::pair<packetList_t::iterator, packetList_t::iterator> windowBounds);
202 
207 
212  packetList_t::iterator GetHighestSnirPacket(
213  const std::pair<packetList_t::iterator, packetList_t::iterator> windowBounds);
214 
218  std::pair<double, double> GetNormalizedPacketInterferenceTime(
220  const SatPhyRxCarrierPerWindow::essaPacketRxParams_s& interferingPacket);
221 
226  std::pair<packetList_t::iterator, packetList_t::iterator> GetWindowBounds(Time startTime,
227  Time endTime);
228 
233 
237  void ProcessWindow(Time startTime, Time endTime);
238 
243 
248 
253 
258 
263 
264  // TODO: REMOVE!
269 
274 
278  // TODO: find a more appropiate place for this parameter
280 
285 
290 
294  uint32_t m_sicEnabled;
295 };
296 
298 
299 } // namespace ns3
300 
301 #endif /* SATELLITE_PHY_RX_CARRIER_PER_WINDOW_H */
CarrierType
Possible carrier types.
Inherited the base functionality of SatPhyRxCarriers for ground station nodes.
Inherited the functionality of ground station SatPhyRxCarriers and extended it with CRDSA functionali...
bool m_windowEndSchedulingInitialized
Has the window end scheduling been initialized.
void BeginEndScheduling()
Function for initializing the window end scheduling.
uint32_t m_payloadBytesInWindow
The number of payload bytes in the window.
void CleanOldPackets(const Time windowStartTime)
Remove old packets from packet container.
Time m_windowDuration
The duration of the sliding window.
void CalculatePacketInterferenceVectors(SatPhyRxCarrierPerWindow::essaPacketRxParams_s &packet)
Calculate gamma and Interference vectors for a single packet.
void AddEssaPacket(SatPhyRxCarrierPerWindow::essaPacketRxParams_s essaPacketParams)
Function for storing the received E-SSA packets.
double GetEffectiveSnir(const SatPhyRxCarrierPerWindow::essaPacketRxParams_s &packet)
Get the effective SNIR of the packet using the Mutual Information function.
virtual void ReceiveSlot(SatPhyRxCarrier::rxParams_s packetRxParams, const uint32_t nPackets)
Receive a slot.
double CalculateNormalizedOfferedRandomAccessLoad()
Function for calculating the normalized offered random access load.
static TypeId GetTypeId(void)
Get the TypeId of the class.
Time m_windowDelay
The delay before processing a sliding window.
void DoWindowEnd()
Function called when a window ends.
TracedCallback< uint32_t, const Address &, bool > m_essaRxErrorTrace
EssaRxError trace source.
Time m_firstWindow
The time of the first window.
void MeasureRandomAccessLoad()
Function for measuring the random access load.
std::pair< double, double > GetNormalizedPacketInterferenceTime(const SatPhyRxCarrierPerWindow::essaPacketRxParams_s &packet, const SatPhyRxCarrierPerWindow::essaPacketRxParams_s &interferingPacket)
Get the normalized start and end time between two interfering packets.
SatPhyRxCarrierPerWindow(uint32_t carrierId, Ptr< SatPhyRxCarrierConf > carrierConf, Ptr< SatWaveformConf > waveformConf, bool randomAccessEnabled)
Constructor.
bool PacketCanBeDetected(const SatPhyRxCarrierPerWindow::essaPacketRxParams_s &packet)
Function for processing a window.
virtual CarrierType GetCarrierType()
Method for querying the type of the carrier.
double m_detectionThreshold
SNIR detection threshold for a packet (in magnitude)
virtual void DoDispose()
Dispose implementation.
void EliminatePreviousInterferences(SatPhyRxCarrierPerWindow::essaPacketRxParams_s &packet)
Calculate gamma and Interference vectors for a single packet.
std::pair< packetList_t::iterator, packetList_t::iterator > GetWindowBounds(Time startTime, Time endTime)
Get a pair of iterators, pointing to the first element in the window, and to the first after the wind...
void DoSic(packetList_t::iterator processedPacket, std::pair< packetList_t::iterator, packetList_t::iterator > windowBounds)
Perform SIC for a given decoded packet.
std::list< SatPhyRxCarrierPerWindow::essaPacketRxParams_s > packetList_t
Time m_windowStep
The step of the sliding window.
packetList_t m_essaPacketContainer
ESSA packet container.
uint32_t m_spreadingFactor
The spreading factor of packets.
packetList_t::iterator GetHighestSnirPacket(const std::pair< packetList_t::iterator, packetList_t::iterator > windowBounds)
Get the packet with the highst SNIR on the list.
uint32_t m_windowSicIterations
The number of SIC iterations performed on each window.
TracedCallback< double > m_windowLoadTrace
WindowLoad trace source.
TracedCallback< uint32_t, const Address &, bool > m_essaRxCollisionTrace
EssaRxError trace source.
void ProcessWindow(Time startTime, Time endTime)
Function for processing a window.
void(* WindowLoadTraceCallback)(double windowLoad)
Callback signature for WindowLoadTrace trace source.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Struct for storing the packet specific Rx parameters.
Struct for storing the E-SSA packet specific Rx parameters.