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 <map>
47 #include <math.h>
48 #include <stdint.h>
49 #include <utility>
50 #include <vector>
51 
52 namespace ns3
53 {
54 
68 class SatFwdLinkScheduler : public Object
69 {
70  public:
74  typedef enum
75  {
82 
91  static bool CompareSoFlowId(Ptr<SatSchedulingObject> obj1, Ptr<SatSchedulingObject> obj2);
92 
101  static bool CompareSoPriorityLoad(Ptr<SatSchedulingObject> obj1, Ptr<SatSchedulingObject> obj2);
102 
111  static bool CompareSoPriorityHol(Ptr<SatSchedulingObject> obj1, Ptr<SatSchedulingObject> obj2);
112 
117  static TypeId GetTypeId(void);
118 
123  virtual TypeId GetInstanceTypeId(void) const;
124 
132 
140  SatFwdLinkScheduler(Ptr<SatBbFrameConf> conf,
141  Mac48Address address,
142  double carrierBandwidthInHz);
143 
150 
156  virtual std::pair<Ptr<SatBbFrame>, const Time> GetNextFrame();
157 
162  typedef Callback<void, std::vector<Ptr<SatSchedulingObject>>&> SchedContextCallback;
163 
173  typedef Callback<Ptr<Packet>, uint32_t, Mac48Address, uint8_t, uint32_t&, uint32_t&>
175 
182  typedef Callback<bool, Ptr<SatControlMessage>, const Address&> SendControlMsgCallback;
183 
191 
198 
204 
210  bool SendControlMsg(Ptr<SatControlMessage> message, const Address& dest) const;
211 
218  void CnoInfoUpdated(Mac48Address utAddress, double cnoEstimate);
219 
226  Time GetDefaultFrameDuration() const;
227 
231  void SetDummyFrameSendingEnabled(bool dummyFrameSendingEnabled);
232 
236  virtual void ClearAllPackets();
237 
238  protected:
239  typedef std::map<Mac48Address, Ptr<SatCnoEstimator>> CnoEstimatorMap_t;
240 
243 
247  void DoDispose(void);
248 
252  void ScheduleBbFrames();
253 
261  bool CnoMatchWithFrame(double cno, Ptr<SatBbFrame> frame) const;
262 
268  double GetSchedulingObjectCno(Ptr<SatSchedulingObject> ob);
269 
273  virtual void SendAndClearSymbolsSentStat();
274 
278  void PeriodicTimerExpired();
279 
286  void GetSchedulingObjects(std::vector<Ptr<SatSchedulingObject>>& output);
287 
293  void SortSchedulingObjects(std::vector<Ptr<SatSchedulingObject>>& so);
294 
299  Ptr<SatCnoEstimator> CreateCnoEstimator();
300 
304  Mac48Address m_macAddress;
305 
311 
315  Ptr<UniformRandomVariable> m_random;
316 
322 
326  Ptr<SatBbFrameConf> m_bbFrameConf;
327 
332 
339 
344 
349 
354 
359 
364 
369 
373  TracedCallback<uint8_t, double> m_schedulingSymbolRateTrace;
374 };
375 
376 } // namespace ns3
377 
378 #endif /* SAT_FWD_LINK_SCHEDULER_H */
EstimationMode_t
Definition of modes for estimator.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.