get started with fixed-凯发k8网页登录
this example shows how to create and use fixed-wing aircraft in matlab®.
for an example of setting realistic coefficients on an aircraft and calculating static stability, see "determine nonlinear dynamics and static stability of fixed-wing aircraft”.
for an example of importing coefficients from digital datcom analysis and linearizing to a state-space model, see “analyze state-space model for linear control and static stability analysis”.
for an example of creating custom states, see “customize fixed-wing aircraft with additional aircraft states”.
what is a fixed-wing aircraft?
fixed-wing aircraft encompass all aircraft that generate lift from fixed airfoil surfaces extending off the main body. the standard configuration for fixed-wing aircraft is a large main wing near the center of gravity and horizontal and vertical stabilizers at the end of the body.
the large main wing of the fixed-wing aircraft generates lift, with the horizontal and vertical stabilizers providing reaction forces and moments for stability and control. however, unlike rotary-wing aircraft, the fixed-wing aircraft's wings are fixed in place. therefore, to provide the airflow to generate the necessary lift to fly aircraft off the ground, the fixed-wing aircraft wings require forward movement. this forward movement is typically created from a thrust vector generated by a jet engine or propeller.
fixed-wing aircraft construction workflow
the construction of a fixed-wing aircraft model requires these components:
the configuration of the aircraft
what aerodynamic surfaces exist on the aircraft?
what control surfaces exist on the aircraft?
what thrust vectors exist on the aircraft?
the numerical model of the aircraft
the current state of the aircraft
this example follows this workflow to illustrate how to construct a fixed-wing aircraft application for numerical analysis in matlab.
fixed-wing aircraft configuration
this example constructs a basic 3-control surface, standard-configuration aircraft.
for this example, only the control surfaces and body will be defined.
to start, define the control surfaces using the fixedwingsurface function.
surface = fixedwingsurface("mysurface")
surface = surface with properties: surfaces: [1x0 aero.fixedwing.surface] coefficients: [1x1 aero.fixedwing.coefficient] maximumvalue: inf minimumvalue: -inf controllable: off symmetry: "symmetric" controlvariables: [0x0 string] properties: [1x1 aero.aircraft.properties]
the surface has many properties that help define a fixed-wing aircraft surface, in particular the controllability, coefficients, maximum and minimum values. symmetry, and any nested surfaces a surface might have.
for this aircraft, the aileron is an asymmetric control surface with a maximum and minimum deflection of 20 and -20 degrees, respectively.
to construct this surface, name-value pairs can be specified to set each property to their desired level.
aileron = fixedwingsurface("aileron", "on", "asymmetric", [-20, 20])
aileron = surface with properties: surfaces: [1x0 aero.fixedwing.surface] coefficients: [1x1 aero.fixedwing.coefficient] maximumvalue: 20 minimumvalue: -20 controllable: on symmetry: "asymmetric" controlvariables: ["aileron_1" "aileron_2"] properties: [1x1 aero.aircraft.properties]
using the same pattern as the aileron construct the elevators and rudders.
these two surfaces follow the same pattern as the aileron, but are defined as symmetric control surfaces.
elevator = fixedwingsurface("elevator", "on", "symmetric", [-20, 20])
elevator = surface with properties: surfaces: [1x0 aero.fixedwing.surface] coefficients: [1x1 aero.fixedwing.coefficient] maximumvalue: 20 minimumvalue: -20 controllable: on symmetry: "symmetric" controlvariables: "elevator" properties: [1x1 aero.aircraft.properties]
rudder = fixedwingsurface("rudder", "on", "symmetric", [-20, 20])
rudder = surface with properties: surfaces: [1x0 aero.fixedwing.surface] coefficients: [1x1 aero.fixedwing.coefficient] maximumvalue: 20 minimumvalue: -20 controllable: on symmetry: "symmetric" controlvariables: "rudder" properties: [1x1 aero.aircraft.properties]
in addition to the control surfaces of the aircraft, also define the thrust vectors.
for this example, it is assumed that there is a single thrust vector along the body of the aircraft.
define this thrust vector using the fixedwingthrust function.
propeller = fixedwingthrust("propeller","on","symmetric",[0, 0.75])
propeller = thrust with properties: coefficients: [1x1 aero.fixedwing.coefficient] maximumvalue: 0.7500 minimumvalue: 0 controllable: on symmetry: "symmetric" controlvariables: "propeller" properties: [1x1 aero.aircraft.properties]
thrust is nearly identical to surface with the exception that it is assumed to be controllable by default, whereas the surface is not controllable by default.
with these control surfaces and thrust vectors defined, create an aircraft using the fixedwingaircraft function.
this aircraft carries the full definition of the fixed-wing aircraft. this example uses it in all analysis methods.
the reference area, span, and length help dimensionalize non-dimensional coefficients used in the analysis methods.
for simplicity, this aircraft uses a reference area, span, and length of 3, 2, and 1, respectively.
aircraft = fixedwingaircraft("myaircraft", 3,2,1)
aircraft = fixedwing with properties: referencearea: 3 referencespan: 2 referencelength: 1 coefficients: [1x1 aero.fixedwing.coefficient] degreesoffreedom: "6dof" surfaces: [1x0 aero.fixedwing.surface] thrusts: [1x0 aero.fixedwing.thrust] aspectratio: 1.3333 properties: [1x1 aero.aircraft.properties] unitsystem: "metric" temperaturesystem: "kelvin" anglesystem: "radians"
additionally, the control surfaces and thrust vectors can be applied to the aircraft
aircraft.surfaces = [aileron, elevator, rudder]
aircraft = fixedwing with properties: referencearea: 3 referencespan: 2 referencelength: 1 coefficients: [1x1 aero.fixedwing.coefficient] degreesoffreedom: "6dof" surfaces: [1x3 aero.fixedwing.surface] thrusts: [1x0 aero.fixedwing.thrust] aspectratio: 1.3333 properties: [1x1 aero.aircraft.properties] unitsystem: "metric" temperaturesystem: "kelvin" anglesystem: "radians"
aircraft.thrusts = propeller
aircraft = fixedwing with properties: referencearea: 3 referencespan: 2 referencelength: 1 coefficients: [1x1 aero.fixedwing.coefficient] degreesoffreedom: "6dof" surfaces: [1x3 aero.fixedwing.surface] thrusts: [1x1 aero.fixedwing.thrust] aspectratio: 1.3333 properties: [1x1 aero.aircraft.properties] unitsystem: "metric" temperaturesystem: "kelvin" anglesystem: "radians"
with the aircraft body construct and control surfaces set, the aircraft is now fully constructed.
however, the current construction of the aircraft does not have much numerical meaning as the numerical model has defaults of 0.
to remedy this, set numeric coefficients.
fixed-wing aircraft numerical modeling
to perform numerical modeling using fixed-wing aircraft in matlab, define known coefficients that represent the nonlinear behavior of the aircraft at its various operating states. aircraft coefficients are the fixed set of coefficients that define body forces and moments, excluding reaction forces due to control surfaces or thrust vectors.
obtain these coefficients through a variety of methods, such as digital datcom, computational fluid dynamics (cfd) analysis, or using first-principles preliminary analysis calculations.
if using digital datcom to calculate the numeric coefficients, directly convert the digital datcom struct to a fixed-wing aircraft using datcomtofixedwing.
you can also manually import assign the coefficients to the aircraft.
fixed-wing aircraft coefficients reside on the aircraft in several places. as can be seen above, the aircraft itself, and every surface and thrust on the aircraft, has a set of coefficients.
control surface coefficients define the forces and moments due to control surface deflections.
thrust coefficients define the forces and moments due to the various propulsion methods.
all these independent forces and moments summed together provide the full forces and moments definition of the aircraft, and in turn the nonlinear dynamics.
define coefficients using the fixedwingcoefficient function.
coeff = fixedwingcoefficient
coeff = coefficient with properties: table: [6x1 table] values: {6x1 cell} statevariables: "zero" stateoutput: [6x1 string] referenceframe: "wind" multiplystatevariables: on nondimensional: on properties: [1x1 aero.aircraft.properties]
the fixedwingcoefficient function defines coefficient-specific properties, including the reference frame, specifying dimensional or non-dimensional coefficients, and specifying the state variable multiply behavior.
setting coefficient values can be done through the setcoefficient function.
retrieving coefficient values can be done through the getcoefficient function.
to view the coefficients of a component in a table, use the table property on the returned coefficient.
cl_alpha = 0.2; aircraft = setcoefficient(aircraft, "cl", "alpha", cl_alpha)
aircraft = fixedwing with properties: referencearea: 3 referencespan: 2 referencelength: 1 coefficients: [1x1 aero.fixedwing.coefficient] degreesoffreedom: "6dof" surfaces: [1x3 aero.fixedwing.surface] thrusts: [1x1 aero.fixedwing.thrust] aspectratio: 1.3333 properties: [1x1 aero.aircraft.properties] unitsystem: "metric" temperaturesystem: "kelvin" anglesystem: "radians"
getcoefficient(aircraft, "cl", "alpha")
ans = 0.2000
aircraft.coefficients.table
ans=6×9 table
zero u alpha alphadot q beta betadot p r
____ _ _____ ________ _ ____ _______ _ _
cd 0 0 0 0 0 0 0 0 0
cy 0 0 0 0 0 0 0 0 0
cl 0 0 0.2 0 0 0 0 0 0
cl 0 0 0 0 0 0 0 0 0
cm 0 0 0 0 0 0 0 0 0
cn 0 0 0 0 0 0 0 0 0
you can also set coefficients on the nested surfaces and thrust vectors using their component name.
the component name is the same name that was set on the aircraft, surface, and thrust.
cl_0_elevator = 0.15; aircraft = setcoefficient(aircraft, "cl", "zero", cl_0_elevator, component="elevator")
aircraft = fixedwing with properties: referencearea: 3 referencespan: 2 referencelength: 1 coefficients: [1x1 aero.fixedwing.coefficient] degreesoffreedom: "6dof" surfaces: [1x3 aero.fixedwing.surface] thrusts: [1x1 aero.fixedwing.thrust] aspectratio: 1.3333 properties: [1x1 aero.aircraft.properties] unitsystem: "metric" temperaturesystem: "kelvin" anglesystem: "radians"
getcoefficient(aircraft, "cl", "zero",component="elevator")
ans = 0.1500
aircraft.surfaces(2).coefficients.table
ans=6×1 table
zero
____
cd 0
cy 0
cl 0.15
cl 0
cm 0
cn 0
set the specific coefficients using the setcoefficient function. retrieve them using the getcoefficient function. these coefficients depend on:
the input fixed-wing object
the reference frame on the coefficient
the state variables defined on the coefficient
the second input to setcoefficient and getcoefficient is the state output. to determine valid state outputs, refer to see the reference frame on the coefficient.
for example, if the reference frame is "body", the valid state outputs are:
"cx" - coefficient of body x force
"cy" - coefficient of body y force
"cz" - coefficient of body z force
"cl" - rolling moment coefficient
"cm" - pitching moment coefficient
"cn" - yawing moment coefficient
coeff.referenceframe = "body";
coeff.table
ans=6×1 table
zero
____
cx 0
cy 0
cz 0
cl 0
cm 0
cn 0
if the reference frame is "wind", the valid state outputs are:
"cd" - coefficient of drag force
"cy" - coefficient of body y force
"cl" - coefficient of lift force
"cl" - rolling moment coefficient
"cm" - pitching moment coefficient
"cn" - yawing moment coefficient
coeff.referenceframe = "wind";
coeff.table
ans=6×1 table
zero
____
cd 0
cy 0
cl 0
cl 0
cm 0
cn 0
the third input argument to setcoefficient and getcoefficient is the state variables that determine the states the coefficients are defined with.
by default, the coefficient assumes no state relationship. these coefficients are defined with the "zero" state variable, which means the coefficient has no states to multiply against.
in the case of the fixed-wing aircraft, there are a set of additional default states that are common to many aircraft definitions, namely, u, alpha, alphadot, beta, betadot, p, q, and r.
use any combination of these state outputs and state variables with setcoefficient and getcoefficient.
coeff.statevariables = ["alpha", "beta"]; coeff = setcoefficient(coeff, "cl", "beta", 5); coeff.table
ans=6×2 table
alpha beta
_____ ____
cd 0 0
cy 0 0
cl 0 5
cl 0 0
cm 0 0
cn 0 0
with the coefficients set on the aircraft, define the aircraft current state.
fixed-wing aircraft states
the current state of an aircraft defines the properties that are independent of the fixed configuration.
these properties include the mass, inertia, airspeed, altitude, deflection angles, and others.
by separating the current state from the configuration, the aircraft coefficient data can remain fixed while individual states change over time.
define fixed-wing aircraft states using the fixedwingstate function.
state = fixedwingstate(aircraft)
state = state with properties: 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: [1x6 aero.aircraft.controlstate] outofrangeaction: "limit" diagnosticaction: "warning" properties: [1x1 aero.aircraft.properties] unitsystem: "metric" temperaturesystem: "kelvin" anglesystem: "radians"
the names of the properties on this state are the same as the state variable string names in the coefficients.
in the aircraft coefficient table above, each coefficient in the "alpha" column is multiplied by the "alpha" property in the state if "multiplystatevariables" is on.
this action applies for every state variable in every coefficient on the aircraft.
some states are dependent states and depend on other properties within the state itself.
if a state depends on properties within the environment, you must define the current flying environment as well.
define the current flying environment using the aircraftenvironment function or by assigning to the environment directly on the state.
environment = aircraftenvironment(aircraft, "isa", 0)
environment = environment with properties: windvelocity: [0 0 0] density: 1.2250 temperature: 288.1500 pressure: 101325 speedofsound: 340.2941 gravity: 9.8100 properties: [1x1 aero.aircraft.properties]
state.environment = environment
state = state with properties: 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: [1x6 aero.aircraft.controlstate] outofrangeaction: "limit" diagnosticaction: "warning" properties: [1x1 aero.aircraft.properties] unitsystem: "metric" temperaturesystem: "kelvin" anglesystem: "radians"
the environment is assumed to be the same unit system as the state. it is important to keep these unit systems aligned and to align the unit systems between each state and aircraft.
creating an array of many states can be helpful for designing the sweep of parameters over which to perform calculations on the aircraft.
in this example, 11 states are created by varying mass, but holding airspeed constant.
mass = num2cell(1000:50:1500)
mass=1×11 cell array
{[1000]} {[1050]} {[1100]} {[1150]} {[1200]} {[1250]} {[1300]} {[1350]} {[1400]} {[1450]} {[1500]}
state = fixedwingstate(aircraft, u=100)
state = state with properties: 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: 100 v: 0 w: 0 phi: 0 theta: 0 psi: 0 p: 0 q: 0 r: 0 weight: 0 altitudeagl: 0 airspeed: 100 groundspeed: 100 machnumber: 0.2939 bodyvelocity: [100 0 0] groundvelocity: [100 0 0] ur: 100 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: 6125 environment: [1x1 aero.aircraft.environment] controlstates: [1x6 aero.aircraft.controlstate] outofrangeaction: "limit" diagnosticaction: "warning" properties: [1x1 aero.aircraft.properties] unitsystem: "metric" temperaturesystem: "kelvin" anglesystem: "radians"
states = repmat(state, size(mass))
states=1×11 object
1x11 state array with properties:
alpha
beta
alphadot
betadot
mass
inertia
centerofgravity
centerofpressure
altitudemsl
groundheight
xn
xe
xd
u
v
w
phi
theta
psi
p
q
r
weight
altitudeagl
airspeed
groundspeed
machnumber
bodyvelocity
groundvelocity
ur
vr
wr
flightpathangle
courseangle
inertialtobodymatrix
bodytoinertialmatrix
bodytowindmatrix
windtobodymatrix
bodytostabilitymatrix
stabilitytobodymatrix
dynamicpressure
environment
controlstates
outofrangeaction
diagnosticaction
properties
unitsystem
temperaturesystem
anglesystem
[states.mass] = mass{:}
states=1×11 object
1x11 state array with properties:
alpha
beta
alphadot
betadot
mass
inertia
centerofgravity
centerofpressure
altitudemsl
groundheight
xn
xe
xd
u
v
w
phi
theta
psi
p
q
r
weight
altitudeagl
airspeed
groundspeed
machnumber
bodyvelocity
groundvelocity
ur
vr
wr
flightpathangle
courseangle
inertialtobodymatrix
bodytoinertialmatrix
bodytowindmatrix
windtobodymatrix
bodytostabilitymatrix
stabilitytobodymatrix
dynamicpressure
environment
controlstates
outofrangeaction
diagnosticaction
properties
unitsystem
temperaturesystem
anglesystem
the second environment input can also help create a state array that iterates over many altitudes using a standard atmosphere model.
statesh = fixedwingstate(aircraft, aircraftenvironment(aircraft, "isa", [0, 1000, 2000]))
statesh=1×3 object
1x3 state array with properties:
alpha
beta
alphadot
betadot
mass
inertia
centerofgravity
centerofpressure
altitudemsl
groundheight
xn
xe
xd
u
v
w
phi
theta
psi
p
q
r
weight
altitudeagl
airspeed
groundspeed
machnumber
bodyvelocity
groundvelocity
ur
vr
wr
flightpathangle
courseangle
inertialtobodymatrix
bodytoinertialmatrix
bodytowindmatrix
windtobodymatrix
bodytostabilitymatrix
stabilitytobodymatrix
dynamicpressure
environment
controlstates
outofrangeaction
diagnosticaction
properties
unitsystem
temperaturesystem
anglesystem
fixed-wing analysis methods
with the construction of the aircraft and its states, you can now perform fixed-wing specific calculations.
these calculations can include:
forces and moments
nonlinear dynamics
static stability
linearization to a state-space model
f = zeros(numel(states), 3); m = zeros(numel(states), 3); dydt = zeros(numel(states), 12); for i = 1:numel(states) [f(i,:), m(i,:)] = forcesandmoments(aircraft, states(i)); dydt(i,:) = nonlineardynamics(aircraft, states(i)); end
the aircraft can also be used as a generic container to hold the aircraft definition as it is passed around to other parts of the program, such as in a simulink lookup table or custom matlab analysis functions.
in summary, the fixed-wing aircraft functions provide a common definition to creating and manipulating fixed-wing aircraft within matlab.
see also
| | | | |