An aircraft controller incorporates several control loops to manage the speed, altitude, and navigation of an airplane. The aircraft pitch control is a vital inner loop for stability augmentation and holds autopilot controllers for the longitudinal dynamics. In this tutorial, we will show how to design a PID tuner for the aircraft pitch control loop

The aircraft pitch system variables are defined in **Figure 1.** The pitch angle \(\theta\) is the angle between the horizon direction and the x-axis of the aircraft's body. The angle of attack \(\alpha\) is the angle between the aircraft's longitudinal axis and the wind direction \(v\). The pitch angle is manipulated through the deflection in the elevator \(\delta_e\).

Through system identification, we can get the following numerical differential equations for aircraft pitch dynamics:

$$\dot\alpha=-0.298\alpha+54.3q+0.223\delta_e$$

$$\dot q=-0.0141\alpha-0.399q+{0.0199\delta}_e$$

$$\dot\theta=54.3q$$

We can convert the above differential equations into a state-space form:

$$\left[\begin{matrix}\dot\alpha\\\dot{q}\\\dot\theta\\\end{matrix}\right]=\left[\begin{matrix}-0.298&54.3&0\\-0.0141&-0.399&0\\0&54.3&0\\\end{matrix}\right]\left[\begin{matrix}\alpha\\q\\\theta\\\end{matrix}\right]+\left[\begin{matrix}0.223\\0.0199\\0\\\end{matrix}\right]\delta_e$$

$$y=\left[\begin{matrix}0&0&1\\\end{matrix}\right]\left[\begin{matrix}\alpha\\q\\\theta\\\end{matrix}\right]$$

Before defining the state space model into Collimator, we will add some useful libraries:

The state-space matrices are defined in the Collimator notebook as follows.

A look at the poles and zeros of the aircraft pitch system gives us the following results.

We can see that the system has an integrator. This will make the system marginally stable, though it can get unstable for some bounded signals. The system also has a zero which will make the time-domain characteristics laws unreliable for design considerations.

Now, we will take a look at the open-loop and closed-loop step responses for the pitch control system. For the closed-loop system, we will apply a proportional controller with \(k_p=1\) for comparative reasons.

We can see that the open-loop step response is growing in an unbounded direction. This is due to the shortcomings of the integrator dynamics as we explained earlier, and the closed-loop step response though stable is unsatisfying:

Due to the integrator dynamics, the system exhibits no steady-state error, but itâ€™s very slow in terms of rise time and settling time. In order to ensure satisfactory standards are met, The flight quality performance measures must meet the following design requirements:

- Overshoot \(\le 15%\).
- Rise time \(\le 0.5\) seconds.
- Settling time \(\le 4\) seconds.
- Steady-state error \(\le 1%\).

A PID controller is added in the loop as depicted in **Figure 2**.

In the next cell, we will create an interactive PID tuner so that we can see how the step responses change as we update the controller gain. We will start designing the controller by evaluating some empirical PID gains. For this purpose, we will use *ipywidgets* library within our Collimator notebook. First, we will define a function that computes the step response and time-domain characteristics for the output step response.

â€Ť

We now define the interactive variables for the tuning function. We will assume a range of \(\left[0,10\right]\) for the PID gains.

â€Ť

We can increase the \(P\) gain until we introduce some oscillation to increase the system speed. Then, we will increase the integrator gain to make the controller more aggressive. Finally, we will introduced the derivate gain to maintain system speed while damping the aggressive oscillation.

Now, we can see that the PID gains meet the design requirements.