In this video you will see how to trim, linearize, and design a controller for an airframe modeled in Simulink.
The model that you see here is a model of de Havilland Beaver airframe with the following inputs:
elevator, aileron, rudder, and throttle and the following outputs:
angles, angular rates, and position.
When we run the model and look at simulation results,
we see that the system is not in steady state.
All the signals are changing during the simulation.
So the first thing that we want to do is trim the model.
To do that we go into Analysis, Control Design, and launch Linear Analysis Tool from Simulink Control Design.
With this tool we can trim the model.
We can specify the trim conditions.
Let’s look at the states in our model and decide which ones should be in steady state.
We want our angles to be in steady state, as well as angular rates, p, q, r.
We want the velocity of the airframe in the body coordinate frame to be in steady state.
X position can vary, y should be in steady state, and altitude, z, should be in steady state and should be trimmed at a known value.
Now let’s go ahead and trim the model with these specifications.
A new operating point, op_trim1, is created, and added to the workspace.
Let’s open this variable, op_trim1, that we just calculated.
Here we can see the desired state derivatives, which are all zeros for states that we wanted to be in steady state, and the actual ones.
You can see that for those states that we wanted to be in steady state, the actual derivatives are very small.
So, indeed, we calculated a good trim point.
To further convince ourselves, let’s use this trim point to initialize our model.
Now run the simulation with the new initial conditions.
We can now see that p, q, and r are all flat.
You can see that even though it looks like the signal values are changing, the scale is 10^-12 here.
Y and h are flat, roll, pitch, and yaw are flat, and angle of attack and sideslip angles are flat.
So we can indeed use this trim point to linearize the model around.
To do that, let’s go back to the Linear Analysis tool, and let’s linearize the model around this op_trim1 trim point.
Let’s specify the input-output signals for linearization.
We already have some linearization inputs and outputs specified in the model.
Here we will select a subset.
We’ll only use elevator as an input, and q, pitch rate, as an output.
We do that because we want to design longitudinal controller first.
Let’s go ahead and linearize our model and compute the Bode plot.
Here it is.
The linear system has been calculated and placed in this variable linsys1.
Let’s now take this variable linsys1, and copy it to MATLAB workspace.
We can look at linsys1 as a transfer function. We can cancel out close pole/zero pairs using minreal command from Control System Toolbox.
And we can use Control System Designer app to design a controller.
The app opens up with the Bode editor, root locus editor, and step response plot.
Let’s just keep the Bode editor for editing the controller.
We can use it to increase controller gain.
We can add the integrator to eliminate steady- state tracking error.
Now we reduce the gain a little bit to make system stable.
Now let’s add a notch filter to cancel the resonant peak. Now we can increase the gain and make the response faster.
We now have a nice, stable step response with zero steady-state error.
We have non-minimal phase zero behavior here which is common for aerospace systems.
If we like this design, we can export it to MATLAB workspace, where it is now available
for further analysis and implementation in Simulink.
This concludes the video.