Optimal Tracking Controller for Ball and Beam System

2 downloads 0 Views 320KB Size Report
Mar 22, 2004 - Here, the Ball and Beam system, shown in Figure 1, developed by. Quanser was the ..... Optimal Control, John Wiley & Sons, New York, 1995.
Optimal Tracking Controller for Ball and Beam System Daniel U. Campos-Delgado Department of Electrical and Computer Engineering Louisiana State University Baton Rouge, LA 70803-5901 Tel. (225) 578-4831 Fax (225) 578-5200 E-mail: [email protected] March 22, 2004 Abstract This paper presents a new approach to regulator state-constrained minimum-time problems, especially applied to a Ball and Beam System. The approach followed in this paper is to separate the problem in trajectory planning and path tracking. Trajectory planning involved determining the near-optimal-time paths according to the actuator limitations and mechanical characteristics. Meanwhile, the path tracking control is achieved by a Time-Variant Linear-Quadratic Tracker controller whose synthesis requires the solution to a set of differential Riccati equations. The advantages of this new controller approach are shown using simulation. Keywords: Minimum-time Path, Regulator, Optimal Control, Quadratic Tracking Control.

1

Introduction

Originally formulated by Johann Bernoulli in 1696, the solution of the Brachystochrone problem can be argued to mark the birth of optimal control. Essentially, the Brachystochrone was defined as a minimumtime trajectory problem between two points. Since then, optimal time problems have been largely studied and a lot effort have been put to obtain analytic solutions. However, for two-point boundary-value problems with bounded control input, the optimal trajectory requires a ”bang-bang” control. In fact, to determine the corresponding switching times and sequence of the control, the Pontryagin’s Minimum Principle must be applied. Nevertheless, these analytic solutions are very difficult to compute with the exception of low-order, linear, and time-invariant models. Furthermore, if also limitations on the states-variables are presented, a mathematical solution is almost hopeless [2]. In the literature, numerical algorithms have been also proposed in order to obtain the switching times of the control signal for the minimum-time bounded-control problem. In [10], Sirisena proposed a gradient method for computing optimal bang-bang controls where the cost of the bang-bang controls is minimized with respect to the switching times and final time. Similarly, several other attempts have been made to obtain numerical solutions, like the shooting method proposed by Lastman [5]. In this method, arbitrarily initial guesses of the costates and final time were used to produce an iterative process ending hopefully with the optimal values. In addition, this method was extended by Fotouhi [3] where a systematic procedure of obtaining a good guess of the initial costates is outlined. Focused on chemical processes, Lin [7] presented a time-optimal control algorithm that do not require a-priori knowledge of the process dynamics, but assumes that the plant model is described by a second order system plus deadtime. On the other hand, Yang [11] developed a fast algorithm to generate near-minimum-time trajectories for a robot manipulator based on a ”two-step” Lyapunov approach. This new approach focused on changes in the manipulator’s kinetic energy during time-optimal motion.

1

In ”bang-bang” control laws the optimal solution switches between its maximum and minimum limits continuously. As a result, no room for extra correction due to feedback is allowed. Consequently, there have been attempts to include feedback to this solutions to improve robustness and noise sensitivity. In [8], Newman presented an algorithm to derive an optimal control based on an underestimate of the actual effort saturation limits, such that the extra effort available between assumed limit and the physical limit is used in a sliding-mode formulation to improve robustness. Also, Kumagai [4] proposed a near-minimum time feedback controller using on-line time scaling of the control input. Hence, this controller adapts to an uncertain environment and automatically adjust obtaining minimum-time trajectories avoiding the saturation condition. Alternatively, Shin [9] developed a new approach for the minimum-time control of robotic manipulator with geometric path constraints focused on trajectory planning. According to this strategy, the control algorithm is divided into two stages: path planning and path tracking. The trajectory planning is addressed according to the dynamics of the system and the path restrictions, and the path tracking control is implemented with linear controllers, like PID control. The motivation of this paper came from the 1998 ACC Control System Design Competition [1], which was sponsored by Quanser Consulting. Here, the Ball and Beam system, shown in Figure 1, developed by Quanser was the test benchmark for different design strategies. For this competition, two controllers were submitted from the Electrical Engineering Department in LSU. The first one was a simple LQG controller and the second one was a time-variant controller based on PD eigenvalue assignment. Now, a new method is proposed that follows the two stages algorithm: trajectory planning and path tracking. First, according to the mechanical and physical constraints of the system a set of desired trajectories are computed. Finally, a Linear-Quadratic Tracking controller is designed to perform optimal-tracking of these trajectories satisfying the former constraints. This paper is organized as follows. Section 2 gives a description of the Ball and Beam system. In section 3, a brief outline of the Continuous Linear Quadratic Tracker (CLQT) design procedure is presented. Section 4 shows how this procedure can be applied to the Ball and Beam system. In section 5, computation of the tracking trajectories is presented. Finally, section 6 shows controller implementation and results.

