Вы находитесь на странице: 1из 118

LDesign and Simulation of the Broom-balance Vehicle System /

A Thesis Presented to
The Faculty of the College of Engineering and Technology Ohio University

In Partial Fulfillment of the Requirements for the Degree Master of Science

by Dejun Sung/ November, 1993

Acknowledgements

I wish to express my deep appreciation to my thesis


advisor Dr. Brian Fabien for his valuable guidance, assistance, patience and encouragement while developing this thesis.

I also wish to express my sincere gratitude to Dr. Sunil


Agrawal of Mechanical Engineering Department and Dr. Larry Snyder of Mathematics Department for their serving on the committee.

Table of Contents
Acknowledgements ........................................................................................... Page ...
111

Table of Contents ................................................................................................ i v List of Tables ........................................................................................................ v i List of Figures ..................................................................................................... vii Chapter 1 Introduction ..................................................................................... 1
1 . 1 Problem .................................................................................................... I

1 . 2 Objective .................................................................................................

1 .3 Theory and Method ............................................................................ 3 Chapter 2 Broom-balance Vehicle Design ................................................

2 . 1 Basic Components of the System .................................................. 6 2.2 Basic Design Models ........................................................................... 7 2 .3 Decided Model ...................................................................................... 1 2 2.3.1 2.3.2 2.3.3 2.3 .4 Cart. Pendulum and Pulley System ............................. 1 2 DC Motor .................................................................................. 1 6 Sensors ..................................................................................... 1 6 Controller and Amplifier .................................................. 1 7

Chapter 3 Control System Analysis and Design ................................... 1 9 3 . 1 Dynamic Equations ........................................................................... 1 9 3 .2 Control System Equations .............................................................. 26

3 . 3 System Analysis ................................................................................ 3 6 3 .3 . 1 3.3 .2 3.3 .3 Stability .................................................................................. 3 6 Controllability ...................................................................... 3 9 Observability .......................................................................

42

3 .4 Controller Design ............................................................................... 4 3

Page 3 . 5 Observer Design ................................................................................5 5 Chapter 4 Simulation of System Response .........................................

62

Chapter 5 Experiment ................................................................................... 7 6 5 . 1 Experiment Equipments ............................................................

76

5 . 2 The Coefficients of Sensors .......................................................... 7 6


5 .3 Control Program ............................................................................... 7 9 5.3.1 5.3.2 5.3.3 Equilibrium Position Readings ..................................... 7 9 Observer Based Feedback Control Method

............. 8 0

Full State Feedback Control Method .......................... 8 2

Chapter 6 Conclusion ...................................................................................... 0 9 References ..........................................................................................................9 4 Appendix A Matalb Program for Controller and Observer Design 9 6 Appendix B Simulation Program of Broom-balance System Appendix C Control Program with Observer Basd Feedback Control Method .....................................................................1 0 2 Appendix D Control Program with Full State Feedback Control 1 Method .....................................................................................0 6 Appendix E Procedure of the Experiment .........................................1 10

....... 9 8

List of Table

Table
3.1

Page Open-loop System State Values at Time tl

............................ .. 4 7

vii

List of Figures

Figure

Page Broom-balancing Vehicle ................................................................. 1 Block Diagram of a Closed-loop Control System ..................... 6 Components of the Broom-balance Vehicle System

............. 7

Broom-balance System Design Model #1 .................................. 8 Broom-balance System Design Model #2 ................................ 1 0 Broom-balance System Design Model #3 ................................ 1 1 Front View of Broom-balance System ...................................... 1 3 Top View of Broom-balance System ......................................... 1 4 Side View of Broom-balance System ........................................ 1 5 Inverted Pendulum with Cart ...................................................... 1 9 Free Body Diagram of the Cart .................................................... 2 0 Free Body Diagram of the Pendulum ....................................... 2 1 Broom-balance Vehicle System .................................................. 2 7 Circuit Diagram of DC Motor ......................................................... 2 8 DC Motor and Pulley System ....................................................... 3 0 Variation of Control Gain kl with Different R ...................... 4 9 Variation of Control Gain k2 with Different R ...................... 5 0 Variation of Control Gain k3 with Different R ...................... 5 1 Variation of Control Gain kq with Different R ...................... 5 2 Eigenvalues of (A-BK) with the Variation of R .................... 5 3 Eigenvalues of (A-BK) with the Variation of R .................... 5 4 Feedback Control Input U with Variation of R at the State x(tl) ............................................................................................. 5 6

Figure

Page Block Diagram of Feedback System with Observer

3.14 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 5.1

........... 5 8

Block Diagram of Simulation Program .................................... 6 6 Time Response Simulation of State Time Response Simulation of State Time Response Simulation of State Time Response Simulation of State
xl

.................................... 6 7
..................................... 6 8

x2

x3
x4

..................................

69

..................................... 7 0
h

Time Response Simulation of Feedback Control Input U .. 7 1 Time Response Simulation of Estimated State Time Response Simulation of Estimated State Time Response Simulation of Estimated State Time Response Simulation of Estimated State
XI
/C.

............... 7 2
73 74 75

x2 .................
h

x3 .................
h

x4 .................

Electric Circuit Connection of Broom-balance Vehicle Control System ................................................................................. 7 7 Block Diagram of Control Program Using Observer Based Feedback Control Method ............................................................ 8 3 Block Diagram of Control Program Using Full State Feedback Control Method ............................................................8 4 Time Response of State xl .........................................................

85

Time Response of State xz ......................................................... 8 6 Time Response of State x3 .......................................................... 8 7 Time Response of State x4 ...........................................................8 8 Time Response of Feedback Control Input U .........................8 9

Chapter 1 Introduction
1 .

Problem

The Broom-balancing vehicle is a dynamic system which can be shown simply as figure 1. I , It consists of an inverted pendulum and a carriage on which the pendulum is mounted with the pivot. The carriage should move properly in horizontal direction in order to keep the pendulum upright. This system is commonly known as the Broom-balancer, because the problem is very similar to that of balancing a broomstick on one's hand. The more practical application of the Broom-balancer is controlling the attitude of a missile or a rocket during the initial stages of launch. A satellite booster rocket

Figure 1.1 Broom-balancing Vehicle

has aerodynamics resembling those of a giant broomstick. The rocket must be balanced on its own thrust vector by rotating the engine. In this thesis, the problem will be more simple than that of balancing a rocket which needs to be controlled in three dimensions. W e simplify the Broom-balancing problem into a two dimensional problem. Then we only discuss the problem that the pendulum motion is constrained to be on a plane, and cart is constrained to be along the horizontal direction only.

1.2

Objective

The basic goal of this thesis is to design and construct a broom-balancing vehicle which will accomplish the required

performance. The design process will include the mechanical system design and control system design. Mechanical system design is to design the mechanical structure of the Broom-balancer system, to choose and design the components of the system and to find the applicable methods and available sensors of measuring the linear and angular displacements and velocities. Control system design is to analyze the feedback control system and to design the controller through establishing the mathematical model of the dynamic system, deriving the differential equations of motions, linearizing the

equation with the assumption that the variables will stay close enough to a given operating point, analyzing the characteristics of the feedback control system, and designing the feedback controller and

observer with state feedback control methods and linear optimal control techniques.

1.3 Theory and Method

Mechanical design knowledge and technique are used in the design of Broom-balancer. The mechanical design includes two basic types of design problems. One kind of problem is the detailed design of the machine part; another kind of problem is broader in design scope and deal with synthesizing a mechanical system from a variety of components such as motors, clutches, gearboxes, and brakes. In this type of problem, the component is treated as a black box, only the properties of the black box will be studied so that it can be synthesized with other components. Newton's Laws are applied in obtaining the differential

equations of the system. Also the technique of linearizing nonlinear systems is used, this technique is important since it provides a standard approach to analysis. In general, analysis and design are much simpler for the linear control system, most systems are linear within some range of the variables and they become nonlinear if the variables move over wide enough ranges. The importance in practice of linear techniques relies on linearization based on the assumption that the variables stay close enough to a given operating point and the limits of operation are small enough to allow a linear analysis to be made.

Feedback control theory is used for designing the control system and analyzing the properties of the control system, such as stability, controllability and observability of the system. The full state feedback control method is used in the feedback control system design. Modern linear control theory is a powerful and eminently practical tool for the solution of linear feedback control problems. The important characteristics of modern linear control theory are the state space description of system in terms of a set of first order differential equations which are written compactly in a standard matrix form, and optimization in terms of quadratic performance criteria. So the state variable method is used in developing the system equations. The state variable form is very convenient for development of computer programs which can be used for analysis and design of the system. Linear optimal control theory is used in the feedback

controller design. Control system design is to obtain the desired performance of the system, it can be considered to be a manipulation to achieve or to fulfil a given objective, such as to transfer the state to a desirable one. When more than a single unique control can fulfil the given objective, the most desirable control in the sense of minimizing a given criterion function can be used, this is the optimal control. Linear optimal control is a special sort of optimal control, the plant that is controlled is assumed linear and the controller, the device that generates the optimal control is constrained to be linear. Linear controller is achieved by working with quadratic performance

indices. Numerical method is used

for solving the

differential

equations in the simulation of system performance. A FORTRAN program is generated to simulate the response of the system with the given initial conditions. The Runge-Kutta-Fehlberg method, which is one of the most commonly used method for solving initial value problems of ordinary differential equations, is introduced in the simulation program by calling a IMSL subroutine IVPRK in the

IMSLIB.
Mechanical construction system. A and data knowledge the and of technique the are used in the

experiment

Broom-balance is used

vehicle in the

acquisition

software NI-DAQ

