WSF
WsfP6DOF_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 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// Updated by Infoscitex, a DCS Company.
13// ****************************************************************************
14
15#ifndef WSFP6DOF_MOVERTESTOBJECT_HPP
16#define WSFP6DOF_MOVERTESTOBJECT_HPP
17
18#include "wsf_p6dof_export.h"
19
20#include "P6DofUtils.hpp"
21
22class P6DofAtmosphere;
25class UtInput;
26class WsfDraw;
28class WsfP6DOF_Mover;
29
30class WSF_P6DOF_EXPORT WsfP6DOF_MoverTestObject
31{
32public:
34 explicit WsfP6DOF_MoverTestObject(WsfP6DOF_Mover* aParentMover);
35
36 void Update(double aSimTime);
37
38 // This returns the great circle distance (in km) of the vehicle from its creation point
39 double GetRangeSinceStart_km() const;
40
41 // These commands control lag/freeze functionality, which are typically used during testing.
42 // They are also used during tuning of the vehicle autopilot.
43
44 // This enabled/disables system lags during testing
45 void SetMasterNoLagTesting(bool aEnable);
46
47 // This enabled/disables freezing of the vehicle in its current location (Lat/Lon) during testing
48 void SetMasterFreezeLocation(bool aEnable);
49
50 // This enabled/disables freezing of the vehicle at its current altitude during testing
51 void SetMasterFreezeAltitude(bool aEnable);
52
53 // This enabled/disables freezing of the vehicle at its current vertical speed during testing
54 void SetMasterFreezeVerticalSpeed(bool aEnable);
55
56 // This enabled/disables freezing of the vehicle at its current pitch angle during testing
57 void SetMasterFreezePitch(bool aEnable);
58
59 // This enabled/disables freezing of the vehicle at its current roll angle during testing
60 void SetMasterFreezeRoll(bool aEnable);
61
62 // This enabled/disables freezing of the vehicle at its current yaw angle during testing
63 void SetMasterFreezeYaw(bool aEnable);
64
65 // This enabled/disables freezing of the vehicle fuel burn during testing.
66 // When enabled, it will not burn fuel.
67 void SetMasterFreezeFuelBurn(bool aEnable);
68
69 // This enabled/disables freezing of the vehicle angle of attack (alpha) during testing.
70 void SetMasterNoAlphaTesting(bool aEnable);
71
72 // This will run an experimental auto-tune on the vehicle. This is still in development.
73 void Autotune();
74
75 // This creates an autopilot config file will the current autopilot data. it can be used
76 // the Autotune function (above).
77 void CreateAutopilotConfigFile(const std::string& aFilename);
78
79 // This function is used to determine if the vehicle can fly at the specified altitude (in feet),
80 // velocity (in ft/sec), throttle setting, and flaps setting. The throttle input assumes that
81 // 0 is idle, 1 is full power without augmentation/afterburner (military power), and 2 is
82 // full power with full augmentation/afterburner (full afterburner). The flaps input assumes that
83 // 0 is fully retracted and 1 is fully deployed. The function returns a CanFlyAtReturnValue,
84 // which can be CAN_NOT_FLY, CONTROL_FAIL, or CAN_FLY.
85 P6DofUtils::CanFlyAtReturnValue CanFlyAt(double aAltitude_ft, double aVelocity_fps, double aThrottle, double aFlaps = 0.0);
86
87 // This returns the turn rate (deg/sec) with the specified specific excess power (in ft/sec),
88 // true airspeed (in ft/sec), and throttle setting (where 0 is idle, 1 is military power
89 // (full power without afterburner), and 2 is full afterburner).
90 double TurnRateAt(double aSpecificExcessPower_fps, double aTrueSpeed_fps, double aThrottleSetting);
91
92 // This returns the turn rate (deg/sec) with the required specific excess power (ft/sec)
93 // at the the specified conditions, including current mass (lbs), maximum g-load,
94 // altitude (ft), airspeed (ft/sec), and throttle setting (where 0 is idle, 1 is
95 // military power (full power without afterburner), and 2 is full afterburner).
96 double TurnRateWithConditions(double aSpecificExcessPower_fps,
97 double aCurrentMass_lbs,
98 double aMaxGLoad,
99 double aAltitude_ft,
100 double aAirspeed_fps,
101 double aThrottleSetting);
102
103 // This returns the horizontal thrust (in lbs) produced in level flight at the specified
104 // altitude (ft) and speed (Mach) with the specified throttle setting and gross weight.
105 // The throttle input assumes that 0 is idle, 1 is military power (full power without
106 // afterburner), and 2 is full afterburner. Note that the thrust returned is the
107 // horizontal component. The total thrust is likely greater due to vehicle pitch attitude.
108 double GetLevelFlightHorizontalThrust(double aAltitude_ft, double aMach, double aThrottle, double aGrossWeight_lbs);
109
110 // This returns the drag (in lbs) when in level flight at the specified altitude (ft) and
111 // speed (Mach) with the specified gross weight.
112 double GetLevelFlightDrag(double aAltitude_ft, double aMach, double aGrossWeight_lbs);
113
114 // This returns the pitching moment (ft-lbs) at the specified altitude (ft), speed (Mach),
115 // angle of attack (alpha) (in deg), and normalized stick back position.
116 double GetPitchingMoment(double aAltitude_ft, double aMach, double aAlpha_deg, double aStickBack);
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 void CreateAutopilotSupportFile(const std::string& aFilename);
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 void CreateAutopilotSupportFileWithMaxMach(const std::string& aFilename, const double& aMaxMach);
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 void LimitAlphaByMaxGLoad(P6DofVehicle* aVehicle,
137 double aMach,
138 double aMaxGLoad,
139 double aDynPressure_ppsqft,
140 double& aAlpha_rad);
141
142 // In addition to limiting alpha, we may also need to limit the g-load.
143 // If necessary, this will limit alpha to stay under the g-load limit.
144 void LimitAlphaByMaxGLoad(P6DofVehicle* aVehicle,
145 double aMach,
146 double aMaxGLoad,
147 double aDynPressure_ppsqft,
148 double aCurrentMass_lbs,
149 double& aAlpha_rad);
150
151 // Modifies base vehicle mass, does NOT modify fuel mass. Used for testing.
152 void SetVehicleMass(double aMass_lbs);
153
154 // Returns the max g-load as limited by autopilot. If no autopilot exists, it
155 // returns zero. If more than one autopilot exists, it selects the autopilot
156 // based on the following order: synthetic pilot, augmented manual pilot,
157 // guidance, and hardware autopilot.
158 double GetMaxGLoad();
159
160 // This provides the maximum instantaneous g-load as a function of altitude (ft) and
161 // speed (Mach) for a specified mass (lbs). This is the maximum pitch g-load based on
162 // conditions and does not consider any thrust effects. Hence, this can calculate the
163 // g-load for speeds that may not be attainable under normal operation. This function
164 // can be used for both aircraft and weapons.
165 double MaxInstantaneousGLoad(double aAltitude_ft, double aMach, double aCurrentMass_lbs);
166
167protected:
168 // This returns the angle of attack (alpha) in radians at the specified altitude (ft),
169 // speed (ft/sec), and desired drag (lbs).
170 double AlphaAtDesiredDrag(double aAlt_ft, double aSpeed_fps, double aDrag_lbs, bool& aOk);
171
172 // This provides the angle of attack (alpha) in radians at the specified altitude (ft),
173 // speed (Mach), and desired drag (lbs) with the specified current mass and while
174 // limited to the specified max g-load.
175 bool AlphaAtDesiredDrag(double aAlt_ft,
176 double aMach,
177 double aDrag_lbs,
178 double aCurrentMass_lbs,
179 double aMaxGLoad,
180 double& aAlpha_rad);
181
182 // This is used to setup/configure for running in test mode
183 void SetupForTestingMode(bool aFreezeFuelBurn);
184
185 // This is used to restore from running in test mode
187
188 // This calculates the drag (lbs) and angle of attack (alpha, in deg) when in level flight
189 // at the specified altitude (ft) and speed (Mach) with the specified gross weight.
190 // Returns true if successful.
191 bool CalcLevelFlightDragAndAlpha(double aAltitude_ft,
192 double aMach,
193 double aGrossWeight_lbs,
194 double& aDrag_lbs,
195 double& aAlpha_deg);
196
197 // For the specified engine (thrust producer), this returns the throttle setting
198 // (where 0 is idle, 1 is military power (full power without afterburner), and
199 // 2 is full afterburner) for the specified altitude (ft) and speed (Mach) with
200 // the specified required thrust (lbs).
202 P6DofAtmosphere* aAtm,
203 double aAltitude_ft,
204 double aMach,
205 double aRequiredThrust_lbs);
206
207 // For the specified engine (thrust producer), this returns the fuel burn rate (lb/hr)
208 // at the specified altitude(ft) and speed (Mach) with the specified required
209 // thrust (lbs).
211 P6DofAtmosphere* aAtm,
212 double aAltitude_ft,
213 double aMach,
214 double aRequiredThrust_lbs);
215
216 // For the specified engine (thrust producer), this returns the fuel burn rate (lb/hr)
217 // at the specified altitude(ft) and speed (Mach) with the specified throttle setting
218 // (where 0 is idle, 1 is military power (full power without afterburner), and 2 is
219 // full afterburner).
221 P6DofAtmosphere* aAtm,
222 double aAltitude_ft,
223 double aMach,
224 double aThrottle);
225
226 // For the specified engine (thrust producer), this returns the thrust (lbs)
227 // at the specified altitude(ft) and speed (Mach) with the specified throttle setting
228 // (where 0 is idle, 1 is military power (full power without afterburner), and 2 is
229 // full afterburner).
231 P6DofAtmosphere* aAtm,
232 double aAltitude_ft,
233 double aMach,
234 double aThrottle);
235
237
239 bool mTestingNolag = false;
241};
242
243#endif
aObjectPtr SetMasterFreezeFuelBurn(aVarArgs[0].GetBool())
aObjectPtr Autotune()
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)
P6DofAtmosphere provides atmospheric data for Pseudo 6DOF objects.
Definition P6DofAtmosphere.hpp:28
Definition P6DofPilotObject.hpp:37
Definition P6DofThrustProducerObject.hpp:34
Definition P6DofVehicle.hpp:53
Provides the capability to draw shapes into the WSF replay file.
Definition WsfDraw.hpp:35
Definition WsfMoverGuidance.hpp:23
void SetMasterFreezeVerticalSpeed(bool aEnable)
Definition WsfP6DOF_MoverTestObject.cpp:78
double GetPitchingMoment(double aAltitude_ft, double aMach, double aAlpha_deg, double aStickBack)
Definition WsfP6DOF_MoverTestObject.cpp:461
void CreateAutopilotConfigFile(const std::string &aFilename)
Definition WsfP6DOF_MoverTestObject.cpp:134
void LimitAlphaByMaxGLoad(P6DofVehicle *aVehicle, double aMach, double aMaxGLoad, double aDynPressure_ppsqft, double &aAlpha_rad)
Definition WsfP6DOF_MoverTestObject.cpp:611
void CreateAutopilotSupportFileWithMaxMach(const std::string &aFilename, const double &aMaxMach)
Definition WsfP6DOF_MoverTestObject.cpp:603
double TurnRateAt(double aSpecificExcessPower_fps, double aTrueSpeed_fps, double aThrottleSetting)
Definition WsfP6DOF_MoverTestObject.cpp:153
double GetMaxGLoad()
Definition WsfP6DOF_MoverTestObject.cpp:779
P6DofUtils::CanFlyAtReturnValue CanFlyAt(double aAltitude_ft, double aVelocity_fps, double aThrottle, double aFlaps=0.0)
Definition WsfP6DOF_MoverTestObject.cpp:143
double FuelBurnAtRequiredThrust(P6DofThrustProducerObject *aEngine, P6DofAtmosphere *aAtm, double aAltitude_ft, double aMach, double aRequiredThrust_lbs)
Definition WsfP6DOF_MoverTestObject.cpp:1695
double FuelBurnAtThrottleSetting(P6DofThrustProducerObject *aEngine, P6DofAtmosphere *aAtm, double aAltitude_ft, double aMach, double aThrottle)
Definition WsfP6DOF_MoverTestObject.cpp:1793
double AlphaAtDesiredDrag(double aAlt_ft, double aSpeed_fps, double aDrag_lbs, bool &aOk)
Definition WsfP6DOF_MoverTestObject.cpp:971
P6DofAtmosphere * GetAtmosphere()
Definition WsfP6DOF_MoverTestObject.cpp:1394
void RestoreFromTestingMode()
Definition WsfP6DOF_MoverTestObject.cpp:1440
double ThrottleSettingToProduceThrust(P6DofThrustProducerObject *aEngine, P6DofAtmosphere *aAtm, double aAltitude_ft, double aMach, double aRequiredThrust_lbs)
Definition WsfP6DOF_MoverTestObject.cpp:1599
double TurnRateWithConditions(double aSpecificExcessPower_fps, double aCurrentMass_lbs, double aMaxGLoad, double aAltitude_ft, double aAirspeed_fps, double aThrottleSetting)
Definition WsfP6DOF_MoverTestObject.cpp:265
bool CalcLevelFlightDragAndAlpha(double aAltitude_ft, double aMach, double aGrossWeight_lbs, double &aDrag_lbs, double &aAlpha_deg)
Definition WsfP6DOF_MoverTestObject.cpp:1451
void SetupForTestingMode(bool aFreezeFuelBurn)
Definition WsfP6DOF_MoverTestObject.cpp:1419
WsfP6DOF_MoverTestObject(WsfP6DOF_Mover *aParentMover)
Constructor.
Definition WsfP6DOF_MoverTestObject.cpp:31
double GetLevelFlightDrag(double aAltitude_ft, double aMach, double aGrossWeight_lbs)
Definition WsfP6DOF_MoverTestObject.cpp:442
void CreateAutopilotSupportFile(const std::string &aFilename)
Definition WsfP6DOF_MoverTestObject.cpp:595
double GetRangeSinceStart_km() const
Definition WsfP6DOF_MoverTestObject.cpp:44
double GetLevelFlightFuelBurnRate(double aAltitude_ft, double aMach, double aGrossWeight_lbs)
Definition WsfP6DOF_MoverTestObject.cpp:500
bool mTestingFreezeFuelBurn
Definition WsfP6DOF_MoverTestObject.hpp:240
void SetVehicleMass(double aMass_lbs)
Definition WsfP6DOF_MoverTestObject.cpp:774
double MaxInstantaneousGLoad(double aAltitude_ft, double aMach, double aCurrentMass_lbs)
Definition WsfP6DOF_MoverTestObject.cpp:857
double GetLevelFlightHorizontalThrust(double aAltitude_ft, double aMach, double aThrottle, double aGrossWeight_lbs)
Definition WsfP6DOF_MoverTestObject.cpp:387
void FlyStraightLevelFullThrottle()
Definition WsfP6DOF_MoverTestObject.cpp:568
double ThrustAtThrottleSetting(P6DofThrustProducerObject *aEngine, P6DofAtmosphere *aAtm, double aAltitude_ft, double aMach, double aThrottle)
Definition WsfP6DOF_MoverTestObject.cpp:1824
bool mTestingNolag
Definition WsfP6DOF_MoverTestObject.hpp:239
WsfP6DOF_Mover * mParentMover
Definition WsfP6DOF_MoverTestObject.hpp:238
Definition WsfP6DOF_Mover.hpp:51
CanFlyAtReturnValue
Definition P6DofUtils.hpp:30
Copyrights Multiple, All Rights Reserved