2

System Description

The Ball and Beam system, shown in Figure 1, consists of a DC-motor servo plant and a ball that is free to roll on a track. The motor has a built in gearbox whose ratio is 14:1. The output drives a 0.5 inch diameter pinion which in turn drives a 2.5 inch diameter gear. The final gear ratio is 70:1. The output gear is equipped with rotational joint to which a lever arm is coupled to one end of the track on which the ball rolls. The other end of the track is free to rotate at a fixed height. The geometry is designed such that when the servo angle is at zero degrees, the track is horizontal. A positive servo angle results in lifting the track from the servo end which causes the ball to roll in the negative direction. Two measurements are available from the system: the servo angle (θ in degrees) and the position of the ball (x in centimeters). A positive voltage applied to the motor results in the rotation of the motor which causes an upward motion of the arm.

2.1

Mathematical model

A model for this system can be derived by considering the equations of a DC servo motor (actuator) and the dynamics of a rolling ball. So, the DC-motor model can be represented by a nonlinear part followed by a transfer function, where the nonlinearities come from saturation and dead-zone. Thus, the DC-motor transfer function from the motor voltage u to servo-angle θ is given by α θ = u s (s + αβ) where α =

km kg Rm Jl

and β = km kg , and the constants km , kg , Rm and Jl represents mechanical parameters

km = 0.00767 N · m/A

Torque constant

(1)

Figure 1: Ball-Beam Experiment kg = 14 × 5 Rm = 2.6 Ω Jm = 3.87 ×1 0−7 kg · m2 Jl = Jm × kg × kg kg · m2

Total gear ratio Armature resistance Armature inertia Inertia at the output end

On the other hand, the ball-dynamics are modeled by a transfer function from the servo-angle θ to the ball displacement x x γ = 2 θ s where γ = −5gr and g, r and L Ã represent 7L r = 1.0 inch L = 17 inch g = 9.81 m/s2

radius of hinge length of the arm gravitational constant

The ball-beam model diagram is shown in Figure 2. Nevertheless, only the linear dynamics will be considered in the designing stage. As a result, the state-space description of the open-loop model is used x˙ = Ax + Bu

(2)

y = Cx 

0  0  A= γ 0

1 −αβ 0 0

 0 0 0 0   0 0  1 0



 0  α   B=  0 , 0

· C=

57 0 0 0 0 0

0 100

¸

where the states vector x has a physical meaning    θ [rad] x1  x2   θ˙ [rad/s]   x=  x3  =  x˙ [m/s] x4 x [m]

   

control

1 input voltage

Saturation

1/Rm

Dead Zone

1/R

Sum

Km*Kg

1

1/Jl

1

s

s

Joint rate

Joint angle

1/Jl

Torque

Km*Kg BEMF theta

SRV−02 Sensor 57

2 angle measurement

x

Sensor Gain 1

Ball velocity

Ball Position

1

1

s

s

5g/7

Sum1

100

position measurement

r/L

−5*g/7

r/L

Band−Limited White Noise1

Figure 2: Ball-Beam Model Diagram

2.2

Controller Performance Requirements

The system is assumed to have the following initial conditions:    θ(0) −52o  θ(0)   ˙ 0   x0 =   x˙ (0)  =  0 0.195 m x (0)

   

(3)

