• 沒有找到結果。

2.2 On-Line Optimal Training

The TS-type FNN model for uncertain systems can be trained by using the on-line optimal training [1]. Because the dynamic optimal training [3] is very powerful for on-line disturbance rejection, it will be utilized in the on-line optimal training of TS-type FNN model for uncertain nonlinear systems.

Let the input training matrix R be

1

And the output matrix of the TS-type FNN model is

] 1 And the output matrix of the uncertain nonlinear system is

xn The overall weighting matrix to include the uncertain Ai and Bi matrices can be shown as [1]:

Therefore the output of TS-type FNN model Y can be shown as:

W R

Y = T (12)

It is therefore the purpose of on-line training to obtain the weighting matrix W .

First, the squared error J and the error function E have to be defined: Then the dynamical learning rates βopt for each iteration k can be determined by the dynamical optimal training in [3]. Define

This learning rate will not only guarantee the stability of the training process, but also have the fastest speed of convergence. Then, the on-line training rule for each subsystem is shown as

, simultaneously by using (20) at the beginning of each time interval.

The final linear dynamic equation, (Af, Bf), of the uncertain nonlinear system has been inferred from (2) at the beginning of any time interval. Then, the pole placement technique can be used to design the controller [1]. The overall design process can be seen from the following Figure 2-2, which is from [1].

Uncertain Nonlinear

Figure 2-2. Overall design process

2.3 Design Algorithm for Computer Simulation

If we ignore the inevitable computational time delay, which includes the training time, the pole-placement and signal transmission, a design algorithm from [1], which is based on Figure 2-2, can be summarized as follows:

Step (1) Specify desired stable poles.

Step (2) Define the r nominal operating points and the corresponding membership functions forx(t)andx&(t). Use any input u(t) to excite the uncertain nonlinear system and measure sufficient data information of x(t)andx&(t). In real implementation, it is easier to use step commands to trigger the system to get sufficient response data. This will be explained later in the real–time control of planetary inverted pendulum in Chapter 3.

Apply (5) to find the initial weighting matrix Wi

( )

0 of each subsystem for i=1, …, r.

Step (3) Apply pole placement to design the controller.

Step (4) If the norm of tracking error > e1, a specified threshold, GOTO Step (2), Else GOTO Step (5).

Step (5) Measure on-linex(t)andx&(t). For i=1,…, r, applying (19) to find the optimal learning rates to train the weighting matrix of each subsystem. The optimal training must continue until relative errors of Wi are less than another pre-defined threshold e2.

Step (6) GOTO Step (3)

Adaptive Rules for updating the closed-loop system in Figure 2-2

If ||ε(t)||>Threshold

Apply all Steps to update the TS-type FNN model, us(t) and Kp

Else

Stand Still End.

The above design algorithm can be best illustrated by the following example.

Example 1. The Mass-Spring-Damper System

Consider the mass-spring-damper system [1] of which the mathematical equation isx&&=−0.1x&3 −0.02x−0.67x3 +u and let

[

x t( ) x t&( )

] [

r = x2 x1

]

. In this example, the objective of the control system is to make the position,x , and the velocity,2 x , 1 trace the reference signal. Now, follow the design flow and rule to implement the controller.

Step (1) Specify the closed-loop poles as -2 and -1.5

Step (2) According to the distribution of the output signal, define the membership function. Then, use the equation (5) to estimate the initial value.

Step (3) Design the controller (Figure 2-6).

Step (4) Apply Adaptive Rules to update the TS-type FNN model and the controller to stabilize the closed-loop system.

We run the simulation of the above system using SimuLink with on-line optimal training and controller design. SimuLink is a graphic extension of MATLAB for modeling and simulation of systems. Figure 2-3 shows the overall SimuLink blocks for the mass-spring-damper system. The “Trained TK-Model” (which includes model description and on-line optimal training) and “Design Controller”

blocks are placed in Figure 2-3.

Figure 2-3. Block diagram of mass-spring-damper system

