satellite-handover-module.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: Mathias Ettinger <mettinger@toulouse.viveris.fr>
19  */
20 
21 #ifndef SATELLITE_HANDOVER_MODULE_H
22 #define SATELLITE_HANDOVER_MODULE_H
23 
25 
26 #include <ns3/callback.h>
27 #include <ns3/node-container.h>
28 #include <ns3/node.h>
29 #include <ns3/nstime.h>
30 #include <ns3/object.h>
31 #include <ns3/ptr.h>
32 
33 #include <stdint.h>
34 #include <utility>
35 #include <vector>
36 
37 namespace ns3
38 {
39 
44 class SatHandoverModule : public Object
45 {
46  public:
47  typedef enum
48  {
51 
57  typedef Callback<void, uint32_t, uint32_t> HandoverRequestCallback;
58 
62  static TypeId GetTypeId(void);
63 
67  virtual TypeId GetInstanceTypeId(void) const;
68 
72  virtual void DoDispose();
73 
78 
85  SatHandoverModule(Ptr<Node> utNode,
86  NodeContainer satellites,
87  Ptr<SatAntennaGainPatternContainer> agpContainer);
88 
93 
99 
104  uint32_t GetAskedSatId();
105 
110  uint32_t GetAskedBeamId();
111 
115  void HandoverFinished();
116 
124  bool CheckForHandoverRecommendation(uint32_t satId, uint32_t beamId);
125 
126  private:
133  std::vector<uint32_t> GetNClosestSats(uint32_t numberOfSats);
134 
141  std::pair<uint32_t, uint32_t> AlgorithmNClosest(GeoCoordinate coords);
142 
147 
152 
154 
155  Ptr<Node> m_utNode;
156  NodeContainer m_satellites;
157  Ptr<SatAntennaGainPatternContainer> m_antennaGainPatterns;
158 
162  uint32_t m_askedSatId;
163  uint32_t m_askedBeamId;
164 
165  TracedCallback<double> m_antennaGainTrace;
166 };
167 
168 } // namespace ns3
169 
170 #endif /* SATELLITE_HANDOVER_MODULE_H */
GeoCoordinate class is used to store and operate with geodetic coordinates.
void HandoverFinished()
Method to call when a handover has been performed.
HandoverDecisionAlgorithm_t m_handoverDecisionAlgorithm
Algorithm used to detect if handover is needed.
uint32_t GetAskedBeamId()
Get the best beam ID.
~SatHandoverModule()
Destroy a SatHandoverModule.
void SetHandoverRequestCallback(SatHandoverModule::HandoverRequestCallback cb)
Set the handover recommendation message sending callback.
HandoverRequestCallback m_handoverCallback
virtual TypeId GetInstanceTypeId(void) const
Derived from Object.
SatHandoverModule()
Default constructor, which is not used.
bool CheckForHandoverRecommendation(uint32_t satId, uint32_t beamId)
Inspect whether or not the given beam is still suitable for the underlying mobility model.
virtual void DoDispose()
Dispose of this class instance.
std::pair< uint32_t, uint32_t > AlgorithmNClosest(GeoCoordinate coords)
Handover algorithm choosing best beam between N closest satellites.
TracedCallback< double > m_antennaGainTrace
Ptr< SatAntennaGainPatternContainer > m_antennaGainPatterns
uint32_t GetAskedSatId()
Get the best sat ID.
uint32_t m_numberClosestSats
Number of satellites to consider when using algorithm SAT_N_CLOSEST_SAT.
std::vector< uint32_t > GetNClosestSats(uint32_t numberOfSats)
Get the N closest satellites to the UT node.
static TypeId GetTypeId(void)
Derived from Object.
Callback< void, uint32_t, uint32_t > HandoverRequestCallback
Handover recommendation message sending callback.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.