WSF
WsfLibrationPoint.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 2020 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 WSFLIBRATIONPOINT_HPP
13#define WSFLIBRATIONPOINT_HPP
14
15#include "wsf_space_export.h"
16
17#include <memory>
18#include <string>
19#include <vector>
20
21#include "UtCalendar.hpp"
22#include "UtCentralBody.hpp"
23#include "UtCloneablePtr.hpp"
24#include "UtMat3.hpp"
25#include "UtVec3.hpp"
26
27namespace wsf
28{
29namespace space
30{
31
39class WSF_SPACE_EXPORT LibrationPoint
40{
41public:
43 enum class System
44 {
45 cSUN_EARTH,
46 cEARTH_MOON,
47 cSUN_JUPITER,
48 cUNKNOWN
49 };
50
52 enum class Point
53 {
54 cL1,
55 cL2,
56 cL3,
57 cL4,
58 cL5,
59 cUNKNOWN
60 };
61
62 explicit LibrationPoint(System aSystem);
63 ~LibrationPoint() = default;
64
66 System GetSystem() const { return mSystem; }
67
68 UtVec3d GetPositionECI(Point aPoint, const UtCalendar& aEpoch) const;
69 UtVec3d GetVelocityECI(Point aPoint, const UtCalendar& aEpoch) const;
70
71 UtVec3d TransformPositionECItoRF(const UtCalendar& aEpoch, const UtVec3d& aPositionECI) const;
72 UtVec3d TransformPositionRFtoECI(const UtCalendar& aEpoch, const UtVec3d& aPositionRF) const;
73 UtVec3d TransformVelocityECItoRF(const UtCalendar& aEpoch, const UtVec3d& aPositionECI, const UtVec3d& aVelocityECI) const;
74 UtVec3d TransformVelocityRFtoECI(const UtCalendar& aEpoch, const UtVec3d& aPositionRF, const UtVec3d& aVelocityRF) const;
75
76 double GetSystemPeriod() const;
77
78 static System GetSystemFromIdentifier(const std::string& aIdentifier);
79 static std::string GetIdentifierFromSystem(System aSystem);
80 static std::vector<std::string> GetSystemIdentifiers();
81 static Point GetPointFromIdentifier(const std::string& aIdentifier);
82 static std::string GetIdentifierFromPoint(Point aPoint);
83 static std::vector<std::string> GetPointIdentifiers();
84 static bool ValidLibrationPoint(System aSystem, Point aPoint);
85
86private:
87 static std::unique_ptr<ut::CentralBody> GetPrimaryBody(System aSystem);
88 static std::unique_ptr<ut::CentralBody> GetSecondaryBody(System aSystem);
89 void ComputeGamma();
90 double F_Gamma1(double aGamma) const;
91 double F_PrimeGamma1(double aGamma) const;
92 double F_Gamma2(double aGamma) const;
93 double F_PrimeGamma2(double aGamma) const;
94 double F_Gamma3(double aGamma) const;
95 double F_PrimeGamma3(double aGamma) const;
96 UtVec3d GetPointLocation(Point aPoint) const;
97 void UpdateTransform(const UtCalendar& aEpoch) const;
98 static void SetMatrixFromVectors(UtMat3d& aMatrix, const UtVec3d& aColumn0, const UtVec3d& aColumn1, const UtVec3d& aColumn2);
99
100 System mSystem;
101 ut::CloneablePtr<ut::CentralBody> mPrimaryBody;
102 ut::CloneablePtr<ut::CentralBody> mSecondaryBody;
103 double mMuStar; // Related to the mass ratio
104 double mGamma1; // non-dimensional position of L1
105 double mGamma2; // non-dimensional position of L2
106 double mGamma3; // non-dimensional position of L3
107
108 // Reusable data updated each time the calculations are done for a new epoch.
109 mutable UtVec3d mPosDiff;
110 mutable UtVec3d mVelDiff;
111 mutable UtVec3d mPosOriginECI;
112 mutable UtVec3d mVelOriginECI;
113 mutable UtMat3d mTransform; // transformation from rotating, primary-centered frame
114 mutable UtMat3d mTransformDot; // the time derivative of the transform
115 mutable UtCalendar mCurrentEpoch; // Current time of the transform
116};
117
118} // namespace space
119} // namespace wsf
120
121#endif // WSFLIBRATIONPOINT_HPP
Definition WsfLibrationPoint.hpp:40
System
The supported primary-secondary body pairs.
Definition WsfLibrationPoint.hpp:44
System GetSystem() const
Return the system for which this object was created.
Definition WsfLibrationPoint.hpp:66
LibrationPoint(System aSystem)
Definition WsfLibrationPoint.cpp:29
Point
Identifiers for the five libration points.
Definition WsfLibrationPoint.hpp:53
Definition WsfAtmosphere.cpp:23
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved