Main Content

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:

  1. Define a new class. This class must inherit from the Aero.FixedWing.State.

  2. Define custom states by adding new dependent properties to the class.

  3. 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
           UnitSystem: "Metric"
          AngleSystem: "Radians"
    TemperatureSystem: "Kelvin"
           Properties: [1x1 Aero.Aircraft.Properties]

cruise = 
  astDehavillandBeaverState with properties:

                  Alpha2: 0.0209
                  Alpha3: 0.0030
                   Beta2: 2.1609e-04
                   Beta3: -3.1765e-06
                     b2V: 0.1642
                      cV: 0.0356
                     qcV: 1.0159e-22
                    pb2V: -1.3994e-20
                    rb2V: 4.9110e-20
                 betab2V: -0.0024
            AileronAlpha: 0.0013
               FlapAlpha: 0
           ElevatorBeta2: -9.1838e-06
             RudderAlpha: -0.0066
                   Alpha: 0.1444
                    Beta: -0.0147
                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: 45
                       V: 0
                       W: 0
                     Phi: 0
                   Theta: 0.1444
                     Psi: 0
                       P: -8.5200e-20
                       Q: 2.8500e-21
                       R: 2.9900e-19
                  Weight: 2.2448e+04
             AltitudeAGL: 2202
                Airspeed: 44.5365
             GroundSpeed: 45
              MachNumber: 0.1339
            BodyVelocity: [44.0682 -0.6547 6.4080]
          GroundVelocity: [45 0 0]
                      Ur: 44.0682
                      Vr: -0.6547
                      Wr: 6.4080
         FlightPathAngle: 0
             CourseAngle: 0
    InertialToBodyMatrix: [3x3 double]
    BodyToInertialMatrix: [3x3 double]
        BodyToWindMatrix: [3x3 double]
        WindToBodyMatrix: [3x3 double]
         DynamicPressure: 998.1851
             Environment: [1x1 Aero.Aircraft.Environment]
              UnitSystem: "Metric"
             AngleSystem: "Radians"
       TemperatureSystem: "Kelvin"
           ControlStates: [1x5 Aero.Aircraft.ControlState]
        OutOfRangeAction: "Limit"
        DiagnosticAction: "Warning"
              Properties: [1x1 Aero.Aircraft.Properties]

cruise.Alpha2
ans = 0.0209
[F, M] = forcesAndMoments(beaver, cruise)
F = 3×1
103 ×

    0.7116
   -0.2185
    2.8976

M = 3×1
103 ×

    0.0579
    1.6427
    0.1933

dydt = nonlinearDynamics(beaver, cruise)
dydt = 12×1

   44.5317
         0
   -6.4754
    0.3110
   -0.0955
    1.2663
    0.0104
    0.2371
    0.0174
   -0.0000
      ⋮

[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    -30.646    -0.94341     656.72          29138    -42.007          0    -557.74          0
    FY    -9.8123     -65.493    -14.105        -558.71    -2917.1    -472.26          0     1396.2
    FZ    -456.65      2.3887    -2888.1    -1.2435e+05     106.36          0    -2469.7          0
    L     -3.4499     -470.72     -6.295         -255.3     -20967     -28110          0     9444.4
    M      217.97       -17.9    -988.08         -44940    -797.04          0     -20417    -1885.2
    N      9.3412      51.579     1.3583       0.002102     2297.4    -8831.5     1928.7      -6196

References

  1. 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.