WSF
P6DofThrustProducerObject.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 2003-2015 The Boeing 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 P6DOFTHRUSTPRODUCEROBJECT_H
13#define P6DOFTHRUSTPRODUCEROBJECT_H
14
15#include "p6dof_export.h"
16
17#include <cinttypes>
18#include <string>
19#include <vector>
20
24#include "P6DofObject.hpp"
25#include "UtTable.hpp"
26#include "UtVec3dX.hpp"
27
28class P6DofFuelTank;
30class P6DofScenario;
31class UtInput;
32
33class P6DOF_EXPORT P6DofThrustProducerObject : public P6DofObject
34{
35public:
36 // This is used to create a type of a P6DofThrustProducerObject
37 explicit P6DofThrustProducerObject(P6DofScenario* aScenario);
40
41 // ProcessInput is called to read input data from a UtInput stream, which
42 // is typically an 'input file'.
43 virtual bool ProcessInput(UtInput& aInput) = 0;
44 virtual bool Initialize(int64_t aSimTime_nanosec) = 0;
45
46 // This sets the propulsion system to which this thrust producer belongs
48
49 // ThrustProducerObject-derived classes should include CalculateThrust and
50 // UpdateThrust functions. CalculateThrust performs calculations but does
51 // not update 'state' while UpdateThrust performs calculations and also
52 // updates the state.
53
54 // The CalculateThrust function is called to calculate the engine's
55 // forces and moments. It does not change the state of the engine.
56 // To change the state, call UpdateThrust instead. This version
57 // uses the thrust producer's internal throttle values.
58 virtual void CalculateThrust(double aDeltaT_sec,
59 double aAlt_ft,
60 double aDynPress_lbsqft,
61 double aStatPress_lbssqft,
62 double aSpeed_fps,
63 double aMach,
64 double aAlpha_rad,
65 double aBeta_rad,
66 P6DofForceAndMomentsObject& aForceAndMoment,
67 double& aFuelBurnRate_pps,
68 double& aFuelBurned_lbs) = 0;
69
70 // The UpdateThrust function is called to calculate the engine's
71 // forces and moments and update the state of the engine.
72 // To perform F&M calculations without changing the state, call the
73 // CalculateThrust function instead.
74 virtual void UpdateThrust(double aDeltaT_sec,
75 double aAlt_ft,
76 double aDynPress_lbsqft,
77 double aStatPress_lbssqft,
78 double aSpeed_fps,
79 double aMach,
80 double aAlpha_rad,
81 double aBeta_rad,
82 P6DofForceAndMomentsObject& aForceAndMoment,
83 double& aFuelBurnRate_pps,
84 double& aFuelBurned_lbs) = 0;
85
86 virtual std::string GetClassType() = 0;
87
88 // This returns the last 'updated' thrust value magnitude
89 double GetThrust_lbs() const;
90
91 // This returns the last 'updated' thrust in the forward direction
92 double GetForwardThrust_lbs() const;
93
94 // Set reference location and attitude (YPR) relative to parent
95 void SetThrustReferenceOffsetAttitude(const UtVec3dX& aReferenceLocation_ft, UtVec3dX& aThrustYPR_rad);
96
97 // Enable (disable) thrust vectoring
98 void SetThrustVectoringEnabled(bool aThrustVectoringEnabled) { mThrustVectoringEnabled = aThrustVectoringEnabled; }
99
100 // Returns whether thrust vectoring is enabled
102
103 // Attitude of thrust vectoring relative to engine
104 void SetThrustVectoringYaw_deg(double aThrustVectoringYaw_deg);
105
106 // Attitude of thrust vectoring relative to engine
107 void SetThrustVectoringPitch_deg(double aThrustVectoringPitch_deg);
108
109 // Attitude of thrust vectoring relative to engine
110 double GetThrustVectoringYaw_deg() const;
111
112 // Attitude of thrust vectoring relative to engine
113 double GetThrustVectoringPitch_deg() const;
114
115 // Enable (disable) thrust reverser
116 void SetThrustReverserEnabled(bool aThrustReverserEnabled) { mThrustReverserEnabled = aThrustReverserEnabled; }
117
118 // Returns whether thrust reverser is enabled
120
121 // Sets thrust reverser: 0=Off, 1=FullReverse
122 void SetThrustReverserSetting(double aThrustReverserSetting);
123
124 // Gets thrust reverser setting
126
127 // Location of thrust relative to parent
128 void GetThrustLocation(UtVec3dX& aThrustLocation_ft) const;
129
130 // Attitude of thrust relative to parent
131 void GetThrustInstalledAnglesYPR(UtVec3dX& aThrustYPR_rad) const;
132
133 // Direction of thrust relative to parent
134 void GetCurrentThrustVectorDirection(UtVec3dX& aDirection) const;
135
136 // CalcCurrentThrustVectors provides the current thrust unit vector and thrust location
137 // in body coordinates including any thrust vectoring and reversing. The
138 // aThrustFactor indicates the magnitude factor for the thrust (positive is forward thrust
139 // and negative is reverse thrust, ranging from:
140 // 1 = full forward thrust to -0.5 = full reverse thrust
141 void CalcCurrentThrustVectors();
142
143 // GetThrustForceAndMoment returns a P6DofForceAndMomentsObject
144 // based on the last 'updated' thrust value
145 const P6DofForceAndMomentsObject& GetThrustForceAndAndMoment() const;
146
147 // GetFuelBurnRate_pph returns the current fuel/propellant burn rate in lbs/hr
148 virtual double GetFuelBurnRate_pph() const = 0;
149
150 // .....................................................................................................
151
152 // This provides the maximum potential thrust available, if full throttle(s) is applied.
153 virtual double GetMaximumPotentialThrust_lbs(double aAlt_ft,
154 double aDynPress_lbsqft,
155 double aStatPress_lbssqft,
156 double aSpeed_fps,
157 double aMach,
158 double aAlpha_rad,
159 double aBeta_rad) = 0;
160
161 // This provides the minimum potential thrust available
162 virtual double GetMinimumPotentialThrust_lbs(double aAlt_ft,
163 double aDynPress_lbsqft,
164 double aStatPress_lbssqft,
165 double aSpeed_fps,
166 double aMach,
167 double aAlpha_rad,
168 double aBeta_rad) = 0;
169
170 // .....................................................................................................
171
172 // This returns a pointer to the mass properties or null, if none exist
174
175 // This abstract function calculates the current mass properties for the
176 // thrust producer, including any integral fuel/propellant that may exist.
178
179 // .....................................................................................................
180
181 // The SetThrottleLeverPosition function should be called prior to calling
182 // UpdateThrust so that the throttle will be properly set.
183 virtual void SetThrottlePosition(double aThrottleLeverPosition) = 0;
184
185 // This returns the current throttle position
186 virtual double GetThrottlePosition() const = 0;
187
188 // Start the engine.
189 virtual void Ignite(int64_t aIgniteTimeInFrame_nanosec) = 0;
190
191 virtual void Shutdown(int64_t aTerminateTime_nanosec = 0) = 0;
192
193 virtual bool AfterburnerIsPresent() const { return mAfterburnerPresent; }
194
195 // .....................................................................................................
196
197 // Appearance Parameters
198 // These functions use the mEngineOperating, mEngineSmoking, mAfterburnerOn, mContrailing,
199 // and mProducingSmokeTrail parameters. For correct operation, derived engine classes
200 // should set those paramaters, as appropriate, in their overridden CalculateThrust()
201 // function, according to the specific characteristics of the type of engine.
202
203 // Returns true if the engine is operating and burning fuel
204 bool EngineOperating() const { return mEngineOperating; }
205
206 // Returns true if the engine will/may produce a engine operating appearance.
207 // If this can not be determined with the knowledge available, return true.
208 // see also EngineOperating()
209 virtual bool MayHaveEngineOperating() const { return true; }
210
211 // Returns true if the engine is producing some smoke. Note that
212 // this is limited smoke from an engine and is different from a
213 // smoke trail effect, which is a dense trail of smoke, typically
214 // from a solid propellant rocket.
215 bool EngineSmoking() const { return mEngineSmoking; }
216
217 // Returns true if the engine will/may produce engine smoke.
218 // If this can not be determined with the knowledge available, return true.
219 // see also EngineSmoking()
220 virtual bool MayProduceEngineSmoke() const { return true; }
221
222 // Returns true if a flame is emanating from the engine, such as that
223 // produced by an afterburner or a rocket that is producing a flame.
224 // see also AfterburnerIsPresent(), for if they function may turn on
225 bool AfterburnerOn() const { return mAfterburnerOn; }
226
227 // Returns true if the engine is producing a contrail
228 bool Contrailing() const { return mContrailing; }
229
230 // Returns true if the engine will/may produce a contrail.
231 // If this can not be determined with the knowledge available, return true.
232 virtual bool MayContrail() const { return true; }
233
234 // Returns true if the engine is producing a smoke trail. Note that
235 // this is a dense trail of smoke, typically from a solid propellant
236 // rocket, as opposed to a limited smoke from an engine (see EngineSmoking).
238
239 // Returns true if the engine will/may produce a smoke trail.
240 // see also ProducingSmokeTrail()
241 // If this can not be determined with the knowledge available, return true.
242 virtual bool MayProduceSmokeTrail() const { return false; }
243
244
245 // If true, will cause an engine to smoke. When false, it stops smoking, unless the
246 // engine's nominal behavior is to smoke.
247 // Note that this is for engine smoke, not a smoke trail.
248 void MakeEngineSmoke(bool aSmoking);
249
250 // .....................................................................................................
251
253 {
254 std::string name;
255 size_t handle;
256 double value;
257 };
258
260 {
261 std::string name;
262 size_t handle;
263 bool value;
264 };
265
266 virtual void SetControlInputHandles(const P6DofFlightControlSystem* aFlightControls) = 0;
267 virtual void SetControlInputValues(const P6DofFlightControlSystem* aFlightControls) = 0;
268
269 static void SetControlInputHandle(const P6DofFlightControlSystem* aFlightControls,
270 ThrustControlInputValueData* aControlInput);
271 static void SetControlInputValue(const P6DofFlightControlSystem* aFlightControls,
272 ThrustControlInputValueData* aControlInput);
273
274protected:
276
277 void DeriveFrom(const P6DofThrustProducerObject* aSrc);
278
279 void SetMassProperties(P6DofMassProperties* aMassProperties) { mMassPropertiesPtr = aMassProperties; }
280
281 // This will return the thrust vector using the thrust magnitude and current direction
282 UtVec3dX CalcThrustVectorFromThrust(double aThrust_lbs);
283
284 // This calculates various thrust F&M vectors.
285 // It is used within the CalculateThrust function of thrust producers
286 void CalcThrustProducerFM(double aThrustMagnitude_lbs, P6DofForceAndMomentsObject& aForceAndMoment);
287
288 // Parent object (propulsion system)
290
291 // A unique name for each subclass of thrust producer
293
294 // Nominal thrust direction vector (does not include vectoring/reversing)
296
297 // Current thrust direction vector (includes vectoring/reversing)
299
300 // Location of the reference point (typically center of engine)
302
303 // Location of thrust relative to parent
305
306 // Current forces and moments of this thrust producer (lbs and ft-lbs respectively)
308
309 // Rotation of thrust relative to parent
311
312 // Location of thrust relative to thrust producer reference point along the x-axis.
313 // A positive value is forward of the engine, negative is aft.
315
316 // Thrust vectoring states
320
321 // Thrust reverser states
324
325 // This is true if a shutdown is in progress. As the shutdown
326 // process is handled, this should be set to false.
328
329 // This is used during a shut down to indicate how far into
330 // the current calculation frame the shut down occurs.
332
333 // This is used during an ignition to indicate how far into
334 // the current calculation frame the ignition occurs.
336
337 // These are for a reference area that can produce drag when
338 // the engine is not operating
341
343
345
347
354};
355
356#endif
Definition P6DofFlightControlSystem.hpp:42
Definition P6DofForceAndMomentsObject.hpp:24
Definition P6DofFuelTank.hpp:33
Definition P6DofMassProperties.hpp:26
P6DofObject(P6DofScenario *aScenario)
Definition P6DofObject.cpp:17
Definition P6DofPropulsionSystem.hpp:35
Definition P6DofScenario.hpp:25
virtual void SetControlInputHandles(const P6DofFlightControlSystem *aFlightControls)=0
double mThrustVectorYaw_rad
Definition P6DofThrustProducerObject.hpp:318
void SetThrustReferenceOffsetAttitude(const UtVec3dX &aReferenceLocation_ft, UtVec3dX &aThrustYPR_rad)
Definition P6DofThrustProducerObject.cpp:173
virtual bool MayHaveEngineOperating() const
Definition P6DofThrustProducerObject.hpp:209
bool mContrailing
Definition P6DofThrustProducerObject.hpp:351
virtual void SetThrottlePosition(double aThrottleLeverPosition)=0
double mCurrentThrustFactor
Definition P6DofThrustProducerObject.hpp:344
P6DofThrustProducerObject & operator=(const P6DofThrustProducerObject &other)=delete
UtVec3dX mNominalThrustVectorDirection
Definition P6DofThrustProducerObject.hpp:295
bool mEngineSmoking
Definition P6DofThrustProducerObject.hpp:349
bool mThrustReverserEnabled
Definition P6DofThrustProducerObject.hpp:322
bool mEngineDamageSmokeActivated
Definition P6DofThrustProducerObject.hpp:353
UtVec3dX mReferenceLocation_ft
Definition P6DofThrustProducerObject.hpp:301
P6DofMassProperties * GetMassProperties() const
Definition P6DofThrustProducerObject.hpp:173
double mThrustVectorPitch_rad
Definition P6DofThrustProducerObject.hpp:319
int64_t mIgniteTimeInFrame_nanosec
Definition P6DofThrustProducerObject.hpp:335
double GetThrust_lbs() const
Definition P6DofThrustProducerObject.cpp:116
P6DofForceAndMomentsObject mCurrentThrustFM_lbs_ftlbs
Definition P6DofThrustProducerObject.hpp:307
virtual double GetFuelBurnRate_pph() const =0
virtual double GetThrottlePosition() const =0
virtual std::string GetClassType()=0
bool Contrailing() const
Definition P6DofThrustProducerObject.hpp:228
UtVec3dX mCurrentThrustVectorDirection
Definition P6DofThrustProducerObject.hpp:298
bool mAfterburnerPresent
Definition P6DofThrustProducerObject.hpp:346
void SetThrustVectoringEnabled(bool aThrustVectoringEnabled)
Definition P6DofThrustProducerObject.hpp:98
bool mProducingSmokeTrail
Definition P6DofThrustProducerObject.hpp:352
virtual void Shutdown(int64_t aTerminateTime_nanosec=0)=0
bool EngineSmoking() const
Definition P6DofThrustProducerObject.hpp:215
virtual bool MayContrail() const
Definition P6DofThrustProducerObject.hpp:232
virtual bool Initialize(int64_t aSimTime_nanosec)=0
bool ThrustVectoringEnabled() const
Definition P6DofThrustProducerObject.hpp:101
virtual bool MayProduceSmokeTrail() const
Definition P6DofThrustProducerObject.hpp:242
bool AfterburnerOn() const
Definition P6DofThrustProducerObject.hpp:225
virtual bool ProcessInput(UtInput &aInput)=0
double GetThrustReverserSetting() const
Definition P6DofThrustProducerObject.hpp:125
double GetForwardThrust_lbs() const
Definition P6DofThrustProducerObject.cpp:121
virtual double GetMinimumPotentialThrust_lbs(double aAlt_ft, double aDynPress_lbsqft, double aStatPress_lbssqft, double aSpeed_fps, double aMach, double aAlpha_rad, double aBeta_rad)=0
void SetParentPropulsionSystem(P6DofPropulsionSystem *aParent)
Definition P6DofThrustProducerObject.cpp:111
virtual void Ignite(int64_t aIgniteTimeInFrame_nanosec)=0
virtual bool MayProduceEngineSmoke() const
Definition P6DofThrustProducerObject.hpp:220
virtual 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, P6DofForceAndMomentsObject &aForceAndMoment, double &aFuelBurnRate_pps, double &aFuelBurned_lbs)=0
P6DofPropulsionSystem * mParentPropulsionSystemPtr
Definition P6DofThrustProducerObject.hpp:289
bool mThrustVectoringEnabled
Definition P6DofThrustProducerObject.hpp:317
int64_t mShutdownFraction_nanosec
Definition P6DofThrustProducerObject.hpp:331
bool mShutdownInProgress
Definition P6DofThrustProducerObject.hpp:327
P6DofMassProperties * mMassPropertiesPtr
Definition P6DofThrustProducerObject.hpp:342
void DeriveFrom(const P6DofThrustProducerObject *aSrc)
Definition P6DofThrustProducerObject.cpp:103
UtVec3dX mThrustInstalledAnglesYPR_rad
Definition P6DofThrustProducerObject.hpp:310
std::string mTypeOfThrustProducer
Definition P6DofThrustProducerObject.hpp:292
bool EngineOperating() const
Definition P6DofThrustProducerObject.hpp:204
static void SetControlInputValue(const P6DofFlightControlSystem *aFlightControls, ThrustControlInputValueData *aControlInput)
Definition P6DofThrustProducerObject.cpp:269
double mThrustReverserSetting
Definition P6DofThrustProducerObject.hpp:323
void SetMassProperties(P6DofMassProperties *aMassProperties)
Definition P6DofThrustProducerObject.hpp:279
bool mAfterburnerOn
Definition P6DofThrustProducerObject.hpp:350
double mThrustOffset_ft
Definition P6DofThrustProducerObject.hpp:314
bool ProducingSmokeTrail() const
Definition P6DofThrustProducerObject.hpp:237
bool ThrustReverserEnabled() const
Definition P6DofThrustProducerObject.hpp:119
double mInOpRefArea_ft2
Definition P6DofThrustProducerObject.hpp:340
P6DofThrustProducerObject(P6DofScenario *aScenario)
Definition P6DofThrustProducerObject.cpp:25
virtual 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, P6DofForceAndMomentsObject &aForceAndMoment, double &aFuelBurnRate_pps, double &aFuelBurned_lbs)=0
bool mInOpRefAreaValid
Definition P6DofThrustProducerObject.hpp:339
bool mEngineOperating
Definition P6DofThrustProducerObject.hpp:348
virtual bool AfterburnerIsPresent() const
Definition P6DofThrustProducerObject.hpp:193
virtual double GetMaximumPotentialThrust_lbs(double aAlt_ft, double aDynPress_lbsqft, double aStatPress_lbssqft, double aSpeed_fps, double aMach, double aAlpha_rad, double aBeta_rad)=0
static void SetControlInputHandle(const P6DofFlightControlSystem *aFlightControls, ThrustControlInputValueData *aControlInput)
Definition P6DofThrustProducerObject.cpp:254
UtVec3dX mThrustLocation_ft
Definition P6DofThrustProducerObject.hpp:304
virtual void CalculateCurrentMassProperties()=0
virtual void SetControlInputValues(const P6DofFlightControlSystem *aFlightControls)=0
void SetThrustReverserEnabled(bool aThrustReverserEnabled)
Definition P6DofThrustProducerObject.hpp:116
Definition P6DofThrustProducerObject.hpp:260
std::string name
Definition P6DofThrustProducerObject.hpp:261
bool value
Definition P6DofThrustProducerObject.hpp:263
size_t handle
Definition P6DofThrustProducerObject.hpp:262
Definition P6DofThrustProducerObject.hpp:253
std::string name
Definition P6DofThrustProducerObject.hpp:254
size_t handle
Definition P6DofThrustProducerObject.hpp:255
double value
Definition P6DofThrustProducerObject.hpp:256
Copyrights Multiple, All Rights Reserved