experiment, and the control programs in C language are developed to control the broom-balance vehicle system.

Chapter 2
2.1

Broom-balance Vehicle Design

Basic Components of the System

Feedback which

control system are closed-loop control

systems

are usually consist of: (1) the plant, the system to be

controlled; (2) measurements, obtain the information about the plant and send back to controller; and (3) the controller, the central processing unit of the control system which compares the measured values of the plant to the desired values and adjusts the input values to maintain the output at the desired value. The closed-loop control system can be simply illustrated as figure 2.1. The basic components of the Broom-balance system should include: (1) the inverted pendulum and the carriage on which the pivot of the pendulum is mounted; (2) driving system, the actuating unit that controls the motion of the carriage; (3) sensors,

Input Plant

Controller

Output Measurements

Figure 2.1 Block Diagram of a Closed-loop Control system

the measurement components, and (4) controller, the intelligent part of the Broom-balance system, which processes the feedback signals and provides the actuating signals to the driving system. These can also be displayed in block diagram as figure 2.2. Input Controller

* Driving System

Inverted Pendulum and Cart

Output

Sensors

Figure 2.2 Components of the Broom-balance Vehicle System

2.2

Basic Design Models

During the design of the Broom-balance system, several kinds of models were considered. Three of them will be introduced in the following pages. The first design model is shown in figure 2.3. The pendulum is mounted on the cart which has four wheel that it can move freely along the horizontal directions. The cart is connected to a pulley system which is fixed on the platform. The DC control motor shaft is connected to the pulley wheel shaft. The linear motion of the cart is controlled by the DC motor. Potentiometer sensors are connected to

Figure 2.3 Broom-balance System Design Model #1 I . Inverted Pendulum with Cart, 2. Patform, 3. Pulley system, 4. DC Motor, 5. Controller

the pivot of the pendulum and the pulley wheel shaft to measure the angular position of the pendulum and the angular position of the pulley wheel, tachometer sensor can be connected to pulley wheel shaft or motor shaft to measure the angular velocity of the pulley wheel. Flexible wires are used to connect the sensors and the controller so that the wires will not affect the motion of the cart. A amplifier can be connected between the controller and DC motor to amplify the control signals. The second design model, as shown in figure 2.4, has a similar driving system as the first model. The difference between the second model and the first model is that the cart of the second model moves on the guided tracks rather than on the platform with the wheels. The cart is driven by the DC motor through the pulley system. Potentiometers are used to measure the angular position of the pendulum and the pulley wheel, tachometer is used to measure the rotating speed of the pulley wheel. Figure 2.5 shows the third model of the Broom-balance vehicle system design. The structure of this model is different from the first and second models, from some points this design model is more like a vehicle than the other two models. The cart, with four wheels, is driven by the control motor installed on the cart. a gear box transmission may be used to connect the motor and cart wheel to obtain the better structure and performance of the system. Angular position sensors can be placed on the pendulum pivot and the cart wheel shaft to measure the angular positions of pendulum and cart wheel. Also, the angular velocity sensor can be placed on the cart

$z5 = 3
, 0

&

Z
C

a s 0

a - ? c .

3u

m
'"

gas
w2.z L.i D

a m

, -

, U

Figure 2.5 Broom-balance System Design Model #3 1. Inverted Pendulum with Cart. 2. Gear Box, 3. DC Motor, 3 . Controller

wheel shaft or the motor shaft to measure the angular velocity of the cart wheel. The controller is connected by flexible wires to sensors and DC control motor. This design model does not need special platform, it can work at any horizontal surface.

2.3

Decided Model

T o choose the design model to build up for analysis and experiment, there are many factors need to be considered, such as the available materials, the available components, the difficulty of making the parts, the complication of the mechanical structures and the cost of the instruments and materials, etc. After consider all these factors, we decided the second design model of the Broom-balance vehicle system discussed in proceeding section as the model to analyze and to set up for the experiment. The assembly drawing of the system is shown as figure 2.6.

2.3.1 Cart, Pendulum and Pulley System

As shown in figure 2.6, the cart is mounted on the track which is fixed on the platform. The cart can be moved along the track by applying the torque on the pulley wheel. Between the cart and track, bearing balls are used to reduce the friction. On the top of the cart, a L shape seat is mounted to support the potentiometer which is used to measure the angular position of the pendulum. The

pendulum is fixed on the shaft of the potentiometer by a screw. The

Unit: m m

Figure 2.6(c) Side View of Broom-balance System

pulley system include a chain and four chain wheels, each two wheels are installed on a L shape support which is fixed on the platform. The dimension of the pendulum and the cart are illustrated in figure 2.6. The material of the pendulum is Aluminium, the mass of the pendulum is 0.0829 kg. In measuring the mass of the cart, all moving parts should be considered, that will include the cart, the potentiometer, the potentiometer seat and the chain, so the mass of the cart is 1.2698 kg.

2.3.2 DC Motor

In the Broom-balance system, the DC motor is fixed on a L shape seat, the position of the seat is adjustable by loose the bolts in order to obtain a good connection between motor shaft and chain wheel shaft. The shaft of the DC motor is connected with the chain wheel shaft by a flexible connector. The characteristics of the DC motor which was chosen in the design are as followings:

The torque constant, KT = 0.0459 N-mlamp; The e.m.f. constant, Kb = 0.0217 V-slrad; The armature resistance, R,
= 2.3 ohm;

The armature inductance, L = 20 Millihenries; The Moment of inertia of motor shaft, J,


= 0.000005 kg-m2.

2.3.3 Sensors

Two potentiometers

are used

for measuring

the

angular

position of the inverted pendulum and the angular position of the chain wheel. The linear position of the cart can be determined from the angular position of the chain wheel. The potentiometer that used for measuring the pendulum angular position is Model SJ660, made by Helipot Corp. Its

characteristics are:

Resistance: 30 K ohms +I- 5%; Linearity: +I- 0.15%.

The potentiometer that used for measuring the chain wheel angular position is SPIRALPOT 85 172K- 10- 15C, made by Giannini Controls Corp. It has following properties:

Resistance: Turns: 10;

1500 ohms;

Linearity:

+I- 0.1%.

The

angular

velocity

of

the

motor

is

measured

by

tachometer which is mounted directly to the end of the DC motor, as shown in figure 2.6. The velocity of the cart can be calculated from the angular velocity of the motor.

2.3.4 Controller and Amplifier

The controller that used for the experiment is a Macintosh IIx computer. The software used for the control experiment is the NIDAQ Software for Macintosh which is a data acquisition software developed by National Instrument. An amplifier is used to amplify the output control signals from computer and send the enlarged signals to the DC control motor. The power amplifier is Model PA118, made by Labworks Inc. The largest amplification ratio of the amplifier is 55.

19

Chapter 3

Control System Analysis and Design

3.1 Dynamic Equations

T o analyze the dynamic system of the Broom-Balancer, first we need to determine the equations of motion that governing the system. The Broom-balancing system is shown as figure 3.1 which consists of a cart and an inverted pendulum attached to the cart. Where M is the mass of cart; m is the mass of pendulum; 1 is the half length of pendulum; u is the force applying on the cart to keep the pendulum upright; z is the position of cart and 8 is the angular position of the pendulum.

Figure 3.1 Inverted Pendulum with Cart

The free-body diagram of the system can be drawn as figure

3.2 and 3.3 where Hf and Vf are forces exerted by the cart on the
pendulum; b2 is the viscous friction coefficient for rotary motion of the pendulum; bl is the viscous friction coefficient for linear motion of the cart; g is the gravitational acceleration and JI is the moment inertia of pendulum with respect to the center of gravity.

z-

Hf
I
e

bli

.....................

Figure 3.2 Free Body Diagram of the Cart

By applying Newton's second law to the horizontal motion of the cart, and to the horizontal, vertical and rotary motions of the pendulum, we have

The cart :

The pendulum:

Hf = m - d1 (L dt

sine

z)

Vf

Figure 3.3 Free Body Diagram of the Pendulum

where

1 Jr = - m l2 3
Equation (3.3) can also be written in the form

To eliminate Hf and Vf, substitute Hf and Vf in equations (3.1)


and (3.4) by equations (3.2) and (3.5) to get