The “Trained TK-Model” block produces the inferred (Af, Bf) system matrices to represent the uncertain system. The details of the “Trained TK-Model” block with nine training blocks for ((Ai, Bi) i, i=1~9) is shown in Figure 2-4.

Figure 2-4. Block diagram of “Trained TK-Model” in Figure 2-3

Figure 2-5 shows the details of the training block in Figure 2-4. The objective of

the “Memory” block in Figure 2-5 is to memorize the training results from previous training and the “Pulse Generator” block is to set the training time interval.

Figure 2-5. Training block in Figure 2-4.

2-6. After the training process, the “Design Controller” block collects the system’s mathematical model and applies pole placement technique to design the controller.

In conclusion, the on-line intelligent adaptive control involves two steps:

1. System identification using on-line optimal training 2. Design of controller using pole-placement technique

The simulation results are shown in Figure 2-7 with initial state,

[

x1 x2

] [

= 0.2 0.2

]

.

Figure 2-7. Trajectories for x1 and x2 in Example 1

2.4 Simulation with Computational Time Delay

In real life, the system has the inevitable time delay associated with it, which includes the training time, the pole-placement and signal transmission [10]. Time delay often occurs in electronic, mechanical, chemical, etc., systems. They may be due to some

the following causes:

1. Measurement of system variable.

2. Physical properties of the equipment used in the system.

3. Signal transmission.

4. Computational delay.

The effect of time delay depends on the size of the delay and the system characteristics. In Example 1, it will need a lot of time to train the TS-type model and to design the controller. To understand the effects of real time-delay on the real system, a “Transport Delay” block is added to Figure 2-3, which is shown in Figure 2-8. The

“Transport Delay” block enumerates the time delay associated with “Trained TK-Model” and “Controller Design”. Figure 2-9 and 2-10 show the responses of Example 1 with time delay = 0.35s and 0.37s respectively. It is obvious that the longer is the delay time, the more oscillatory the response will be.

Figure 2-8. Mass-spring-damper system with time delay

Figure 2-9. Time response of Example 1 with delay time = 0.35s.

Figure 2-10. Time response of Example 1 with delay time = 0.37s.

Figure 2-11. Time response of Example 1 with delay time = 0.39s.

It is also obvious from Figure 2-10 that time delay of 0.37s, by trial process, is almost the maximum allowable time delay for Example 1 with on-line optimal trained controller. This implies that the total inevitable computational time delay of “Trained TK-Model” and “Design Controller” cannot exceed 0.37s. It is therefore a future research topic to find the maximum allowable delay time, theoretically, for the closed-loop system with on-line optimal trained controller to be stable.

CHAPTER 3

Real-Time Control of Planetary Inverted Pendulum

In the preceding chapter, we have reviewed the on-line intelligent adaptive control for uncertain nonlinear systems by using optimally trained TS-type FNN models. We have also presented the SimuLink simulation for the mass-spring-damper system with the design algorithm in [1]. In this chapter, we will employ the same methodology to design the planetary inverted pendulum control system. According to the design flow, we will estimate the initial weighting matrices and then train the model and design the on-line controller. The amount of computation of training the TS-type FNN model is large, so the incurred computational time delay will influence the performance of the controller. In the following, there are four parts in the chapter:

I. Introduction to the planetary inverted pendulum II. Simulation without computational delay

III. Simulation with time delay IV. Hardware implementation

3.1 Planetary Inverted Pendulum

The planetary inverted pendulum [7] is shown in Figure 3-1. A PID controller was designed to control the system in [7]. In this chapter, the control approach, on-line intelligent adaptive control for uncertain nonlinear systems using optimally trained TS-type FNN models, is applied to control the planetary inverted pendulum system.

Figure 3-1. Planetary inverted pendulum.

From Figure 3-1, electric motor 29 drives the fixed-star gear, gear 9, to give it an angular acceleration. Then gear 9 drives gear 3, the planetary gear, so that gear 3 would orbit gear 9. We use a bearing and shaft 2 to fix gear 3 with pendulum 1 so that pendulum 1 will orbit gear 9. Therefore, pendulum 1 is drove by electric motor 29, and the angular position of pendulum 1 can be detected by sensor 30. Figure 3-2 shows the coupling of gear 1 and gear 2, which steers pendulum 1.

