WSF
WsfNORAD_PropagatorInverter.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2017 Infoscitex, a DCS Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFNORADPROPAGATORINVERTER_HPP
13#define WSFNORADPROPAGATORINVERTER_HPP
14
15#include "wsf_space_export.h"
16
17#include <memory>
18
19#include "UtCalendar.hpp"
20#include "UtECI_Conversion.hpp"
21#include "UtMatrix.hpp"
22#include "UtNewtonRaphson.hpp"
23#include "UtOrbitalState.hpp"
24#include "UtTwoLineElement.hpp"
25#include "UtVec3.hpp"
26
28
30class WSF_SPACE_EXPORT WsfNORAD_PropagatorInverter
31{
32public:
39 WsfNORAD_PropagatorInverter(const ut::OrbitalState& aOsculatingInitialState,
40 std::unique_ptr<WsfNORAD_OrbitalPropagator> aPropPtr);
41
43 bool SolutionFound() const { return mSolutionFound; }
44
46 ut::OrbitalState GetOrbitalState() const;
47
49 UtTwoLineElement GetTwoLineElement() const;
50
51private:
53 class StateVector
54 {
55 public:
56 StateVector(const ut::OrbitalState::Vector& aVector);
57 explicit StateVector(const UtMatrixd& aMatrix);
58 StateVector() = default;
59
60 UtVec3d Position() const;
61 UtVec3d Velocity() const;
62
63 StateVector operator-(const StateVector& aOther) const;
64 StateVector operator*(double aScalar) const;
65
66 double Component(int aIndex) const { return mVec(aIndex); }
67
68 const UtMatrixd& Vector() const { return mVec; }
69
70 static const int cDIMENSION = 6;
71
72 private:
73 UtMatrixd mVec;
74 };
75
77 class SearchVector
78 {
79 public:
80 explicit SearchVector(const UtTwoLineElement& aElements);
81 explicit SearchVector(const UtMatrixd& aMatrix);
82 explicit SearchVector(double aFillValue);
83
84 UtTwoLineElement GetTLE(const UtCalendar& aEpoch, const UtTwoLineElement& aReferenceTLE) const;
85
86 SearchVector& operator+=(const SearchVector& aOther);
87 SearchVector& operator-=(const SearchVector& aOther);
88 SearchVector operator+(const SearchVector& aOther) const;
89 SearchVector operator*(double aScalar) const;
90
91 double Component(int aIndex) const;
92
93 static SearchVector UnitVector(int aIndex, double aValue = 1.0);
94
95 static const int cDIMENSION = 6;
96
97 private:
98 UtMatrixd mVec;
99 };
100
102 // TODO finish the description here about the requirements of Q and X
103 template<typename Q, typename X>
104 class Jacobian
105 {
106 public:
107 static_assert(Q::cDIMENSION == X::cDIMENSION, "Search and State space must have the same dimension");
108
109 Jacobian()
110 : mMat(Q::cDIMENSION, Q::cDIMENSION)
111 {
112 }
113
114 void SetColumn(int aIndex, const X& aStateColumn)
115 {
116 for (int i = 0; i < cDIMENSION; ++i)
117 {
118 mMat(i, aIndex) = aStateColumn.Component(i);
119 }
120 }
121
122 Q InverseProduct(const X& aState) const
123 {
124 UtMatrixd Jinv;
125 Jinv.Invert(mMat);
126
127 UtMatrixd retval;
128 retval.Multiply(Jinv, aState.Vector());
129
130 return Q{retval};
131 }
132
133 static const int cDIMENSION = Q::cDIMENSION;
134
135 private:
136 UtMatrixd mMat;
137 };
138
139 using FullStateSolver = ut::NewtonRaphson<SearchVector, StateVector, Jacobian<SearchVector, StateVector>>;
140
141 StateVector Propagate(const SearchVector& aElems) const;
142 SearchVector InitialOsculatingElements(const StateVector& aState) const;
143
144 std::unique_ptr<WsfNORAD_OrbitalPropagator> mPropPtr;
145 UtCalendar mEpoch;
146 UtECI_Conversion mECI_TEME_Converter;
147 StateVector mTargetStateTEME;
148 SearchVector mSearchSolution;
149 bool mSolutionFound;
150 UtTwoLineElement mReferenceTLE;
151};
152
153
154#endif // WSFNORADPROPAGATORINVERTER_HPP
Definition WsfNORAD_OrbitalPropagator.hpp:35
WsfNORAD_PropagatorInverter(const ut::OrbitalState &aOsculatingInitialState, std::unique_ptr< WsfNORAD_OrbitalPropagator > aPropPtr)
Definition WsfNORAD_PropagatorInverter.cpp:29
bool SolutionFound() const
Returns if a solution was found during construction.
Definition WsfNORAD_PropagatorInverter.hpp:43
Copyrights Multiple, All Rights Reserved