• 沒有找到結果。

動態類神經網路控制系統之設計及其應用

N/A
N/A
Protected

Academic year: 2021

Share "動態類神經網路控制系統之設計及其應用"

Copied!
96
0
0

加載中.... (立即查看全文)

全文

(1)

電機與控制工程研究所

動態類神經網路控制系統之設計及其應用

On the Design of Dynamical Neural Network

Controller with Its Applications

研 究 生:黃薰毅

指 導 教 授:王啟旭 教授

(2)

動態類神經網路控制系統之設計及其應用

On the Design of Dynamical Neural Network

Controller with Its Applications

研 究 生:黃薰毅 Student:Huang, Hsun-Yi

指導教授:王啟旭 教授 Advisor:Prof. Chi-Hsu Wang

國 立 交 通 大 學

電 機 與 控 制 工 程 研 究 所

碩 士 論 文

A Thesis

Submitted to Institute of Electrical and Control Engineering College of Electrical Engineering

National Chiao Tung University in partial Fulfillment of the Requirements

for the Degree of Master

in

Electrical and Control Engineering December 2008

Hsinchu, Taiwan, Republic of China

(3)

動態類神經網路控制系統之設計及其應用

研究生:黃薰毅 指導教授:王啟旭 教授

國立交通大學電機學院電機與控制工程研究所

摘要

由於控制器的老化而造成控制系統的出錯是很普遍的,而這種情況發生,常常因 為某些原因,原本的控制器很難被修復。本篇論文探討以動態類神經網路控制器 取代原本控制器的可行性來設法解決上述問題。我們以霍普菲爾類神經網路控制 器做為動態類神經網路控制器。先以最陡坡降演算法離線訓練霍普菲爾類神經網 路的網路權重值使得霍普菲爾類神經網路的輸出能模仿原先的控制器。訓練完成 之後再將該霍普菲爾類神經網路當作控制系統的即時控制器。我們以倒單擺系統 及球桿系統來驗證該霍普菲爾類神經網路控制器的效果。模擬的結果顯示即使控 制系統在和訓練時有不同的初始條件,該霍普菲爾類神經網路控制器依然可以模 仿原先的控制器並達到令人滿意的效能。

(4)

On the Design of Dynamical Neural Network Controller

with Its Applications

Student: Huang,Hsun-yi Advisor: Prof. Chi-Hsu Wang

Institute of Electrical and Control Engineering College of Electrical Engineering

National Chiao Tung University

ABSTRACT

Faults due to the aging of a controller for a control system are very common; once they happen, the controller is quite difficult to be repaired for some reasons. To solve this problem, in this thesis, we discuss the feasibility of replacing the existing controller with a dynamical neural network (DNN) controller. A Hopfield neural network (HNN) controller is used as the DNN controller. The weightings of the HNN are first trained off line by the steepest descent algorithm to make the output of the HNN can mimic the existing controller. After the training is completed, the HNN is applied to the control system as a real-time controller. An inverted pendulum system (IPS) and a ball and beam system (BABS) are used to examine the effectiveness of the proposed HNN controller. The simulation results show that even with the initial condition different from that in the training data, the proposed HNN controller can mimic the existing controller and achieve favorable performance.

(5)

致謝

這篇論文的完成使得我在交通大學電機控制碩士班的研究生活畫上一個美好的 句點。這段研究期間獲得很多人的幫助,首先我要感謝我的指導老師王啟旭教授 指導我研究的方向,我要感謝林保村學長及林炳榮學長提供我研究的建議並和我 討論研究的成果,我還要感謝陳品程學長提供我論文寫作的建議。另外我要感謝 我的朋友黃庭偉等人,在我研究陷入瓶頸時陪我去散心並鼓勵我繼續堅持。最後 我要感謝我的家人,尤其是爸媽的支持,讓我能很從容地完成研究。

(6)

TABLE OF CONTENTS

摘要………i ABSTRACT………..ii 致謝………..iii TABLE OF CONTENTS………..iv LIST OF FIGURES………...vi Chapter 1 Introduction………...1

Chapter 2 Theoretical Foundation………..3

2.1 Structure of Hopfield Neural Network………...3

2.2 Lyapunov Energy Function………5

2.3 Method of Steepest Descent………...6

2.4 Training More than One Epoch……….……….8

2.5 Fourth Order of Runge-Kutta Formula for Numerical Method………...8

Chapter 3 Control of Inverted Pendulum System (IPS)………..…….10

3.1 Dynamics of Inverted Pendulum System (IPS)…….………...10

3.2 Design of Reference Controller ….……….……….10

3.3 Architecture and Algorithm of Weighting Training…...13

3.4 Simulation Result………...17

3.4.1 Seeking for Weighting Factors……..………17

3.4.2 IPS Controlled by HNN Controller Trained with the Same Initial State..……..………..19

3.4.3 IPS Controlled by HNN Controller Trained with Different Initial State..…..………..22

3.4.4 IPS Controlled by HNN Controller Trained by Nonlinear Reference Controller with the Same Initial State……….………….30

3.4.5 IPS Controlled by HNN Controller Trained by Nonlinear Reference Controller with Different Initial State……….………….35

Chapter 4 Control of Ball and Beam System (BABS)……….40

4.1 Dynamics of Ball and Beam System (BABS)……….…….40

4.2 Simulation of BABS Controlled by Reference Controller……….…..41

4.3 Architecture and Algorithm of Weighting Training………...44

4.4 Simulation Result ………..………..49

4.4.1 Seeking for Weighting Factors …..……….…..49

4.4.2 BABS Controlled by HNN Controller Trained with the Same Initial State………..53

4.4.3 BABS Controlled by HNN Controller Trained with Different Initial State..…..………..58

(7)

4.4.4 BABS Controlled by HNN Controller Trained by Nonlinear Reference

Controller with the Same Initial State……….………….64

4.4.5 BABS Controlled by HNN Controller Trained by Nonlinear Reference Controller with Different Initial State……….………….73

Chapter 5 Discussion and Conclusion………..………....80

5.1 Discussion of Parameters Setting……….80

5.2 Conclusion…..………..81

(8)

LIST OF FIGURES

Fig-2.1. The circuit model of a Hopfield neuron……….…..3

Fig-2.2. The architecture of a Hopfield neural network with Hopfield neurons………5

Fig-3.1. The inverted pendulum system (IPS)……….10

Fig-3.2. The control force of the reference controller……….12

Fig-3.3. The output angle of IPS controlled by the reference controller……….12

Fig-3.4. The output angular speed of IPS controlled by the reference controller……13

Fig-3.5. The architecture of the IPS controlled by the HNN controller in the training phase………..……….13

Fig-3.6. The architecture of the IPS controlled by the HNN controller………...16

Fig-3.7. The total errorJt(epo)and the last epoch errorJ(k,6)………..18

Fig-3.8. The last epoch training iteration process ofw11,w12,w21, and w22………...18

Fig-3.9. The control forces of IPS……… ………..19

Fig-3.10. The output angles of IPS…….………...20

Fig-3.11. The output angular speeds of IPS ………20

Fig-3.12. The node 1 voltage v1of the HNN circuit………...21

Fig-3.13. The node 2 voltage v2of the HNN circuit………...21