Figure 3-2. The fixed-star gear and the planetary gear

The dynamic equation of the planetary train type inverted pendulum is shown in (21) [7].

The angle of the fixed star gear the planetary gear and the pendulum with respect to vertical

θ θ θ、 、

1 2:

-N -N The number of teeth of the planetary gear and the fixed star gear

2 1 0: - ,

m m m、 、 The mass of the fixed star gear the planetary gear and the pendulum

1 2:

-I -IThe moment of inertia of the planetary gear and the fixed star gear

1 2:

-r -r The -radius of the planeta-ry gea-r and the fixed sta-r gea-r

3.2 Simulation

Before the hardware implementation of the controller for the planetary inverted pendulum system, we perform the simulation for the inverted pendulum system in SimuLink. The control objective of this control system is to stabilize the inverted pendulum after the pendulum has been flung upward. The process includes two stages [7]:

1. Flinging the pendulum upward

2. Stabilization of the pendulum in the upward direction

In the first stage, we give a small torque to make the pendulum oscillate slightly and then control the electric motor’s output according to the oscillation frequency of the pendulum to enlarge the pendulum’s swing amplitude. When θ0 is smaller than 10°, the second stage begins. In the second stage, we apply on-line intelligent adaptive control with the optimally trained TS-type FNN model to stabilize the inverted pendulum system in dynamic equilibrium point (θ0=0).

The control method is applied in the second stage, so we will run the simulation for the second stage with the initial condition,

θ& =1(rad/s) and0 θ0 =0.17(rad). The following parameters are assumed in [7], which will be applied in (21):

1 2

Thus, we have the dynamical equation:

(22)

0 149.3003sin 0 2214.3u θ&& = θ +

Step (1) Specify the closed-loop poles as -2 and -1.5

Step(2)The mathematical equation of the inverted pendulum system has been described in (22). We apply u=0.03sin (t) to the inverted pendulum system for measurements of θ&0

( )

t and . According to the distribution of the measured data, the membership functions for

0( )t θ&&

θ& and0 θ0 can be defined as the follows:

Figure 3-3. MF of θ& (rad/s) 0

Figure 3-4. MF of θ0 (rad)

The order of the TS-type FNN model for the inverted pendulum system is two and the number of input is one, so we measure three outputs to get the estimated initial value. We choose four nominal operating points, i.e., r=4.

The nominal operating points and the initial weighting matrices are shown in the Table 3-1.

Table 3-1. Four nominal operating points with initial weighting matrices

R [ θ& 0 θ0 ]

2 [ -2 , 0.17 ]

Step (3): Design controller with pole placement technique for the closed-loop poles as -2 and -1.5.

Step (4): Apply Adaptive Rules to update the TS-type FNN model and the controller to stabilize the closed-loop system.

The control system model and the controller are shown in Figures 3-5~3-7. Figure 3-8 illustrates the trajectory forθ0with the initial condition⎣θ θ&0 0⎤ = −⎦

[

2 0.17

]

.

Figure 3-5. Simulation model of the planetary inverted pendulum system

Figure 3-6. Block diagram of “Trained TK-Model” in Figure 3-5

Figure 3-7. Block diagram of “Design Controller” in Figure 3-5

Figure 3-8. Trajectories forθ0 in Figure 3-5

3.3 Simulation with Computational Time Delay

In this section, we consider the effect of time delay on the angular control system of planetary inverted pendulum. We add the “Transport Delay” block into the Figure 3-5, which is shown in Figure 3-9. Figure 3-10 and 3-11 show the responses of the control system with time delay = 0.015s and 0.022s respectively. We can find that θ& and 0 θ0 are always oscillatory and the longer is the delay time, the more oscillatory the responses will be. From Figure 3-11, the time delay of 0.022s is almost the maximum time delay for the inverted pendulum system with the on-line optimal trained controller.

Figure 3-9. The inverted pendulum system with time delay

