WSF
WsfSixDOF_Engine.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 WSFSIXDOFENGINE_HPP
13#define WSFSIXDOFENGINE_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
25namespace wsf
26{
27namespace six_dof
28{
29class FuelTank;
30class MassProperties;
32class TypeManager;
33
34class WSF_SIX_DOF_EXPORT Engine
35{
36public:
37 // This is used to create a type of a Engine
38 explicit Engine(ThrustProducerObject* aParentObject);
39 virtual ~Engine() = default;
40 Engine& operator=(const Engine& other) = delete;
41
42 virtual Engine* Clone() const = 0;
43
44 virtual bool ProcessInput(UtInput& aInput, TypeManager* aTypeManager) = 0;
45 virtual bool Initialize(int64_t aSimTime_nanosec) = 0;
46
47 virtual void DeriveFrom(const Engine* aSrc);
48
51 {
52 mParentThrustProducerPtr = aThrustProducerPtr;
53 }
54
55 // This returns the last 'updated' thrust value magnitude
56 double GetThrust_lbs() const { return mCurrentThrust_lbs; }
57
58 virtual double GetMaximumPotentialThrust_lbs(double aAlt_ft,
59 double aDynPress_lbsqft,
60 double aStatPress_lbssqft,
61 double aSpeed_fps,
62 double aMach,
63 double aAlpha_rad,
64 double aBeta_rad) = 0;
65
66 virtual double GetMinimumPotentialThrust_lbs(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) = 0;
73
74 // The CalculateThrust function is called to calculate the engine's
75 // forces and moments. It does not change the state of the engine.
76 // To change the state, call UpdateThrust instead. This version
77 // uses the thrust producer's internal throttle values.
78 void CalculateThrust(double aDeltaT_sec,
79 double aAlt_ft,
80 double aDynPress_lbsqft,
81 double aStatPress_lbssqft,
82 double aSpeed_fps,
83 double aMach,
84 double aAlpha_rad,
85 double aBeta_rad,
86 double& aForce_lbs,
87 double& aFuelBurnRate_pps,
88 double& aFuelBurned_lbs);
89
90 // The UpdateThrust function is called to calculate the engine's
91 // forces and moments and update the state of the engine.
92 // To perform F&M calculations without changing the state, call the
93 // CalculateThrust function instead.
94 void UpdateThrust(double aDeltaT_sec,
95 double aAlt_ft,
96 double aDynPress_lbsqft,
97 double aStatPress_lbssqft,
98 double aSpeed_fps,
99 double aMach,
100 double aAlpha_rad,
101 double aBeta_rad,
102 double& aForce_lbs,
103 double& aFuelBurnRate_pps,
104 double& aFuelBurned_lbs);
105
106 // CheckCurrentFuelTank ensures the engine has a valid fuel flow.
107 // Returns false and sets the tank pointer to null if it does not.
109
110 // SetFuelTank sets the fuel source for the engine. Returns false with an error by default.
111 virtual bool SetFuelTank(const std::string& aFuelTankName);
112
113 // GetFuelTank returns a pointer to the fuel tank, if one is assigned to the engine
114 const FuelTank* GetFuelTank() const { return mCurrentFuelTank; }
115
116 // GetFuelBurnRate_pph returns the current fuel/propellant burn rate in lbs/hr
117 virtual double GetFuelBurnRate_pph() const = 0;
118
119 virtual double GetThrottlePosition() const = 0;
120
121 virtual void SetThrottlePosition(double aThrottleLeverPosition) = 0;
122
123 // Start the engine.
124 virtual void Ignite(int64_t aIgniteTimeInFrame_nanosec) = 0;
125
126 virtual void Shutdown(int64_t aTerminateTime_nanosec = 0) = 0;
127
128 // Returns true if the engine is operating and burning fuel
129 bool EngineOperating() const { return mEngineOperating; }
130
131 // Returns true if the engine will/may produce a engine operating appearance.
132 // If this can not be determined with the knowledge available, return true.
133 // see also EngineOperating()
134 virtual bool MayHaveEngineOperating() const { return true; }
135
136 // Returns true if the engine will/may produce engine smoke.
137 // If this can not be determined with the knowledge available, return true.
138 // see also EngineSmoking()
139 virtual bool MayProduceEngineSmoke() const { return true; }
140
141 // Returns true if the engine will/may produce a contrail.
142 // If this can not be determined with the knowledge available, return true.
143 virtual bool MayContrail() const { return true; }
144
145 // Returns true if the engine is producing a smoke trail. Note that
146 // this is a dense trail of smoke, typically from a solid propellant
147 // rocket, as opposed to a limited smoke from an engine (see EngineSmoking).
149
150 // Returns true if the engine will/may produce a smoke trail.
151 // see also ProducingSmokeTrail()
152 // If this can not be determined with the knowledge available, return true.
153 virtual bool MayProduceSmokeTrail() const { return false; }
154
155 // Returns true if a flame is emanating from the engine, such as that
156 // produced by an afterburner or a rocket that is producing a flame.
157 // see also AfterburnerIsPresent(), for if they function may turn on
158 bool AfterburnerOn() const { return mAfterburnerOn; }
159
160 // Returns true if the engine is producing a contrail
161 bool Contrailing() const { return mContrailing; }
162
163 // Returns true if the engine is producing some smoke. Note that
164 // this is limited smoke from an engine and is different from a
165 // smoke trail effect, which is a dense trail of smoke, typically
166 // from a solid propellant rocket.
167 bool EngineSmoking() const { return mEngineSmoking; }
168
169 // If true, will cause an engine to smoke. When false, it stops smoking, unless the
170 // engine's nominal behavior is to smoke.
171 // Note that this is for engine smoke, not a smoke trail.
172 void MakeEngineSmoke(bool aSmoking) { mEngineDamageSmokeActivated = aSmoking; }
173
174 // Returns true if an afterburner is present on any engine
175 virtual bool AfterburnerIsPresent() const { return mAfterburnerPresent; }
176
177protected:
178 explicit Engine(const Engine& aSrc);
179
180 virtual void CalculateThrust(double aDeltaT_sec,
181 double aAlt_ft,
182 double aDynPress_lbsqft,
183 double aStatPress_lbssqft,
184 double aSpeed_fps,
185 double aMach,
186 double aAlpha_rad,
187 double aBeta_rad,
188 double& aForce_lbs,
189 double& aFuelBurnRate_pps,
190 double& aFuelBurned_lbs,
191 bool aUpdateData) = 0;
192
194
195 // A unique name for each subclass of engine
196 std::string mTypeOfEngine;
197
198 // Fuel tank or propellant information. Some engine types may need to use a particular fuel tank,
199 // so SetFuelTank may not be available
201
202 double mCurrentThrust_lbs = 0.0;
203
204 // This is true if a shutdown is in progress. As the shutdown
205 // process is handled, this should be set to false.
207
208 // This is used during a shut down to indicate how far into
209 // the current calculation frame the shut down occurs.
211
212 // This is used during an ignition to indicate how far into
213 // the current calculation frame the ignition occurs.
215
216 bool mEngineOperating = false;
217 bool mContrailing = false;
219 bool mAfterburnerOn = false;
222 bool mEngineSmoking = false;
223};
224} // namespace six_dof
225} // namespace wsf
226
227#endif
Definition WsfSixDOF_Engine.hpp:35
virtual bool MayProduceEngineSmoke() const
Definition WsfSixDOF_Engine.hpp:139
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, double &aForce_lbs, double &aFuelBurnRate_pps, double &aFuelBurned_lbs, bool aUpdateData)=0
double GetThrust_lbs() const
Definition WsfSixDOF_Engine.hpp:56
virtual void Shutdown(int64_t aTerminateTime_nanosec=0)=0
virtual bool MayHaveEngineOperating() const
Definition WsfSixDOF_Engine.hpp:134
bool mProducingSmokeTrail
Definition WsfSixDOF_Engine.hpp:220
bool mAfterburnerOn
Definition WsfSixDOF_Engine.hpp:219
virtual Engine * Clone() const =0
bool mEngineOperating
Definition WsfSixDOF_Engine.hpp:216
bool AfterburnerOn() const
Definition WsfSixDOF_Engine.hpp:158
void MakeEngineSmoke(bool aSmoking)
Definition WsfSixDOF_Engine.hpp:172
virtual void Ignite(int64_t aIgniteTimeInFrame_nanosec)=0
Engine & operator=(const Engine &other)=delete
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
virtual void SetThrottlePosition(double aThrottleLeverPosition)=0
virtual bool MayProduceSmokeTrail() const
Definition WsfSixDOF_Engine.hpp:153
const FuelTank * GetFuelTank() const
Definition WsfSixDOF_Engine.hpp:114
Engine(ThrustProducerObject *aParentObject)
Definition WsfSixDOF_Engine.cpp:16
ThrustProducerObject * GetParentThrustProducer()
Definition WsfSixDOF_Engine.hpp:49
virtual bool AfterburnerIsPresent() const
Definition WsfSixDOF_Engine.hpp:175
bool Contrailing() const
Definition WsfSixDOF_Engine.hpp:161
bool CheckCurrentFuelTank()
Definition WsfSixDOF_Engine.cpp:99
std::string mTypeOfEngine
Definition WsfSixDOF_Engine.hpp:196
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, double &aForce_lbs, double &aFuelBurnRate_pps, double &aFuelBurned_lbs)
Definition WsfSixDOF_Engine.cpp:47
bool mEngineDamageSmokeActivated
Definition WsfSixDOF_Engine.hpp:221
virtual bool Initialize(int64_t aSimTime_nanosec)=0
bool mShutdownInProgress
Definition WsfSixDOF_Engine.hpp:206
int64_t mShutdownFraction_nanosec
Definition WsfSixDOF_Engine.hpp:210
FuelTank * mCurrentFuelTank
Definition WsfSixDOF_Engine.hpp:200
int64_t mIgniteTimeInFrame_nanosec
Definition WsfSixDOF_Engine.hpp:214
double mCurrentThrust_lbs
Definition WsfSixDOF_Engine.hpp:202
bool mEngineSmoking
Definition WsfSixDOF_Engine.hpp:222
bool mContrailing
Definition WsfSixDOF_Engine.hpp:217
virtual ~Engine()=default
bool mAfterburnerPresent
Definition WsfSixDOF_Engine.hpp:218
virtual bool SetFuelTank(const std::string &aFuelTankName)
Definition WsfSixDOF_Engine.cpp:119
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
virtual void DeriveFrom(const Engine *aSrc)
Definition WsfSixDOF_Engine.cpp:21
virtual bool ProcessInput(UtInput &aInput, TypeManager *aTypeManager)=0
bool ProducingSmokeTrail() const
Definition WsfSixDOF_Engine.hpp:148
void SetParentThrustProducer(ThrustProducerObject *aThrustProducerPtr)
Definition WsfSixDOF_Engine.hpp:50
ThrustProducerObject * mParentThrustProducerPtr
Definition WsfSixDOF_Engine.hpp:193
bool EngineOperating() const
Definition WsfSixDOF_Engine.hpp:129
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, double &aForce_lbs, double &aFuelBurnRate_pps, double &aFuelBurned_lbs)
Definition WsfSixDOF_Engine.cpp:73
virtual bool MayContrail() const
Definition WsfSixDOF_Engine.hpp:143
virtual double GetFuelBurnRate_pph() const =0
bool EngineSmoking() const
Definition WsfSixDOF_Engine.hpp:167
virtual double GetThrottlePosition() const =0
Definition WsfSixDOF_FuelTank.hpp:35
Definition WsfSixDOF_MassProperties.hpp:29
Definition WsfSixDOF_ThrustProducerObject.hpp:35
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