Fig-3.14. The control forces of IPS with initial angle=30 degree, initial angular speed=20 degree/sec.………....22

Fig-3.15. The output angles of IPS with initial angle=30 degree, initial angular speed=20 degree/sec.………23

Fig-3.16. The output angular speeds of IPS with initial angle=30 degree, initial angular speed=20 degree/sec………...……….23

Fig-3.17. The node 1 (2) voltage v1 (v2) of the HNN circuit with IPS initial angle=30 degree, initial angular speed=20 degree/sec……….24

Fig-3.18. The control forces of IPS with initial angle=20 degree, initial angular speed=30 degree/sec.………....24

Fig-3.19. The output angles of IPS with initial angle=20 degree, initial angular speed=30 degree/sec.………25

Fig-3.20. The output angular speeds of IPS with initial angle=20 degree, initial angular speed=30 degree/sec………...……….25

Fig-3.21. The node 1 (2) voltage v1 (v2) of the HNN circuit with IPS initial angle=30 degree, initial angular speed=20 degree/sec……….26

Fig-3.22. The control forces of IPS with initial angle=25 degree, initial angular speed=25 degree/sec.………....26

Fig-3.23. The output angles of IPS with initial angle=25 degree, initial angular speed=25 degree/sec.………27

(9)

Fig-3.24. The output angular speeds of IPS with initial angle=25 degree, initial

angular speed=25 degree/sec………...……….27

Fig-3.25. The node 1 (2) voltage v1 (v2) of the HNN circuit with IPS initial angle=25 degree, initial angular speed=25 degree/sec……….28

Fig-3.26. The control forces of IPS with initial angle=10 degree, initial angular speed=10 degree/sec.………....28

Fig-3.27. The output angles of IPS with initial angle=10 degree, initial angular speed=10 degree/sec.………29

Fig-3.28. The output angular speeds of IPS with initial angle=10 degree, initial angular speed=10 degree/sec………...……….29

Fig-3.29. The node 1 (2) voltage v1 (v2) of the HNN circuit with IPS initial angle=10 degree, initial angular speed=10 degree/sec……….30

Fig-3.30. The control force of the nonlinear reference controller………31

Fig-3.31. The output angle of IPS controlled by the nonlinear reference controller....31

Fig-3.32. The output angular speed of IPS controlled by the nonlinear reference Controller……….32

Fig-3.33. The total error Jt(epo) and the last epoch error J(k,10)……….32

Fig-3.34. The last epoch training iteration process ofw11,w12,w21 and w22……….33

Fig-3.35. The control forces of IPS……… ……….33

Fig-3.36. The output angles of IPS…….………...34

Fig-3.37. The output angular speeds of IPS ………34

Fig-3.38. The node 1 (2) voltage v1 (v2) of the HNN circuit………35

Fig-3.39. The control forces of IPS with initial angle=30 degree, initial angular speed=30 degree/sec……….36

Fig-3.40. The output angles of IPS with initial angle=30 degree, initial angular speed=30 degree/sec.………36

Fig-3.41. The output angular speeds of IPS with initial angle=30 degree, initial angular speed=30 degree/sec………...……….37

Fig-3.42. The node 1 (2) voltage v1 (v2) of the HNN circuit with IPS initial angle=30 degree, initial angular speed=30 degree/sec……….37

Fig-3.43. The control forces of IPS with initial angle=10 degree, initial angular speed=10 degree/sec.………....38

Fig-3.44. The output angles of IPS with initial angle=10 degree, initial angular speed=10 degree/sec.………38

Fig-3.45. The output angular speeds of IPS with initial angle=10 degree, initial angular speed=10 degree/sec………...……….39

Fig-3.46. The node 1 (2) voltage v1 (v2) of the HNN circuit with IPS initial angle=10 degree, initial angular speed=10 degree/sec……….39

(10)

Fig-4.1. The ball and beam system (BABS)………40

Fig-4.2. The control torque of the reference controller………41

Fig-4.3. The ball’s position of BABS controlled by the reference controller…….….42

Fig-4.4. The ball’s velocity of BABS controlled by the reference controller………..42

Fig-4.5. The beam’s angle of BABS controlled by the reference controller………....43

Fig-4.6. The beam’s angular speed of BABS controlled by the reference controller...43

Fig-4.7. The architecture of the BABS controlled by the HNN controller in the training phase ………44

Fig-4.8. The architecture of the BABS controlled by HNN controller………48

Fig-4.9. The total error Jt(epo)and the last epoch error J(k,20)………....50

Fig-4.10. The last epoch training iteration process ofw11,w12,w21, andw22………...51

Fig-4.11. The last epoch training iteration process ofw21,w22,w and 23 w24……….51

Fig-4.12. The last epoch training iteration process ofw ,31 w ,32 w and 33 w ……….52 34 Fig-4.13. The last epoch training iteration process ofw41,w42,w and 43 w44……….52

Fig-4.14. The control torques of BABS………...…53

Fig-4.15. The ball’s positions of BABS………...54

Fig-4.16. The ball’s velocities of BABS………...54

Fig-4.17. The beam’s angles of BABS……….…...55

Fig-4.18. The beam’s angular speeds of BABS………...55

Fig-4.19. The node 1 voltage v1of the HNN circuit………...56

Fig-4.20. The node 2 voltage v2of the HNN circuit………...56

Fig-4.21. The node 3 voltage v of the HNN circuit………...57 3 Fig-4.22. The node 4 voltage v4of the HNN circuit………...57

Fig-4.23. The control torques of BABS with initial ball’s position=0.1 meter, initial beam’s angle=5 degree……….58

Fig-4.24. The ball’s positions of BABS with initial ball’s position=0.1 meter, initial beam’s angle=5 degree………...59

Fig-4.25. The ball’s velocities of BABS with initial ball’s position=0.1 meter, initial beam’s angle=5 degree……….59

Fig-4.26. The beam’s angles of BABS with initial ball’s position=0.1 meter, initial beam’s angle=5 degree………...60

Fig-4.27. The beam’s angular speeds of BABS with initial ball’s position=0.1 meter, initial beam’s angle=5 degree………..…….60

Fig-4.28. The node 1 (2) (3) (4) voltage v1 (v2) (v ) (3 v4) of the HNN circuit with BABS initial ball’s position=0.1 meter, initial beam’s angle=5 degree..….61

Fig-4.29. The control torques of BABS with initial ball’s position=0.4 meter, initial beam’s angle=20 degree………..….61 Fig-4.30. The ball’s positions of BABS with initial ball’s position=0.4 meter, initial

(11)

beam’s angle=20 degree………...62

Fig-4.31. The ball’s velocities of BABS with initial ball’s position=0.4 meter, initial beam’s angle=20 degree………..…….62

Fig-4.32. The beam’s angles of BABS with initial ball’s position=0.4 meter, initial beam’s angle=20 degree………...63

Fig-4.33. The beam’s angular speeds of BABS with initial ball’s position=0.4 meter, initial beam’s angle=20 degree………..……...63

Fig-4.34. The node 1 (2) (3) (4) voltage v1 (v2) (v ) (3 v4) of the HNN circuit with BABS initial ball’s position=0.4 meter, initial beam’s angle=20 degree….64 Fig-4.35. The control torque of the nonlinear reference controller..………65