Figure 3-10. Trajectories of θ0 with delay time = 0.015s in Figure 3-9

Figure 3-11. Trajectories of θ0 with delay time = 0.022s in Figure 3-9

Figure 3-12. Trajectories of θ0 with delay time = 0.023s in Figure 3-9

3.4 Hardware Implementation

I. Hardware platform DS 1104 R&D control board

We will implement a controller to control this uncertain nonlinear system by using on-line intelligent optimally adaptive control method. In the beginning, we design the controller in SimuLink and generate the control program and then sent it into the hardware platform, DS 1104 R&D control board, to control the inverted pendulum system. The overall control process is shown in Figure 3-13.

Figure 3-13. Overall hardware configuration using DS 1104

SimuLink is an interactive environment for modeling an off-line simulation with easy-to-use diagram. In MATLAB, Real-Time Workshop can automatically generate C code from SimuLink block diagrams. Together with dSPACE’s Real-Time Interface, these tools can transfer the C code generated from our block diagram to dSPACE’s Real-Time hardware. Here, DS 1104 R&D Controller Board is selected.

dSPACE system is the platform for electronic control unit (ECU) development. It provides the V-cycle concept in the development process, in which control design is involved. In dSPACE system, control design is model-based so that we can work with a single model of a complete system in an integrated software environment, as SimuLink. dSPACE hardware includes a powerful processor and numerous I/O interfaces. The processor can calculate our models in real time, and these I/O interfaces can connect to outside world. The hardware, DS 1104 R&D Controller Board, can run directly in the PC.

For the implementation of the controller for the planetary inverted pendulum system,

planetary inverted pendulum through the dSPACE system interface.

II. Design flow

We have presented the simulation for the inverted pendulum system via the on-line intelligent adaptive control approach. The control block for the planetary inverted pendulum system has been built in SimuLink. But, from (22), the input of the system is torque. In the real planetary inverted pendulum system, the input is voltage. The mathematical relation between torque and voltage is unknown, so that the mathematical relation between the voltage and the angle of inverted pendulum is uncertain and nonlinear.

Step (1) Specify the closed-loop poles as -2 and -1.5.

Step (2) Define the membership function and estimate the initial weighting matrices.

Because the order of the TS-type FNN model is two and the number of input is one, we have to measure three outputs to estimate the initial matrices. The controller is applied in the second stage, so we have to get the estimated initial matrices when θ0 is between 10° and -10°. But, when θ0 is between 10° and -10°, it is difficult to apply u = 10sin (t) to the inverted pendulum system to measure θ& and0 θ&& . Therefore we apply three step 0 commands (u = 10 volts) as the inputs to the system to get sufficient data ( θ& and0 θ&& ) to estimate the initial matrices with least square 0 estimation-technique. For this uncertain nonlinear system, when θ0 equals to 10°(= 0.1745rad), 15°(= 0.2018rad), 20°(= 0.3491rad) respectively, we apply u = ±10V to electric motor 29 to drive the pendulum for measurements of θ& and0 θ&& . The membership functions for 0 θ& and θ0 0 can be defined as the follows:

Figure 3-14. MF of θ& (rad/s)

Figure 3-15. MF of θ0 (rad)

There are four nominal operating points. The nominal operating points and the initial weighting matrices are shown in the Table 3-2.

Table 3-2. Four nominal operating points with initial weighting matrices

R [ θ& 0 θ0 ]

Step (3): Design controller with pole placement technique for the closed-loop poles as -2 and -1.5.

Step (4): Apply Adaptive Rules to update the TS-type FNN model and the controller to stabilize the closed-loop system.

III. Building the control block

According to the two stages mentioned in section 3.2 for the overall control of this system, we create the dSPACE inverted pendulum control block (Figure 3-16) which can fling and stabilize the pendulum.

Figure 3-16. The dSPACE control block diagram for inverted pendulum

Figure 3-17 shows the blocks with proper timings [7] to fling the pendulum upward in the first stage.

Figure 3-17. Block diagram of “Select output timing” in Figure 3-16

