A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
leo-circular-orbit-position-allocator.cc
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/**
9 * @file
10 * @ingroup leo
11 * Implementation of LeoCircularOrbitAllocator.
12 */
13
15
16#include "math.h"
17
18#include "ns3/double.h"
19#include "ns3/uinteger.h"
20
21namespace ns3
22{
23
25
29
33
36{
37 static TypeId tid =
38 TypeId("ns3::LeoCircularOrbitPositionAllocator")
40 .SetGroupName("Leo")
41 .AddConstructor<LeoCircularOrbitAllocator>()
42 .AddAttribute("NumOrbits",
43 "The number of orbits",
48 .AddAttribute("NumSatellites",
49 "The number of satellites per orbit",
54 .AddAttribute("PhasingFactor",
55 "Walker Delta phasing factor F; staggers satellites in "
56 "adjacent planes by F * 360 / T degrees, where "
57 "T = NumOrbits * NumSatellites",
62 .AddAttribute("RaanSpanDeg",
63 "Total RAAN span in degrees over which orbital planes "
64 "are distributed (360 for Walker Delta, 180 for Walker Star)",
65 DoubleValue(360.0),
68 MakeDoubleChecker<double>(0.0, 360.0));
69 return tid;
70}
71
72int64_t
74{
75 return 0;
76}
77
78Vector
80{
81 auto params = GetNextOrbitPosition();
82 return Vector{params.longitude, params.argumentOfLatitude, params.satelliteIndex};
83}
84
87{
88 double phasingOffset = m_config.m_phasingFactor * m_lastOrbit * 360.0 /
89 (m_config.m_numOrbits * m_config.m_numSatellites);
90 LeoOrbitPosition params{m_config.m_raanSpanDeg * (m_lastOrbit / (double)m_config.m_numOrbits),
91 360.0 * (m_lastSatellite / (double)m_config.m_numSatellites) +
92 phasingOffset,
94
95 m_lastSatellite = (m_lastSatellite + 1) % m_config.m_numSatellites;
96 if (!m_lastSatellite)
97 {
98 m_lastOrbit = (m_lastOrbit + 1) % m_config.m_numOrbits;
99 }
100
101 return params;
102}
103
104}; // namespace ns3
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
Allocate pairs of longitude and latitude (offset within orbit) for use in LeoCircularOrbitMobilityMod...
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
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:999
Hold an unsigned integer type.
Definition uinteger.h:34
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Declaration of LeoCircularOrbitAllocator.
log2() macro definition; to deal with Bug 1467.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition double.h:82
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition double.h:32
Represents a position in a Walker constellation as a pair of angular coordinates.