A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
leo-circular-orbit-position-allocator.h
Go to the documentation of this file.
1// Copyright (c) Tim Schubert
2//
3// SPDX-License-Identifier: GPL-2.0-only
4//
5// Author: Tim Schubert <ns-3-leo@timschubert.net>
6// Porting: Thiago Miyazaki <miyathiago@gmail.com> <t.miyazaki@unesp.br>
7
8#ifndef LEO_CIRCULAR_ORBIT_POSITION_ALLOCATOR_H
9#define LEO_CIRCULAR_ORBIT_POSITION_ALLOCATOR_H
10
11#include "position-allocator.h"
12
13/**
14 * @file
15 * @ingroup leo
16 *
17 * Declaration of LeoCircularOrbitAllocator
18 */
19
20namespace ns3
21{
22
23/**
24 * @ingroup leo
25 * @brief Represents a position in a Walker constellation as a pair of angular
26 * coordinates.
27 *
28 * The fields are in degrees to match the LeoCircularOrbitMobilityModel
29 * SetPosition() interface (longitude/argument of latitude in degrees).
30 */
32{
33 double longitude; ///< Longitude of the ascending node in degrees
34 double argumentOfLatitude; ///< Argument of latitude (orbital offset) in degrees
35 double satelliteIndex; ///< Satellite index within the plane (kept for compat)
36};
37
38/**
39 * @ingroup leo
40 * @brief Allocate pairs of longitude and latitude (offset within orbit) for
41 * use in LeoCircularOrbitMobilityModel
42 */
44{
45 public:
46 /**
47 * @brief Get the type ID.
48 * @return the object TypeId
49 */
50 static TypeId GetTypeId();
51
52 /// constructor
54 /// destructor
56
57 /**
58 * @brief Gets the next position on the longitude grid
59 *
60 * If all positions have been returned once, the first position is returned
61 * again and so on.
62 *
63 * @return LeoOrbitPosition with longitude of the ascending node in degrees
64 * (x), orbital offset / argument of latitude in degrees (y), and
65 * the satellite index within the plane (z).
66 */
68
69 /**
70 * @brief Gets the next position on the longitude grid (base class compat)
71 *
72 * If all positions have been returned once, the first position is returned
73 * again and so on.
74 *
75 * @return Vector where x is the longitude of the ascending node in
76 * degrees, y is the orbital offset in degrees, and z is the
77 * satellite index within the plane.
78 */
79 Vector GetNext() const override;
80
81 // Inherited
82 int64_t AssignStreams(int64_t stream) override;
83
84 /**
85 * @brief Set the number of orbits (planes) in the constellation.
86 *
87 * @param num Number of orbits.
88 */
89 void SetNumOrbits(uint64_t num)
90 {
91 m_config.m_numOrbits = num;
92 }
93
94 /**
95 * @brief Get the number of orbits (planes) in the constellation.
96 *
97 * @return Number of orbits.
98 */
99 uint64_t GetNumOrbits() const
100 {
101 return m_config.m_numOrbits;
102 }
103
104 /**
105 * @brief Set the number of satellites per orbit.
106 *
107 * @param num Number of satellites.
108 */
109 void SetNumSatellites(uint64_t num)
110 {
111 m_config.m_numSatellites = num;
112 }
113
114 /**
115 * @brief Get the number of satellites per orbit.
116 *
117 * @return Number of satellites per orbit.
118 */
119 uint64_t GetNumSatellites() const
120 {
121 return m_config.m_numSatellites;
122 }
123
124 /**
125 * @brief Set the phasing factor (angular spacing between adjacent orbits).
126 *
127 * @param factor Phasing factor value.
128 */
129 void SetPhasingFactor(uint16_t factor)
130 {
131 m_config.m_phasingFactor = factor;
132 }
133
134 /**
135 * @brief Get the phasing factor.
136 *
137 * @return Phasing factor.
138 */
139 uint16_t GetPhasingFactor() const
140 {
141 return m_config.m_phasingFactor;
142 }
143
144 /**
145 * @brief Set the RAAN (Right Ascension of the Ascending Node) span in degrees.
146 *
147 * @param deg RAAN span in degrees.
148 */
149 void SetRaanSpanDeg(double deg)
150 {
151 m_config.m_raanSpanDeg = deg;
152 }
153
154 /**
155 * @brief Get the RAAN span in degrees.
156 *
157 * @return RAAN span in degrees.
158 */
159 double GetRaanSpanDeg() const
160 {
161 return m_config.m_raanSpanDeg;
162 }
163
164 private:
165 /**
166 * @brief Configuration parameters for the LEO circular orbit allocator.
167 */
168 struct Config
169 {
170 uint64_t m_numOrbits; ///< Number of orbits (planes)
171 uint64_t m_numSatellites; ///< Number of satellites per orbit
172 uint16_t m_phasingFactor; ///< Phasing factor (angular spacing)
173 double m_raanSpanDeg; ///< RAAN span in degrees
174 } m_config; ///< Configuration parameters
175
176 /// The last orbit that has been assigned
177 mutable uint64_t m_lastOrbit{0};
178 /// The last position inside the orbit that has been assigned
179 mutable uint64_t m_lastSatellite{0};
180};
181
182}; // namespace ns3
183
184#endif
Vector GetNext() const override
Gets the next position on the longitude grid (base class compat).
uint64_t m_lastOrbit
The last orbit that has been assigned.
double GetRaanSpanDeg() const
Get the RAAN span in degrees.
uint64_t GetNumOrbits() const
Get the number of orbits (planes) in the constellation.
void SetRaanSpanDeg(double deg)
Set the RAAN (Right Ascension of the Ascending Node) span in degrees.
void SetNumSatellites(uint64_t num)
Set the number of satellites per orbit.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
uint64_t GetNumSatellites() const
Get the number of satellites per orbit.
LeoOrbitPosition GetNextOrbitPosition() const
Gets the next position on the longitude grid.
uint64_t m_lastSatellite
The last position inside the orbit that has been assigned.
void SetNumOrbits(uint64_t num)
Set the number of orbits (planes) in the constellation.
struct ns3::LeoCircularOrbitAllocator::Config m_config
Configuration parameters.
uint16_t GetPhasingFactor() const
Get the phasing factor.
void SetPhasingFactor(uint16_t factor)
Set the phasing factor (angular spacing between adjacent orbits).
a unique identifier for an interface.
Definition type-id.h:50
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Configuration parameters for the LEO circular orbit allocator.
uint64_t m_numSatellites
Number of satellites per orbit.
uint16_t m_phasingFactor
Phasing factor (angular spacing).
Represents a position in a Walker constellation as a pair of angular coordinates.
double argumentOfLatitude
Argument of latitude (orbital offset) in degrees.
double longitude
Longitude of the ascending node in degrees.
double satelliteIndex
Satellite index within the plane (kept for compat).