WSF
WsfRigidBodySixDOF_ThrustProducerObject.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 WSFRIGIDBODYTHRUSTPRODUCEROBJECT_HPP
13#define WSFRIGIDBODYTHRUSTPRODUCEROBJECT_HPP
14
15class UtInput;
19
20namespace wsf
21{
22namespace six_dof
23{
25
26class WSF_SIX_DOF_EXPORT RigidBodyThrustProducerObject : public ThrustProducerObject
27{
28public:
29 // This is used to create a type of a RigidBodyThrustProducerObject
33
34 ThrustProducerObject* Clone() const override;
35
36 // ProcessInput is called to read input data from a UtInput stream, which
37 // is typically an 'input file'.
38 bool ProcessInput(UtInput& aInput, TypeManager* aTypeManager) override;
39
40 // ThrustProducerObject-derived classes should include CalculateThrust and
41 // UpdateThrust functions. CalculateThrust performs calculations but does
42 // not update 'state' while UpdateThrust performs calculations and also
43 // updates the state.
44
45 // The CalculateThrust function is called to calculate the engine's
46 // forces and moments. It does not change the state of the engine.
47 // To change the state, call UpdateThrust instead. This version
48 // uses the thrust producer's internal throttle values.
49 void CalculateThrust(double aDeltaT_sec,
50 double aAlt_ft,
51 double aDynPress_lbsqft,
52 double aStatPress_lbssqft,
53 double aSpeed_fps,
54 double aMach,
55 double aAlpha_rad,
56 double aBeta_rad,
57 ForceAndMomentsObject& aForceAndMoment,
58 double& aFuelBurnRate_pps,
59 double& aFuelBurned_lbs);
60
61 // The UpdateThrust function is called to calculate the engine's
62 // forces and moments and update the state of the engine.
63 // To perform F&M calculations without changing the state, call the
64 // CalculateThrust function instead.
65 void UpdateThrust(double aDeltaT_sec,
66 double aAlt_ft,
67 double aDynPress_lbsqft,
68 double aStatPress_lbssqft,
69 double aSpeed_fps,
70 double aMach,
71 double aAlpha_rad,
72 double aBeta_rad,
73 ForceAndMomentsObject& aForceAndMoment,
74 double& aFuelBurnRate_pps,
75 double& aFuelBurned_lbs);
76
77 double GetThrottleMilSetting() override { return mThrottleSettingMIL->value; }
78 double GetThrottleAbSetting() override { return mThrottleSettingAB->value; }
79
80 // Set reference location and attitude (YPR) relative to parent
81 void SetThrustReferenceOffsetAttitude(const UtVec3dX& aReferenceLocation_ft, const UtVec3dX& aThrustYPR_rad) override;
82
83 // Attitude of thrust vectoring relative to engine
84 void SetThrustVectoringYaw_deg(double aThrustVectoringYaw_deg);
85
86 // Attitude of thrust vectoring relative to engine
87 void SetThrustVectoringPitch_deg(double aThrustVectoringPitch_deg);
88
89 // Attitude of thrust vectoring relative to engine
90 double GetThrustVectoringYaw_deg() const;
91
92 // Attitude of thrust vectoring relative to engine
93 double GetThrustVectoringPitch_deg() const;
94
95 // Enable (disable) thrust reverser
96 void SetThrustReverserEnabled(bool aThrustReverserEnabled) { mThrustReverserEnabled = aThrustReverserEnabled; }
97
98 // Returns whether thrust reverser is enabled
100
101 // Sets thrust reverser: 0=Off, 1=FullReverse
102 void SetThrustReverserSetting(double aThrustReverserSetting);
103
104 // Gets thrust reverser setting
106
107 // Direction of thrust relative to parent
108 void GetCurrentThrustVectorDirection(UtVec3dX& aDirection) const override;
109
110 // CalcCurrentThrustVectors provides the current thrust unit vector and thrust location
111 // in body coordinates including any thrust vectoring and reversing. The
112 // aThrustFactor indicates the magnitude factor for the thrust (positive is forward thrust
113 // and negative is reverse thrust, ranging from:
114 // 1 = full forward thrust to -0.5 = full reverse thrust
115 void CalcCurrentThrustVectors();
116
117 // .....................................................................................................
118
120 {
121 std::string name;
122 size_t handle = 0;
123 double value = 0.0;
124 };
125
127 {
128 std::string name;
129 size_t handle = 0;
130 bool value = false;
131 };
132
133 void SetControlInputHandles(const RigidBodyFlightControlSystem* aFlightControls);
134 void SetControlInputValues(const RigidBodyFlightControlSystem* aFlightControls);
135
136 static void SetControlInputHandle(const RigidBodyFlightControlSystem* aFlightControls,
137 ThrustControlInputValueData* aControlInput);
138 static void SetControlInputValue(const RigidBodyFlightControlSystem* aFlightControls,
139 ThrustControlInputValueData* aControlInput);
140
141protected:
143
144 // For deep copies within the class
145 void DeriveFrom(const ThrustProducerObject* aSrc) override;
146
147 // This will return the thrust vector using the thrust magnitude and current direction
148 UtVec3dX CalcThrustVectorFromThrust(double aThrust_lbs);
149
150 // This calculates various thrust F&M vectors.
151 // It is used within the CalculateThrust function of thrust producers
152 void CalcThrustProducerFM(double aThrustMagnitude_lbs, ForceAndMomentsObject& aForceAndMoment);
153
154 // Current thrust direction vector (includes vectoring/reversing)
155 UtVec3dX mCurrentThrustVectorDirection{1.0, 0.0, 0.0};
156
157 // Thrust vectoring states
160
161 // Thrust reverser states
164
165 // This is true if a shutdown is in progress. As the shutdown
166 // process is handled, this should be set to false.
168
169 // This is used during a shut down to indicate how far into
170 // the current calculation frame the shut down occurs.
172
173 // This is used during an ignition to indicate how far into
174 // the current calculation frame the ignition occurs.
176
178
179 // These settings won't be used by all engine types
180 std::unique_ptr<ThrustControlInputValueData> mThrottleSettingMIL{nullptr};
181 std::unique_ptr<ThrustControlInputValueData> mThrottleSettingAB{nullptr};
182 std::unique_ptr<ThrustControlInputValueData> mThrottleSettingReverser{nullptr};
183 std::unique_ptr<ThrustControlInputValueData> mThrottleSettingYaw{nullptr};
184 std::unique_ptr<ThrustControlInputValueData> mThrottleSettingPitch{nullptr};
185};
186} // namespace six_dof
187} // namespace wsf
188
189
190#endif
Definition WsfSixDOF_ForceAndMomentsObject.hpp:28
Definition WsfRigidBodySixDOF_FlightControlSystem.hpp:44
Definition WsfRigidBodySixDOF_PropulsionSystem.hpp:28
double GetThrottleAbSetting() override
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:78
std::unique_ptr< ThrustControlInputValueData > mThrottleSettingMIL
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:180
std::unique_ptr< ThrustControlInputValueData > mThrottleSettingYaw
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:183
void DeriveFrom(const ThrustProducerObject *aSrc) override
Definition WsfRigidBodySixDOF_ThrustProducerObject.cpp:57
bool ThrustReverserEnabled() const
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:99
static void SetControlInputValue(const RigidBodyFlightControlSystem *aFlightControls, ThrustControlInputValueData *aControlInput)
Definition WsfRigidBodySixDOF_ThrustProducerObject.cpp:396
RigidBodyThrustProducerObject & operator=(const RigidBodyThrustProducerObject &other)=delete
bool mThrustReverserEnabled
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:162
UtVec3dX mCurrentThrustVectorDirection
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:155
static void SetControlInputHandle(const RigidBodyFlightControlSystem *aFlightControls, ThrustControlInputValueData *aControlInput)
Definition WsfRigidBodySixDOF_ThrustProducerObject.cpp:381
UtVec3dX CalcThrustVectorFromThrust(double aThrust_lbs)
Definition WsfRigidBodySixDOF_ThrustProducerObject.cpp:375
int64_t mIgniteTimeInFrame_nanosec
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:175
ThrustProducerObject * Clone() const override
Definition WsfRigidBodySixDOF_ThrustProducerObject.cpp:107
double mThrustVectorYaw_rad
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:158
std::unique_ptr< ThrustControlInputValueData > mThrottleSettingAB
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:181
int64_t mShutdownFraction_nanosec
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:171
void SetControlInputHandles(const RigidBodyFlightControlSystem *aFlightControls)
Definition WsfRigidBodySixDOF_ThrustProducerObject.cpp:170
double mThrustReverserSetting
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:163
bool mShutdownInProgress
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:167
void CalcThrustProducerFM(double aThrustMagnitude_lbs, ForceAndMomentsObject &aForceAndMoment)
Definition WsfRigidBodySixDOF_ThrustProducerObject.cpp:405
void SetControlInputValues(const RigidBodyFlightControlSystem *aFlightControls)
Definition WsfRigidBodySixDOF_ThrustProducerObject.cpp:179
void UpdateThrust(double aDeltaT_sec, double aAlt_ft, double aDynPress_lbsqft, double aStatPress_lbssqft, double aSpeed_fps, double aMach, double aAlpha_rad, double aBeta_rad, ForceAndMomentsObject &aForceAndMoment, double &aFuelBurnRate_pps, double &aFuelBurned_lbs)
Definition WsfRigidBodySixDOF_ThrustProducerObject.cpp:141
double mThrustVectorPitch_rad
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:159
bool ProcessInput(UtInput &aInput, TypeManager *aTypeManager) override
Definition WsfRigidBodySixDOF_ThrustProducerObject.cpp:188
std::unique_ptr< ThrustControlInputValueData > mThrottleSettingReverser
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:182
double GetThrottleMilSetting() override
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:77
void SetThrustReverserEnabled(bool aThrustReverserEnabled)
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:96
std::unique_ptr< ThrustControlInputValueData > mThrottleSettingPitch
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:184
double GetThrustReverserSetting() const
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:105
void CalculateThrust(double aDeltaT_sec, double aAlt_ft, double aDynPress_lbsqft, double aStatPress_lbssqft, double aSpeed_fps, double aMach, double aAlpha_rad, double aBeta_rad, ForceAndMomentsObject &aForceAndMoment, double &aFuelBurnRate_pps, double &aFuelBurned_lbs)
Definition WsfRigidBodySixDOF_ThrustProducerObject.cpp:112
double mCurrentThrustFactor
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:177
Definition WsfSixDOF_TypeManager.hpp:32
Definition WsfSA_Processor.hpp:35
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:127
std::string name
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:128
bool value
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:130
size_t handle
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:129
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:120
double value
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:123
size_t handle
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:122
std::string name
Definition WsfRigidBodySixDOF_ThrustProducerObject.hpp:121
Copyrights Multiple, All Rights Reserved