WSF
WsfSixDOF_MoverTestObject.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 WSFSIXDOFMOVERTESTOBJECT_HPP
13#define WSFSIXDOFMOVERTESTOBJECT_HPP
14
15#include "wsf_six_dof_export.h"
16
17class UtInput;
18class WsfDraw;
20#include "WsfSixDOF_Engine.hpp"
21#include "WsfSixDOF_Utils.hpp"
22
23namespace wsf
24{
25namespace six_dof
26{
27class Environment;
28class Mover;
29class PilotObject;
31
32class WSF_SIX_DOF_EXPORT MoverTestObject
33{
34public:
35 virtual Mover* GetParentVehicle() const = 0;
36
37 std::unique_ptr<Engine> GetTestEngineFromThrustProducer(ThrustProducerObject* aEngine) const;
38
39 void Update(double aSimTime);
40
41 // This returns the great circle distance (in km) of the vehicle from its creation point
42 double GetRangeSinceStart_km() const;
43
44 // These commands control lag/freeze functionality, which are typically used during testing.
45 // They are also used during tuning of the vehicle autopilot.
46
47 // This enabled/disables system lags during testing
48 void SetMasterNoLagTesting(bool aEnable);
49
50 // This enabled/disables freezing of the vehicle in its current location (Lat/Lon) during testing
51 void SetMasterFreezeLocation(bool aEnable);
52
53 // This enabled/disables freezing of the vehicle at its current altitude during testing
54 void SetMasterFreezeAltitude(bool aEnable);
55
56 // This enabled/disables freezing of the vehicle at its current vertical speed during testing
57 void SetMasterFreezeVerticalSpeed(bool aEnable);
58
59 // This enabled/disables freezing of the vehicle at its current pitch angle during testing
60 void SetMasterFreezePitch(bool aEnable);
61
62 // This enabled/disables freezing of the vehicle at its current roll angle during testing
63 void SetMasterFreezeRoll(bool aEnable);
64
65 // This enabled/disables freezing of the vehicle at its current yaw angle during testing
66 void SetMasterFreezeYaw(bool aEnable);
67
68 // This enabled/disables freezing of the vehicle fuel burn during testing.
69 // When enabled, it will not burn fuel.
70 void SetMasterFreezeFuelBurn(bool aEnable);
71
72 // This enabled/disables freezing of the vehicle speed during testing.
73 void SetMasterFreezeSpeed(bool aEnable);
74
75 // This enabled/disables freezing of the vehicle angle of attack (alpha) during testing.
76 void SetMasterNoAlphaTesting(bool aEnable);
77
78 // This creates an autopilot config file will the current autopilot data. it can be used
79 // the Autotune function (above).
80 virtual void CreateAutopilotConfigFile(const std::string& aFilename) = 0;
81
82 // This function is used to determine if the vehicle can fly at the specified altitude (in feet),
83 // velocity (in ft/sec), throttle setting, and flaps setting. The throttle input assumes that
84 // 0 is idle, 1 is full power without augmentation/afterburner (military power), and 2 is
85 // full power with full augmentation/afterburner (full afterburner). The flaps input assumes that
86 // 0 is fully retracted and 1 is fully deployed. The function returns a CanFlyAtReturnValue,
87 // which can be CAN_NOT_FLY, CONTROL_FAIL, or CAN_FLY.
89 CanFlyAt(double aAltitude_ft, double aVelocity_fps, double aThrottle, double aFlaps = 0.0) = 0;
90
91 // This returns the turn rate (deg/sec) with the specified specific excess power (in ft/sec),
92 // true airspeed (in ft/sec), and throttle setting (where 0 is idle, 1 is military power
93 // (full power without afterburner), and 2 is full afterburner).
94 virtual double TurnRateAt(double aSpecificExcessPower_fps, double aTrueSpeed_fps, double aThrottleSetting) = 0;
95
96 // This returns the turn rate (deg/sec) with the required specific excess power (ft/sec)
97 // at the the specified conditions, including current mass (lbs), maximum g-load,
98 // altitude (ft), airspeed (ft/sec), and throttle setting (where 0 is idle, 1 is
99 // military power (full power without afterburner), and 2 is full afterburner).
100 virtual double TurnRateWithConditions(double aSpecificExcessPower_fps,
101 double aCurrentMass_lbs,
102 double aMaxGLoad,
103 double aAltitude_ft,
104 double aAirspeed_fps,
105 double aThrottleSetting) = 0;
106
107 // This returns the horizontal thrust (in lbs) produced in level flight at the specified
108 // altitude (ft) and speed (Mach) with the specified throttle setting and gross weight.
109 // The throttle input assumes that 0 is idle, 1 is military power (full power without
110 // afterburner), and 2 is full afterburner. Note that the thrust returned is the
111 // horizontal component. The total thrust is likely greater due to vehicle pitch attitude.
112 double GetLevelFlightHorizontalThrust(double aAltitude_ft, double aMach, double aThrottle, double aGrossWeight_lbs);
113
114 // This returns the drag (in lbs) when in level flight at the specified altitude (ft) and
115 // speed (Mach) with the specified gross weight.
116 double GetLevelFlightDrag(double aAltitude_ft, double aMach, double aGrossWeight_lbs);
117
118 // This returns the fuel burn rate (in lbs/hr) when in level flight at the specified
119 // altitude (ft) and speed (Mach) with the specified gross weight.
120 double GetLevelFlightFuelBurnRate(double aAltitude_ft, double aMach, double aGrossWeight_lbs);
121
122 // This uses maximum/full throttle (value=2.0, afterburner). If the vehicle lacks an
123 // afterburner, it will use a full throttle setting of 1.0 (military power) instead.
125
126 // This creates the autopilot support file for the current vehicle, outputting to the
127 // specified filename.
128 virtual void CreateAutopilotSupportFile(const std::string& aFilename) = 0;
129
130 // This creates the autopilot support file for the current vehicle, outputting to the
131 // specified filename. This variant includes a limit to max mach.
132 virtual void CreateAutopilotSupportFileWithMaxMach(const std::string& aFilename, const double& aMaxMach) = 0;
133
134 // In addition to limiting alpha, we may also need to limit the g-load.
135 // If necessary, this will limit alpha to stay under the g-load limit.
136 virtual void LimitAlphaByMaxGLoad(double aMach, double aMaxGLoad, double aDynPressure_ppsqft, double& aAlpha_rad) = 0;
137
138 // In addition to limiting alpha, we may also need to limit the g-load.
139 // If necessary, this will limit alpha to stay under the g-load limit.
140 virtual void LimitAlphaByMaxGLoad(double aMach,
141 double aMaxGLoad,
142 double aDynPressure_ppsqft,
143 double aCurrentMass_lbs,
144 double& aAlpha_rad) = 0;
145
146 // Modifies base vehicle mass, does NOT modify fuel mass. Used for testing.
147 virtual void SetVehicleMass(double aMass_lbs) = 0;
148
149 // Returns the max g-load as limited by autopilot. If no autopilot exists, it
150 // returns zero. If more than one autopilot exists, it selects the autopilot
151 // based on the following order: synthetic pilot, augmented manual pilot,
152 // guidance, and hardware autopilot.
153 double GetMaxGLoad();
154
155 // This provides the maximum instantaneous g-load as a function of altitude (ft) and
156 // speed (Mach) for a specified mass (lbs). This is the maximum pitch g-load based on
157 // conditions and does not consider any thrust effects. Hence, this can calculate the
158 // g-load for speeds that may not be attainable under normal operation. This function
159 // can be used for both aircraft and weapons.
160 virtual double MaxInstantaneousGLoad(double aAltitude_ft, double aMach, double aCurrentMass_lbs) = 0;
161
162protected:
163 // This returns the angle of attack (alpha) in radians at the specified altitude (ft),
164 // speed (ft/sec), and desired drag (lbs).
165 virtual double AlphaAtDesiredDrag(double aAlt_ft, double aSpeed_fps, double aDrag_lbs, bool& aOk) = 0;
166
167 // This provides the angle of attack (alpha) in radians at the specified altitude (ft),
168 // speed (Mach), and desired drag (lbs) with the specified current mass and while
169 // limited to the specified max g-load.
170 virtual bool AlphaAtDesiredDrag(double aAlt_ft,
171 double aMach,
172 double aDrag_lbs,
173 double aCurrentMass_lbs,
174 double aMaxGLoad,
175 double& aAlpha_rad) = 0;
176
177 // This is used to setup/configure for running in test mode
178 void SetupForTestingMode(bool aFreezeFuelBurn);
179
180 // This is used to restore from running in test mode
182
183 // This calculates the drag (lbs) and angle of attack (alpha, in deg) when in level flight
184 // at the specified altitude (ft) and speed (Mach) with the specified gross weight.
185 // Returns true if successful.
186 virtual bool CalcLevelFlightDragAndAlpha(double aAltitude_ft,
187 double aMach,
188 double aGrossWeight_lbs,
189 double& aDrag_lbs,
190 double& aAlpha_deg) = 0;
191
192 // For the specified engine (thrust producer), this returns the throttle setting
193 // (where 0 is idle, 1 is military power (full power without afterburner), and
194 // 2 is full afterburner) for the specified altitude (ft) and speed (Mach) with
195 // the specified required thrust (lbs).
197 const Environment* aAtm,
198 double aAltitude_ft,
199 double aMach,
200 double aRequiredThrust_lbs);
201
202 // For the specified engine (thrust producer), this returns the fuel burn rate (lb/hr)
203 // at the specified altitude(ft) and speed (Mach) with the specified required
204 // thrust (lbs).
206 const Environment* aAtm,
207 double aAltitude_ft,
208 double aMach,
209 double aRequiredThrust_lbs);
210
211 // For the specified engine (thrust producer), this returns the fuel burn rate (lb/hr)
212 // at the specified altitude(ft) and speed (Mach) with the specified throttle setting
213 // (where 0 is idle, 1 is military power (full power without afterburner), and 2 is
214 // full afterburner).
216 const Environment* aAtm,
217 double aAltitude_ft,
218 double aMach,
219 double aThrottle);
220
221 // For the specified engine (thrust producer), this returns the thrust (lbs)
222 // at the specified altitude(ft) and speed (Mach) with the specified throttle setting
223 // (where 0 is idle, 1 is military power (full power without afterburner), and 2 is
224 // full afterburner).
226 const Environment* aEnv,
227 double aAltitude_ft,
228 double aMach,
229 double aThrottle);
230
232
233 bool mTestingNoLag = false;
235};
236} // namespace six_dof
237} // namespace wsf
238
239#endif
aObjectPtr SetMasterFreezeFuelBurn(aVarArgs[0].GetBool())
aObjectPtr SetMasterFreezePitch(aVarArgs[0].GetBool())
aObjectPtr SetMasterNoAlphaTesting(aVarArgs[0].GetBool())
aObjectPtr SetMasterFreezeYaw(aVarArgs[0].GetBool())
aObjectPtr SetMasterFreezeLocation(aVarArgs[0].GetBool())
aObjectPtr SetMasterFreezeRoll(aVarArgs[0].GetBool())
aObjectPtr SetMasterFreezeAltitude(aVarArgs[0].GetBool())
aObjectPtr SetMasterNoLagTesting(aVarArgs[0].GetBool())
aObjectPtr Update(simTime)
Provides the capability to draw shapes into the WSF replay file.
Definition WsfDraw.hpp:35
Definition WsfMoverGuidance.hpp:23
Definition WsfSixDOF_Environment.hpp:30
Definition WsfSixDOF_MoverTestObject.hpp:33
virtual double TurnRateAt(double aSpecificExcessPower_fps, double aTrueSpeed_fps, double aThrottleSetting)=0
void SetMasterFreezeSpeed(bool aEnable)
Definition WsfSixDOF_MoverTestObject.cpp:119
double FuelBurnAtThrottleSetting(ThrustProducerObject *aEngine, const Environment *aAtm, double aAltitude_ft, double aMach, double aThrottle)
Definition WsfSixDOF_MoverTestObject.cpp:574
virtual void CreateAutopilotConfigFile(const std::string &aFilename)=0
bool mTestingNoLag
Definition WsfSixDOF_MoverTestObject.hpp:233
void FlyStraightLevelFullThrottle()
Definition WsfSixDOF_MoverTestObject.cpp:263
virtual utils::CanFlyAtReturnValue CanFlyAt(double aAltitude_ft, double aVelocity_fps, double aThrottle, double aFlaps=0.0)=0
virtual void CreateAutopilotSupportFileWithMaxMach(const std::string &aFilename, const double &aMaxMach)=0
double GetRangeSinceStart_km() const
Definition WsfSixDOF_MoverTestObject.cpp:45
std::unique_ptr< Engine > GetTestEngineFromThrustProducer(ThrustProducerObject *aEngine) const
Definition WsfSixDOF_MoverTestObject.cpp:24
void SetupForTestingMode(bool aFreezeFuelBurn)
Definition WsfSixDOF_MoverTestObject.cpp:330
virtual void CreateAutopilotSupportFile(const std::string &aFilename)=0
double GetMaxGLoad()
Definition WsfSixDOF_MoverTestObject.cpp:288
virtual double TurnRateWithConditions(double aSpecificExcessPower_fps, double aCurrentMass_lbs, double aMaxGLoad, double aAltitude_ft, double aAirspeed_fps, double aThrottleSetting)=0
virtual void LimitAlphaByMaxGLoad(double aMach, double aMaxGLoad, double aDynPressure_ppsqft, double aCurrentMass_lbs, double &aAlpha_rad)=0
double GetLevelFlightHorizontalThrust(double aAltitude_ft, double aMach, double aThrottle, double aGrossWeight_lbs)
Definition WsfSixDOF_MoverTestObject.cpp:135
void RestoreFromTestingMode()
Definition WsfSixDOF_MoverTestObject.cpp:349
virtual Mover * GetParentVehicle() const =0
virtual double MaxInstantaneousGLoad(double aAltitude_ft, double aMach, double aCurrentMass_lbs)=0
virtual void LimitAlphaByMaxGLoad(double aMach, double aMaxGLoad, double aDynPressure_ppsqft, double &aAlpha_rad)=0
bool mTestingFreezeFuelBurn
Definition WsfSixDOF_MoverTestObject.hpp:234
double GetLevelFlightDrag(double aAltitude_ft, double aMach, double aGrossWeight_lbs)
Definition WsfSixDOF_MoverTestObject.cpp:183
virtual double AlphaAtDesiredDrag(double aAlt_ft, double aSpeed_fps, double aDrag_lbs, bool &aOk)=0
double GetLevelFlightFuelBurnRate(double aAltitude_ft, double aMach, double aGrossWeight_lbs)
Definition WsfSixDOF_MoverTestObject.cpp:202
double FuelBurnAtRequiredThrust(ThrustProducerObject *aEngine, const Environment *aAtm, double aAltitude_ft, double aMach, double aRequiredThrust_lbs)
Definition WsfSixDOF_MoverTestObject.cpp:466
virtual void SetVehicleMass(double aMass_lbs)=0
void SetMasterFreezeVerticalSpeed(bool aEnable)
Definition WsfSixDOF_MoverTestObject.cpp:79
virtual bool AlphaAtDesiredDrag(double aAlt_ft, double aMach, double aDrag_lbs, double aCurrentMass_lbs, double aMaxGLoad, double &aAlpha_rad)=0
const Environment * GetEnvironment()
Definition WsfSixDOF_MoverTestObject.cpp:317
virtual bool CalcLevelFlightDragAndAlpha(double aAltitude_ft, double aMach, double aGrossWeight_lbs, double &aDrag_lbs, double &aAlpha_deg)=0
double ThrustAtThrottleSetting(ThrustProducerObject *aEngine, const Environment *aEnv, double aAltitude_ft, double aMach, double aThrottle)
Definition WsfSixDOF_MoverTestObject.cpp:610
double ThrottleSettingToProduceThrust(ThrustProducerObject *aEngine, const Environment *aAtm, double aAltitude_ft, double aMach, double aRequiredThrust_lbs)
Definition WsfSixDOF_MoverTestObject.cpp:358
This is a base class for detailed air movers. This umbrella can cover RB6 or PM6 models.
Definition WsfSixDOF_Mover.hpp:58
Definition WsfSixDOF_PilotObject.hpp:39
Definition WsfSixDOF_ThrustProducerObject.hpp:35
CanFlyAtReturnValue
Definition WsfSixDOF_Utils.hpp:31
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