🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
StateMapper.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstCore/TimePoint.hpp"
25#include "AstCore/OrbitElement.hpp"
26#include "AstMath/Vector.hpp"
27#include "AstMath/Matrix.hpp"
28
29AST_NAMESPACE_BEGIN
30
39{
40public:
41 StateMapper() = default;
42 virtual ~StateMapper() = default;
43
47 virtual void toState(const double* y, double x, SpacecraftState& state) const = 0;
48
52 virtual void fromState(const SpacecraftState& state, double* y, double& x) const = 0;
53
57 virtual void toState(const double* y, CartState& state) const = 0;
58 CartState toCartState(const double* y) const{CartState state{}; toState(y, state); return state;}
59
60
65 virtual errc_t toStateTransitionMatrix(const double* y, Matrix6d& stm) const = 0;
66 Matrix6d toStateTransitionMatrix(const double* y) const{Matrix6d stm{}; toStateTransitionMatrix(y, stm); return stm;}
67
72 virtual errc_t toStateSensitivityWrtDrag(const double* y, Vector6d& stateSensWrtDrag) const = 0;
73 Vector6d toStateSensitivityWrtDrag(const double* y) const{Vector6d stateSensWrtDrag{}; toStateSensitivityWrtDrag(y, stateSensWrtDrag); return stateSensWrtDrag;}
74
79 virtual errc_t toStateSensitivityWrtSRP(const double* y, Vector6d& stateSensWrtSRP) const = 0;
80 Vector6d toStateSensitivityWrtSRP(const double* y) const{Vector6d stateSensWrtSRP{}; toStateSensitivityWrtSRP(y, stateSensWrtSRP); return stateSensWrtSRP;}
81
82
86 void toTime(double x, TimePoint& time) const
87 {
88 time = epoch_ + x;
89 }
90
94 void fromTime(const TimePoint& time, double& x) const
95 {
96 x = time - epoch_;
97 }
98public:
99
102 const TimePoint& epoch() const{return epoch_;}
103
106 void setEpoch(TimePoint epoch){epoch_ = epoch;}
107private:
108 TimePoint epoch_{};
109};
110
113AST_NAMESPACE_END
直角坐标
定义 OrbitElement.hpp:46
航天器状态,包含轨道状态、航天器参数(质量、面积、阻力系数、光压、密度、压力、温度等)
定义 SpacecraftState.hpp:43
状态映射器
定义 StateMapper.hpp:39
void setEpoch(TimePoint epoch)
设置参考历元
定义 StateMapper.hpp:106
virtual void fromState(const SpacecraftState &state, double *y, double &x) const =0
将状态量映射到状态向量
const TimePoint & epoch() const
获取参考历元
定义 StateMapper.hpp:102
virtual errc_t toStateSensitivityWrtDrag(const double *y, Vector6d &stateSensWrtDrag) const =0
将状态向量映射到状态相对于弹道系数B的敏感性向量(笛卡尔状态量对阻力弹道系数(B = Cd·A/m)的偏导)
virtual void toState(const double *y, CartState &state) const =0
将状态向量映射到笛卡尔状态
void fromTime(const TimePoint &time, double &x) const
将时间点映射到自变量
定义 StateMapper.hpp:94
virtual errc_t toStateSensitivityWrtSRP(const double *y, Vector6d &stateSensWrtSRP) const =0
将状态向量映射到状态相对于SRP综合参数K的敏感性向量(笛卡尔状态量对SRP综合参数(K = Cr·A/m)的偏导)
virtual errc_t toStateTransitionMatrix(const double *y, Matrix6d &stm) const =0
将状态向量映射到状态转移矩阵
virtual void toState(const double *y, double x, SpacecraftState &state) const =0
将状态向量映射到状态量
void toTime(double x, TimePoint &time) const
将自变量映射到时间点
定义 StateMapper.hpp:86
绝对时间点
定义 TimePoint.hpp:108