WSF
WsfSixDOF_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 WSFSIXDOFTHRUSTPRODUCEROBJECT_HPP
13#define WSFSIXDOFTHRUSTPRODUCEROBJECT_HPP
14
15#include "wsf_six_dof_export.h"
16
17#include <cinttypes>
18#include <string>
19#include <vector>
20
21#include "UtLog.hpp"
22#include "UtTable.hpp"
23#include "UtVec3dX.hpp"
24#include "WsfSixDOF_Engine.hpp"
25#include "WsfSixDOF_Object.hpp"
26
27namespace wsf
28{
29namespace six_dof
30{
31class MassProperties;
33
34class WSF_SIX_DOF_EXPORT ThrustProducerObject : public Object
35{
36public:
37 // This is used to create a type of a ThrustProducerObject
41
42 virtual ThrustProducerObject* Clone() const = 0;
43
44 // This sets the propulsion system to which this thrust producer belongs
46
47 // This retrieves the propulsion system to which this thrust producer belongs
49
50 // This sets the engine to which this thrust producer belongs
51 void SetEngine(std::unique_ptr<Engine> aEngine) { mEnginePtr = aEngine.release(); }
52
53 // This retrieves the engine to which this thrust producer belongs
54 const Engine* GetEngine() const { return mEnginePtr; }
55
56 virtual bool ProcessInput(UtInput& aInput, TypeManager* aTypeManager);
57
58 bool Initialize(int64_t aSimTime_nanosec) { return mEnginePtr->Initialize(aSimTime_nanosec); }
59
60 std::string GetBaseName() { return mBaseName; }
61
62 // Start the engine.
63 void Ignite(int64_t aIgniteTimeInFrame_nanosec) { mEnginePtr->Ignite(aIgniteTimeInFrame_nanosec); }
64
65 void Shutdown(int64_t aTerminateTime_nanosec = 0) { mEnginePtr->Shutdown(aTerminateTime_nanosec); };
66
67 // .....................................................................................................
68
69 // Set reference location and attitude (YPR) relative to parent
70 virtual void SetThrustReferenceOffsetAttitude(const UtVec3dX& aReferenceLocation_ft, const UtVec3dX& aThrustYPR_rad) = 0;
71
72 // This provides the maximum potential thrust available, if full throttle(s) is applied.
73 double GetMaximumPotentialThrust_lbs(double aAlt_ft,
74 double aDynPress_lbsqft,
75 double aStatPress_lbssqft,
76 double aSpeed_fps,
77 double aMach,
78 double aAlpha_rad,
79 double aBeta_rad);
80
81 // This provides the minimum potential thrust available
82 double GetMinimumPotentialThrust_lbs(double aAlt_ft,
83 double aDynPress_lbsqft,
84 double aStatPress_lbssqft,
85 double aSpeed_fps,
86 double aMach,
87 double aAlpha_rad,
88 double aBeta_rad);
89
91
92 virtual double GetThrottleMilSetting() = 0;
93 virtual double GetThrottleAbSetting() = 0;
94
95 // Location of thrust relative to parent
96 void GetThrustLocation(UtVec3dX& aThrustLocation_ft) const { aThrustLocation_ft = mThrustLocation_ft; };
97
98 // Location of thrust producer relative to parent
99 void GetReferenceLocation(UtVec3dX& aReferenceLocation_ft) const { aReferenceLocation_ft = mReferenceLocation_ft; };
100
101 // Attitude of thrust relative to parent
102 void GetThrustInstalledAnglesYPR(UtVec3dX& aThrustYPR_rad) const { aThrustYPR_rad = mThrustInstalledAnglesYPR_rad; };
103
104 // .....................................................................................................
105
106 // This returns the current throttle position
107 double GetThrottlePosition() const { return mEnginePtr->GetThrottlePosition(); }
108
109 // The SetThrottleLeverPosition function should be called prior to calling
110 // UpdateThrust so that the throttle will be properly set.
111 void SetThrottlePosition(double aThrottleLeverPosition)
112 {
113 return mEnginePtr->SetThrottlePosition(aThrottleLeverPosition);
114 }
115
116 // Enable (disable) thrust vectoring
117 void SetThrustVectoringEnabled(bool aThrustVectoringEnabled) { mThrustVectoringEnabled = aThrustVectoringEnabled; }
118
119 // Returns whether thrust vectoring is enabled
121
122 // GetFuelBurnRate_pph returns the current fuel/propellant burn rate in lbs/hr
123 double GetFuelBurnRate_pph() const { return mEnginePtr->GetFuelBurnRate_pph(); }
124
125 // This returns the last 'updated' thrust value magnitude
126 double GetThrust_lbs() const { return mEnginePtr->GetThrust_lbs(); }
127
128 // This returns the last 'updated' thrust in the forward direction
129 double GetForwardThrust_lbs() const;
130
131 // Direction of thrust relative to parent
132 virtual void GetCurrentThrustVectorDirection(UtVec3dX& aDirection) const = 0;
133
134 // SetFuelTank sets the fuel source for the engine and returns true if successful
135 virtual bool SetFuelTank(const std::string& aFuelTankName);
136
137 // .....................................................................................................
138
139 // Appearance Parameters
140 // These functions use the mEngineOperating, mEngineSmoking, mAfterburnerOn, mContrailing,
141 // and mProducingSmokeTrail parameters. For correct operation, derived engine classes
142 // should set those paramaters, as appropriate, in their overridden CalculateThrust()
143 // function, according to the specific characteristics of the type of engine.
144
145 // Returns true if the engine is operating and burning fuel
146 bool EngineOperating() const { return mEnginePtr->EngineOperating(); }
147
148 // Returns true if the engine will/may produce a engine operating appearance.
149 // If this can not be determined with the knowledge available, return true.
150 // see also EngineOperating()
151 bool MayHaveEngineOperating() const { return mEnginePtr->MayHaveEngineOperating(); }
152
153 // Returns true if the engine will/may produce engine smoke.
154 // If this can not be determined with the knowledge available, return true.
155 // see also EngineSmoking()
156 bool MayProduceEngineSmoke() const { return mEnginePtr->MayProduceEngineSmoke(); }
157
158 // Returns true if the engine will/may produce a contrail.
159 // If this can not be determined with the knowledge available, return true.
160 bool MayContrail() const { return mEnginePtr->MayContrail(); }
161
162 // Returns true if the engine is producing a smoke trail. Note that
163 // this is a dense trail of smoke, typically from a solid propellant
164 // rocket, as opposed to a limited smoke from an engine (see EngineSmoking).
165 bool ProducingSmokeTrail() const { return mEnginePtr->ProducingSmokeTrail(); }
166
167 // Returns true if the engine will/may produce a smoke trail.
168 // see also ProducingSmokeTrail()
169 // If this can not be determined with the knowledge available, return true.
170 bool MayProduceSmokeTrail() const { return mEnginePtr->MayProduceSmokeTrail(); }
171
172 // Returns true if a flame is emanating from the engine, such as that
173 // produced by an afterburner or a rocket that is producing a flame.
174 // see also AfterburnerIsPresent(), for if they function may turn on
175 bool AfterburnerOn() const { return mEnginePtr->AfterburnerOn(); }
176
177 // Returns true if the engine is producing a contrail
178 bool Contrailing() const { return mEnginePtr->Contrailing(); }
179
180 // Returns true if the engine is producing some smoke. Note that
181 // this is limited smoke from an engine and is different from a
182 // smoke trail effect, which is a dense trail of smoke, typically
183 // from a solid propellant rocket.
184 bool EngineSmoking() const { return mEnginePtr->EngineSmoking(); }
185
186 // If true, will cause an engine to smoke. When false, it stops smoking, unless the
187 // engine's nominal behavior is to smoke.
188 // Note that this is for engine smoke, not a smoke trail.
189 void MakeEngineSmoke(bool aSmoking) { mEnginePtr->MakeEngineSmoke(aSmoking); }
190
191 // Returns true if an afterburner is present on any engine
192 virtual bool AfterburnerIsPresent() const { return mEnginePtr->AfterburnerIsPresent(); }
193
194protected:
196
197 // For deep copies within the class
198 virtual void DeriveFrom(const ThrustProducerObject* aSrc);
199
200 // Common function for getting type name and base-type name, and deriving from base types as requested
201 bool ProcessInputType(UtInput& aInput, TypeManager* aTypeManager);
202
203 // Name of the type this thrust producer was derived from
204 std::string mBaseName;
205
206 // Parent object (propulsion system)
208
209 // Object that calculates the thrust force
210 UtCloneablePtr<Engine> mEnginePtr{nullptr};
211
212 // Nominal thrust direction vector (does not include vectoring/reversing)
213 UtVec3dX mNominalThrustVectorDirection = UtVec3dX::cUNIT_FORWARD;
214
215 // Rotation of thrust relative to parent
217
218 // Location of the reference point (typically center of engine)
220
221 // Location of thrust relative to parent
223
224 // Location of thrust relative to thrust producer reference point along the x-axis.
225 // A positive value is forward of the engine, negative is aft.
226 double mThrustOffset_ft = 0.0;
227
228 // A reference area that can produce drag when the engine is not operating; 1.0 by default
229 double mInOpRefArea_ft2 = 1.0;
230
232};
233} // namespace six_dof
234} // namespace wsf
235
236#endif
Definition WsfSixDOF_Engine.hpp:35
Definition WsfSixDOF_MassProperties.hpp:29
Definition WsfSixDOF_PropulsionSystem.hpp:35
Definition WsfSixDOF_ThrustProducerObject.hpp:35
virtual void GetCurrentThrustVectorDirection(UtVec3dX &aDirection) const =0
virtual bool SetFuelTank(const std::string &aFuelTankName)
Definition WsfSixDOF_ThrustProducerObject.cpp:188
double GetThrust_lbs() const
Definition WsfSixDOF_ThrustProducerObject.hpp:126
bool Contrailing() const
Definition WsfSixDOF_ThrustProducerObject.hpp:178
PropulsionSystem * mParentPropulsionSystemPtr
Definition WsfSixDOF_ThrustProducerObject.hpp:207
double GetMaximumPotentialThrust_lbs(double aAlt_ft, double aDynPress_lbsqft, double aStatPress_lbssqft, double aSpeed_fps, double aMach, double aAlpha_rad, double aBeta_rad)
Definition WsfSixDOF_ThrustProducerObject.cpp:142
void MakeEngineSmoke(bool aSmoking)
Definition WsfSixDOF_ThrustProducerObject.hpp:189
void GetReferenceLocation(UtVec3dX &aReferenceLocation_ft) const
Definition WsfSixDOF_ThrustProducerObject.hpp:99
bool mThrustVectoringEnabled
Definition WsfSixDOF_ThrustProducerObject.hpp:231
void Shutdown(int64_t aTerminateTime_nanosec=0)
Definition WsfSixDOF_ThrustProducerObject.hpp:65
bool Initialize(int64_t aSimTime_nanosec)
Definition WsfSixDOF_ThrustProducerObject.hpp:58
double GetMinimumPotentialThrust_lbs(double aAlt_ft, double aDynPress_lbsqft, double aStatPress_lbssqft, double aSpeed_fps, double aMach, double aAlpha_rad, double aBeta_rad)
Definition WsfSixDOF_ThrustProducerObject.cpp:159
virtual bool AfterburnerIsPresent() const
Definition WsfSixDOF_ThrustProducerObject.hpp:192
bool MayProduceEngineSmoke() const
Definition WsfSixDOF_ThrustProducerObject.hpp:156
std::string GetBaseName()
Definition WsfSixDOF_ThrustProducerObject.hpp:60
const Engine * GetEngine() const
Definition WsfSixDOF_ThrustProducerObject.hpp:54
double GetInoperatingDragArea_ft2()
Definition WsfSixDOF_ThrustProducerObject.cpp:176
bool ThrustVectoringEnabled() const
Definition WsfSixDOF_ThrustProducerObject.hpp:120
void SetParentPropulsionSystem(PropulsionSystem *aParent)
Definition WsfSixDOF_ThrustProducerObject.hpp:45
bool AfterburnerOn() const
Definition WsfSixDOF_ThrustProducerObject.hpp:175
virtual void SetThrustReferenceOffsetAttitude(const UtVec3dX &aReferenceLocation_ft, const UtVec3dX &aThrustYPR_rad)=0
UtVec3dX mThrustLocation_ft
Definition WsfSixDOF_ThrustProducerObject.hpp:222
double mInOpRefArea_ft2
Definition WsfSixDOF_ThrustProducerObject.hpp:229
UtVec3dX mReferenceLocation_ft
Definition WsfSixDOF_ThrustProducerObject.hpp:219
PropulsionSystem * GetParentPropulsionSystem()
Definition WsfSixDOF_ThrustProducerObject.hpp:48
bool MayHaveEngineOperating() const
Definition WsfSixDOF_ThrustProducerObject.hpp:151
std::string mBaseName
Definition WsfSixDOF_ThrustProducerObject.hpp:204
UtVec3dX mThrustInstalledAnglesYPR_rad
Definition WsfSixDOF_ThrustProducerObject.hpp:216
virtual double GetThrottleAbSetting()=0
void SetThrottlePosition(double aThrottleLeverPosition)
Definition WsfSixDOF_ThrustProducerObject.hpp:111
void GetThrustInstalledAnglesYPR(UtVec3dX &aThrustYPR_rad) const
Definition WsfSixDOF_ThrustProducerObject.hpp:102
void SetThrustVectoringEnabled(bool aThrustVectoringEnabled)
Definition WsfSixDOF_ThrustProducerObject.hpp:117
bool EngineSmoking() const
Definition WsfSixDOF_ThrustProducerObject.hpp:184
bool ProducingSmokeTrail() const
Definition WsfSixDOF_ThrustProducerObject.hpp:165
bool EngineOperating() const
Definition WsfSixDOF_ThrustProducerObject.hpp:146
double GetThrottlePosition() const
Definition WsfSixDOF_ThrustProducerObject.hpp:107
void GetThrustLocation(UtVec3dX &aThrustLocation_ft) const
Definition WsfSixDOF_ThrustProducerObject.hpp:96
void Ignite(int64_t aIgniteTimeInFrame_nanosec)
Definition WsfSixDOF_ThrustProducerObject.hpp:63
virtual ThrustProducerObject * Clone() const =0
ThrustProducerObject & operator=(const ThrustProducerObject &other)=delete
double GetFuelBurnRate_pph() const
Definition WsfSixDOF_ThrustProducerObject.hpp:123
bool MayProduceSmokeTrail() const
Definition WsfSixDOF_ThrustProducerObject.hpp:170
virtual double GetThrottleMilSetting()=0
double mThrustOffset_ft
Definition WsfSixDOF_ThrustProducerObject.hpp:226
UtCloneablePtr< Engine > mEnginePtr
Definition WsfSixDOF_ThrustProducerObject.hpp:210
UtVec3dX mNominalThrustVectorDirection
Definition WsfSixDOF_ThrustProducerObject.hpp:213
bool MayContrail() const
Definition WsfSixDOF_ThrustProducerObject.hpp:160
void SetEngine(std::unique_ptr< Engine > aEngine)
Definition WsfSixDOF_ThrustProducerObject.hpp:51
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
Copyrights Multiple, All Rights Reserved