• 沒有找到結果。

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 implementation of the control algorithm in [1]. The computational time delay to obtain the control signal has also been studied using real hardware emulations. The computational time delay of the planetary inverted pendulum using DS 1104 R&D control board has been estimated to be 0.003 seconds. This is within the maximum allowable computational time of 0.022 seconds, which is assumed to be correct by a pure computer simulation. This result can be very meaningful for industrial applications by choosing cheaper hardware platform with less cost to achieve the same control purpose.

REFERENCES

[1] Shi-Hao Ker, “On-Line Intelligent Adaptive Control for Uncertain Nonlinear Systems using Optimally Trained TS-Type Fuzzy Models”, MS Thesis, Department of Electrical and Control Engineering, National Chiao-Tung University, Hsin-Chu, Taiwan, 2002.

[2] T. Takagi and M. Sugeno, “Fuzzy Identification of Systems and Its Applications to Modeling and control,” IEEE Trans. Syst., Man, Cybern., Vol. 15, pp. 116-132, Jan./Feb., 1985.

[3] Chi-Hsu Wang, Han-Leih Liu, Chin-Teng Lin, “Dynamic optimal learning rates of a certain class of fuzzy neural networks and its applications with genetic algorithm”, IEEE Transactions on Systems, Man and Cybernetics, Part B, Vol. 31, p.p. 467 -475 June 2001.

[4] T. C. Hsia, “System Identification”, Lexington Books, 1977.

[5] Shing-Jen Wu and Chin-Teng Lin, “Optimal Fuzzy Controller Design: Local Concept Approach,” IEEE Trans. On Fuzzy Systems, Vol. 8, No. 2, pp. 171-183, April 2000.

[6] Shing-Jen Wu and Chin-Teng Lin, “Optimal Fuzzy Controller Design in Continuous Fuzzy System: Global Concept Approach,” IEEE Trans. On Fuzzy Systems, Vol. 8, No. 6, pp. 713-729, Dec. 2000.

[7] Shuang-Yuan Chen and Chen-Ren Lin, “Design and Control System Simulation of a Planetary Train Type Inverted Pendulum Mechanism,” 第六屆機構與機器設計 學術研討會暨海峽兩岸機構學術研討會, Nov. 2003.

[8] “DS1104 R&D Controller Board, Installation and Configuration Guide”, dSPACE, July 2001.

[9] “DS1104 R&D Controller Board, ControlDesk Experiment Guide”, dSPACE, July 2001.

[10] M. Malek-Zavarei and M. Jamshidi, “Time-Delay Systems, Analysis, Optimization and Applications,” Elsevier Science Publishers B.V., 1987

[11] R. N. Bateson, “Introduction to Control System Technology,” Prentice Hall International, Inc, 2002

[12] 林群超, “自動控制系統設計與 MATLAB 語言,” 全華科技圖書股份有限公司, 1999

[13] William J. Palm III, “Introduction to MATLAB 6 for Engineers,” McGraw-Hill Education, Jan. 2003.

相關文件