| ![]() |
|||||||||||||||||||||||||||||||||||||||||
|
3. A Fighter AircraftIn this section a controller for a linear system is designed using LQG techniques; see, for example, [1, 3]. The resulting filter is transformed into discrete form and C++ code is generated corresponding to the filter equations. An extremely simple simulation is used to compare the generated code with the uncompiled Mathematica functions. The SystemWe will consider a linearization of a nonlinear aircraft dynamics for some specific flight conditions. We study only horizontal motions.
ModelingIntroduce the following notations:
and choose the state vector Notation for a Linear Time Invariant (LTI) system is given in state-space form: ![]() The following numerical instantiations of the system matrices comes from an example in [1]. Controller DesignSuppose that we have the following wind disturbance acting on the system. Figure 6. Some wind disturbances acting on the aircraft. How will the system respond to these disturbances? We plot a simulation of the system response for 10 seconds. Figure 7. The response in roll angle (blue) and course angle (red) to the wind disturbances plotted in Figure 6.
An LQ State-Feedback Design We compute a state-feedback, that is, an ![]() We play around with the matrices The closed-loop eigenvalues are given. A necessary and sufficient condition for asymptotic stability of the closed-loop system is that these eigenvalues belong to the left half-plane. We simulate the closed-loop output response. Figure 8. The response in roll angle (blue) and course angle (red) to the wind disturbances plotted in Figure 6 for the controlled system.We compare the disturbance attenuation with (dashed) and without the controller. Figure 9. A comparison between the response in roll angle (blue) and course angle (red) to the wind disturbances plotted in Figure 6 for the controlled (dashed) and uncontrolled system, respectively.
Kalman Filter Now suppose that the states cannot be measured. Here we will design a linear dynamic controller known as a Kalman filter, which is used to estimate the states from measured signals. Assume that the noise has the following covariance matrices. We check the eigenvalues of the dynamic controller to verify that it is stable. A Dynamic Controller The Kalman filter equations are ![]() The computed state-feedback control law is of the form ![]() if we add a reference signal r. Using the separation principle [1, 3], we can use the estimated states in equation (9) instead of the true states and still get an optimal design. In that case, equations (9) and (10) give the following LQG controller. ![]() Here we choose We represent the controller given by equation (11) in state-space form. The continuous Kalman filter above is transformed to discrete time for implementation purposes. We define a simple test signal, which corresponds to a unit step in the reference signal for the roll angle Figure 10. The controller outputs and when sensor signals are kept to zero and there is a unit step in the reference signal for the roll angle .
Simulation and Code GenerationThe system matrices of the discrete Kalman filter are declared as global real constants (type information given to MathCode C++). Define the system functions (right-hand sides of the controller equations). We perform a simulation of the controller equations using these right-hand sides with a specified initial condition.
Remove the last value. Compute the output from the calculated input and state. Plot the output Figure 11. The controller output when sensor signals are kept to zero and there is a unit step in the reference signal for the roll angle . Create a loop that will be the main loop in the external code. By construction, the functions Generate the code and compile it. The functions We inspect the resulting C++ code. Install the compiled code into Mathematica and test if the same simulation result as in Figure 11 is achieved. Compare the controller outputs computed by Mathematica and by the external code. The maximum absolute error in the given sequence. Plot the simulation when the compiled code is used. Figure 12. The same plot as in Figure 11 but computed by the external code. We observe that the external simulation gives the same result as the simulation computed within Mathematica. Clean-upUninstall the code and delete the temporary files. Delete the temporary directory and all files it contains. Copyright © 2001 Wolfram Media, Inc. All rights reserved. |