PitchGainSchedule Icon
Examples.PitchGainSchedule
Gain schedule for a pitch-attitude PID controller, with altitude and airspeed as scheduling variables.
The schedule evaluates the coefficients of the transfer function from the elevator deflection to the pitch angle of AircraftPitch,
\[P(s) = \dfrac{g}{s^2 + a s + b}, \qquad g = c_u q, \quad a = c_ω \dfrac{q}{V}, \quad b = c_θ q,\]
at the sampled altitude $h$ and airspeed $V$, where $q = \tfrac{1}{2} ρ_0 e^{-h/H} V^2$ is the dynamic pressure. The gains of the PID controller $k_p + k_i/s + k_d s$ are then chosen such that the characteristic polynomial of the closed loop, $s^3 + (a + g k_d) s^2 + (b + g k_p) s + g k_i$, equals the desired polynomial $(s + α ω)(s^2 + 2 ζ ω s + ω^2)$:
\[k_p = \dfrac{(1 + 2 α ζ) ω^2 - b}{g}, \qquad k_i = \dfrac{α ω^3}{g}, \qquad k_d = \dfrac{(α + 2 ζ) ω - a}{g}.\]
The outputs are the corresponding parameters of the PID controller on standard form, $K = k_p$, $T_i = k_p / k_i$ and $T_d = k_d / k_p$. The closed-loop poles of the continuous-time design are thereby independent of the operating point. The design requires $(1 + 2 α ζ) ω^2 > b$ and $(α + 2 ζ) ω > a$ within the flight envelope, so that all gains are positive.
Usage
DiscreteComponents.Examples.PitchGainSchedule(rho0=1.225, H=8500, c_u=6e-4, c_theta=4e-4, c_omega=7.4e-3, omega=4, zeta=0.7, alpha=1)
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
rho0 | Air density at sea level [kg/m³] | – | 1.225 |
H | Scale height of the exponential atmosphere [m] | – | 8500 |
c_u | Pitch acceleration per unit elevator deflection and unit dynamic pressure | – | 6e-4 |
c_theta | Pitch acceleration per unit pitch angle and unit dynamic pressure | – | 4e-4 |
c_omega | Pitch damping coefficient | – | 7.4e-3 |
omega | Natural frequency of the desired complex-conjugate closed-loop pole pair [rad/s] | – | 4 |
zeta | Relative damping of the desired complex-conjugate closed-loop pole pair | – | 0.7 |
alpha | Ratio of the desired real closed-loop pole to omega | – | 1 |
Connectors
h- This connector represents a real signal as an input to a component (RealInput)V- This connector represents a real signal as an input to a component (RealInput)K- This connector represents a real signal as an output from a component (RealOutput)Ti- This connector represents a real signal as an output from a component (RealOutput)Td- This connector represents a real signal as an output from a component (RealOutput)
Variables
| Name | Description | Units |
|---|---|---|
q | Dynamic pressure [Pa] | – |
g | Numerator coefficient of the transfer function from elevator deflection to pitch angle | – |
a | Damping coefficient of the transfer function from elevator deflection to pitch angle | – |
b | Stiffness coefficient of the transfer function from elevator deflection to pitch angle | – |
ki | Integral gain | – |
kd | Derivative gain | – |
Behavior
using DiscreteComponents #hide
using ModelingToolkit #hide
@variables rho0 #hide
@variables H #hide
@variables c_u #hide
@variables c_theta #hide
@variables c_omega #hide
@variables omega #hide
@variables zeta #hide
@variables alpha #hide
@named sys = DiscreteComponents.Examples.PitchGainSchedule(rho0=rho0, H=H, c_u=c_u, c_theta=c_theta, c_omega=c_omega, omega=omega, zeta=zeta, alpha=alpha) #hide
full_equations(sys) #hideSource
"""
Gain schedule for a pitch-attitude PID controller, with altitude and airspeed as scheduling variables.
The schedule evaluates the coefficients of the transfer function from the elevator deflection to the pitch angle of `AircraftPitch`,
```math
P(s) = \dfrac{g}{s^2 + a s + b}, \qquad g = c_u q, \quad a = c_ω \dfrac{q}{V}, \quad b = c_θ q,
```
at the sampled altitude ``h`` and airspeed ``V``, where ``q = \tfrac{1}{2} ρ_0 e^{-h/H} V^2`` is the dynamic pressure. The gains of the PID controller ``k_p + k_i/s + k_d s`` are then chosen such that the characteristic polynomial of the closed loop, ``s^3 + (a + g k_d) s^2 + (b + g k_p) s + g k_i``, equals the desired polynomial ``(s + α ω)(s^2 + 2 ζ ω s + ω^2)``:
```math
k_p = \dfrac{(1 + 2 α ζ) ω^2 - b}{g}, \qquad k_i = \dfrac{α ω^3}{g}, \qquad k_d = \dfrac{(α + 2 ζ) ω - a}{g}.
```
The outputs are the corresponding parameters of the PID controller on standard form, ``K = k_p``, ``T_i = k_p / k_i`` and ``T_d = k_d / k_p``. The closed-loop poles of the continuous-time design are thereby independent of the operating point. The design requires ``(1 + 2 α ζ) ω^2 > b`` and ``(α + 2 ζ) ω > a`` within the flight envelope, so that all gains are positive.
"""
component PitchGainSchedule@[input clk extends Discrete]
"Altitude [m]"
h = RealInput@[clk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -100, "y1": 200, "x2": 0, "y2": 300, "rot": 0}
},
"tags": []
}
}
"Airspeed [m/s]"
V = RealInput@[clk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -100, "y1": 700, "x2": 0, "y2": 800, "rot": 0}
},
"tags": []
}
}
"Proportional gain"
K = RealOutput@[clk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 200, "y1": 1000, "x2": 300, "y2": 1100, "rot": 90}
},
"tags": []
}
}
"Integral time [s]"
Ti = RealOutput@[clk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": 1000, "x2": 550, "y2": 1100, "rot": 90}
},
"tags": []
}
}
"Derivative time [s]"
Td = RealOutput@[clk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 700, "y1": 1000, "x2": 800, "y2": 1100, "rot": 90}
},
"tags": []
}
}
"Air density at sea level [kg/m³]"
parameter rho0::Real = 1.225
"Scale height of the exponential atmosphere [m]"
parameter H::Real = 8500
"Pitch acceleration per unit elevator deflection and unit dynamic pressure"
parameter c_u::Real = 6e-4
"Pitch acceleration per unit pitch angle and unit dynamic pressure"
parameter c_theta::Real = 4e-4
"Pitch damping coefficient"
parameter c_omega::Real = 7.4e-3
"Natural frequency of the desired complex-conjugate closed-loop pole pair [rad/s]"
parameter omega::Real = 4
"Relative damping of the desired complex-conjugate closed-loop pole pair"
parameter zeta::Real = 0.7
"Ratio of the desired real closed-loop pole to `omega`"
parameter alpha::Real = 1
"Dynamic pressure [Pa]"
variable q::Real
"Numerator coefficient of the transfer function from elevator deflection to pitch angle"
variable g::Real
"Damping coefficient of the transfer function from elevator deflection to pitch angle"
variable a::Real
"Stiffness coefficient of the transfer function from elevator deflection to pitch angle"
variable b::Real
"Integral gain"
variable ki::Real
"Derivative gain"
variable kd::Real
relations
q = 0.5 * rho0 * exp(-h / H) * V ^ 2
g = c_u * q
a = c_omega * q / V
b = c_theta * q
K = ((1 + 2 * alpha * zeta) * omega ^ 2 - b) / g
ki = alpha * omega ^ 3 / g
kd = ((alpha + 2 * zeta) * omega - a) / g
Ti = K / ki
Td = kd / K
metadata {
"Dyad": {
"labels": [{"label": "$(instance)", "x": 500, "y": -130, "rot": 0}],
"icons": {"default": "dyad://Dyad/Default.svg"}
}
}
end
Flattened Source
"""
Gain schedule for a pitch-attitude PID controller, with altitude and airspeed as scheduling variables.
The schedule evaluates the coefficients of the transfer function from the elevator deflection to the pitch angle of `AircraftPitch`,
```math
P(s) = \dfrac{g}{s^2 + a s + b}, \qquad g = c_u q, \quad a = c_ω \dfrac{q}{V}, \quad b = c_θ q,
```
at the sampled altitude ``h`` and airspeed ``V``, where ``q = \tfrac{1}{2} ρ_0 e^{-h/H} V^2`` is the dynamic pressure. The gains of the PID controller ``k_p + k_i/s + k_d s`` are then chosen such that the characteristic polynomial of the closed loop, ``s^3 + (a + g k_d) s^2 + (b + g k_p) s + g k_i``, equals the desired polynomial ``(s + α ω)(s^2 + 2 ζ ω s + ω^2)``:
```math
k_p = \dfrac{(1 + 2 α ζ) ω^2 - b}{g}, \qquad k_i = \dfrac{α ω^3}{g}, \qquad k_d = \dfrac{(α + 2 ζ) ω - a}{g}.
```
The outputs are the corresponding parameters of the PID controller on standard form, ``K = k_p``, ``T_i = k_p / k_i`` and ``T_d = k_d / k_p``. The closed-loop poles of the continuous-time design are thereby independent of the operating point. The design requires ``(1 + 2 α ζ) ω^2 > b`` and ``(α + 2 ζ) ω > a`` within the flight envelope, so that all gains are positive.
"""
component PitchGainSchedule
"Altitude [m]"
h = RealInput@[clk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -100, "y1": 200, "x2": 0, "y2": 300, "rot": 0}
},
"tags": []
}
}
"Airspeed [m/s]"
V = RealInput@[clk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -100, "y1": 700, "x2": 0, "y2": 800, "rot": 0}
},
"tags": []
}
}
"Proportional gain"
K = RealOutput@[clk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 200, "y1": 1000, "x2": 300, "y2": 1100, "rot": 90}
},
"tags": []
}
}
"Integral time [s]"
Ti = RealOutput@[clk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": 1000, "x2": 550, "y2": 1100, "rot": 90}
},
"tags": []
}
}
"Derivative time [s]"
Td = RealOutput@[clk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 700, "y1": 1000, "x2": 800, "y2": 1100, "rot": 90}
},
"tags": []
}
}
"Air density at sea level [kg/m³]"
parameter rho0::Real = 1.225
"Scale height of the exponential atmosphere [m]"
parameter H::Real = 8500
"Pitch acceleration per unit elevator deflection and unit dynamic pressure"
parameter c_u::Real = 6e-4
"Pitch acceleration per unit pitch angle and unit dynamic pressure"
parameter c_theta::Real = 4e-4
"Pitch damping coefficient"
parameter c_omega::Real = 7.4e-3
"Natural frequency of the desired complex-conjugate closed-loop pole pair [rad/s]"
parameter omega::Real = 4
"Relative damping of the desired complex-conjugate closed-loop pole pair"
parameter zeta::Real = 0.7
"Ratio of the desired real closed-loop pole to `omega`"
parameter alpha::Real = 1
"Dynamic pressure [Pa]"
variable q::Real
"Numerator coefficient of the transfer function from elevator deflection to pitch angle"
variable g::Real
"Damping coefficient of the transfer function from elevator deflection to pitch angle"
variable a::Real
"Stiffness coefficient of the transfer function from elevator deflection to pitch angle"
variable b::Real
"Integral gain"
variable ki::Real
"Derivative gain"
variable kd::Real
relations
q = 0.5 * rho0 * exp(-h / H) * V ^ 2
g = c_u * q
a = c_omega * q / V
b = c_theta * q
K = ((1 + 2 * alpha * zeta) * omega ^ 2 - b) / g
ki = alpha * omega ^ 3 / g
kd = ((alpha + 2 * zeta) * omega - a) / g
Ti = K / ki
Td = kd / K
metadata {
"Dyad": {
"labels": [{"label": "$(instance)", "x": 500, "y": -130, "rot": 0}],
"icons": {"default": "dyad://Dyad/Default.svg"}
}
}
endTest Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses