Customize Fixed-Wing Aircraft with Additional Aircraft States
This example shows how to construct and define a custom state for a fixed-wing aircraft.
This example describes:
Defining custom states and when they might be used.
Creating a basic custom state.
Creating an advanced custom state.
Using a custom state in the analysis of a fixed-wing aircraft.
What Are Custom States?
By default, the fixed-wing state object has a fixed set of state values. These include angle of attack, airspeed, altitude, and others.
These states are used within the fixed-wing object to dimensionalize non-dimensional coefficients or provide data to lookup table breakpoints.
However, there are cases where this default set of states does not capture all of the desired states of an aircraft. This is when custom states are used.
By defining a custom state, it is possible to create new state values which can be used within any component of a fixed-wing aircraft.
Defining a Custom State
To create custom states with the Aero.FixedWing.State
class:
Define a new class. This class must inherit from the
Aero.FixedWing.State
.Define custom states by adding new dependent properties to the class.
Define the get.State method in the custom state class.
Below is a simple example state where the custom state class, MyState
, is defined with a custom state value, MyValue
.
The get
methods of dependent properties can access any other property on the state. In this case, MyValue
uses ground forward speed, U
.
classdef MyState < Aero.FixedWing.State properties (Dependent) MyValue end methods function value = get.MyValue(obj) value = obj.U * 10; end end end
A more advanced example of the custom state is the De Havilland Beaver aircraft model [1] which uses a number of custom states to dimensionalize its coefficients. This custom state can be seen as "astDehavillandBeaverState" below.
classdef astDehavillandBeaverState < Aero.FixedWing.State properties (Dependent) Alpha2 Alpha3 Beta2 Beta3 b2V cV qcV pb2V rb2V betab2V AileronAlpha FlapAlpha ElevatorBeta2 RudderAlpha end methods function value = get.Alpha2(obj) value = obj.Alpha ^ 2; end function value = get.Alpha3(obj) value = obj.Alpha ^ 3; end function value = get.Beta2(obj) value = obj.Beta ^ 2; end function value = get.Beta3(obj) value = obj.Beta ^ 3; end function value = get.b2V(obj) value = 14.6300 / (2*obj.Airspeed); end function value = get.cV(obj) value = 1.5875 / (obj.Airspeed); end function value = get.qcV(obj) value = obj.Q * obj.cV; end function value = get.pb2V(obj) value = obj.P * obj.b2V; end function value = get.rb2V(obj) value = obj.R * obj.b2V; end function value = get.betab2V(obj) value = obj.Beta * obj.b2V; end function value = get.AileronAlpha(obj) value = obj.getState("Aileron") * obj.Alpha; end function value = get.FlapAlpha(obj) value = obj.getState("Flap") * obj.Alpha; end function value = get.ElevatorBeta2(obj) value = obj.getState("Elevator") * obj.Beta2; end function value = get.RudderAlpha(obj) value = obj.getState("Rudder") * obj.Alpha; end end end
This custom state not only directly uses the pre-defined state properties from the fixed-wing state, but also uses the getState method to extract the control surface deflection angles. Any combination of states or methods can be used in the get methods for custom states.
Using a Custom State
With the custom state defined, use the custom state in the analysis methods.
[beaver, cruise] = astDehavillandBeaver()
beaver = FixedWing with properties: ReferenceArea: 23.2300 ReferenceSpan: 14.6300 ReferenceLength: 1.5875 Coefficients: [1x1 Aero.FixedWing.Coefficient] DegreesOfFreedom: "6DOF" Surfaces: [1x3 Aero.FixedWing.Surface] Thrusts: [1x1 Aero.FixedWing.Thrust] AspectRatio: 9.2138 Properties: [1x1 Aero.Aircraft.Properties] UnitSystem: "Metric" TemperatureSystem: "Kelvin" AngleSystem: "Radians"
cruise = astDehavillandBeaverState with properties: Alpha2: 0.0170 Alpha3: 0.0022 Beta2: 0.0036 Beta3: 2.1974e-04 b2V: 0.1625 cV: 0.0353 qcV: 0 pb2V: 0 rb2V: 0 AileronAlpha: 0.0012 FlapAlpha: 0 ElevatorBeta2: -1.5476e-04 RudderAlpha: -0.0060 Alpha: 0.1303 Beta: 0.0603 AlphaDot: 0 BetaDot: 0 Mass: 2.2882e+03 Inertia: [3x3 table] CenterOfGravity: [0 0 0] CenterOfPressure: [0 0 0] AltitudeMSL: 2202 GroundHeight: 0 XN: 0 XE: 0 XD: -2202 U: 44.5400 V: 2.7140 W: 5.8360 Phi: 0 Theta: 0.1309 Psi: 0 P: 0 Q: 0 R: 0 Weight: 2.2448e+04 AltitudeAGL: 2202 Airspeed: 45.0026 GroundSpeed: 45.0026 MachNumber: 0.1357 BodyVelocity: [44.5400 2.7140 5.8360] GroundVelocity: [44.5400 2.7140 5.8360] Ur: 44.5400 Vr: 2.7140 Wr: 5.8360 FlightPathAngle: 0.1303 CourseAngle: 0.0609 InertialToBodyMatrix: [3x3 double] BodyToInertialMatrix: [3x3 double] BodyToWindMatrix: [3x3 double] WindToBodyMatrix: [3x3 double] BodyToStabilityMatrix: [3x3 double] StabilityToBodyMatrix: [3x3 double] DynamicPressure: 998.6513 Environment: [1x1 Aero.Aircraft.Environment] ControlStates: [1x5 Aero.Aircraft.ControlState] OutOfRangeAction: "Limit" DiagnosticAction: "Warning" Properties: [1x1 Aero.Aircraft.Properties] UnitSystem: "Metric" TemperatureSystem: "Kelvin" AngleSystem: "Radians"
cruise.Alpha2
ans = 0.0170
[F, M] = forcesAndMoments(beaver, cruise)
F = 3×1
103 ×
0.4037
-1.3285
4.7465
M = 3×1
103 ×
-1.5125
2.3497
0.3744
dydt = nonlinearDynamics(beaver, cruise)
dydt = 12×1
44.9207
2.7140
-0.0276
0.1764
-0.5806
2.0743
-0.2619
0.3391
0.0297
0
⋮
[stability, derivatives] = staticStability(beaver, cruise)
stability=6×8 table
U V W Alpha Beta P Q R
________ ________ ________ ________ ________ ________ ________ ________
FX "Stable" "" "" "" "" "" "" ""
FY "" "Stable" "" "" "" "" "" ""
FZ "" "" "Stable" "" "" "" "" ""
L "" "" "" "" "Stable" "Stable" "" ""
M "Stable" "" "" "Stable" "" "" "Stable" ""
N "" "" "" "" "Stable" "" "" "Stable"
derivatives=6×8 table
U V W Alpha Beta P Q R
_______ _______ _______ ___________ _______ _______ _______ _______
FX -32.531 2.7704 601.22 26968 124.91 0 -552.22 0
FY -33.152 -398.64 -16.894 -558.01 -17973 -467.59 0 1382.4
FZ -410.16 -4.8834 -2867.8 -1.2531e+05 -220.18 0 -2445.2 0
L -37.919 -469.28 -10.703 -254.35 -21158 -27832 0 9350.9
M 222.86 74.529 -930.3 -42740 3360.4 0 -20214 -1866.5
N 12.771 62.732 1.6733 -0.35231 2828.4 -8744.1 1909.6 -6134.6
States can also be created using the fixedWingStateCustom function.
This function is identical to the fixedWingState function except for the addition of a string input which specified the state object to create.
state = fixedWingStateCustom("astDehavillandBeaverState",beaver)
state = astDehavillandBeaverState with properties: Alpha2: 0 Alpha3: 0 Beta2: 0 Beta3: 0 b2V: 0.1463 cV: 0.0318 qcV: 0 pb2V: 0 rb2V: 0 AileronAlpha: 0 FlapAlpha: 0 ElevatorBeta2: 0 RudderAlpha: 0 Alpha: 0 Beta: 0 AlphaDot: 0 BetaDot: 0 Mass: 0 Inertia: [3x3 table] CenterOfGravity: [0 0 0] CenterOfPressure: [0 0 0] AltitudeMSL: 0 GroundHeight: 0 XN: 0 XE: 0 XD: 0 U: 50 V: 0 W: 0 Phi: 0 Theta: 0 Psi: 0 P: 0 Q: 0 R: 0 Weight: 0 AltitudeAGL: 0 Airspeed: 50 GroundSpeed: 50 MachNumber: 0.1469 BodyVelocity: [50 0 0] GroundVelocity: [50 0 0] Ur: 50 Vr: 0 Wr: 0 FlightPathAngle: 0 CourseAngle: 0 InertialToBodyMatrix: [3x3 double] BodyToInertialMatrix: [3x3 double] BodyToWindMatrix: [3x3 double] WindToBodyMatrix: [3x3 double] BodyToStabilityMatrix: [3x3 double] StabilityToBodyMatrix: [3x3 double] DynamicPressure: 1.5312e+03 Environment: [1x1 Aero.Aircraft.Environment] ControlStates: [1x5 Aero.Aircraft.ControlState] OutOfRangeAction: "Limit" DiagnosticAction: "Warning" Properties: [1x1 Aero.Aircraft.Properties] UnitSystem: "Metric" TemperatureSystem: "Kelvin" AngleSystem: "Radians"
state2 = fixedWingStateCustom("astDehavillandBeaverState",beaver,aircraftEnvironment(beaver,"COESA",1000))
state2 = astDehavillandBeaverState with properties: Alpha2: 0 Alpha3: 0 Beta2: 0 Beta3: 0 b2V: 0.1463 cV: 0.0318 qcV: 0 pb2V: 0 rb2V: 0 AileronAlpha: 0 FlapAlpha: 0 ElevatorBeta2: 0 RudderAlpha: 0 Alpha: 0 Beta: 0 AlphaDot: 0 BetaDot: 0 Mass: 0 Inertia: [3x3 table] CenterOfGravity: [0 0 0] CenterOfPressure: [0 0 0] AltitudeMSL: 0 GroundHeight: 0 XN: 0 XE: 0 XD: 0 U: 50 V: 0 W: 0 Phi: 0 Theta: 0 Psi: 0 P: 0 Q: 0 R: 0 Weight: 0 AltitudeAGL: 0 Airspeed: 50 GroundSpeed: 50 MachNumber: 0.1486 BodyVelocity: [50 0 0] GroundVelocity: [50 0 0] Ur: 50 Vr: 0 Wr: 0 FlightPathAngle: 0 CourseAngle: 0 InertialToBodyMatrix: [3x3 double] BodyToInertialMatrix: [3x3 double] BodyToWindMatrix: [3x3 double] WindToBodyMatrix: [3x3 double] BodyToStabilityMatrix: [3x3 double] StabilityToBodyMatrix: [3x3 double] DynamicPressure: 1.3896e+03 Environment: [1x1 Aero.Aircraft.Environment] ControlStates: [1x5 Aero.Aircraft.ControlState] OutOfRangeAction: "Limit" DiagnosticAction: "Warning" Properties: [1x1 Aero.Aircraft.Properties] UnitSystem: "Metric" TemperatureSystem: "Kelvin" AngleSystem: "Radians"
References
Rauw, M.O.: "A Simulink Environment for Flight Dynamics and Control analysis - Application to the DHC-2 'Beaver' ". Part I: "Implementation of a model library in Simulink". Part II: "Nonlinear analysis of the 'Beaver' autopilot". MSc-thesis, Delft University of Technology, Faculty of Aerospace Engineering. Delft, The Netherlands, 1993.