Loading...
Searching...
No Matches
satellite-sgp4-mobility-model.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2016 INESC TEC
4 * Copyright (c) 2021 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 * Code from https://gitlab.inesctec.pt/pmms/ns3-satellite
20 *
21 * Author: Pedro Silva <pmms@inesctec.pt>
22 * Author: Bastien Tauran <bastien.tauran@viveris.fr>
23 */
24
25#ifndef SAT_SGP4_MOBILITY_MODEL_H
26#define SAT_SGP4_MOBILITY_MODEL_H
27
28#include "julian-date.h"
30#include "satellite-sgp4io.h"
31#include "satellite-sgp4unit.h"
32
33#include "ns3/nstime.h"
34#include "ns3/vector.h"
35
36#include <stdint.h>
37#include <string>
38
39namespace ns3
40{
41
47{
48 public:
50 static const gravconsttype WGeoSys;
52 static const uint32_t TleSatInfoWidth;
53
58 static TypeId GetTypeId(void);
59
64
73 virtual void NotifyConstructionCompleted() override;
74
78 virtual ~SatSGP4MobilityModel();
79
80 // Inherited from MobilityModel
81 Ptr<MobilityModel> Copy() const override
82 {
83 return CreateObject<SatSGP4MobilityModel>(*this);
84 }
85
91 void SetStartDate(std::string startStr);
92
98
103 void SetStartTime(const JulianDate& t);
104
109 void SetTleInfo(const std::string& tle);
110
111 private:
113 struct Row
114 {
115 double r[3];
116
117 double& operator[](uint32_t i)
118 {
119 return r[i];
120 }
121
122 const double& operator[](uint32_t i) const
123 {
124 return r[i];
125 }
126 };
127
130 struct Matrix
131 {
132 public:
133 Matrix(void)
134 {
135 }
136
137 Matrix(double c00,
138 double c01,
139 double c02,
140 double c10,
141 double c11,
142 double c12,
143 double c20,
144 double c21,
145 double c22);
146
147 Row& operator[](uint32_t i)
148 {
149 return m[i];
150 }
151
152 const Row& operator[](uint32_t i) const
153 {
154 return m[i];
155 }
156
157 Vector3D operator*(const Vector3D& v) const;
158
159 Matrix Transpose(void) const;
160
161 private:
162 Row m[3];
163 };
164
165 std::string m_tle1, m_tle2;
167
168 virtual Vector DoGetVelocity() const;
169
170 virtual GeoCoordinate DoGetGeoPosition() const;
171 virtual void DoSetGeoPosition(const GeoCoordinate& position);
172 virtual Vector DoGetPosition() const;
173 virtual void DoSetPosition(const Vector& position);
174
179 bool IsInitialized(void) const;
180
186 JulianDate GetTleEpoch(void) const;
187
193 static Vector3D rTemeTorItrf(const Vector3D& rteme, const JulianDate& t);
194
200 static Matrix PefToItrf(const JulianDate& t);
201
207 static Matrix TemeToPef(const JulianDate& t);
208
214 static Vector3D rvTemeTovItrf(const Vector3D& rteme,
215 const Vector3D& vteme,
216 const JulianDate& t);
217
222
227
231 std::string m_startStr;
232
237
242
246 mutable Time m_timeLastUpdate;
247};
248
249} // namespace ns3
250
251#endif /* SAT_SGP4_MOBILITY_MODEL_H */
GeoCoordinate class is used to store and operate with geodetic coordinates.
Class to handle Julian days and provide respective Earth Orientation Parameters (EOP).
Definition julian-date.h:79
SatMobilityModel()
Default constructor.
std::string m_startStr
Simulation absolute start time in string format.
virtual void DoSetGeoPosition(const GeoCoordinate &position)
static const gravconsttype WGeoSys
World Geodetic System (WGS) constants to be used by SGP4/SDP4 models.
JulianDate GetStartTime() const
Get the time instant considered as the simulation start.
virtual void DoSetPosition(const Vector &position)
static const uint32_t TleSatInfoWidth
Satellite's information line size defined by TLE data format.
virtual void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
GeoCoordinate m_lastPosition
Last saved satellite position.
void SetStartTime(const JulianDate &t)
Set the time instant considered as the simulation start.
static Matrix PefToItrf(const JulianDate &t)
Retrieve the matrix for converting from PEF to ITRF at a given time.
Time m_updatePositionPeriod
Period of satellite position refresh, if UpdatePositionEachRequest is false.
JulianDate GetTleEpoch(void) const
Retrieve the TLE epoch time.
bool m_updatePositionEachRequest
Compute position each time a packet is transmitted.
elsetrec m_sgp4_record
SGP4/SDP4 record.
static Vector3D rvTemeTovItrf(const Vector3D &rteme, const Vector3D &vteme, const JulianDate &t)
Retrieve the satellite's velocity vector in ITRF coordinates.
static Matrix TemeToPef(const JulianDate &t)
Retrieve the matrix for converting from TEME to PEF at a given time.
Time m_timeLastUpdate
Last position update time.
std::string m_tle2
satellite's TLE data.
static TypeId GetTypeId(void)
Get the type ID.
static Vector3D rTemeTorItrf(const Vector3D &rteme, const JulianDate &t)
Retrieve the satellite's position vector in ITRF coordinates.
void SetStartDate(std::string startStr)
Set the simulation absolute start time in string format.
virtual GeoCoordinate DoGetGeoPosition() const
bool IsInitialized(void) const
Check if the satellite has already been initialized.
void SetTleInfo(const std::string &tle)
Set satellite's TLE information required for its initialization.
JulianDate m_start
Simulation absolute start time.
Ptr< MobilityModel > Copy() const override
Copy function allows one to copy the underlying MobilityModel from a MobilityModel pointer,...
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
gravconsttype
Matrix data structure to make coordinate conversion code clearer and less verbose.
Vector3D operator*(const Vector3D &v) const
const double & operator[](uint32_t i) const