Fig-4.36. The ball’s position of BABS controlled by the nonlinear reference controller………...66

Fig-4.37. The ball’s velocity of BABS controlled by the nonlinear reference controller………...66

Fig-4.38. The beam’s angle of BABS controlled by the nonlinear reference controller………...67

Fig-4.39. The beam’s angular speed of BABS controlled by the nonlinear reference controller...67

Fig-4.40. The total error Jt(epo) and the last epoch error J(k,200)………..68

Fig-4.41. The last epoch training iteration process of w11(w21,w ,31 w41), w12(w22,w ,32 w42), w (13 w ,23 w ,33 w ) and 43 w14(w24,w ,34 w44)………...69

Fig-4.42. The control torques of BABS………...…70

Fig-4.43. The ball’s positions of BABS………...70

Fig-4.44. The ball’s velocities of BABS………...71

Fig-4.45. The beam’s angles of BABS……….…...71

Fig-4.46. The beam’s angular speeds of BABS………...72

Fig-4.47. The node 1 (2) (3) (4) voltage v1 (v2) (v ) (3 v4) of the HNN circuit...72

Fig-4.48. The control torques of BABS with initial ball’s position=0.1 meter, initial beam’s angle=5 degree……….74

Fig-4.49. The ball’s positions of BABS with initial ball’s position=0.1 meter, initial beam’s angle=5 degree………...74

Fig-4.50. The ball’s velocities of BABS with initial ball’s position=0.1 meter, initial beam’s angle=5 degree……….75

Fig-4.51. The beam’s angles of BABS with initial ball’s position=0.1 meter, initial beam’s angle=5 degree………...75

Fig-4.52. The beam’s angular speeds of BABS with initial ball’s position=0.1 meter, initial beam’s angle=5 degree………..…….76 Fig-4.53. The node 1 (2) (3) (4) voltage v1 (v2) (v ) (3 v4) of the HNN circuit with

(12)

BABS initial ball’s position=0.1 meter, initial beam’s angle=5 degree..….76 Fig-4.54. The control torques of BABS with initial ball’s position=0.4 meter, initial

beam’s angle=20 degree………..….77 Fig-4.55. The ball’s positions of BABS with initial ball’s position=0.4 meter, initial beam’s angle=20 degree………...77 Fig-4.56. The ball’s velocities of BABS with initial ball’s position=0.4 meter, initial

beam’s angle=20 degree………..…….78 Fig-4.57. The beam’s angles of BABS with initial ball’s position=0.4 meter, initial

beam’s angle=20 degree………...78 Fig-4.58. The beam’s angular speeds of BABS with initial ball’s position=0.4 meter,

initial beam’s angle=20 degree………..……...79 Fig-4.59. The node 1 (2) (3) (4) voltage v1 (v2) (v ) (3 v4) of the HNN circuit with

(13)

Chapter 1

Introduction

Many tasks involving intelligence or pattern recognition are extremely difficult to automate, but appear to be performed very easily by animals. It stands to reason that computing systems that attempt similar tasks will profit enormously from understanding how animals perform these tasks and simulation these processes to the extent allowed by physical limitations [1]. Learning is a fundamental aspect of neural networks and a major feature that makes the neural approach so attractive for applications that have from the beginning been an elusive goal for artificial intelligence [2].Artificial neural networks (ANNs) are systems that are constructed to make use of some organizational principles resembling those of human brain. The collective behavior of an ANN, like a human brain, demonstrates the ability to learn, recall, and generalize from training patterns or data [3].In recent years, the research of artificial neural networks (ANNs) is more and more popular. In [4], one of the interesting characteristic of an ANN is that it can present its adaptivity by adjusting the connection strengths to new data or information. In [5], we can use the supervised training to adjust the weighting factors of the ANN. During the training, we can give the ANN a good reference, and let the ANN modifies its weighting factors of all the neurons of it by minimizing the “error” between the ANN and the reference. What is the “error” between the ANN and the reference? We can define many cost (error) functions to present it, and we had better using the functions satisfy the following conditions: the value of each error function must be always positive or zero, and if and only if ANN and reference are identical, the value of each cost (error) function is zero. The procedure of getting the proper weighting factors of all the neurons of ANN is called the training of ANN. It is generally understood that the selection of the ANN training algorithm plays an important role for most ANN’s applications [6]. And the way of training of ANN most used is the steepest descent method [5, 7]. We will define the cost (error) function, and explain the steepest descent method in the latter chapters. ANNs consist of many interconnected simple nonlinear systems called neurons. Generally speaking, neuron models can be divided in two basic types, static and dynamic. A dynamic neuron is the one whose output is described by a differential equation, and the dynamic neural network is a neural network containing at least one dynamic neuron [8]. On the other hand, a recurrent neural network (RNN) usually belongs to a dynamical neural network (DNN). A recurrent neural network is a neural network with feedback connections and its techniques have been applied to a wide variety of problems [2]. In [9, 10], we know the Hopfield neural networks (HNNs) are

(14)

dynamical neural networks, and they have been extensively studied in many aspects and successfully applied to many fields [11]. We want to use HNN architecture controllers as mentioned in [12, 13]. The weights of the HNN architecture need to be updated using a dynamical learning algorithm during the control process. The learning algorithms adjust the weights of the network, so that the trained network will exhibit the required properties. The general algorithms used for HNN architecture are usually the steepest descent learning algorithms as mentioned before. By evaluating the gradient of a cost (error) function with respect to the weights of the networks, it is possible to iteratively adjust the value of the weights in the direction opposite to the gradient [14]. One of the famous nonlinear plants is the inverted pendulum system (IPS). Although the IPS is not a linear system, we want to know the ability of the HNN as to be a controller, so we try to use HNN controller to control the IPS. The problem is how we find the proper values of the parameters of HNN. First, we provided the architecture for IPS controlled well by a good reference controller and collecting the data of the control signal of the reference controller and the output of IPS. And by the data we collected, we trained the HNN controller to make the weighting factors between neurons of the HNN to be proper values. The process above is called the HNN in the training phase. In fact, the HNN controller after trained is used to mimic the well-designed controller of the IPS. After the training phase, the HNN controller is considered to be with proper values of parameters and it is used as a controller to control IPS in real time and called the HNN in the working phase. If the output of IPS controlled by the HNN controller is a good approximation of the output of IPS controlled by well-designed controller, then the HNN model for well-designed controller must be good [15]. After we succeed using HNN as a controller to control IPS in real time, we try to use it to control the ball and beam system (BABS). The BABS is a more complicated system, and the nonlinearity of BABS is very high, so it is a big challenge of the HNN controller to control BABS. Nevertheless, we can still get a nice result of the control of BABS by the HNN controller used the similar way to train the weighting factors between each two neurons of all neurons of the HNN. So, we think that the HNN architectures have the potential to be good controllers to control some nonlinear systems, and maybe some HNN controllers will be cheap controllers to control some complicated systems.

(15)

Chapter 2

Theoretical Foundation

The dynamical (recurrent) neural networks can be classified as being globally or partially dynamical (recurrent). Globally dynamical (recurrent) neural networks have arbitrary feedback connections, including neurons with self-feedback. On the other hand, partially dynamical (recurrent) neural networks have their main structure non-recurrent, or recurrent but with restrictive properties associated with the feedback connections [2].