u - m -d2l s i n e + z ) ( dt2
and

b l -dzM = dt

d2 -z dt2

(3.6)

[ m g + m d-2_(1 cose)] 1sine - [m L ( l sine dt2 dt2 d2 +z)]lcos 8 = I -I+ b2-de dt dt2
Since

(3.7)
..
(3.8)

2 -d(2 s i n ~ ) = - (dl c o s ~ 8 ) = - l s i n ~ 8 + 1 c o s 0 0 1 dt2 dt

and

d d- cos8) = - (-1 sin0 8) = - 1 cose 9. 2+l sine (.3. (1 dt2 dt

(3.9)

Equations

(3.6) and (3.7) can be written as:

Obviously, these differential equations are nonlinear, they can not be solved except by numerical methods, so
a

further

simplification is needed. Since the object of controlling the system is to keep the pendulum upright, it is reasonable to assume that 8 and 8 will remain close to zero. With this assumption, the equations can be linearized by retaining only those terms which are linear in 0 and 8,

and neglecting higher order terms such as e2, 8 and 88, because they will be insignificantly small when 0 and

.2

e are close to zero.

From trigonometric expansions, there will be

Substitute these two equations into equations (3.10) and


(3.11) and drop the higher order terms. The linearized differential

equations for the cart and pendulum system are:

These approximate equations will be valid and accurate as long as the condition is maintained such that

0 z 0 r 0.

To solve equations (3.14) and (3.15), rewrite them as

Then plug equation (3.16) into equation (3.15), and equation (3.17) into equation (3.14) we get

Let

A =(M+m)JI+Mm12

Equations (3.18) and (3.19) can be written as:

Also, we can have


-z C i

=i

and

dt

-d = 8 8 dt

Then equations (3.20), (3.21) and (3.22) can be expressed as following

They can be written in matrix form as

This is the linearized differential equations which governs the behavior of the broom-balancer under the condition that 9 remain small.

3.2 Control System Equations

To derive the feedback system equations, we will consider the whole system, the inverted pendulum with the cart and the driving system, which are shown as figure 3.4. The variables appeared in the figure are: V,: i:
Rm:

The input armature voltage of the DC motor; (Volt) The armature current of the DC motor; (A) The resistance of the DC motor; (ohm) The output torque of the DC motor; (Nm) The torque constant of the DC motor; (Nm/A) The radius of the chain wheel; (m) The angular position of the motor shaft; (rad) The angular velocity of the motor shaft; (rad/s) The force that the chain applying on the cart; (N) The horizontal position of the cart; (m) The velocity of the cart; (m/s) The angular position of the pendulum; (rad) The angular velocity of the pendulum. (rad/s)

Tm:
KT:

r: em:
em:

u:
z:

z:

0: 0:

The linearized

differential

equations of

motions

of

the

inverted pendulum and the cart have been derived as equation (3.27). Next, we need to derive the differential equations of the control system. Since the DC motor is the armature control, its output torque is proportional to the armature current[l], this can be expressed as:

The armature circuit of DC motor can be shown as Figure 3.5.


L is the armature inductance; R ,

is the armature resistance;

V,

is

the input voltage of the motor; i is the armature current; Kb is the e.m.f. constant;
em

is the angular position of the motor shaft and

em

is

the angular velocity of the motor. The voltage equation of the circuit is

divide the equation with R,,

we have

Figure 3.5 Circuit Diagram of DC Motor

the value of L/R,

is very small, the first term in the equation (3.30)

can be neglected. So equation (3.30) becomes

Then the torque T,

can be expressed as

The shaft of the DC motor is connected directly to the shaft of the chain wheel, we can derive the equation of motion with figure 3.6. Jm is the moment of inertia of the motor shaft, the equation of motion can be written as

The differential equations of the cart and the pendulum have been derived, so the differential equations of the control system can be obtained by combining the differential equations of cart and pendulum with the differential equation of the motor. Since the relation between z, the horizontal position of the cart, and 8 ,

, the angular position of the motor shaft is

also

z = re,
..

z = re,

(3.36)

and the angular position of the motor shaft will be measured instead of the position of the cart, the linearized differential equations of the cart with inverted pendulum (3.14) and (3.15) can be rewritten as

(M

+ m) re, + ml 9

..

..

= - blrem + u

Simplify equations (3.33) and (3.37) by eliminating the force u, we get

vm

Figure 3.6 DC Motor and Pulley System

31 (M

+ m)r29, + mlr 9

..

..
= -blr29,

+ Tm - Jm9,

..

(3.39)

substitute Tm by equation (3.32), we can have

.. .. [(M + m)r2+ Jm]em+ m118 +(blr2+ -0 1


Rm

- - Vm KT
R m

(3.40)

equations (3.38) and (3.40) can be written in the form em=---1 ( J ~ +m12)e - bz + g o mrl mrl

..

(3.41)

e=- -( M r 2 + m r 2 + l m ) 8 , - 1 (blr2 1 ~ ~ ~ KT ) 0 (3.42) ~ Vm ~ + mrl mrl R m mrlR,

..

..
Substitute 9, in equation (3.40) by equation (3.41) and equation (3.38) by equation (3.42), we have

e in

( ~ r ~ + m r ~ + ~ ~ ) ~ ~ + M m r ~ l ~ + m ~ ~ l ~ 0 = (blr 2 KT&) 0 m mrl R m

+(Mr2+mr2+lm)g r

-(Mr2+mr2+~m)b2 mrl R m

(3.43)

( ~ ~ + m l ~ ) ( b .~ r ~ m ) ( ~ r ~ + r n r ~ + ~ ~ ) ~ I + ~. .r n r ~ l ~ + m ~ ~ l ~ em =R m em mrl mrl

Let

A , = (Mr2 + mr2 + Jm)JI+ ~ m r +~ml,12 ~ 1

equations (3.44) and (3.43) will become

+ mrl b2
As

(J~+ml )KT
AsRm

v m

(3.45)

also we can have

Then equations (3.45), (3.46), (3.47) and (3.48) can be expressed in matrix form

where a32= rn21~~r


1

As

This is the differential equations of the feedback control system. Define the state vector x that

The system equation (3.49) can be expressed as

This is the linearized feedback control system equation in the state variable format. The system equation can also be written in the form

where A and B are matrices, they are expressed as equations ( 3 . 5 3 ) and (3.54), U is V,.

where

The output of the plant can be given by

where C is the output matrix, for the system that xl, x2 and x3 will be measured, C is equal to

3.3 System

Analysis

In this section, several properties of the feedback control system will be discussed.

3.3.1 Stability

The stability of the state differential equations can be defined as Kwakernaak [2] discussed. Consider the state differential equation

with the nominal solution xo(t). Then the nominal solution is stable in the sense of Lyapunov if for any to and any e > 0, there exists a

6(&,to) > 0 such that I x(t0) - xo(tO) I


t 2 to.

6 implies I x(t) - xo(t) I < E for all

The nominal solution xo(t) of the state differential equation

(3.57) is asymptotically stable if it is stable in the sense of Lyapunov,

and for all to there exists a p(t) > 0 such that I x(t0) - xo(tO) I < p implies I x(t) -xo(t) I

-+

0 as t -+

00.

For the time-invariant linear system

The necessary and sufficient condition to be asymptotically stable is that all its characteristic roots have strictly negative real parts. So for the system

If there is a small but unknown perturbation of the initial state and if u is an open-loop control, the equilibrium point would be asymptotically stable if all the eigenvalues of A had negative real parts, and it would be unstable if at least one eigenvalue of A had a positive real part. The eigenvalues of A are the roots of

The

matrix

has

been

developed

as

equation

(3.53)

Introducing the values of all parameters in the matrix, which are

M = 1.2698 kg;

m = 0.0829 kg; 1 = 0.1745 m;

J, = 0.000005 kg-m2;

R ,

= 2.3 ohm;

KT = 0.0459 N-m/amp; K b = 0.0217 V-s/rad;


b l = 0.05 N-s/m; b2= 0.005 N-m-s/rad; g = 9.8066 kg-m/s2; r = 0.0127 m.

the A matrix yields

The eigenvalues of matrix A can be calculated by using Matlab, eigenvalues of matrix A are

Since there are positive real eigenvalues, the equilibrium point of the open-loop system is unstable. The stabilization of instable system is one of the major aims of feedback design. The linearized system

with state feedback

would be asymptotically stable if all the eigenvalues of A - BK, that is all the roots of

had negative real parts. The feedback control gain matrix K could be chosen to make the coefficients of the characteristic equation (3.65) have any desired values, not only the eigenvalues to have the negative real parts. If the linearized system x = A x + B U is controllable, then the matrix K can always be chosen to attain eigenvalues of (A
-

any desired

set of

BK).

3.3.2 Controllability

When we solving the control problems, it is important to know whether or not the system which will be analyzed has the property that it may be steered from any given state to any other given state, this is the controllability of the system. For the linear system given by equation (3.63), if there exists an input U which transfers the initial state x(0) = xo to the zero state x ( t l ) = 0 in a finite time tl, the state xo is said to be controllable. If all

initial states are controllable, the system is said to be completely controllable. [3] To determine a n-dimensional linear time-invariant system, such as equation (3.63), whether or not is completely controllable, the necessary and sufficient condition is that the column vectors of the controllability matrix

span the n-dimensional space. This condition can also be expressed as rank

r, = n

(3.67)

Since matrix A has been given in equation (3.61), before we construct the controllability matrix, substituting the parameters in matrix B by their values. From equation (3.54) we know matrix B is

where
As = (hTr2 + mr2 + Jm)JI+ ~ m r + ~ l ~ rnJm12;

the parameters are

M = 1.2698 kg;

m = 0.0829 kg;
1 = 0.1745 m; r = 0.0127 m;
R m = 2.3 ohm;

KT = 0.0459 N-mlamp;

After introducing the values, matrix B becomes

Then the controllability matrix and its rank can be calculated


by using Matlab. we get the controllability matrix as

and the rank of the controllability matrix is Rank


T,=4

(3.71)

So the system (3.63) is completely controllable.

3.3.3 Observability

The controllability condition assures the existence of the input which to transfer the state of the system from the initial state to a desired state. On the other hand, it is sometimes necessary to know all state variables from the measurement of the output whose

dimension is less than that of the state. The observability condition assures the construction of the state from the output. If the system is observable as well as controllable, the system can be made stable by feedback through an observer. The observability of the system can be determined and by

checking the observability matrix. The necessary

sufficient

condition for the system to be completely observable is that the observability matrix has full rank.[4] For the system (3.63), the observability matrix is

where C is the output matrix of the system. If the rank of matrix equal to 4, the system is completely observable. Assuming that the outputs of the system are
Om,

r,
it

0 and

om,

means that only xl x2 and x3 three states can be measured, then the output matrix C is

so that

Also, the observability matrix and its rank can be calculated by using Matlab, we get

and Rank To = 4
(3.76)

So, when only xl, x2 and x3 can be measured, the system is completely observable.

3.4 Controller Design

In the design of feedback controller in state space, there are two major methods, pole assignment method and optimal control method. In pole assignment, the feedback control gains can be achieved by placing the closed-loop poles in specified locations, as John Van de Vegte [ 5 ] discussed, for the feedback control system

any specified set of closed-loop eigenvalues can be obtained by state feedback with K consisting of constant gains if and only if the pair (A, B) is controllable. The eigenvalues in pole assignment design could be placed far from the imaginary axis, making the speed of response arbitrarily fast. But this would require large control inputs and actuator

capacities, this implies a high cost of control. The choice of desired eigenvalues in pole assignment techniques implies a trade-off

between performance and cost of control. In optimal control, the controller is achieved by working with quadratic performance indices and minimizing a specified

performance criterion. The control is sought which gives the best trade-off between performance and cost of control. To design the controller of the Broom-balancing feedback control system, for the controllable system

the optimal control which minimizes the value of a performance index J of the form

is giving by

where P is a symmetric and positive definite matrix; Q is a symmetric and positive semidefinite matrix written as Q = H ~ Hwith observable pair (A, H), and rank (H) = rank (Q); R is a symmetric and positive definite matrix and P is the solution of the algebraic matrix Riccati equation, which is

Q and R are weighting matrices and are usually diagonal. The terms xTQx and U ~ R U of the integrand are quadratic forms which measure, respectively, the performance and the cost of control. So, one of the important procedures in the controller design is to determine the weighting matrices Q and R . Suppose Q matrix has the form

then

To determine the values of q l , q2, q 3 and q4, we have to find the relations between the states xl x2 and x3 determined
x4.

These relations are

by the system equations of motion. Apparently, the

relations of xl x2 and x3 x4 are not constant values, they will vary with the changes of the states, and they also can be effected by initial conditions of the system and the input control force. Since we have assumed that x2 and x4 will remain to small values, approximated values can be made to represent the relations between the states xl x2 and the states x3 xq. Using the open-loop system equation

with the initial condition x(0) = 0 and U(0) = Uo, and a constant input U(t) = UO,we can get x(tl), the values of the states at time tl, from x(tl) the relations among the states can be decided with

approximation.

A FORTRAN program is used with the IMSL subroutine IVPRK


to solve the system differential equations.

When the response of the open-loop system have been calculated, we can choose certain values of the state variables for discussion, that is at time tl, the value of state variable x2 which is the angular position of the pendulum, closes to

5O

(+0.08727 rad) or

5O

(-0.08727 rad). With three different initial inputs, we have x(tl)

shown in Table 3.1.

Table 3.1 Open-loop System State Values at Time UO

tl

(v)
2.5

t1 (s) 0.12 0.09 0.07

xl(tl> (rad) 1.5535 1.7823 1.6390

x2(t 1)

@a

x3(tl) (radls) 24.8894 38.4271 45.7753

4 1)0

(radls)
- 1.3774

-0.0841 -0.0957 -0.0879

5 .O
7.5

-2.0780 -2.4528

From equation (3.84) and Table 3.1, we can find that

Since the main objective of the control is to maintain the pendulum in upright position, it is obvious that the states xa and x4 which represent the angular position and the angular velocity of the pendulum are more important than the states represent
xl

and x3

which

the position and the velocity of the cart. So the relative

weighting of x2 and x4 should be larger than those of xl and x3, so Q matrix can be determined as

Since Q=H=H, H matrix could be

so that H can meet the requirements that (A, H) should be observable

and rank (H) = rank (Q). For single input control problem, R should be a scalar, the suitable value of R for the optimal control can be obtained by studying the feedback control gains and the eigenvalues of (A - BK) with R changes. Figures 3.7, 3.8, 3.9 and 3.10 show respectively the changes of control gain K = [ k l , k2, k3, k4] when the value of R increases from zero to infinity; Figures 3.1 1 and 3.12 show the variations of the eigenvalues of (A - BK), the system poles, with the different values of R.

Figure 3.7 Variation of Control Gain kl with Different R

Figure 3.8 Variation of Control Gain k2 with Different R

Figure 3.9 Variarion of Control Gain k3 with Different R

Figure 3.10

Variation of Control Gain k4 with Different R

Figure 3.1 1 Eigenvalues of (A-BK) with the Variation of R

Figure 3.12 Eigenvalues of (A - BK) with the Varaition of R

From figures 3.7, 3.8, 3.9, and 3.10, we can see the variations of control gain with the changes of R, all the values of control gain become smaller when R increases. How to choose the appropriate control gain is related to the applicable range of the DC motor input voltage and the possible largest state values. The input voltage of the DC motor can be ranged from -10 V to 10 V. If we consider one set

of state values in Table 3.1 as the largest possible state value which is shown as equation (3.90). Then required input voltages can be calculated with the state values and different control gains by the equation (3.91). Since the control gains are corresponding to R, the relation between U and R for certain state values can be plotted as figure 3.13.

From figure 3.13, a suitable value of R can be chosen such that the control input voltage U is in the available range. The controller gain is decided as K = [-0.0707, -43.4045, -0.1 3 10 -6.04711 at R = 200.

3.5 Observer Design

When the

state variables of the system are not all available

since some reasons, such as the difficulties of measurements or the cost. Full state feedback control method is not applicable. For the

Figure 3.13 Feedback Control Input U with Variation of R

system which is completely observable, the output feedback control method can be used. An observer can be designed to determine an estimate

;of

the state x from the measured output y, and then send

the estimated state to the controller.[6] For the system

where

the state equation of observer can be written as

and the feedback control law can be formed as

the block diagram of the system with observer is shown as figure

3.14.
The error of the state estimation by observer can be defined

then from equations (3.92) and (3.94), we have

From equation (3.99), we can see that the error will become to zero as time goes to infinite, if all the eigenvalues of (A - MC) have negative real parts. Substitute U in equation (3.92) with equation (3.95), we get

equation (3.96) can also be expressed as

then equation (3.100) becomes to

x = (A - BK)x

+ BKe

(3.102)

Combine equation (3.102) with equation (3.99), we can have

(A-MC)

So the closed-loop system with initial conditions

is stable if all the eigenvalues of (A - BK) and (A - MC) have negative real parts. For the completely controllable system, K can be chosen to yield any set of desired eigenvalues of (A
-

BK), these have been

discussed and designed in the proceeding sections. Also the system has been proved to be completely observable, so M can be chosen to yield any desired set of eigenvalues of (A - MC). Apparently, the design of M is an important procedure. Similar to the techniques used for the design of feedback control matrix K, M can be decided by placing the observer eigenvalues in specified locations. These locations could be chosen to the left of those used for design of K to make the observer faster. K has been chosen as

the eigenvalues of (A - BK) are

If w e make the observer two times faster, the eigenvalues of (A -

MC) should be

Since the eigenvalues of (A - MC) are equal to the eigenvalues of ( A ~ CTMT ), M can be calculated from ( A ~ CTMT ) with the decided eigenvalues. By using the Matlab program PLACE, M matrix is obtained as following

Chapter 4

Simulation of System Response

After finish the control system design, a computer simulation of the system performance is usually a necessary procedure to study the system response, to verify the mathematical system and to evaluate the design of the system. The response of the system can be obtained by utilizing a discrete-time approximation, the system is represented by a state vector differential equation. The discrete-time approximation
is

models of the

based on the division of the time axis into sufficiently small time increments. Then the values of the state variables are evaluated at the successive time intervals; such as t = 0, T, 2T, 3T,
a m . ,

where T is

the increment of time At = T. If the T is sufficiently small, the response evaluated by discrete-time methods will be reasonably

accurate. [7] The feedback control system can be represented as

where

the full state observer equation is

the feedback control is

In the designed feedback control system, the state variables


XI,

xz and x j which are Om, O and be estimated by

8 ,

can be measured and all the state the output, then the

will

the observer from

estimated state will be sent back to the controller. In the simulation of the system response, the state values will be calculated from system differential equations and assumed initial conditions. With the given initial conditions of the system and with the time increment At = T, The state, the system output and the estimated state at t = T can be obtained by solving the differential equations (4.1) and (4.3) with the initial values x(0) = xo, c(0) = 0 and U(0) = Uo, the state is x(T), the output is y(T) and the estimated state is ;(T),
h

the feedback control input is U(T) which is obtained from

x(T). In each time interval T, the system equation (4.1) and observer equation (4.3) can be solved as the initial value problem of ordinary differential equations. At time t, the state is x(t), the estimated state is ;(t) and the control input is U(t). At time t+T the state x(t+T) can be obtained by solving the differential equations with the initial values x(t) and U(t), the output at time t+T is y(t+T) = C x(t+T), then the estimated state at time t+T, ;(t+~), can be calculated by solving the state equations of the observer with the initial values ;(t) and U(t),

and then U(t+T) can be calculated through the feedback control law u(~+T)= -K;(~+T). The time increment procedure of the discrete-time equations can be shown as following

with initial conditions: x(0) = xo, ;(o) = 0 and U(0) = Uo at time t = T, x(T) = A (4.5)

I'

x(t)dt+BU(O)

(4.6)

at time t = (n+l)T,

There are many numerical methods to solve the differential equations as initial value problems. In this computer simulation, an

IMSL routine IVPRK is used to solve the differential equations. This


FORTRAN subroutine is an error-control procedure, the method it use for solving differential equations with initial values is the RungeKutta-Fehlberg method which is one of the most commonly used method. The Runge-Kutta-Fehlberg method is a difference-equation method for solving the initial value problems of ordinary differential equations. The estimation of the local truncation error is used in the method approximating the optimal step size to control the global error. The method consists of using a Runge-Kutta method with local truncation error of order five, to estimate the local error in a RungeKutta method of order four.[8] The block diagram of the simulation program is shown as figure 4.1, the EPS is constant which is set for testing the state values, the program will stop when the state values are smaller than the EPS, that means the systems has been stabilized. The simulated system time response can be studied by plotting out the variations of the states and the control input via the time. Figures 4.2, 4.3, 4.4, 4.5 and 4.6 show respectively the time responses of the states and the control input with the assumed initial condition x(0) = [0.1, 0.1, 0, 01 and U(0) = 0. Figures 4.7, 4.8, 4.9 and 4.10 show the time responses of the estimated states with the initial condition i(0) = 10, 0, 0, 01.

Read the system data A, B, C, M and K Set time increment T

I
x(0) = xo , xh(0) = 0 and

I Set time t to zero I


I

Calculate state xt(t+T) at time t+T

from

Calculate the output y(t+T) at time t+T Calculate estimated state xht(t+T) at time t+T from estimated state xh(t) and input U(t) at time t, and output y(t+T) at time t+T

time t+T, U(t+T) = -Kxht(t+T) Time increment, t = t

+T

I
I

Output time t, state xt(t), estimated state xht(t) and control input U(t)

I Set x(t) = xt(t) I

Figure 4.1 Block Diagram of Simulation Program

Time (second)

Figure 4.2 Time Response Simulation of State

xl

Time (second)

Figure 4.3 Time Response Simulation of State

x2

10

Time (second)

Figure 4.4 Time Response Simulation of State

x3

10

Time (second)

Figure 4.5 Time Response Simulation of State

x4

Time (second)

Figure 4.6 Time Response Simulation of Feedback Control Input U

Time (second)

Figure 4.7 Time Response Simulation of Estimated State

10

Time (second)

Figure 4.8 Time Response Simulation of Estimated State

G2

Time (second)

Figure 4.9 Time Response Simulation of Estimated State

x3

10

Time (second)

Figure 4.10 Time Response Simulation of Estimated State

g4

Chapter 5

Experiment
Equipments

5.1 Experiment

To set up the experiment equipments, it includes two steps. First step is to assemble the Broom-balance system, this is mainly the mechanical works. The second step is to connect the electric circuit of the control system. The Broom-balance system is constructed as shown in figure

2.6. During the assembling of the system, it is important that to make


sure the screws of the connections are tight. The electric circuit connections of the Broom-balance

feedback control system can be shown as figure 5.1. Before to connect the circuit, a test of the potentiometers should be taken to determine the wiper end and other two ends of resistance element, also the tachometer should be tested to determine the relation

between the voltage outputs and the motor rotating directions.

5.2 The Coefficients of Sensors

Since the outputs of the sensors are all voltages, and what we need for the control calculation are the position and the velocity variables. First, we need to find the relations between the voltage readings of the sensors and the displacements and velocities which being measured. These relations can be denoted as coefficients Kpp,
K ~ m and

Kt,

which

represent

the

coefficient

of

potentiometer

measuring

the

pendulum

angular

position,

the

coefficient

of

potentiometer measuring the motor shaft angular position and the coefficient of tachometer measuring the motor rotating speed

respectively. For the potentiometers, a constant voltage is applied by the amplifier to the two ends of the potentiometer, the output of the potentiometer is a variable voltage which is measure between the

wiper end and one of the two ends. The relations of the output voltage and the position variable can be expressed as

where Vpp is the output voltage of the potentiometer measuring the angular position of the pendulum; O p is the angular displacement of the pendulum; V p m is the output voltage of the potentiometer is the angular

, measuring the angular position of the motor shaft; 8

displacement of the motor shaft. Make a certain angular displacement of the pendulum, use the voltmeter to measure the output voltage of the potentiometer, the coefficient Kpp is determined as 0.16552 Voltlrad. By the same method, Kpm is determined as 0.01720 Voltlrad. The output voltage of the tachometer is proportional to the angular velocity which it measured, the relation can be written as

where Vt,

is the output voltage of the tachometer; om is the angular

velocity of the motor. Apply a constant voltage to the motor, the rotating speed of the motor can be obtained by using a standard tachometer, measure the output voltage of the tachometer with a voltmeter, the Kt, determined from equation ( 5 . 3 ) , Kt, is equal to 0.0304 Volt-shad. is

5.3 Control Program

The

software

NI-DAQ

Software for

Macintosh,

a data

acquisition software developed by National Instrument Corp., was used for the experiment. The software can be used by running a control program written in C language. Two control methods were used in the experiment, one is the observer based feedback control method, another one is the full state feedback control method. Since the amplifier is used to amplify the control signals, the values of control gains used in the control program should be divided by the amplification ratio.

5.3.1 Equilibrium Position Readings

In the control program, the center position readings of the potentiometers should be set to indicate the equilibrium position of the system. These readings are the output voltages of the

potentiometers when the pendulum is at zero degree upright position and the cart is at the center of the track. Since there are certain errors between the data computer obtained and the sensor outputs, the calibration of the data reading in the control program is necessary. This work can be done by keeping the system in the equilibrium position, at this position, all the output values of the sensors are same as the values that set in the program, set the amplification ratio of the amplifier to zero, then run the control program to get the data that read by the computer. The values of all three measured state variables should close to zero at this time, if there are errors, they can be corrected by adding or subtracting the same value of errors to the state variables in the program so that the state values become to zero.

5.3.2 Observer Based Feedback Control Method

Since the state are not all measured in the experiment, we need to get the unmeasured values of the state, the angular velocity of the pendulum, to complete the feedback control of the system. To estimate the state by using an observer is one method. The analysis and design of observer have been discussed in Chapter 3. To apply the observer method in the control program, a conversion of observer equation from continuous time model to discrete time model is needed. In the simulation program that discussed in preceding chapter, the Runge-Kutta method was used to solve the differential equations. In the control program, the observer

equation is changed into a discrete time state space model by using the Matlab function C2D. The conversion can be expressed as following for the system x=Ax+BU y=Cx the observer equation is
A

x=A~+Bu+M(~-c;~)

the equation can also be written as


A

x =(A - BK - MC) ; My + and


A

(5.7)

let

A=A - BK - MC

B=
-

M; the equation (5.7) becomes


-

x = A ~ + B ~

(5.8)

by using the Matlab function


- -

[@,I?]

= C2D (A, B, T)

where T is the sample time. the continuous time system is converted to the discrete time system
A

x(n+l) = @ ; (n)

+r

y(n)

(5.10)

The block diagram of the control program that use the observer method is shown as figure 5.2.

5.3.3 Full State Feedback Control Method


The second method used in the experiment is the full state feedback control method. Since the angular velocity of the pendulum is not measured, to achieve the full state feedback control, the calculation of the angular velocity of the pendulum is needed. We calculate the angular velocity of the pendulum from the measured angular positions of the pendulum. The calculation can be written as

x4(t+At ) is the calculated angular velocity of the pendulum at time t+At, x2(t+At ) is the angular position of the pendulum at time t+At, x2(t) is the angular position of the pendulum at time t, A t is the time interval between the two readings, it is equal to the time interval of each loop that the computer program runs. The value of the time interval is determined by the speed of the computer, for Macintosh
IIx, the A t is close to 0.013 second. So, when we calculate the angular

velocity of pendulum using equation (5.11), the value of A t should be close to that value. This time interval value is also applicable for the sample time which is discussed in the preceding section about conversion of state space model from continuous to discrete time by using the Matlab function C2D.

b e t Parameter Values

1 I
Define Variables
I

Read the Voltage Output of Sensors

Calculate the Estimated State Values with the Observer Equation L a t e the Control Voltage

v
Calculate the State Values
I

c
Output the Control Voltage Command Figure 5.2 Block Diagram of Control Program Using Observer Based Feedback Control Method

The block diagram of control program that using the full state feedback control method is shown as figure 5.3. The system responses in the experiment are shown as figures 5.4, 5.5, 5.6, 5.7 and 5.8. Define Variables

I Set

Parameter Values

Read the Voltage Output of Sensors

Calculate State x4 with the Equation


x4

(t

+ At) = X 2
I

(t+At) At

X2

(t)

Calculate the Control Voltage

1 Output

the Control Voltage Command

Figure 5.3 Block Diagram of Control Program Using Full State Feedback Control Method

Time (second)

Figure 5.4 Time Response of State xl

Time (second)

Figure 5.5 Time Response of State

x2

Time (second)

Figure 5.6 Time Response of State

x3

Time (second)

Figure 5.7 Time Response of State

x4

10

12

14

Time (second)

Figure 5.8 Time Response of Feedback Control Input U

Chapter 6

Conclusion
system, three design

During the design of broom-balance

models of the system were considered and discussed, one of them was chosen and built up for the experiment. Basic methods of design the control system and mechanical system were developed. Also the mechanical measurement techniques were applied in the experiment. In establishing the dynamic model of the Broom-balance

system, the differential equations of motions of the dynamic system were developed. The linearization for the nonlinear differential equation of the system was made with the assumption that the deviation angle and angular velocity of the pendulum should remain close to zero. The state space model of the feedback control system was established for the analysis and design of the control system. The stability, controllability and observability of the feedback control system were discussed and tested. The Broom-balance system, which has the inverted pendulum and the cart, is an unstable system. The system is completely controllable. When the state
x4,

the angular

velocity of the pendulum, is not measured, the system is observable. The optimal control method was applied in the controller design. A Matlab program was used for the system calculation and controller design. Also, the observer method was discussed for

estimating the state values when some of the states of the system can not be measured. The observer was designed by using the Pole Placement Method.

simulation model

was

established

and

the

simulation

program in FORTRAN was developed to simulate the responses of the Broom-balance feedback control system in which the observer

method is used. The result of the simulation was obtained with satisfaction. With small initial state values, the system was stabilized in a short time and all the state values decay to zero very fast. From the simulation we can conclude that the observer based feedback control method is applicable for the Broom-balance system in which the state of the pendulum angular velocity is not measured. During the preparation of the experiment, the broom-balance system was built and the equipments and sensors for the experiment were selected. The parameters of the sensors were tested. Two methods were used in the experiment control program. The observer based feedback control and full state feedback control. Control programs written in C language were developed for using the

software NI-DAQ for Macintosh. With the observer based feedback control method the

performance of the Broom-balance feedback control system was not as good as that in the simulation. There are several factors that may cause the problem. The calculation errors in solving the observer equation. Since the discrete time model of observer equation was used in the control program and there is restrictions in choosing the sample time, the calculation errors may be introduced to the estimated state values. The data reading errors caused by some random noises.

During the experiment, noises were found occasionally in the data

readings, these random reading errors will destroy the continuity of the state estimation. The loose of the mechanical connections in the driving system. This delays the actions of the control input. By using the full state state feedback control method, the system can be controlled much better than using the observer based feedback control method. The advantages of this method are that the feedback control input is calculated directly from the measured state values, only the state
x4

is calculated from state

x2

with a certain

time interval At, this will avoid the calculation errors produced in solving the observer equation. Also the full state feedback control system are affected less by the random reading errors caused by noises than the system with observer, since only one state variable has the continuity problem in the full state feedback control

program. As same as using the other method, any loose of the mechanical connection in the system such as the shaft connection will make the system lose control. Some suggestions may be helpful for the further study on this topic or related problems. Another kind of full state feedback control method can be developed to improve the experiment. To use a differential circuit to obtain the angular velocity of the pendulum from the output of the potentiometer which measuring the pendulum angular position. Based on the techniques developed for the two dimensional Broom-balance feedback control system, the future work on this

topic may proceed to analyze and develop the three dimensional Broom-balance feedback control system.

References
1 . Carstens, J. R., Automatic Control Systems and Com~onents,

Prentice-Hall, Inc., New Jersey, 1990. 2. Kwakernaak, H. and Sivan, R., Linear O ~ t i m a l Control Svstems, John Wiley & Sons, 1972. 3 . Hostetter, G. H., Design Of Feedback Control Svstems, CBS College Publishing, New York, 1982. 4 . D'azzo, J. J. and Houpis, C. H., Linear Control Svsvtem Analysis and Design, McGraw-Hill, Inc., New York, 1975. 5 . Van De Vegte, J., Feedback Control Systems, Prentice-Hall, New Jersey, 1990.

6 . Furuta, K., State Variable Methods in Automatic Control, John


Wiley & Sons, New York, 1988. 7 . Whicker, M. L. and Sigelman, L., C o m p u t e r Simulation

Applications, Sage Publications, Inc., Newbury Park, CA, 1991. 8 . IMSL MATH I LIBRARY, USER'S MANUAL, Fortran Subroutines For Mathematical Application, Vol 2, Chapter 5, P633-639. 9 . Anderson, B. 0. and Moore, J. B., Optimal Control Linear Ouadratic Methods, Prentice-Hall, Inc. New Jersey, 1990. 1 0 Thaler, G. J., Automatic Control Svstem, West Publishing Company,
MN, 1989.

1 1 Bollinger, J. G. and Duffie, N. A., Computer Control of Machines and Processes, Addison Wesley Publishing Company Inc., 1988. 1 2 Nise, N. S., Control Systems Engineering, The BenjaminICummings Publishing Company, Inc., Redwood City, CA, 1992.

1 3 Dorf, R. C., Modern Control Systems, Addison Wesley Publishing Company, Inc., Massachusetts, 1989.
1 4 Derusso, P. M., State Variables for Engineers, John Wiley & Sons,

New York, 1965. 1 5 Smith, J. M., Mathematical Modeling and Digital Simulation for Engineers and Scientists, John wiley & Son, Inc., Canada, 1987. 1 6 NI-DAQ for Macintosh, Software Reference User's Manual. 1 7 Shearer, J. L. and Kulakowski, B. T., Dynamic Modeling and Control of Engineering Systems, Macmillan Publishing Company, New York, 1990.

Appendix A Matlab Program for Controller and Observer Design


Program for the design of feedback control gain using optimal control method and the design of observer using pole placement method. Calculate the discrete-time state space system with function C2D m l : Mass of the cart(kg); m2: Mass of the pendulum(kg); 1: Half length of the pendulum(m); fc: Viscous-friction coefficient of rotary motion(N-m-shad); ff: Viscous-friction coefficient of linear motion(N-dm); jm: Moment of inetia of the motor shaft(kg-m*m); r: Resistance of motor(ohm); kt: Coefficient of torque(N-mlamp); kb: E.M.F. constant of the motor(V-shad); rr: Radius of chain wheel(m); m1=1.2698; m2=0.0829; 1=0.1745; fc=0.005; ff=0.05; g=9.8; jm=0.000005; r=2.3; rr=0.0127; kt=0.0459; kb=0.0217; j=m2*1*1/3; delta=j*((ml+m2)*rr*rr+jm)+ml m 2 * r r * r r * l * l + m 2 * l * l * j r n ; * a32=-m2*m2*rr*l*l*g/delta; a33=-(ff*rr*rr*r+kt*kb)*(j+m2*l*l)/(delta*r); a34=m2*rr*l*fc/delta; a 4 2 = ( ( m 1+ m 2 ) * r r * r r + j m ) * m 2 * l * g / d e l t a ; a43=(ff*rr*rr*r+kt*kb)*m2*rr*l/(delta*r); a44=-fc*((ml+m2)*rr*rr+jm)/delta; b3=(j+m2*l*l)*kt/(delta*r); b4=-m2*rr*l*kt/(delta*r); %A matrix; a=[O 0 1 0;O 0 0 1;O a32 a33 a34;O a42 a43 a441; %B matrix; b=[O 0 b3 b41'; %C matrix; c=[l 0 0 0; 0 1 0 0; 0 0 1 01; %Q matrix; q=[l 0 0 0; 0 342.25 0 0; 0 0 1 0; 0 0 0 342.251; %Input the value of R; rol=input('input rol='); disp('a='),disp(a); disp('b='),disp(b); disp('c='),disp(c);
% % % % % % % % % % % % %

disp('q='),disp(q); disp('rol='),disp(rol); %Calculate the controllability matrix; conmtx=[b a*b a*a*b a*a*a*b]; %Calculate the observability matrix; obrmtx=[cl a'*c' at*a'*c' a'*aa'*a'*c']; cablty=rank(conmtx); oablty=rank(obrmtx); disp('Rank of controllability matrix='),disp(cablty); disp('Rank of observability matrix='),disp(oablty); eiga=eig(a); disp('Eigenva1ues of A matrix='),disp(eiga); %Calculate the optimal feedback control gain K; k=lqr(a,b,q,rol); disp('Optima1 feedback control gain K='),disp(k); eigk=eig(a-b*k); disp('Eigenva1ues of (A-BK)='), disp(eigk); %Decide the position of observer poles; tleft=input('input the times of poles go left,tleft='); pole=(tleft- l)*real(eigk)+eigk; disp('po1e locations ='),disp(pole); %Calculate the M matrix; m=(place(al, c', pole))'; disp('The M matrix ='),disp(m); eigm=eig(a-m*c); disp('Eigenva1ues of (A-MC)='), disp(eigm); %Change the observer equation to discrete-time model; splt=0.025; abar=a-b*k-m*c; bbar=m; [phi, gamma]=c2d(abar, bbar, splt); disp('Phi ='), disp(phi); disp('Gamma ='), disp(gamma);

Appendix B Simulation Program of Broom-balance System


C PROGRAM TO SIMULATE THE BROOM-BALANCE SYSTEM RESPONSE C USING THE RUNGE-KUTTA-VERNER FIFTH-ORDER AND SIXTH-ORDER METHOD C SOLVE THE INITIAL-VALUE PROBLEM FOR ORDINARY DIFFERENTIAL EQUATION C VARIABLES EXTERNAL FCN1 ,FCN2,IVPRK,SSET REAL PARAM(SO),T,TEND REAL X(4),XT(4),XH(4),XHT(4),A(4,4),B(4),Y(3),K(4) REAL M(4,3),C(3,4),MC(4,4),U,UO,UT,TA,TIME,DT C INTEGER I D 0 C CONSTANT REAL EPS,TOL INTEGER NEQ,MXPARM PARAMETER(EPS= 1.OE-05,TOL= 1.OE-05,NEQ=4,MXPARM=50) C GLOBLE VARIABLES COMMON ISYSI A,B,U COMMON IOBSI M,MC,Y C ARGUMENTS C C C C C C C C C C C I D 0 - FLAG INDICATING THE STATE OF THE COMPUTATION. NEQ - NUMBER OF DIFFERENTIAL EQUATIONS. (INPUT) FCN1,2 - USER-SUPPLIED SUBROUTINE TO EVALUATE FUNCTIONS. - INDEPENDENT VARIABLE. (INPUTIOUTPUT) T TEND - VALUE OF T AT WHICH THE SOLUTION IS DESIRED. (INPUT) TOL - TOLERANCE FOR ERROR CONTROL. (INPUT) PARAM - VECTOR OF LENGTH 50 CONTAINING OPTIONAL PARAMETERS. X,XH - VECTOR OF LENGTH NEQ OF DEPENDENT VARIABLES.

BEGIN SET PARAM TO DEFAULT CALL SSET (MXPARM, 0.0, PARAM,l) C SELECT ABSOLUTE ERROR CONTROL PARAM(l0) = 1.0 C READ DATA OF SYSTEM, OBSERVER AND CONTROLLER OPEN (3, FILE='sim.datal, STATUS='OLDt) DO 10 I=1,4 READ (3,*) (A(I,J),J=1,4) 10 CONTINUE READ (3,") (B(I), I=1,4) READ (3,") (K(I), I=1,4) DO 20 I=1,4 READ (3,*) (M(I,J),J=1,3) 20 CONTINUE CLOSE (3) C SET ELEMENT VALUES OF C MATRIX

40 30

50

C C

C C C C

DO 30 I= 1,3 DO 40 J= 1,4 C(I,J)=O CONTINUE CONTINUE C(l,l)=l C(2,2)=1 C(3,3)=1 SET THE INITIAL VALUES DO 50 I=1,4 X(I)=O XH(I)=O CONTINUE TIME=O NT=O N=O INPUT INITIAL POSITION OF MOTOR SHAFT WRITE(6,") 'ENTER THE INITIAL POSITION OF MOTOR SHAFT' READ(5,") X(l) INPUT INITIAL POSITION OF PENDULUM WRITE(6,") 'ENTER THE INITIAL POSITION OF PENDULUM' READ(5, *) X(2) TIME=O NT=O N=O INPUT INITIAL VALUE OF INPUT VOLTAGE WRITE (6,") 'ENTER THE INITIAL VALUE OF INPUT VOLTAGE UO' READ (5,") U O INPUT TIME INCREMENT STEP DT WRITE (6,") 'ENTER THE TIME INCREMENT STEP DT' READ (5,") DT INPUT THE OUTPUT STEP NOUT (WRITE OUTPUT EVERY NOUT LOOPS) WRITE (6,") 'ENTER THE OUTPUT STEP NOUT' READ (5,") NOUT MATRIX MULTIPULATION, MC=M*C DO 70 I= 1,4 DO 80 J=1,4

MC(I,J)=M(I,l)*C(l,J)+M(I,2)*C(2,J)+M(I,3)*C(3,J)
80 CONTINUE 70 CONTINUE C OUTPUT INITIAL VALUES OPEN (2, FILE='simout.dat', STATUS='NEW') WRITE(2,71) X(1),X(2),U07DT,NOUT FORMAT(' Xl=',F7.4,' X2=',F7.4,' UO=',F5.2,' DT=', F7.5, ' NOUT=',I4,) 71 WRITE(2,") ' K=',K DO 85 I=1,4 WRITE(2,86) (I,J,M(I,J),J=1,3) 86 FORMAT(",3(2X,'M(',Il ,',',I1,')=',F9.5)) 85 CONTINUE WRITE(2,5) TIME,(X(I), 1=1,4), U O OPEN (7,FILE='obsvr.dat', STATUS='NEW1) WRITE(7,5) TIME, (XH(I), 1=1,4), U O
I,'

u=uo
C LOOP 110 CONTINUE DO 140 I=1,3 Y(I)=X(I) 140 CONTINUE C SOLVE EQUATION DX/DT=A*X+B*U C INITIAL ENTRY IDO= 1 T=TIME TEND=TIME+DT CALL IVPRK(IDO,NEQ,FCNl ,T,TEND,TOL,PARAM,X) DO 120 I=1,4 XT(I)=X(I) 120 CONTINUE C FINAL CALL TO R E L E A S E WORKSPACE IDO=3 CALL IVPRK(IDO,NEQ,FCNl ,T,TEND,TOL,PARAM,X) C C SOLVE EQUATION DHX/DT=(A-M*C)*XH+B*U+M*Y C INITIAL ENTRY IDO=l T=TIME TEND=TIME+DT CALL IVPRK(IDO,NEQ,FCN2,T,TEND,TOL,PARAM,XH) DO 130 I=l,NEQ XHT(I)=XH(I) 130 CONTINUE C FINAL CALL TO RELEASE WORKSPACE IDO=3 CALL IVPRK(IDO,NEQ,FCN2,T,TEND,TOL,PARAM,XH) C UT=O DO 180 I=1,4 UT=UT-K(I)*XHT(I) 180 CONTINUE C NT=NT+l TIME=NT*DT N=N+l C OUTPUT IF(N.EQ.NOUT) THEN WRITE(2,5) TIME,(XT(I), 1=1,4),UT WRITE(7,5) TIME,(XHT(I), I= 1,4),UT N=O ENDIF C CHECK THE MAXIMUM DEVIATION OF ANGLE FROM VERTICAL POSITION IF(TIME.LT.TA) GOT0 185

IF(((ABS(XT(2)).LT.EPS).AND.(ABS(XT(4)).LT.EPS)).OR.(TIME.GT.
& 15)) GOT0 999

C 185 CONTINUE

DO 190 I=1,4 X(I)=XT(I) XH(I)=XHT(I) 190 CONTINUE U=UT C ENDLOOP GOT0 110 999 CONTINUE CLOSE (2) CLOSE (7) 5 FORMAT(",2X,F8.3,2X,4F10.6,2X,E11.4) STOP END C ................................ C SUBROUTINE FCN l(NEQ,T,X,XPRIM) INTEGER NEQ REAL T,X(4),XPRIM(4),A(4,4),B(4),U COMMON /SYS/ A,B,U DO 10 I=l, 4 XPRIM(I)=O DO 20 J=l, 4 XPRIM(I)=A(I,J)*X(J)+XPRIM(I) 20 CONTINUE XPRIM(I)=XPRIM(I)+B(I) * U 10 CONTINUE RETURN END C SUBROUTINE FCN2(NEQ,T,XH,XHPRIM) INTEGER NEQ REAL T,XH(4),XHPRIM(4),A(4,4),B(4),U,M(4,3) REAL MC(4,4),Y(3) COMMON /SYS/ A,B,U COMMON /OBS/ M,MC,Y DO 10 I=1,4 XHPRIM(I)=O D O 2 0 J=l, 4

XHPRIM(I)=(A(I,J)-MC(I,J))*XH(J)+XHPRIM(I)
20 10 CONTINUE

XHPRIM(I)=XHPRIM(I)+B(I)*U+M(I,l)*Y(l)+M(I,2)*Y(2)+M(I,3)*Y(3)
CONTINUE RETURN END

Appendix C Control Program with Observer Based Feedback Control Method


#include <stdio.h> #include <console.h> #include <math.h> #include <stdlib.h> #include <string.h> #include "NI-DAQ-MAC.hU #define COUNT 1OOOL #define COUNT-2 3072 #define SWITCH 512 #define OK 1 #define PI 3.141592654 void pause( void ); float save[7] [COUNT]; int 16 brd; i n t l 6 chan-out; i n t l 6 *bin-v-out; int16 out-mode, update-mode, update-signal, update-edge; float volt-out; float out-range; i n t l 6 chan-in-0; int16 chan-in-1 ; int16 chan-in-2; i n t l 6 input-mode, input-range, polarity; int 16 gain-0, *bin-v-in-0; i n t l 6 gain-1, *bin-v-in-1; int 16 gain-2, *bin-v-in-2; float *volt-in-0; float *volt-in-1 ; float *volt-in-2; float pos-err; float x-1, x-2, x-3, x-1-0, x-2-0, x-3-0, x-4-0; float x-1-o-old, x-2-o-old, x-3-o-old, x-4-o-old; float aa-1, aa-2, aa-3, aa-4, bb-1, bb-2, bb-3, bb-4; float v-gain-1, v-gain-2, v-gain-3, v-gain-4; float center-pos, center-pend; float mtr-pos-fac, mtr-speed-fac, pend-pos-fac; float *volt-in-0; float *volt-in-1 ; float *volt-in-2; float sgn-x, v-frict; long *count; main()
{

intl6 i; long j;

brd = 2; chan-out = 0; out-mode = 0; out-range = 10.0; update-mode = 0; update-signal = 0; update-edge = 0; chan-in-0 = 0; chan-in-1 = 1; chan-in-2 = 2; input-mode = 0; input-range = 10; polarity = 0; gain-0 = 1; gain-1 = 1; gain-2 = 1; /*set the coefficients of the sensors*/ mtr-pos-fac = 94.510.128; I* mmlvolt * I mtr-speed-fac = 41 7.7632; I* mm/volt-sec */ pend-pos-fac = PI/0.520; /* mm/volt */ /*set the center positions*/ center-pos = 0.298; /* voltage when x-1 = 0 *I center-pend = 0.396; I* voltage when x-2 = 0 */ /*voltage when cart can be moved against friction*/ v-frict = 0.042; /*Initialize board and input - output*/ AO-Setup( brd, chan-out, out-mode, out-range, update-mode, update-signal, update-edge); AI-Config( volt-out = 0.0; AO-VScale( brd, chan-out, volt-out, bin-v-out AO-Write ( brd, chan-out, *bin-v-out ); /*set feedback control gain*/ v-gain-1 = -0.001 2855; v-gain-2 = -0.789173; v-gain-3 = -0.00238 18; v-gain-4 = -0.109947; /*start loop*/ for( j = 0; j < COUNT; j++ ) { /*Read motor potentiometer voltage*/ AI-Read ( brd, chan-in-0, gain-0, bin-v-in-0 AI-Scale( brd, gain-0, *bin-v-in-0, volt-in-0 x-1 = (float)*volt-in-0; x-1 = (center-pos-x-l)*mtr-pos-facll2.7; x-1 = x-1 - 2.92479001e-01;
); ); );

brd, input-mode,

input-range,

polarity );

/*Read

pendulum potentiometer voltage*/ AI-Read ( brd, chan-in-2, gain-2, bin-v-in-2 AI-Scale( brd, gain-2, *bin-v-in-2, volt-in-2 x-2 = (float)*volt-in-2; x-2 = (center-pend-x-2)*pend_pos_fac; x-2 = x-2 - 3.247318e-02; motor tachometer voltage*/ AI-Read ( brd, chan-in-1, gain-1, bin-v-in-1 AI-Scale( brd, gain-1, *bin-v-in-1, volt-in-1 x-3 = (float)*volt-in-1 ; x-3 = x-3*mtr-speed-facll2.7; x-3 = x-3 +1.6061885649263e-01;

); );

/*Read

); );

volt-out = -v-gain-l*x-1-0 v-gain-4*x-4-0; /*decide the sign of friction*/ if( volt-out < -0.0001 ) sgn-x = -1.0; else if( volt-out > 0.0001 ) sgn-x = 1.0; else sgn-x = 0.0; volt-out = volt-out

- v-gain-2*x-2-0

v-gain-3*x_3-0

v-frict*sgn-x;

/*set the bounds of the control voltage*/ if( volt-out > 0.17 ) volt-out = 0.17; else if(vo1t-out < -0.17) volt-out = -0.17; else volt-out = volt-out; /*Output the voltage command*/
);

AO-VScale( brd, chan-out, volt-out, bin-v-out AO-Write ( brd, chan-out, *bin-v-out );

/*save the values of states, estimated states and control voltage*/ save[O]lj] = x-1; save[l]lj] = x-2; save[2]ti] = x-3; save[3]lj] = x-1-0; save[4] ti] = x-2-0; save[5]u] = x-3-0; save[6]b] = x-4-0; save[7]lj] = volt-out;

volt-out = 0.0; AO-VScale( brd, chan-out, volt-out, bin-v-out AO-Write ( brd, chan-out, *bin-v-out );

);

AO-Update(2); pause(); /*print out the values of states, estimated states and control voltages*/ for( j = 0; j < COUNT; j++) printf("%e\t%e\t%e\t%e\t%e\nU, save[O]h], save[l][j], save[3]u], save[4] ti], save[7l[jl); pause(); for( j = 0; j < COUNT; j++ ) printf("%e\t%e\t%e\t%e\nW, save[2] lj], save[5]lj], save[6] ti], save[7] ti]); void pause()
{

char c; printf("\nPause c = getchar(); c = c;

...'I);

Appendix D

Control Program with Full State Feedback Control Method

#include <stdio.h> #include <console.h> #include <math.h> #include <stdlib.h> #include <string.h> #include "NI-DAQ-MAC.h" #define COUNT lOOOL #define COUNT-2 3072 #define SWITCH 512 #define OK 1 #define PI 3.141592654 void pause( void ); float save[7] [COUNT]; intl6 brd; i n t l 6 chan-out; i n t l 6 *bin-v-out; intl6 out-mode, update-mode, update-signal, update-edge; float volt-out; float out-range; int 16 chan-in-0; i n t l 6 chan-in-1; int 16 chan-in-2; int 16 input-mode, input-range, polarity; int 16 gain-0, *bin-v-in-0; i n t l 6 gain-1, *bin-v-in-1; int 16 gain-2, *bin-v-in-2; float *volt-in-0; float *volt-in-1; float *volt-in-2; float pos-err; float x-1, x 2 , x-3, x-4; float x-2_old, x-2-old-l ; float v-gain-1, v-gain-2, v-gain-3, v-gain-4; float center-pos, center-pend; float mtr-pos-fac, mtr-speed-fac, pend-pos-fac; float *volt-in-0; float *volt-in-1; float *volt-in-2; float sgn-x, v-frict, sgn-x-1, x-frict; float dt, t, tstep; long *count; FILE *ofp;

long j;

brd = 2; chan-out = 0; out-mode = 0; out-range = 10.0; update-mode = 0; update-signal = 0; update-edge = 0; chan-in-0 = 0; chan-in-1 = 1; c h a n - i n = 2; input-mode = 0; input-range = 10; polarity = 0; gain-0 = 1; gain-1 = 1; gain-2 = 1;

/* set the coefficients of sensors*/ mtr-pos-fac = 94.510.128; /* mm/volt */ mtr-speed-fac = 417.7632; /* mmlvolt-sec *I pend-pos-fac = PI/0.520; I* radlvolt */
/*set the center positions*/ /* voltage when x-1 = 0 */ center-pos = 0.280; center-pend = 0.396; /* voltage when x-3 = 0 */ /*set the voltages against the frictions*/ v-frict = 0.03; x-frict = 0.02; /*set the time interval*/ dt = 0.0328; tstep = 0.0129; t=0;

/* open file 0UT.data for saving output data */ ofp = fopen("OUT.data","w"); /* Initialize board and input - output */
AO_Setup( brd, chan-out, out-mode, out-range, update-mode, update-edge); AI-Config( volt-out = 0.0; AO-VScale( brd, chan-out, volt-out, bin-v-out AO-Write ( brd, chan-out, *bin-v-out );
);

update-signal,

brd, input-mode, input-range, polarity );

/*set the v-gain-1 v-gain-2 v-gain-3 v-gain

feedback control gain*/ = - 1.28563e-03; = -0.775473; = -2.37054e-03; = -0.105458;

for( j = 0; j < COUNT; j++ ) /*Read

I
); );

motor potentiometer voltage*/ AI-Read ( brd, chan-in-0, gain-0, bin-v-in-0 AI-Scale( brd, gain-0, *bin-v-in-0, volt-in-0 x-1 = (float)*volt-in-0; x-1 = (center-pos-x-l)*mtr-pos-facll2.7; x-1 = x-1 - 9.764431e-02;

/*Read

pendulum potentiometer voltage*/ AI-Read ( brd, chan-in-2, gain-2, bin-v-in-2 AI-Scale( brd, gain-2, *bin-v-in-2, volt-in-2 x-2 = (float)*volt-in-2; x-2 = (center-pend-x-2)*pend_pos_fac; x-2 = x-2 - 3.2473 18e-02; motor tachometer voltage*/ AI-Read ( brd, chan-in-1, gain-1, bin-v-in-1 AI-Scale( brd, gain-1, *bin-v-in-1, volt-in-1 x-3 = (float)*volt-in-1 ; x-3 = x-3*mtr-speed-facll2.7; x-3 = x-3 + 1.60618856549263e-01;

); );

/*Read

); );

/*Calculate pendulum angular velocity*/ x-4 = (x-2 - ~-2-old-l)/(2*dt); x-2-old-1 = x-2-old; x-2-old = x-2; /*Output voltage*/ volt-out = -v-gain- 1*x- 1 - v-gain-2*x-2 /*decide the sign of friction*/ if( volt-out c -0.0001) sgn-x = -1.O; else if( volt-out > 0.0001 ) sgn-x = 1.0; else sgn-x = 0.0; if( x-1 < -1 ) sgn-x-1 = -1.0; else if( x-1 > 1 ) sgn-x-1 = 1.O;

- v-gain-3 *x-3 - v-gain-4*x-4;

else sgn-x-1 = 0.0; volt-out = volt-out

v~frict*sgn~x+x~frict*sgn~x~l+x~2*0.18;

/*set the bounds of the control voltage*/ if( volt-out > 0.17) volt-out = 0.17; else if(vo1t-out c -0.17) volt-out = -0.17; else volt-out = volt-out;

/* Output the voltage command*/


AO-VScale( brd, chan-out, volt-out, bin-v-out AO-Write ( brd, chan-out, *bin-v-out );
);

/*save the value of the states and control voltages*/ save[O]U] = x-1; save[l]Q] = x-2; save[2]lj] = x-3; save[3]lj] = x-4; save[4]lj] = volt-out;

volt-out = 0.0; AO-VScale( brd, chan-out, volt-out, bin-v-out AO-Write ( brd, chan-out, *bin-v-out );
);

/*print the time, state values and control voltages to a file*/ for( j = 0; j c COUNT; j++ ) {

fprintf(ofp,"%e\t%e\t%e\t%e\t%e\t%e\n", save[3lLil, save[41 [jl); t = t + tstep;


void pause()

t, save[O]U], save[l][j], save[2][j],

char c; printf('lnPause c = getchar(); c = c;

...");

Appendix E

Procedure of the Experiment

Turn on the computer, open the "Macintosh HD" folder. Open the folder "Broom-balance". Double click on the file "invert-fst-x2.cU, the computer will open a window named "Broom-balance". Highlight the file "Motor-10" in the window, then press "Open", a small window "Motor-10" will be opened with the files

"invert-fst-x2 .c, NI-DAQ-MACLI,

ANSI, ChkErr .c and MacTraps" will be

listed in it, also the text of the program "invert-fst-x2.c

displayed. The program can be edited at this time. For example, to change the feedback control gain by changing the values of the variables "v-gain-1, v-gain-2, v-gain-3 and v-gain-4".

Turn on the amplifier, set the amplification ratio to maximum. Move the cart close to center of the track and set the pendulum in upright position. Pull down the menu project from the top of the screen and select the command "Run", the system will perform the feedback control of the inverted pendulum for about 14 seconds, then the program will pause with a window "Console", to press "Enter" key, all the values of the states and control voltages during the experiment will be printed to a file "OUT.dataM,to skip this step, just press "% " and

"."

keys at the pause mode. After the data has

been printed, the computer pause with a window "Press <return> to exit", then press "Return" to stop the program. The experiment can be repeated from step 6.

9.

To quit the program, first turn off the amplifier, and then pull down the menu "File" from top of the screen and select "Quit".

10. Pull down the menu "Special" and select "Shutdown" to turn off

the computer.

Вам также может понравиться