The task of the controller is to bring the ball to the zero position as fast as possible and with as little overshoot as possible, i.e. x(T ) = 0 , where T represents the final time. In addition, the controller must ensure that the servo angle (θ) does not exceed 52o in magnitude, | θ |≤ 52o . Moreover, the DC-servo motor is saturated at 5 V , so a mechanical limitation on the rate of the servo-angle θ is present, | θ˙ |≤ constant (this values will be calculated later).

3

Continuous Linear Quadratic Tracker (CLQT)

In this section, a brief description of the implementation of the continuous linear quadratic tracker controller is presented, for further details see [6]. First, it is assumed that the plant model is represented by a LinearTime-Invariant (LTI) model : x˙ = Ax+Bu, y = Cx where x ∈ Rn , u ∈ Rm and y ∈ Rp . At the same time, according to the model description a set of states xd is available for tracking. Note that if only the desired output yd is given, the problem can be converted to state tracking by xd = C † yd , where C † represents the pseudo-inverse of C. So, the quadratic cost index is defined: Z T £ ¤ J= (x − xd )T Q(x − xd ) + uT Ru dt (4) 0

Q ≥ 0,

R>0

where Q ∈ Rn×n and R ∈ Rm×m , all symmetric. So, the optimal tracking problem is formulated as follows min J(xd , x, u) u

s.t.

x˙ = Ax + Bu

Thus, the optimal-solution can be written : u(t) = −K(t) · x + R−1 B T · v(t)

(5)

where K(t) = R−1 B T S(t) and S(t), v(t) satisfy: −S˙ = AT S + SA − SBR−1 B T S + Q S(T ) = 0 T

−v˙ = (A − BK(t)) · v + Q · xd

v(T ) = 0

(6) (7)

Therefore, if the desired states to track are known a priori, the optimal controller involves the solution of two Riccati equations backward in time.

4

CLQT Synthesis

Hence, applying this design technique to our system (2) and assuming that the desired states xd are available, (6) and (7) can solved off-line. Therefore, let   q1 0 0 0    0 q2 0 0    Q= (8)  ,R = r  0  0 q 0 3   0 0 0 q4 and



s1

  s2  S=  s3  s4

s2

s3

s5

s6

s6

s8

s7

s9

s4



 s7   , s9   s10



v1

  v2  v=  v3  v4

      

(9)

since S is always a symmetric matrix. Thus, from (6) and substituting (8) and (9), 10 scalar Riccati equations are obtained: s2 2 α 2 + q1 r

−s˙ 1

=

2 γ s3 −

−s˙ 2

=

γ s6 + s1 − β α s2 −

−s˙ 3

=

−s˙ 4

=

−s˙ 5

=

−s˙ 6

=

−s˙ 7

=

2

α 2 s5 r

s2 α2 s6 r s2 α 2 s7 γ s9 − r s5 2 α2 2 s2 − 2 β α s5 − + q2 r s5 α2 s6 s3 − β α s6 + s7 − r s5 α2 s7 s4 − β α s7 − r γ s8 + s4 −

(10)

−s˙ 8

=

−s˙ 9

=

−s˙ 10

=

s6 2 α 2 + q3 r s6 α2 s7 s10 − r s7 2 α 2 − + q4 r

2 s9 −

In addition, from (7) and substituting again (8) and (9), another set of 4 Riccati equations must be solved: Mux To Workspace

Fcn

Integrator Mux

s1

1 s

−((u(1)*alpha)^2)/R +2*gama*u(2)+q1

Mux To Workspace1

Integrator1 1

Mux1

s2

s

Fcn1 u(1)−alpha*beta*u(2)−(alpha^2)*u(2)*u(3)/R +gama*u(4)

Mux To Workspace2

Fcn2

Integrator2 Mux2

s3

1 s

−(alpha^2)*u(1)*u(3)/R+u(2)+gama*u(4)

Mux To Workspace3

Fcn3

Integrator3 1

Mux3

s4

s

−(alpha^2)*u(1)*u(2)/R+gama*u(3)

Mux To Workspace4

Fcn4

Integrator4 1

Mux4

s5

s

2*u(1)−2*beta*alpha*u(2)−(1/R)*(u(2)*alpha)^2+q2