We take the Hopfield neural network (HNN) as example. HNN belongs to the globally dynamical (recurrent) neural network, in fact, HNN is fully connected neural network, and we will explain the fully connected neural network later.

2.1 Structure of Hopfield Neural Network

. ∑ ϕ ⋅( ) 1 x 2 x N x 1 j w 2 j w jN w ji i i w x

j C Rj j I j v j x

Fig-2.1. The circuit model of a Hopfield neuron

In [16], the circuits model of a Hopfield neuron figure 2-1 shows the input of the neuron is the output voltages (x1,x2,...xN) of each Hopfield neurons, and the output each of voltages(x1,x2,...xN) multiple each of the weighting factors, conductance

) ,... ,

(wj1 wj2 wjN , become each of the currents(wj1x1,wj2x2,...wjNxN) . Summation of the currents (wj1x1,wj2x2,...wjNxN)and adding the bias current I is the total j currentIjtotal , and the total current is the sum of the current IjC passing through capacitor to the ground, and the current IjR passing through the resistor to the

(16)

ground. We can express as the following equation: jR jC j N i i ji total j w x I I I I =

+ = + = − 1 (2-1) The voltage drop between the resistor and the ground equals the resistanceR j

multiplying the currentI , and the voltage drop make the node voltagejR v , as the j

following equation:

jR j j R I

v = (2-2)

And the current I passing through the capacitor to ground equals the capacitance jc

j

C multiplying the rate of the varying of the node voltagev , as the following j

equation:

dt dv C

IjC = j j (2-3)

The node voltage v passing to the voltage amplifier j ϕ(•) will produce the output voltage x of the Hopfield neuron, and can be written as the following equation: j

j j j j v v v v j j j e e e e v v x − + − = = =ϕ( ) tanh( ) (2-4) We note the input impedance of the voltage amplifier ϕ(•)is infinity, so no current passing through it and the output impedance of the voltage amplifier ϕ(•)is zero, so the output voltage x of the Hopfield neuron will not reduce, no matter how much j

the output current is. In practice, we often let the bias current I to be zero, so it j

means that we actually don’t need the bias current I in the circuit model of a j

(17)

Fig-2.2. The architecture of a Hopfield neural network with Hopfield neurons Fig-2.2. is also a full connected neural network, that is an artificial neural network architecture in which every node is connected to every node, and these connections may be either excitatory (positive weights), inhibitory (negative weights), or irrelevant (almost zero weights).This is the most general neural network architecture, and every other architecture can be seen to be its special case, obtained by setting some weights to zeros. [1].

The whole Hopfield neural network contains all the individual of Hopfield neurons. Each of the individual of Hopfield neurons can be modeled by the figure 2-1. So by figure 2-2, we have an idea that the input of one Hopfield neuron is the output of all Hopfield neurons of the whole Hopfield neural network, and the output of one Hopfield neuron will be the one of the input of the all Hopfield neurons of the whole Hopfield neural network.

2.2 Lyapunov Energy Function

For any Hopfield neural network with symmetric weights, we can define a suitable Lyapunov energy function as following equation:

∑∑

= − = = = − + − = xj N j j j N j N i N j j i j ji x dx I x R x x w E 0 1 1 1 1 1 ) ( 1 2 1 φ

,

(2-5) where φ−1(x)=v is the inverse of the function x(v).To show that the equation

(2-5) is a Lyapunov function for the Hopfield neural network with symmetric weights, we take the time derivative of equation (2-5):

dt dx R v I x w x w dt dE N j j N i j j j i ij i ji ) ] ( 2 1 [ 1 1

∑ ∑

= = − + + − = . (2-6)

(18)

According to the symmetric weightswji =wij, so we can write the following equation from equation (2-6): dt dx R v I x w dt dE N j j N i j j j i ji ] [ 1 1

∑ ∑

= = − + − = . (2-7) Use the equations (2-1), (2-2), and (2-3), we can write the following equation from equation (2-7):

= − = N j j j j dt dx dt dv C dt dE 1 . (2-8) By chain rule, we can write the following equation from equation (2-8):

= − = N j j j j j j dt dv dv dx dt dv C dt dE 1 . (2-9) Use the equation (2-4), we can write the following equation from equation (2-9):

2 2 1 ) }( ] ) [tanh( 1 { dt dv v C dt dE N j j j j

= − − = , (2-10) or we can write the other form of equation (2-10):

2 1 2 ) ( ) ( 4 dt dv e e C dt dE N j j v v j j j

= + − − = . (2-11) BecauseCj >0 , 0 ) ( 4 2 > + − j j v v e e , ( ) 0 2 dt dvj , we get ≤0 dt dE

, and thus the Lyapunov energy function E must decrease as the system evolves. Hence, if E is bounded, the system will eventually reach a stable state where =0

dt dE

, and =0

dt dvj

But it is become increasing clear that the symmetric weights assumption has imposed serious constraints on both physical realizations and practical applications of the Hopfield neural networks [17], we will not use the symmetric weights condition of the Hopfield neural networks for our applications. But we still need the assumption that

0 =

dt dvj

for we training the weighting factors of HNN. In the latter chapter, we will use the other view to show that in the training of weighting factors of HNN , we can use the assumption =0

dt dvj

.

(19)

In [18], first, we set all weights to small values or zeros, and then we present the desired output U =(u1,u2,...uk,...un) , and we calculate the network output

) ,... ,... , (∧12 ∧ ∧ ∧ = u u uk un U . Because ( 1, 2,... ,... ) ∧ ∧ ∧ ∧ ∧ = u u uk un U is a function of weighting

vector Wand the error between the desired output and network output ,that is the

error function J is a function of u and k

k

u , so we know J is a function of weighting vector W, so we can write J(W) to emphasize the error function is the

function of weighting vector W.

In [7], we consider an error function J(W) is a continuously differentiable function of some weighting vectorW. We want to find an optimal solution W that satisfies *

the condition bellow:

) ( ) ( * W J W J ≤ . (2-12)

This means minimize the error function J(W) with respect to the weighting vectorW, so the necessary condition for (2-12) is

0 ) ( * =

∇ WJ . (2-13)

So we can use the idea of local iteration descent by starting with an initial guess denoted byW(0), generating the a sequence of weighting vectorsW(1), )W(2 ,…,

) (k

W , )W(k+1 ,…, such that the error function J(W) being reduced at each

iteration of the algorithm as shown by the following inequality: )) ( ( )) 1 ( (W k J W k J + < (2-14)

Where )W(k is the old value of the weighting vector and W(k+1)is its updated

value.

For convenience, we write the following equation: ) (W

J

g=∇ (2-15)

So the steepest descent algorithm can be written as the following equation: ) ( ) ( ) 1 (k W k g k W + = −η (2-16)

Where

η

is a positive constant called learning rate parameter, and g(k) is the gradient vector evaluated at the pointW(k).From (2-16), we can write the following equation: ) ( ) ( ) 1 ( ) (k W k W k g k W = + − =−η Δ (2-17) Now, we use the 1st order Taylor series expansion around W(k) to approximate

)) 1 ( (W k+

J as the following equation:

) ( ) ( )) ( ( )) 1 ( (W k J W k g k W k J + ≈ + T Δ (2-18)

Substituting equation (2-10) to equation (2-11), we can get the following equation:

2 ) ( )) ( ( ) ( ) ( )) ( ( )) 1 ( (W k J W k g k g k J W k g k J + ≈ −η T = −η (2-19)

(20)

the algorithm progresses from one iteration to the next.

2.4 Training More than One Epoch

As mentioned in the section 2.3, the desired outputU =(u1,u2,...uk,...un)and we calculate the network output U∧ =(u1,u2,...uk,...un) can train the weighting vector W on the base of that the weighting vector Wis the function of the network output

) ,... ,... , (∧12 ∧ ∧ ∧ = u u uk un

U and the network output ( 1, 2,... ,... )

∧ ∧ ∧ ∧ ∧ = u u uk un U is the

function of the error functionJ. But after one whole epoch, the training of the weighting vector Wmay be not enough. One way to solve this problem is to add the number of the time sequence point of the desired output U =(u1,u2,...uk,...um), and calculate more number of time sequence point of the network output

) ,... ,... , (∧12 ∧ ∧ ∧ = u u uk um

U ,m>n, but it is not a good method for take too many samples from a control system in the steady state. Even we just use the same total time with the higher sampling rate to get more points, it maybe produce big run-off error because of the difference of the two neighbor points maybe too small. To avoid the problems above, we can use more than one epoch. After one whole epoch training of the weighting vector W, we can take the final value of the weighting vector W of the first epoch as the initial value of the weighting vector W of the second epoch, and we will get the new value of the network output

)) 2 ( ),... 2 ( ),... 2 ( , ) 2 ( ( ) 2 ( 1∧ ∧2 ∧ ∧ ∧ = u u uk un

U , because of the weighting vector W is the

function of the network output U∧ =(u1,u2,...uk,...un), and after the second epoch, we can take the final value of the weighting vector W of the second epoch as the initial value of the weighting vector W of the third epoch. And we can repeat this method till we finish the last epoch, and the training of the weighting vector W is good enough.

2.5

Fourth

Order of

Runge-Kutta Formula for Numerical Method

In [19], we use the fourth order of Runge-Kutta formula which provides a good approximation and efficient way for numerical method. Let an initial value problem as following equations: 0 0) ( ) , ( ' y t y y t f y = = (2-20)

(21)

Then, the fourth order of Runge-Kutta formula for this problem can be written by the following equations: ) , ( ) 2 1 , 2 ( ) 2 1 , 2 ( ) , ( ) 2 2 ( 6 1 3 4 2 3 1 2 1 1 4 3 2 1 1 k y h t hf k k y h t hf k k y h t hf k y t hf k h t t k k k k y y n n n n n n n n n n n n + + = + + = + + = = + = + + + + = + + (2-21)

(22)

Chapter 3

Control of Inverted Pendulum System (IPS)

3.1 Dynamics of Inverted Pendulum System (IPS)

M

m u l θ • θ

Fig-3.1. The inverted pendulum system (IPS)

In [16, 20], the half-axle length of the IPS l= 0.5 meter; the cart mass of the IPS M = 1 kg; the pendulum mass of the IPS m = 0.1 kg. And we can get the equation:

u m M m l m M m M m l m M ml g × + − + + + − + − = = • • ) cos 3 4 ( cos ) cos 3 4 ( sin cos sin 1 2 1 1 2 1 1 2 2 1 2 2 1 θ θ θ θ θ θ θ θ θ θ (3-1)

, where θ is the bias angle of the IPS; 1 θ is the angle velocity of the IPS; 2 u is the control force to push the cart. We substitute the values above, and we can get the following equation: u × − × + × × − × = = • • 2 1 1 1 1 2 2 1 2 2 1 )) (cos( 667 . 14 ) cos( 20 ) sin( ) cos( ) ( ) sin( 6 . 215

θ

θ

θ

θ

θ

θ

θ

θ

θ

(3-2)

3.2 Design of Reference Controller

(23)

can get the following equation: u m M m l m M m M m l g × + − + + × + − = = • • ) 3 4 ( 1 ) 3 4 ( 1 2 2 1 θ θ θ θ (3-3)

Substitute the values (

M

=

1

,

m

=

0

.

1

,

l

=

0

.

5

,

g

=

9

.

8

), we can get the following equation: u × + × = = • • 1.46 15.8 1 2 2 1 θ θ θ θ (3-4)

In [21], let u=k1θ1+k2θ2, we can get the following equation by (3-4):

2 2 1 1 2 2 1 1.46k ) 1.46k 15.8 ( θ θ θ θ θ × + × + = = • • (3-5) And we present (3-5) by matrix form

⎟⎟ ⎠ ⎞ ⎜⎜ ⎝ ⎛ ⎟⎟ ⎠ ⎞ ⎜⎜ ⎝ ⎛ × × + = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ • • 2 1 2 1 2 1 k 1.46 k 1.46 15.8 1 0 θ θ θ θ (3-6) Let ⎟⎟ ⎠ ⎞ ⎜⎜ ⎝ ⎛ × × + = 2 1 1.46 k k 1.46 15.8 1 0 A , so ⎟⎟ ⎠ ⎞ ⎜⎜ ⎝ ⎛ × − × − − = − 2 1 1.46 k k 1.46 15.8 1 -λ λ λI A ,

and if we ask the determinant of λIA is zero ,we will get the following equation:

0 1.46k 15.8 1.46k k 1.46 k 1.46 15.8 1 -det 2 2 1 2 1 = − − − = ⎟⎟ ⎠ ⎞ ⎜⎜ ⎝ ⎛ × − × − − λ λ λ λ (3-7)

(3-7) is the form of the second order linear system 2 +2 + 2 =0 n ns s ξω ω , so we get 1 2 2 1.46k 15.8 k 0.73 − − = × − = × n n ω ω ξ (3-8) Letξ =0.4 , ωn =1.8, we can get k1 =-13 , k2 =−0.99, so we have

• − − = − − = 13θ1 0.99θ2 13θ1 0.99θ1 u (3-9)

So the equation of the reference controller of IPS is equation (3-9). Let the IPS initial angle=20 degree and initial angular speed=20 degree/sec, and the simulation time=10 sec. With the equations (3-2) and (3-9), we can get the results of the IPS controlled by the reference controller, and we show them in the following figures:

(24)

Fig-3.2. The control force of the reference controller

(25)

Fig-3.4. The output angular speed of IPS controlled by the reference controller

3.3 Architecture and Algorithm of Weighting Training

ϕ

()

IPS

u

u ) (x1 x2 camp× + u

u

J 2 ) ( ∑ ∧ −u u W Δ W J ∂ ∂ × η Reference controller θ • θ θ • θ + + ∑ ∑ 1 d 2 d

R

R

C

C

2 x 1 x ∑ + + ∑ 11 W 12 W 21 W 22 W + +

()

ϕ

) tanh( ) (•= • φ ) tanh( ) (•= • φ 1

v

2

v

1 i 2 i

(26)

We use the following parameters of HNN controller: the resistor=1(ohm), the capacitor=0.01(Farr), the amplification constant=-30, and the learning rate=0.001. In the training phase, we note that the Hopfield neural network (HNN) doesn’t control the IPS. So we can imagine that when trainw11,w12,w21 andw22 by the set of

)

,

,

,

,

(

u

θ

1

d

1

θ

2

d

2 (the value of the set is corresponding to this moment time t1 ), the

time of the reference controller and the IPS pauses until the HNN circuit is in the steady state. And we continue to trainw11,w12,w21 andw22 by the next set of

)

,

,

,

,

(

u

θ

1

d

1

θ

2

d

2 (the value of the “next set” is corresponding to the next moment

time t2).

So we can consider that in the training phase, the circuit is already in the steady state, so no current passes to both capacitors C (it is equal to both capacitors C are open, C=0), so we can get the equation bellow (by the circuit theorem: the voltage drop equals the multiplication of the resistance and the current):

2 2 1 1 i R v i R v × = × = (3-10) We have the equation bellow (by the circuit theorem: current equals the multiplication of the conductance and the voltage):

)

(

)

(

)

(

)

(

2 2 2 22 1 1 1 21 2 2 2 2 12 1 1 1 11 1

d

x

w

d

x

w

i

d

x

w

d

x

w

i

+

×

+

+

×

=

+

×

+

+

×

=

θ

θ

θ

θ

(3-11) The effect ofϕ(•) is as voltage amplifier, so we can write the equations bellow:

(

(

)

)

tanh(

tanh(

)

)

2 2 2 1 1 1

v

v

x

v

v

x

=

=

=

=

ϕ

ϕ

(3-12) The equation of the output of Hopfield neural network, the HNN controller‘s control signal u is bellow:

)

(

x

1

x

2

c

u

=

amp

×

+

∧ (3-13) We define the error J as the measurement of the half squared distance between the reference controller’s control signal u and the HNN controller’s control signal

u .

And we write the equation bellow:

2 ) ( 2 1 ∧ − × = u u J (3-14)

(27)

half squared distance between the reference controller’s control signal u and the

HNN controller’s control signal u will be smaller. How can we reach this task? We

can deal it by trainingw11,w12,w21 and w22with the steepest descent method as we introduced in the section 2.3. Let us take w11 for example to show how it to be trained. First, we can write the equation bellow to show how we get the better next value ofw11: 11 11 11( 1) ( ) w J k w k w ∂ ∂ × − = + η , (3-15) where η is the learning rate, and we should calculate the value of

11 w J ∂ ∂ . We can use the chain rule to write the equation bellow:

11 1 1 1 1 11 w v v x x u u J w J ∂ ∂ × ∂ ∂ × ∂ ∂ × ∂ ∂ = ∂ ∂ ∧ ∧ (3-16)

From the equation (3-14), we have the equation bellow: ) (u u u J = ∂ ∂ ∧ ∧ (3-17)

From the equation (3-13), we have the equation bellow:

amp c xu = ∂ ∂∧ 1 (3-18) From the equation (3-12), we have the equation bellow:

2 1 1 1 1 [tanh( )] v v x − = ∂ ∂ (3-19) From the equation (3-10), (3-11), we have the equation bellow:

) ( 1 1 1 11 1 d x R w v − + × = ∂ ∂ θ (3-20) So, from the equations (3-16), (3-17), (3-18), (3-19) and (3-20), we have equation bellow: ) ( } )] [tanh( 1 { ) ( 2 1 1 1 1 11 d x R v c u u w J amp× − × × + − × − = ∂ ∂ ∧ θ (3-21) Substitute equations (3-21) to the equations (3-15), we have equation bellow:

) ( } )] [tanh( 1 { ) ( ) ( ) 1 ( 2 1 1 1 1 11 11 k w k u u c v R x d w + = − × − × amp × − × × + − ∧ θ η (3-22)

Similarly, for trainingw12, w21 andw22, we can write the equations bellow:

) ( } )] [tanh( 1 { ) ( ) ( ) 1 ( 2 2 2 2 1 12 12 k w k u u c v R x d w + = − × − × amp × − × × + − ∧ θ η (3-23)

(28)

) ( } )] [tanh( 1 { ) ( ) ( ) 1 ( 2 1 1 1 2 21 21 k w k u u c v R x d w + = − × − × amp× − × × + − ∧ θ η (3-24) ) ( } )] [tanh( 1 { ) ( ) ( ) 1 ( 2 2 2 2 2 22 22 k w k u u c v R x d w + = − × − × amp× − × × + − ∧ θ η (3-25)

IPS

11

w

12

w

21

w

22

w

2

x

Hopfield NN controller

u

u

1 x

+

+

+

+

+

+

+

+

+

+

+

-+

-2 θ 1 θ 2 d 1 d

+

+

Σ Σ Σ Σ Σ Σ Σ Σ Σ Σ Σ ) tanh( ) (•= • φ ) tanh( ) (•= • φ R R C C ) (• φ ) (• φ amp c 1 v 1 i 2 i v1

Fig-3.6. The architecture of the IPS controlled by the HNN controller

In the working phase, the HNN is a real time controller, responding to control the IPS. The value of the set ofw11,w12,w21 and w22 is fixed. And as a real time controller, the circuit is dynamic, so we cannot ask the circuit always in the steady state, so we should know that the current passing the both capacitors C is not always zero. Actually, it is very complicated to calculate the output of IPS. In the working phase, the architecture is the recurrent neural network. The output of IPS is

(

θ

1

(

t

),

θ

2

(

t

))

, and

(

θ

1

(

t

),

θ

2

(

t

))

will affect the values of the current

(

i

1

(

t

),

i

2

(

t

))

, and the current

(

i

1

(

t

),

i

2

(

t

))

will affect the values of the voltage

(

v

1

(

t

),

v

2

(

t

))

, and the time-varying current passing the capacitors will affect the values of the voltage

(

v

1

(

t

),

v

2

(

t

))

, too. The voltage

(

v

1

(

t

),

v

2

(

t

))

will be amplified by

ϕ

(•

)

to

(29)

get the values of

(

x

1

(

t

),

x

2

(

t

))

, and the values of x1(t) and x2(t) will affect i1(t) and i2(t) respectively, and

(

x

1

(

t

)

+

x

2

(

t

))

×

c

amp will get the control signal u(t) .

Of course, the control signal u(t) will affect the output of the IPS

(

θ

1

(

t

),

θ

2

(

t

))

by the IPS equation (3-2). So this is a complicated recurrent control system. So we don’t calculate the analytic solution of this system. Instead, we try to use the numerical method to simulate this system.

3.4 Simulation Result

3.4.1 Seeking for Weighting Factors

First, we should try to seek a good set ofw11,w12,w21 and w22. With the equations (3-22), (3-23), (3-34) and (3-25), we may use many training epochs for get better training results. How can we use training epochs to get better results? First, we define a new parameter: the total error during the whole timeJ as the following equation: t

= = m k t J k m J 1 ) ( 1 (3-27) Where the parameter J(k) is just the detailed presentation of J , with

2 )) ( ) ( ( 2 1 ) (k u k u k J ∧ − ×

= , to emphasize J is the function of the parameter k (the discrete time point). And to emphasize the inference of the epoch number to the total error during the whole time we can write the equation bellow:

= = m k t J k epo m epo J 1 ) , ( 1 ) ( (3-28) Because J is the function of the parameter t epo (the epoch number), and generally speaking, J will decrease as t epo increase. So we can use a big value of epo to let J become small enough. We can show this in the following figure, Fig-3.7, and t we can find that using 6 epochs is good enough for simulation.

(30)

Fig-3.7. The total error Jt(epo) and the last epoch error J(k,6)

By the simulation, we can find a set ofw11,w12,w21 and w22, and we write it down as(w11,w12,w21,w22)=(0.1755,0.01367,0.1755,0.01367).

In fact, the seeking of a good set ofw11,w12,w21 and w22 is the process of the training iteration in the whole time and every epoch, and we can show the training iteration process (in the last epoch) in the whole time by the following figure.

(31)

3.4.2 IPS Controlled by HNN Controller Trained with the Same

Initial State

After we seek the values ofw11,w12,w21 and w22, we can begin to run the simulation of the IPS controlled by the HNN controller in real time. We use the Matlab with the 4th order of Runge-Kutta formula to simulate IPS controlled by HNN controller. By the simulation, we can get the following figures as the results.

Fig-3.9. The control forces of IPS: reference controller (dash line) and HNN controller (solid line)

(32)

Fig-3.10. The output angles of IPS: reference controller (dash line) and HNN controller (solid line)

Fig-3.11. The output angular speeds of IPS: reference controller (dash line) and HNN controller (solid line)

(33)

Fig-3.12. The node 1 voltage v1 of the HNN circuit

(34)

3.4.3 IPS Controlled by HNN Controller Trained with Different

Initial State

We use the following examples to examine the abilities of HNN controllers to control IPS with initial state different from the initial state of training the HNN controller. We can let the values ofw11,w12,w21 and w22 be the same with section 3.4.1, so

) 01367 . 0 , 1755 . 0 , 01367 . 0 , 1755 . 0 ( ) , , ,

(w11 w12 w21 w22 = is fixed for the initial state of

IPS: the initial angle=20 (degree) and initial angular speed=20 (degree/sec) in the training phase. And then, we will examine the following pairs (initial angle (degree), initial angular speed (degree/sec)) of the initial state of IPS: (30, 20), (20, 30), (25, 25), and (10, 10) in the working phase as the following figures:

Fig-3.14. The control forces of IPS with initial angle=30 degree, initial angular speed=20 degree/sec: reference controller (dash line) and HNN controller (solid line)

(35)

Fig-3.15. The output angles of IPS with initial angle=30 degree, initial angular speed=20 degree/sec: reference controller (dash line) and HNN controller (solid line)

Fig-3.16. The output angular speeds of IPS with initial angle=30 degree, initial angular speed=20 degree/sec: reference controller (dash line) and HNN controller

(36)

Fig-3.17. The node 1 (2) voltage v1 (v2) of the HNN circuit with IPS initial angle=30 degree, initial angular speed=20 degree/sec

Fig-3.18. The control forces of IPS with initial angle=20 degree, initial angular speed=30 degree/sec: reference controller (dash line) and HNN controller (solid line)

(37)

Fig-3.19. The output angles of IPS with initial angle=20 degree, initial angular speed=30 degree/sec: reference controller (dash line) and HNN controller (solid line)

Fig-3.20. The output angular speeds of IPS with initial angle=20 degree, initial angular speed=30 degree/sec: reference controller (dash line) and HNN controller

(38)

Fig-3.21. The node 1 (2) voltage v1 (v2) of the HNN circuit with IPS initial angle=20 degree, initial angular speed=30 degree/sec

Fig-3.22. The control forces of IPS with initial angle=25 degree, initial angular speed=25 degree/sec: reference controller (dash line) and HNN controller (solid line)

(39)

Fig-3.23. The output angles of IPS with initial angle=25 degree, initial angular speed=25 degree/sec: reference controller (dash line) and HNN controller (solid line)

Fig-3.24. The output angular speeds of IPS with initial angle=25 degree, initial angular speed=25 degree/sec: reference controller (dash line) and HNN controller

(40)

Fig-3.25. The node 1 (2) voltage v1 (v2) of the HNN circuit with IPS initial angle=25 degree, initial angular speed=25 degree/sec

Fig-3.26. The control forces of IPS with initial angle=10 degree, initial angular speed=10 degree/sec: reference controller (dash line) and HNN controller (solid line)

(41)

Fig-3.27. The output angles of IPS with initial angle=10 degree, initial angular speed=10 degree/sec: reference controller (dash line) and HNN controller (solid line)

Fig-3.28. The output angular speeds of IPS with initial angle=10 degree, initial angular speed=10 degree/sec: reference controller (dash line) and HNN controller

(42)

Fig-3.29. The node 1 (2) voltage v1 (v2) of the HNN circuit with IPS initial angle=10 degree, initial angular speed=10 degree/sec

3.4.4 IPS Controlled by HNN Controller Trained by Nonlinear

Reference Controller with the Same Initial State

To examine the ability of HNN controller to mimic the nonlinear reference controller, we use the following equation as the nonlinear reference controller of IPS:

) e )(1 e (1 1 ) e )(1 e (1 1 ) e )(1 e (1 1 ) e )(1 e (1 1 ) e )(1 e (1 70 -) e )(1 e (1 70 2 1 2 1 2 1 2 1 2 1 2 1 -θ θ θ θ θ θ θ θ θ θ θ θ + + + + + + + + + + + + + + + = u (3-29)

Let the IPS initial angle=20 degree and initial angular speed=20 degree/sec, and the simulation time=20 sec. We can get the following three figures of IPS controlled by the nonlinear reference controller:

(43)

Fig-3.30. The control force of the nonlinear reference controller

(44)

Fig-3.32. The output angular speed of IPS controlled by the nonlinear reference controller

We use the same parameters of HNN controller: the resistor=1(ohm), the capacitor=0.01(Farr), the amplification constant=-30, the learning rate=0.001, and 10 epochs for training, and we show the training process as the following two figures:

(45)

Fig-3.34. The last epoch training iteration process ofw11,w12,w21 and w22 By the simulation, we find the values ofw11,w12,w21 and w22, and we write it down as(w11,w12,w21,w22)=(0.1846,0.1876,0.1846,0.1876).Then, we show the following

four figures as simulation result of IPS controlled by trained HNN controller:

Fig-3.35. The control forces of IPS: nonlinear reference controller (dash line) and

(46)

Fig-3.36. The output angles of IPS: reference controller (dash line) and HNN controller (solid line)

Fig-3.37. The output angular speeds of IPS: reference controller (dash line) and HNN controller (solid line)

(47)

Fig-3.38. The node 1 (2) voltage v1 (v2) of the HNN circuit

3.4.5 IPS Controlled by HNN Controller Trained by Nonlinear

Reference Controller with Different Initial State

We use the following examples to examine the abilities of HNN controllers to control IPS with initial state different from the initial state of training the HNN controller by the nonlinear reference controller. We let the values ofw11,w12,w21 and w22 be the same with section 3.4.4, so (w11,w12,w21,w22)=(0.1846,0.1876,0.1846,0.1876) is

fixed for the initial state of IPS: the initial angle=20 (degree) and initial angular speed=20 (degree/sec) in the training phase. And then, we will examine the following pairs (initial angle (degree), initial angular speed (degree/sec)) of the initial state of IPS: (30, 30), and (10, 10) in the working phase as the following figures:

(48)

Fig-3.39. The control forces of IPS with initial angle=30 degree, initial angular speed=30 degree/sec: the nonlinear reference controller (dash line) and HNN

controller (solid line)

Fig-3.40. The output angles of IPS with initial angle=30 degree, initial angular speed=30 degree/sec: the nonlinear reference controller (dash line) and HNN

(49)

Fig-3.41. The output angular speeds of IPS with initial angle=30 degree, initial angular speed=30 degree/sec: the nonlinear reference controller (dash line) and HNN

controller (solid line)

Fig-3.42. The node 1 (2) voltage v1 (v2) of the HNN circuit with IPS initial angle=30 degree, initial angular speed=30 degree/sec

(50)

Fig-3.43. The control forces of IPS with initial angle=10 degree, initial angular speed=10 degree/sec: the nonlinear reference controller (dash line) and HNN

controller (solid line)

Fig-3.44. The output angles of IPS with initial angle=10 degree, initial angular speed=10 degree/sec: the nonlinear reference controller (dash line) and HNN

(51)

Fig-3.45. The output angular speeds of IPS with initial angle=10 degree, initial angular speed=10 degree/sec: the nonlinear reference controller (dash line) and HNN

controller (solid line)

Fig-3.46. The node 1 (2) voltage v1 (v2) of the HNN circuit with IPS initial angle=10 degree, initial angular speed=10 degree/sec

(52)

Chapter 4

Control of Ball and Beam System (BABS)

4.1 Dynamics of Ball and Beam System (BABS)

3 θ 1 θ f M 2 θ 4 θ b R b P P

Fig-4.1. The ball and beam system (BABS) In [22], the moment of inertia of the beam is P=0.02 (kg- 2

m ); the mass of the ball is

M=0.05 (kg); the moment of inertia of the ball is =2×10−6

b

P (kg-m ); the radius of 2

the ball is R=0.01(m); the gravity acceleration is G.=9.8(m/ 2

s ); the torque applied to

the beam is f (nt-m). With the ball positionθ1 , the ball velocityθ2, the beam angleθ3, and the beam angular speedθ4, we can get the equations bellow:

0 ) ( ) sin( ) ( 2 4 1 3 2 2 + × + × × − × × = • θ θ θ θ M G M M R Pb (4-1) f G M M P P M× + + b × + × × × × + × × × = • ) cos( 2 ] ) ( [ 2 4 1 2 4 1 3 1 θ θ θ θ θ θ θ (4-2) And we define 2 R P M M B b + = , so 0.7143 7 5 = =

B , and we can get the equations bellow:

2 1 θ θ• = (4-3) )] sin( ) ( [ 2 3 4 1 2 θ θ θ θ• = B× × −G× (4-4) 4 3 θ θ• = (4-5) b P P M f G M M + + × + × × × − × × × × − = • 2 1 3 1 4 2 1 4 ) ( ) cos( 2 θ θ θ θ θ θ θ (4-6)

(53)

We substitute the values of B, G, M, P, P above, and we can get the following b equations: 000002 . 0 02 . 0 ) ( 05 . 0 ) cos( 8 . 9 05 . 0 05 . 0 2 )] sin( 8 . 9 ) ( [ 7 5 2 1 3 1 4 2 1 4 4 3 3 2 4 1 2 2 1 + + × + × × × − × × × × − = = × − × × = = • • • • θ θ θ θ θ θ θ θ θ θ θ θ θ θ θ f (4-7)

4.2 Simulation of BABS Controlled by Reference Controller

We use the following equation as reference controller of BABS:

4 3 2 1 0.7 3 1.5 7 . 0 ×θ + ×θ − ×θ − ×θ = f , (4-8)

where f is the control torque. Let the BABS initial position (ball’s position) =0.2 meter, initial velocity (ball’s velocity) =0 meter/sec, initial angle (beam’s angle) =10 degree and initial angular speed (beam’s angular speed) =0 degree/sec, and the simulation time=15sec. With equation (4-7) and (4-8), we can get the results of the BABS controlled by the reference controller, and we can show them in the following figures.

(54)

Fig-4.3. The ball’s position of BABS controlled by the reference controller

(55)

Fig-4.5. The beam’s angle of BABS controlled by the reference controller

(56)

4.3 Architecture and Algorithm of Weighting Training

f ∑ = ×4 1 i i amp x Cf J 2 ) ( ∑ ∧ − f f W Δ W J ∂ ∂ × η 1 θ 4 θ 1 θ 4 θ 1 d 2 d

4

x

1 x 11 W 14 W 41 W 44 W • • • • • • • • • • • • • • • • • • • • • 1

i

v1 4

i

v

4

Fig-4.7. The architecture of the BABS controlled by the HNN controller in the training phase

We use the following parameters of HNN controller: the resistor=1(ohm), the capacitor=0.01(Farr), the amplification constant=-30, and the learning rate=0.001. In the training phase, we note that the Hopfield neural network (HNN) doesn’t control the ball and beam system (BABS). So we can imagine that when train w11, w12, w , 13

14

w , w21, w22, w , 23 w24, w , 31 w , 32 w , 33 w , 34 w41, w42, w and 43 w44 by the set of

(

u

,

θ

1

,

d

1

,

θ

2

,

d

2

,

θ

3

,

d

3

,

θ

4

,

d

4

)

(the value of the set is corresponding to this

moment time t1), the time of the reference controller and the BABS pauses until the HNN circuit is in the steady state. And we continue to train w11, w12, w , 13 w14,

21

w , w22, w , 23 w24, w , 31 w , 32 w , 33 w , 34 w41, w42, w and 43 w44 by the next set of

(

u

,

θ

1

,

d

1

,

θ

2

,

d

2

,

θ

3

,

d

3

,

θ

4

,

d

4

)

(the value of the “next set” is corresponding

to the next moment time t2).

So we can consider that in the training phase, the circuit is already in the steady state, so no current passes to the four capacitors C (it equals that the four capacitors C are open, C=0), so we can get the equations bellow (by the circuit theorem: the voltage drop equals the multiplication of the resistance and the current):

參考文獻

相關文件

6 《中論·觀因緣品》,《佛藏要籍選刊》第 9 冊,上海古籍出版社 1994 年版,第 1

The beam we selected for the bright-field image was the central (transmitted) beam of the diffraction pattern. Selecting other diffracted beam produces

• elearning pilot scheme (Four True Light Schools): WIFI construction, iPad procurement, elearning school visit and teacher training, English starts the elearning lesson.. 2012 •

 name common laboratory apparatus (e.g., beaker, test tube, test-tube rack, glass rod, dropper, spatula, measuring cylinder, Bunsen burner, tripod, wire gauze and heat-proof

ADSL(A symmetric D igital S ubscriber L ine ,非對稱數位

First, when the premise variables in the fuzzy plant model are available, an H ∞ fuzzy dynamic output feedback controller, which uses the same premise variables as the T-S

In this paper, by using Takagi and Sugeno (T-S) fuzzy dynamic model, the H 1 output feedback control design problems for nonlinear stochastic systems with state- dependent noise,

In the table boldface line was the S curve means students and dotted line was the P curve means problem.