satellite-group-helper.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: Bastien Tauran <bastien.tauran@viveris.fr>
20  */
21 
22 #ifndef SATELLITE_GROUP_HELPER_H
23 #define SATELLITE_GROUP_HELPER_H
24 
25 #include <ns3/geo-coordinate.h>
26 #include <ns3/mobility-helper.h>
27 #include <ns3/node-container.h>
28 #include <ns3/satellite-mobility-model.h>
29 #include <ns3/satellite-position-allocator.h>
30 #include <ns3/satellite-ut-handover-module.h>
31 #include <ns3/vector.h>
32 
33 #include <algorithm>
34 #include <list>
35 #include <map>
36 #include <set>
37 #include <vector>
38 
39 namespace ns3
40 {
41 
42 class SatHelper;
43 
47 class SatGroupHelper : public Object
48 {
49  public:
54  static TypeId GetTypeId(void);
55 
60  virtual TypeId GetInstanceTypeId(void) const;
61 
66 
70  virtual ~SatGroupHelper()
71  {
72  }
73 
78  void Init(NodeContainer uts);
79 
85  void AddUtNodeToGroup(uint32_t groupId, Ptr<Node> node);
86 
92  void AddUtNodesToGroup(uint32_t groupId, NodeContainer nodes);
93 
101  void CreateGroupFromPosition(uint32_t groupId,
102  NodeContainer nodes,
103  GeoCoordinate center,
104  uint32_t radius);
105 
111  void CreateGroupsUniformly(std::vector<uint32_t> groupIds, NodeContainer nodes);
112 
119  void CreateUtNodesFromPosition(uint32_t groupId,
120  uint32_t nb,
121  GeoCoordinate center,
122  uint32_t radius);
123 
130  void AddNodeToGroupAfterScenarioCreation(uint32_t groupId, Ptr<Node> node);
131 
136  std::vector<std::pair<GeoCoordinate, uint32_t>> GetAdditionalNodesPerBeam();
137 
142  NodeContainer GetUtNodes(uint32_t groupId) const;
143 
148  uint32_t GetN();
149 
154  std::list<uint32_t> GetGroups();
155 
159  virtual void DoDispose();
160 
162 
163  private:
169  bool IsGroupExisting(uint32_t groupId) const;
170 
176  uint32_t GetGroupId(Ptr<Node> node) const;
177 
183  NodeContainer GetNodesNotAddedFromPosition(NodeContainer nodes);
184 
188  NodeContainer m_uts;
189 
193  std::map<uint32_t, std::set<Ptr<Node>>> m_groupsMap;
194 
198  std::list<uint32_t> m_groupsList;
199 
203  std::vector<std::pair<GeoCoordinate, uint32_t>> m_additionalNodesPerBeam;
204 
205  /*
206  * Map to store node to add to groups after scenario is created
207  */
208  std::map<Ptr<Node>, uint32_t> m_nodesToAdd;
209 
210  /*
211  * Tells if the scenario has been created by simulation helper.
212  * Some methods have to be called before, some after.
213  */
215 
220 };
221 
222 } // namespace ns3
223 
224 #endif /* SATELLITE_GROUP_HELPER_H */
GeoCoordinate class is used to store and operate with geodetic coordinates.
This helper is used to create groups of UTs.
std::list< uint32_t > GetGroups()
Get the list of groups created.
virtual void DoDispose()
Dispose of this class instance.
void Init(NodeContainer uts)
Initialize the helper.
NodeContainer GetUtNodes(uint32_t groupId) const
uint32_t GetN()
Count the number of groups created.
void AddUtNodesToGroup(uint32_t groupId, NodeContainer nodes)
Add several nodes to a group.
NodeContainer m_uts
The list of all the UTs in the simulation.
void CreateUtNodesFromPosition(uint32_t groupId, uint32_t nb, GeoCoordinate center, uint32_t radius)
Create a new group using a central position and a radius, and create UT nodes inside this area.
static TypeId GetTypeId(void)
Get the type ID.
std::map< Ptr< Node >, uint32_t > m_nodesToAdd
std::map< uint32_t, std::set< Ptr< Node > > > m_groupsMap
Container to associate nodes to the groups.
void AddNodeToGroupAfterScenarioCreation(uint32_t groupId, Ptr< Node > node)
Schedule a node to be added to a group when scenario creation is finished.
std::list< uint32_t > m_groupsList
List of group ID created.
virtual ~SatGroupHelper()
Destructor for SatGroupHelper.
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
bool m_satConstellationEnabled
Use a constellation of satellites.
void CreateGroupsUniformly(std::vector< uint32_t > groupIds, NodeContainer nodes)
Create several groups and distribute nodes among them.
NodeContainer GetNodesNotAddedFromPosition(NodeContainer nodes)
Get list of nodes not created from position by group helper.
bool IsGroupExisting(uint32_t groupId) const
Tells if the groupId is already existing in the database.
std::vector< std::pair< GeoCoordinate, uint32_t > > GetAdditionalNodesPerBeam()
Get the position of nodes to add to the scenario.
SatGroupHelper()
Default constructor for SatGroupHelper.
uint32_t GetGroupId(Ptr< Node > node) const
Get the group to which a node belongs.
void CreateGroupFromPosition(uint32_t groupId, NodeContainer nodes, GeoCoordinate center, uint32_t radius)
Create a new group using a central position and a radius.
std::vector< std::pair< GeoCoordinate, uint32_t > > m_additionalNodesPerBeam
Nodes created by position to add to scenario.
void AddUtNodeToGroup(uint32_t groupId, Ptr< Node > node)
Add a node to a group.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.