Mux To Workspace5

Fcn5

Integrator5 1

Mux5

s6

s

u(1)−(alpha^2)*u(2)*u(3)/R−alpha*beta*u(2)+u(3)

Mux To Workspace6

Fcn6

Integrator6 1

Mux6

s7

s

u(1)−(alpha^2)*u(2)*u(3)/R−beta*alpha*u(3)

Mux To Workspace7

Fcn7

Integrator7 Mux7

s8

1 s

−(1/R)*(alpha*u(1))^2 +2*u(2)+q3

Mux To Workspace8

Mux8

s9

1 s

To Workspace9

Fcn8

Integrator8

−(alpha^2)*u(1)*u(2)/R+u(3)

Fcn9

Integrator9 1

s10

s

−(1/R)*(alpha*u)^2+q4

Figure 3: Simulink implementation to compute S(t) −v˙ 1 −v˙ 2 −v˙ 3 −v˙ 4

= −α k1 v2 + γ v3 + q1 x1d = v1 + (−β α − α k2 ) v2 + q2 x2d = −α k3 v2 + v4 + = −α k4 v2 + q4 x4d

(11)

q3 x3d

In order to obtain a solution to the differential Riccati equations, Simulink diagrams were used for numerical integration, shown in Figures 3 and 4. Finally, the Kalman gain K(t) is given by £ ¤ £ α s7 ¤ (12) K = k1 k2 k3 k4 = αrs2 αrs5 αrs6 r and by (5) the optimal affine control u(t) can be written as: u(t) = −k1 x1 − k2 x2 − k3 x3 − k4 x4 +

α v2 r

(13)

Gain1

yd1

q1 To Workspace1 v1

Integrator

Sum

Gain10

1

gama

s Product

Gain3

k1

alpha

Sum1 To Workspace v2

[tsim,k1f]

Gain2 q2

1 s

alpha*beta

[tsim,x2df]

Gain4

k2

alpha

[tsim,k2f]

Gain5

Gain6

Sum3 v3

yd

Integrator1

Product1

To Workspace2

[tsim,x1df]

Integrator2

v4

[tsim,x3df]

1 s

Product2

Gain8

k3

alpha

To Workspace3

yd2

q3

Integrator3

[tsim,k3f]

Gain7

Sum2

s

yd3

q4

1 Product3

Gain9 alpha

[tsim,x4df]

k4 [tsim,k4f]

Figure 4: Simulink implementation to compute v(t)

5

Computation of Tracking Trajectories

First, the optimal minimum-time trajectory for the ball-dynamics is computed assuming no restriction on the servo-angle rate θ˙ (x2 ). For this purpose, the state-space representation of the ball dynamics is taken from (2): x˙ 3 = γ · x1 x˙ 4 = x3

(14)

with | x1 |≤ 52o = θmax and boundary conditions x3 (0) = 0, x4 (0) = 0.195 and x3 (T ) = 0, x4 (T ) = 0. Let x ˆ1 = x1 /θmax . So, the system can be written as: x˙ 3 = −ξ · xˆ1 x˙ 4 = x3

(15)

thus, ξ = −γ · θmax (ξ > 0) and | x ˆ1 |≤ 1. Consequently, the optimal control x ˆ1 that minimizes time T and satisfies dynamics, constrains and boundary conditions is wanted. The solution to this optimization problem is a well-known classic result: ”bang-bang” control. For details about the properties of this optimal solution refer to [6] and [2]. Hence, the optimal solution to (15) is a nonlinear feedback control law  1 if x4 > −1   2ξ x3 | x3 | or   if x4 = −1 2ξ x3 | x3 | and x4 < 0 x ˆ1 = (16) −1 −1 if x <  4 2ξ x3 | x3 | or    if x4 = −1 2ξ x3 | x3 | and x4 > 0 and the optimal time

µ ¶ q T = (1/ξ) · x3 (0) + 4x23 (0) + 4ξx4 (0) − 0.5x23 (0)

(17)

Therefore, substituting the values of the initial conditions (3) in (17), the optimal minimum-time T = 1.4447 sec is obtained. Furthermore, scaling properly and applying (16) to system (14) the optimal trajectories for

