The Mathematica Journal
Departments
Feature Articles
Columns
New Products
New Publications
Classifieds
Calendar
News Bulletins
Mailbox
Letters
FAQ
Write Us
About the Journal
Staff and Contributors
Submissions
Subscriptions
Advertising
Back Issues
Home
Download this Issue

1. Introduction

Control system design is a discipline where advanced mathematics is applied to real-world problems ranging from pulp and paper manufacturing, aircraft, and CD players to biochemical processes, logistics, and financial applications. Mathematica is very powerful for dealing with the mathematics in these control problems, and the application package Control System Professional (CSP) implements many useful features. When it comes to nonlinear systems, the combination of the symbolic and numeric capabilities of Mathematica makes modeling and control system design in this environment very attractive. The notebook concept for documentation of different tradeoffs and decisions during the design process also contributes to making Mathematica suitable for this kind of work.

The application package MathCode C++ adds automatic C++ code generation to Mathematica, which can be used both to enhance the performance of simulations of large systems and to generate standalone C++ code to be used in applications separately from Mathematica. Performance will be the issue in the seesaw/pendulum example below while the standalone feature is explored in the fighter aircraft example. The standalone code generation feature of MathCode C++ makes it possible to design and prototype a controller in Mathematica and then "lift out" the resulting standalone code to be used in the real control system. This minimizes the need to code the control law manually from the algorithms designed in Mathematica.

In this document we will try to illustrate the use of Mathematica together with MathCode C++ for modeling, control system design, and code generation. The document is organized as follows. In the rest of this section we give some basic facts about dynamic systems needed to formulate controller design problems. In section 2, a nonlinear mechanical system is modeled and simulated using generated C++ code. In section 3, controller design for an aircraft is done, and in section 4, we give some conclusions.

Preliminaries

Many dynamic systems can be modeled by a set of first-order differential equations. See, for example, [1, 2]


where . Here , , and are called the states, inputs, and outputs of the system, respectively. Equation (1) is called the state space form of the equations describing the behavior of the system and is particularly useful for control system design. We will also use the dot-notation for denoting differentiation with respect to time . If the system is linear, the state space form can be written as


where , , and are constant real matrices. If in equation (1), the system can be linearized around , . The matrices , , and are then computed from and by taking partial derivatives as follows.


The linearized model is usually a good approximation whenever the states and inputs to the system are small. There exists a large number of control design methods for linear systems that makes it desirable to work with linear models if possible during controller synthesis. The performance of the resulting controller can then be studied in simulations where the linear model has been exchanged with the nonlinear one.

A linear state-feedback controller is a very simple type of controller where the control signal is a linear combination of the states that are assumed to be measurable. Hence, a linear state-feedback law has the form


There exist many methods for computing the matrix but a necessary condition is that the chosen makes the closed-loop system asymptotically stable, which essentially means that nonzero states converge to zero. More or less advanced methods make it possible to compute such that different tradeoffs between performance and robustness can be obtained; see, for example, [1, 3, 4].

A slightly more advanced controller is the linear dynamic controller, which includes an internal model of the system to be controlled. A so-called observer is used to estimate the states of the system from measured signals and a linear feedback law is used to compute the input to the system to be controlled. Using the notation for estimated states, the linear dynamic controller can be written as follows.


Hence, a dynamic controller requires real-time solving of a system of differential equations. In the seesaw/pendulum example below, we will use a linear state-feedback controller of the form in equation (1), and in the fighter aircraft example, we will use the observer-based controller of the form in equation (5).


Copyright © 2001 Wolfram Media, Inc. All rights reserved.

[Article Index][Next Page]