satellite-fwd-link-scheduler.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: Sami Rantanen <sami.rantanen@magister.fi>
19  */
20 
21 #ifndef SAT_FWD_LINK_SCHEDULER_H
22 #define SAT_FWD_LINK_SCHEDULER_H
23 
24 #include "satellite-bbframe-conf.h"
26 #include "satellite-bbframe.h"
28 #include "satellite-mac.h"
29 #include "satellite-net-device.h"
30 #include "satellite-phy.h"
33 
34 #include <ns3/address.h>
35 #include <ns3/callback.h>
36 #include <ns3/mac48-address.h>
37 #include <ns3/node.h>
38 #include <ns3/nstime.h>
39 #include <ns3/packet.h>
40 #include <ns3/ptr.h>
41 #include <ns3/random-variable-stream.h>
42 #include <ns3/timer.h>
43 #include <ns3/traced-callback.h>
44 
45 #include <cstring>
46 #include <math.h>
47 
48 namespace ns3
49 {
50 
64 class SatFwdLinkScheduler : public Object
65 {
66  public:
70  typedef enum
71  {
78 
87  static bool CompareSoFlowId(Ptr<SatSchedulingObject> obj1, Ptr<SatSchedulingObject> obj2);
88 
97  static bool CompareSoPriorityLoad(Ptr<SatSchedulingObject> obj1, Ptr<SatSchedulingObject> obj2);
98 
107  static bool CompareSoPriorityHol(Ptr<SatSchedulingObject> obj1, Ptr<SatSchedulingObject> obj2);
108 
113  static TypeId GetTypeId(void);
114 
119  virtual TypeId GetInstanceTypeId(void) const;
120 
128 
136  SatFwdLinkScheduler(Ptr<SatBbFrameConf> conf,
137  Mac48Address address,
138  double carrierBandwidthInHz);
139 
146 
152  virtual std::pair<Ptr<SatBbFrame>, const Time> GetNextFrame();
153 
158  typedef Callback<void, std::vector<Ptr<SatSchedulingObject>>&> SchedContextCallback;
159 
169  typedef Callback<Ptr<Packet>, uint32_t, Mac48Address, uint8_t, uint32_t&, uint32_t&>
171 
178  typedef Callback<bool, Ptr<SatControlMessage>, const Address&> SendControlMsgCallback;
179 
187 
194 
200 
206  bool SendControlMsg(Ptr<SatControlMessage> message, const Address& dest) const;
207 
214  void CnoInfoUpdated(Mac48Address utAddress, double cnoEstimate);
215 
222  Time GetDefaultFrameDuration() const;
223 
227  void SetDummyFrameSendingEnabled(bool dummyFrameSendingEnabled);
228 
229  protected:
230  typedef std::map<Mac48Address, Ptr<SatCnoEstimator>> CnoEstimatorMap_t;
231 
234 
238  void DoDispose(void);
239 
243  void ScheduleBbFrames();
244 
252  bool CnoMatchWithFrame(double cno, Ptr<SatBbFrame> frame) const;
253 
259  double GetSchedulingObjectCno(Ptr<SatSchedulingObject> ob);
260 
264  virtual void SendAndClearSymbolsSentStat();
265 
269  void PeriodicTimerExpired();
270 
277  void GetSchedulingObjects(std::vector<Ptr<SatSchedulingObject>>& output);
278 
284  void SortSchedulingObjects(std::vector<Ptr<SatSchedulingObject>>& so);
285 
290  Ptr<SatCnoEstimator> CreateCnoEstimator();
291 
295  Mac48Address m_macAddress;
296 
302 
306  Ptr<UniformRandomVariable> m_random;
307 
313 
317  Ptr<SatBbFrameConf> m_bbFrameConf;
318 
323 
330 
335 
340 
345 
350 
355 
360 
364  TracedCallback<uint8_t, double> m_schedulingSymbolRateTrace;
365 };
366 
367 } // namespace ns3
368 
369 #endif /* SAT_FWD_LINK_SCHEDULER_H */
EstimationMode_t
Definition of modes for estimator.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.