🛰️航天仿真算法库 SpaceAST 0.3.1
载入中...
搜索中...
未找到
JplDe.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstCore/RunTime.hpp"
25#include "AstUtil/OrderedMap.hpp" // for OrderedMap
26#include <stdint.h> // for uint32_t
27#include <cstdio> // for FILE
28#include <string> // for std::string
29#include <mutex> // for std::mutex
30
31AST_NAMESPACE_BEGIN
32
33
42class AST_CORE_API JplDe
43{
44public:
45 // 与GMAT的DeFile类中的天体编号一致
47 {
48 eNotAvailable = -1,
50 eVenus = 1,
51 eEarth = 2,
52 eMars = 3,
54 eSaturn = 5,
55 eUranus = 6,
57 ePluto = 8,
58 eMoon = 9,
59 eSun = 10,
60 eSSBarycenter = 11,
61 eEMBarycenter = 12,
62 };
63
64 using ConstantList = std::vector<std::pair<std::string, double>>;
65 using ConstantMap = OrderedMap<std::string, double>;
66
67 JplDe();
68 ~JplDe();
69
70 JplDe(const JplDe&) = delete;
71 JplDe& operator=(const JplDe&) = delete;
72
76 errc_t open(const char* filepath);
77
78
79 errc_t openDefault();
80
83 bool isOpen() const;
84
85
87 void close();
88
89
98 errc_t getPosVelICRF(
99 const TimePoint& time,
100 EDataCode target,
101 EDataCode referenceBody,
102 Vector3d& pos,
103 Vector3d& vel
104 );
105
106 errc_t getPosVelICRF(
107 const TimePoint& time,
108 EDataCode target,
109 EDataCode referenceBody,
110 Vector3d& pos,
111 Vector3d* vel
112 );
113
114
122 errc_t getPosICRF(
123 const TimePoint& time,
124 EDataCode target,
125 EDataCode referenceBody,
126 Vector3d& pos
127 );
128
129
135 errc_t getNutation(
136 const TimePoint& time,
137 double& nutLong,
138 double& nutObl
139 );
140
141
148 errc_t getLibration(
149 const TimePoint& time,
150 Euler& ang,
151 Euler& angRate
152 );
153
154
160 errc_t getLibration(
161 const TimePoint& time,
162 Euler& ang
163 );
164
167 uint32_t getEphemVersion() const{ return ephemVersion_; }
168
169
172 uint32_t getNumConstants() const { return numConstants_; }
173
174
175 const ConstantList& getConstants() const;
176
183 errc_t getConstant(size_t index, double& value, std::string* name = nullptr) const;
184
185
191 errc_t getConstant(const std::string& name, double& value) const;
192
197 double getConstant(const std::string& name) const;
198
201 double getAU() const{ return au_ * 1000; }
202
205 double getEarthMoonMassRatio() const{ return emMassRatio_; }
206
213 double getBodyGM(EDataCode bodyCode) const;
214 errc_t getBodyGM(EDataCode bodyCode, double& value) const;
215
219 errc_t getInterval(TimeInterval& interval) const;
220
221private:
224 errc_t loadConstants() const;
225
226 errc_t readDataBlock(size_t idx);
227 errc_t getStateTDB(const JulianDate& jdTDB, int dataid, double pos[], double vel[]);
228 errc_t getStateTDB(const JulianDate& jdTDB, int datalist[11], double statelist[11][6]);
229
230 errc_t getState(const TimePoint& time, int dataid, double pos[], double vel[]);
231 errc_t getState(const TimePoint& time, int datalist[11], double statelist[11][6]);
232protected:
233
235 uint32_t ephemVersion_{ 0 };
236 uint32_t numConstants_{};
237 uint32_t numDataBlock_{0};
238 uint32_t numCoeff_{};
239 uint32_t ipt_[15][3]{};
240 double ephemStart_{0};
241 double ephemEnd_{0};
242 double ephemStep_{0};
243 double au_{};
244 double emMassRatio_{};
245 FILE* deFile_{ NULL };
246 double** dataBlocks_{NULL};
247 mutable ConstantMap constants_{};
248 mutable std::mutex mutex_{};
249};
250
251
252
255AST_NAMESPACE_END
欧拉角
定义 Euler.hpp:31
JPL DE文件接口类
定义 JplDe.hpp:43
double getEarthMoonMassRatio() const
获取JPL DE文件中的地球月球质量比
定义 JplDe.hpp:205
double getAU() const
获取JPL DE文件中的天文单位长度
定义 JplDe.hpp:201
EDataCode
定义 JplDe.hpp:47
bool isSameEndian_
二进制文件与系统大小端是否一致
定义 JplDe.hpp:234
uint32_t getEphemVersion() const
获取JPL DE文件的星历版本
定义 JplDe.hpp:167
uint32_t getNumConstants() const
获取JPL DE文件中的常量个数
定义 JplDe.hpp:172
儒略日
定义 JulianDate.hpp:86
有序映射类,保持键值对的插入顺序
定义 OrderedMap.hpp:41
时间区间
定义 TimeInterval.hpp:64
绝对时间点
定义 TimePoint.hpp:108
@ eJupiter
木星
定义 CelestialBody.hpp:443
@ eVenus
金星
定义 CelestialBody.hpp:433
@ eMoon
月球
定义 CelestialBody.hpp:436
@ eUranus
天王星
定义 CelestialBody.hpp:488
@ eMercury
水星
定义 CelestialBody.hpp:431
@ eNeptune
海王星
定义 CelestialBody.hpp:506
@ eSaturn
土星
定义 CelestialBody.hpp:461
@ eEarth
地球
定义 CelestialBody.hpp:435
@ eSun
太阳
定义 CelestialBody.hpp:429
@ eMars
火星
定义 CelestialBody.hpp:438
@ ePluto
冥王星
定义 CelestialBody.hpp:516