Loading...
Searching...
No Matches
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-handover-module.h"
29#include "ns3/satellite-mobility-model.h"
30#include "ns3/satellite-position-allocator.h"
31#include "ns3/vector.h"
32
33#include <algorithm>
34#include <list>
35#include <map>
36#include <set>
37#include <stdint.h>
38#include <utility>
39#include <vector>
40
41namespace ns3
42{
43
44class SatHelper;
45
49class SatGroupHelper : public Object
50{
51 public:
56 static TypeId GetTypeId(void);
57
62
67 {
68 }
69
73 void Init();
74
80 void AddUtNodeToGroup(uint32_t groupId, Ptr<Node> node);
81
87 void AddUtNodesToGroup(uint32_t groupId, NodeContainer nodes);
88
96 void CreateGroupFromPosition(uint32_t groupId,
97 NodeContainer nodes,
98 GeoCoordinate center,
99 uint32_t radius);
100
106 void CreateGroupsUniformly(std::vector<uint32_t> groupIds, NodeContainer nodes);
107
114 void CreateUtNodesFromPosition(uint32_t groupId,
115 uint32_t nb,
116 GeoCoordinate center,
117 uint32_t radius);
118
125 void AddNodeToGroupAfterScenarioCreation(uint32_t groupId, Ptr<Node> node);
126
131 std::vector<std::pair<GeoCoordinate, uint32_t>> GetAdditionalNodesPerBeam();
132
137 NodeContainer GetUtNodes(uint32_t groupId) const;
138
143 uint32_t GetN();
144
149 std::list<uint32_t> GetGroups();
150
154 virtual void DoDispose();
155
157
158 private:
164 bool IsGroupExisting(uint32_t groupId) const;
165
171 uint32_t GetGroupId(Ptr<Node> node) const;
172
178 NodeContainer GetNodesNotAddedFromPosition(NodeContainer nodes);
179
183 std::map<uint32_t, std::set<Ptr<Node>>> m_groupsMap;
184
188 std::list<uint32_t> m_groupsList;
189
193 std::vector<std::pair<GeoCoordinate, uint32_t>> m_additionalNodesPerBeam;
194
195 /*
196 * Map to store node to add to groups after scenario is created
197 */
198 std::map<Ptr<Node>, uint32_t> m_nodesToAdd;
199
200 /*
201 * Tells if the scenario has been created by simulation helper.
202 * Some methods have to be called before, some after.
203 */
205
210};
211
212} // namespace ns3
213
214#endif /* SATELLITE_GROUP_HELPER_H */
GeoCoordinate class is used to store and operate with geodetic coordinates.
std::list< uint32_t > GetGroups()
Get the list of groups created.
virtual void DoDispose()
Dispose of this class instance.
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.
void Init()
Initialize the helper.
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.
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.
Build a satellite network set with needed objects and configuration.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.