From Figure 3-18, we can see that the angles of the pendulum (θ0), starts at 180° and

the swing amplitude is enlarged gradually.

Figure 3-18. Trajectory of θ0 for flinging pendulum upward in Figure 3-16

When θ0 is smaller than 10°, the inverted pendulum system is controlled by the “FNN controller”. Figure 3-19 shows the detail of the “FNN controller” block.

Figure 3-19. Block diagram of “FNN controller” in Figure 3-16

In Figure 3-19, the “Trained TK-Model” block produces the inferred (Af, Bf) system matrices to represent the inverted pendulum system and the “Design Controller”

Figure 3-20. Block diagram of “Trained TK-Model” in Figure 3-19

Figure 3-21. Block diagram of “Design Controller” in Figure 3-19

Figure 3-22. Trajectory for θ0 in Figure 3-16

Figure 3-23 shows the partial trajectory of θ0 from Figure 3-22 after the stabilization of the pendulum.

We let the on-line intelligent optimal controller control the inverted pendulum, when θ0 is smaller than 15°. The on-line intelligent adaptive control is also able to control the inverted pendulum. Figure 3-24 shows the trajectory of θ0 during the stabilization of the pendulum with the application of the control method as θ0<15°.

Figure 3-24. Trajectory of θ0 during the stabilization of the pendulum with the application of the control method as θ0<15°

As the result presented in Figures 3-23 and 3-24, we have achieved the objective to apply on-line intelligent adaptive control method to stabilize the planetary inverted pendulum. Then, in order to consider the time delay in the real system, we add the

“Integer Delay” block to Figure 3-16. Figure 3-24 shows the dSPACE inverted pendulum control block with “Integer Delay” block.

Figure 3-25. The dSPACE inverted pendulum control block diagram with “Integer Delay” block.

Figure 3-25 shows the trajectory of θ0 for the stabilization of the pendulum with time delay = 0.014s.

Figure 3-26. Trajectory of θ0 to stabilize the pendulum with time delay = 0.014s

Figure 3-26 shows the trajectory of θ0 for the stabilization of the pendulum with time delay = 0.019s.

Figure 3-27. Trajectory of θ0 to stabilize the pendulum with time delay = 0.019s

Figure 3-27 shows the trajectory of θ0 for the stabilization of the pendulum with time delay =0.020s.

Figure 3-28. Trajectory of θ0 to stabilize the pendulum with time delay = 0.020s

From Figure 3-26, 0.019s is almost the maximum allowed time delay for the real inverted pendulum control system with on-line optimal trained controller in the dSPACE control platform. The maximum allowed delay time for the inverted pendulum control system in simulation is about 0.022s. If we assume the maximum time delay from simulation is correct, then the computational time for the on-line controller is less than 0.003s (=0.022s-0.019s). This will change when different hardware platform is applied. Thus it is obvious that we can still use slower hardware platform to control the planetary inverted pendulum system to reduce the cost.

CHAPTER 4 Conclusion

The on-line adaptive intelligent control for uncertain nonlinear systems by using TS-type FNN models proposed in [1] has been fully implemented using real hardware platform, i.e., DS 1104 R&D control board, under MatLab SimuLink. The planetary inverted pendulum was adopted as the real example to be controlled. The initial perturbation was done by various step commands to get the initial TS-type FNN model matrices. Then the on-line optimal training algorithm was implemented in SimuLink to drive the DS 1104 R&D control board to control the planetary inverted pendulum. Excellent results have been obtained to show the feasibility of hardware

The on-line adaptive intelligent control for uncertain nonlinear systems by using TS-type FNN models proposed in [1] has been fully implemented using real hardware platform, i.e., DS 1104 R&D control board, under MatLab SimuLink. The planetary inverted pendulum was adopted as the real example to be controlled. The initial perturbation was done by various step commands to get the initial TS-type FNN model matrices. Then the on-line optimal training algorithm was implemented in SimuLink to drive the DS 1104 R&D control board to control the planetary inverted pendulum. Excellent results have been obtained to show the feasibility of hardware

相關文件