x , x˙ and θ (x3 ,x4 and x1 ) can be computed, see Figure 5. However, the optimal trajectory for θ˙ is noncontinuous and becomes infinity at the transition points of θ. Nevertheless, the information of θ can be used to approximate θ˙ by means of a derivative block followed by a low-pass filter. Thus, a set of state trajectories x1d for (2) is available in order to design the CLQT controller. 1

θd (rad) v (m/s) d x (m)

0.8

0.6

d

0.4

0.2 T=1.4447 s 0

−0.2

−0.4

−0.6

−0.8

−1

0

0.2

0.4

0.6

0.8

1 time (sec.)

1.2

1.4

1.6

1.8

2

Figure 5: Optimal Minimum time paths assuming a bang-bang control is available As mentioned earlier, the optimal trajectory θ requires instantaneous transitions from the lower to upper limits and viceversa, but due to mechanical limitations, this is impossible. Instead, the response of the DCmotor transfer function will be examined. From (1), if a step input is applied with the maximum allowed voltage (5 V) then the time response for the servo-angle θ is given by µ ¶ 1 t e−α β t θ(t) = 5 α − 2 2 + + 2 2 rad α β αβ α β θ(t) = 9.3250 · t − 0.0660 + 0.1600 · e−58.46·t rad Therefore, the response is dominated by the ramp function, which gives the maximum changing rate for θ, i.e. θ˙ ≤ 9.325. Consequently, a more realistic tracking trajectory for θ must incorporate this restriction. Therefore, using the information from the optimal minimum-time servo-angle, a suboptimal θd that makes the transitions using this maximum slope and drives the states x , x˙ from the initial position to zero in minimum time was computed, see Figure 6. As a result, a new set of state paths x2d is available. Obviously, the minimum-time obtained assuming rate constraint T=1.6390 sec is somewhat longer that the optimal time T=1.4447 sec, but still close to it. 1

θd (rad) vd (m/s) xd (m)

0.5 T=1.6390 s

0

−0.5

−1

0

0.5

1

1.5

2

2.5

3

2

2.5

3

1

0.5 T=1.6760 s 0

−0.5

−1

0

0.5

1

1.5 time (sec.)

Figure 6: Optimal Minimum time paths assuming rate-limitations i) slope=9.3250 ii) slope=8

Now, in order to have a more trackable signal the slope of θ was reduced from its limit value of 9.325 to 8, i.e. the control voltage does not need to reach its limit value. The suboptimal path in this case is shown also in Figure 6. Hence, another set of state trajectories x3d was obtained. Similarly, the final time T=1.6760 sec was close to the optimal performance.

6

Controller Implementation

So far, three sets of state tracking trajectories are given, x1d , x2d and x3d . Hence, the CLQT controller can be implemented following the procedure outlined previously. First, the weighting matrices Q and R must be specified. Next, equations (10) and (11) must be solved in order to get the optimal control signal u(t). Actually, to be able to solve (10) and (11), SIMULINK and MATLAB were used to integrate the equations backward in time from the final boundary conditions, see Figures 3 and 4. Therefore, given S(t) and v(t) the control signal u(t) can be constructed by (12) and (13). Finally, the closed-loop behavior is obtained by simulation, see diagram Figure 7. To Workspace2

x_pos

u

x4 SRV−3

Ball and Beam

Ball sensor

Sum1

x_dot

Observer 1

x3 theta x1

Angle sensor

theta_dot

Observer

x2 Product2 alpha/R

k4 −K−

[tsim,k4] Product3 k3 [tsim,k3]

Product k1 [tsim,k1] Product1 k2 [tsim,k2] [tsim,v2] v2

Figure 7: Closed-loop Simulation Diagram with CLQT controller Thus, the remaining task is to find the values for Q and R that lead to the best performance. However, this is a iterative process and involves analyzing the response for each corresponding Q and R seeking to satisfy | θ(t) |≤ 52o . In the first place, a controller is designed to track x1d . The best performance is shown in Fig. 8. Likewise, the same design iteration was carried on for x2d and x3d . The best responses are shown in Figs. 9 and 10. From these plots, it can be argued that the best performance was achieved in the last case, Figure 10. In fact, the path of the ball from the initial condition is pretty close to the desired trajectory. On the other hand, it was also investigated applying time varying weight, i.e. Q is now a function of time. Particularly, varying the values of q1 and q4 to settle the response faster. But, no improvement was obtained, since applying Q(t) produced the servo-angle θ(t) to go out of the limits ,i.e. | θ(t) |≥ 52o .

