---------------------------------------------------------------------------
Dynamics model for an aircraft. Updates the data structure x.
This model can include:
Flexible appendages
Spinning rotors
Nonlinear aerodynamics
Disturbance models
You can supply up to six routine names to customize the simulation:
d.aero.name = 'YourAeroFunctionName' - default []
d.actuator.name = 'YourActuatorFunctionName' - default []
d.engine.name = 'YourEngineFunctionName' - default []
d.rotor.name = 'YourRotorFunctionName' - default []
d.sensor.name = 'YourSensorFunctionName' - default []
d.disturb.name = 'YourDisturbanceFunctionName' - default []
-----------------------------------------------------------
Your aerodynamics routine must be in the form:
gAero = YourAeroFunctionName( alpha, beta, x, d.aero, qBar, control )
where gAero is a data structure that computes
the forces and torques on all of the components
and an addition the the mass and inertia matrix.
gAero is a data structure of the form
gAero.torque (3,1) Core torques
gAero.force (3,1) Core forces
gAero.modal (:,1) Modal forces
gAero.inertia (3,3) Delta inertia due to aerodynamics
gAero.mass (3,3) Delta mass matrix due to aerodynamics
If the last terms are zero return [] for them.
All terms are in the body frame.
-----------------------------------------------------------
Your engine routine must be in the form:
gEngine = YourEngineFunctionName( x.engine, d.engine, control, altitude, machNo )
where gEngine is a data structure that contains
the forces and torques on the aircraft due to the engines
and the engine state derivatives.
gEngine is a data structure of the form
gEngine.torque (3,1) Core torques
gEngine.force (3,1) Core forces
gEngine.dX (:,1) Engine state derivatives
gEngine.mDot (1,1) Fuel consumption
gEngine.inertiaDot (3,3) Inertia derivative due to fuel consumption
gEngine.cGDot (3,1) CG derivative due to fuel consumption
gEngine.torqueRotor (:,1) Torques on rotors
-----------------------------------------------------------
Your rotor routine must be in the form:
torque = YourRotorFunctionName( gEngine.torqueRotor, d.control, d.rotor )
where torque is a data structure that contains the torques on all rotors.
gEngine.torqueRotor (:,1) Torques on rotors
-----------------------------------------------------------
Your actuator routine must be in the form:
[dXActuator, control] = YourActuatorFunctionName( x.actuator, d.control, d.actuator )
where torque is a data structure that contains the torques on all rotors.
-----------------------------------------------------------
Your sensor routine must be in the form:
x = YourSensorFunctionName( x, d, opt )
when opt = 'rhs'
x = dXSensor
when opt = 'meas'
x = measurement
-----------------------------------------------------------
Your disturbance routine must be in the form:
disturb = YourDisturbanceFunctionName( x.disturb, d.disturb )
where
disturb.xDot - disturbance state derivatives
disturb.torque - disturbance torque
disturb.force - disturbance force
---------------------------------------------------------------------------
Form:
[x, measurement] = ACModel( x, t, dT, d, opt )
---------------------------------------------------------------------------
------
Inputs
------
x (:) Aircraft state
r (3,1) ECI position vector
q (4,1) Quaternion from ECI to body
w (3,1) Inertial body rate in body frame
v (3,1) Velocity of cm wrt air
wR (:,1) Angular velocity of rotors
mass (1,1) Mass
inertia (6,1) Inertia
cG (3,1) Center of mass
engine (:,1) Engine states
actuator (:,1) Actuator states
sensor (:,1) Sensor states
flex (:,1) Flex model states organized [x;v] by appendage
disturb (:,1) Disturbance model states
t (1,1) Time
dT (1,1) Time step
d (:) Aircraft data structure
d.wPlanet (3,1) Planet rate
d.mu (1,1) Planet gravitational parameter
d.theta0 (1,1) Initial angle between planet
x-axis and ECI x-axis
d.atmData (1,:) Atmospheric data
d.atmUnits (1,:) Atmospheric data units
d.rotor (:) Rotor data structure
.u (3,1) Unit vector
.inertia (1,1) Spin axis inertia
d.flex (:) See get BldFlex
d.engine (:) Private engine data structure
d.aero (:) Private aerodynamics data structure
d.actuator (:) Private actuator data structure
d.sensor (:) Private sensor data structure
d.disturb (:) Private disturbance data structure
d.control (:) Control data structure
.elevator
.aileron
.rudder
.throttle
opt (1,:) Options
'integrate' (default)
'xdot'
'meas'
-------
Outputs
-------
x (:) Aircraft state 'integrate'
acceleration 'xdot'
measurement (:) Measurement data structure
opt
---------------------------------------------------------------------------