0.2

x 4d x

0.15

meters

0.1 0.05 0 −0.05

0

1

2

3

4 time (sec)

5

6

7

8

1

x1d θ

rad

0.5

0

−0.5

−1

0

1

2

3

4 time (sec)

5

6

7

8

Figure 8: Closed-loop simulation with the CLQT controller tracking x1d

7

Conclusions

The designing of this controller was a challenging task since it involves two major steps: (i) computation of tracking trajectories and (ii) implementation of CLQT controller. The first step, trajectory planning was developed using optimal control paths as reference and incorporating the actuator limitations and physical restrictions. Finally, the CLQT controller design reduced to tuning of weighting parameters Q and R to satisfy the mechanical requirements. Analyzing Figures 5 and 10, the performance achieved by the proposed controller (CLQT) is close to the optimal path. Therefore, it can be argued that the response of the CLQT controller is almost optimal.

References [1] 1998 ACC Control System Design Competition. Philadelphia, Pennsylvania USA. [2] Arthur E. Bryson, Yu-Chi Ho. Applied Optimal Control : Optimization, Estimation and Control , Hemisphere Publishing Corporation, Washington,D.C., 1975 [3] Reza Fotouhi-C. and Walerian Szyszkowski. An Algorithm for Time-Optimal Control Problems. Journal of Dynamics Systems, Measurements and Control. September 1998, Vol. 120, pp. 414-418. [4] A. Kumagai, D. Kohli and R. Perez. Near-Minimum Time Feedback Controller for Manipulators Using On-Line Time Scaling of Trajectories. Journal of Dynamics Systems, Measurements and Control. June 1996, Vol. 118, pp. 300-308. [5] G.J. Lastman. A Shooting Method for Solving Two-Point Boundary-Value Problems Arising From NonSingular Bang-Bang Optimal Control Problems. International Journal of Control. Vol. 27, No. 4, pp. 513-524. [6] Frank L. Lewis, Vassilis L. Syrmos. Optimal Control, John Wiley & Sons, New York, 1995. [7] Yeong-Iuan Lin, John N. Beard and Stephen S. Meisheimer. Model-Independent Algorithms for TimeOptimal Control of Chemical Processes. AIChe Journal. June 1993, Vol. 39, No. 6, pp. 979-988. [8] W.S. Newman. Robust Near Time-Optimal Control. IEEE Transactions on Automatic Control. July 1990, Vo. 35, No. 7, pp. 841-843.

0.2

x 4d x

meters

0.15

0.1

0.05

0

0

1

2

3 time (sec)

4

5

6

1

x1d θ

rad

0.5

0

−0.5

−1

0

1

2

3 time (sec)

4

5

6

Figure 9: Closed-loop simulation with the CLQT controller tracking x2d [9] Kang G. Shin and Neil D. McKay. Minimum-Time Control of Robotic Manipulators with Geometric Path Constraints. IEEE Transactions on Automatic Control. June 1985, Vol. 30, No. 6, pp. 531-541. [10] H.R. Sirisena. A Gradient Method for Computing Optimal Bang-Bang Controls, International Journal of Control. 1974, Vol. 19, No. 2, pp. 257-264. [11] Hyun S. Yang and Jean-Jacques E. Slotine. Fast Algorithm for Near-Minimum-Time Control of Robot Manipulators. International Journal of Robotics Research. December 1994, Vol.13, No. 6, pp. 521-532

0.2

x 4d x

meters

0.15

0.1

0.05

0

0

1

2

3 time (sec)

4

5

6

1

x 1d θ

rad

0.5

0

−0.5

−1

0

1

2

3 time (sec)

4

5

6

Figure 10: Closed-loop simulation with the CLQT controller tracking x3d

Suggest Documents