• 沒有找到結果。

霍普菲爾類神經網路控制器設計及其應用

N/A
N/A
Protected

Academic year: 2021

Share "霍普菲爾類神經網路控制器設計及其應用"

Copied!
53
0
0

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

全文

(1)

國 立 交 通 大 學

電 機 與 控 制 工 程 學 系

碩 士 論 文

霍普菲爾類神經網路控制器設計及其應用

Design of Hopfield Neural Network Controller with Its

applications

研究生:甘能捷

指導教授:王啟旭 教授

(2)

霍普菲爾類神經網路控制器設計及其應用

Design of Hopfield Neural Network Controller with Its

applications

研究生:甘能捷 Student: Neng-Chieh Kan 指導教授:王啟旭 教授 Advisor: Chi-Hsu Wang

國 立 交 通 大 學 電機與控制工程學系

碩士論文

A Thesis

Submitted to Department of Electrical and Control Engineering College of Electrical Engineering and Computer Science

National Chiao Tung University in Partial Fulfillment of the Requirements

for the Degree of Master in

Electrical and Control Engineering October 2006

Hsinchu, Taiwan, Republic of China

(3)

霍普菲爾類神經網路控制器設計及其應用

研究生:甘能捷 指導教授:王啟旭 教授

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

摘要

本篇論文是將霍普菲爾類神經網路當作一個控制器應用在控制領域上。先將霍普菲爾神 經網路做訓練,使其能夠產生較佳的控制訊號,訓練完之後再當一個即時的控制器使 用。霍普菲爾神經網路是一個有迴授的具有保持穩定特性的類神經網路。我們利用兩種 方法來做網路的訓練法則,其中一個是倒傳遞訓練演算法,而另一個動態最佳學習則可 以加速我們的學習過程。要使用倒傳遞訓練演算法來訓練霍普菲爾類神經網路當作一個 即時控制器,最小能量的條件扮演了一個重要的角色。最後我們用倒單擺系統和飛機控 制系統當作我們的受控體得到了良好的結果,並討論如何實現霍普菲爾類神經網路。

(4)

Design of Hopfield Neural Network Controller with Its

applications

Student: Neng-Chieh Kan Advisor: Chi-Hsu Wang

Department of Electrical and Control Engineering National Chiao Tung University

ABSTRACT

This thesis explores the design of Hopfield neural network (NN) as a controller for control system. The training algorithms for Hopfield NN are first developed to generate proper control signal and then the Hopfield NN is used as a real-time controller after training. The Hopfield NN is a recurrent neural network which has the potential of maintaining stability. We use two approaches for training algorithm, one is normal back-propagation training, the other is dynamic optimal learning which can accelerate the learning process. The minimum energy requirement in Hopfield NN plays the key role in the back-propagation training of Hopfield NN as a real-time controller. Finally the inverted pendulum system and aircraft control system are illustrated as the plants to be controlled by Hopfield NN. Excellent results are obtained and the implementation of Hopfield NN is also discussed.

(5)

ACKNOWLEDGEMENT

I feel external gratitude to my advisor, Chi-Hsu Wang for teaching me many things about how to do the research in the two years. When I get some problems in my research, he always gives me a hand at the right moment such that my thesis can finish in time.

And I am grateful to everyone in ECL. I am very happy to get along with all of you. Finally, I appreciate my family’s support and encouragement; therefore I can finish my master degree smoothly.

(6)

TABLE OF CONTENTS

摘要 ...i ABSTRACT ...ii ACKNOWLEDGEMENT...iii TABLE OF CONTENTS...iv LIST OF TABLES ... v

LIST OF FIGURES ...vi

CHAPTER 1 Introduction ... 1

CHAPTER 2 The Hopfield Neural Network... 3

2.1 The Recurrent Neural Network ... 3

2.2 The Hopfield Neuron with Closed-Loop Dynamics... 4

2.3 Stability Analysis of Hopfield Neural Network ... 7

2.4 The Discrete Hopfield Neural Network... 9

CHAPTER 3 Training Algorithm of Continuous Hopfield Neural Network for Control Applications... 16

3.1 Back-propagation of continuous Hopfield neural network ... 17

3.2 Optimum learning rate for the training of continuous Hopfield NN... 23

3.3 Hopfield NN as a Real-Time Controller... 27

CHAPTER 4 Experimental Results... 30

4.1 Example 1: The Inverted Pendulum System (IPS) ... 30

4.2 Example 2: The aircraft attitude control system... 37

CHAPTER 5 Conclusions ... 42

(7)

LIST OF TABLES

TABLE 4-1. TRAINED WEIGHTING FACTORS OF IPS... 33 TABLE 4-2. TRAINED WEIGHTING FACTORS OF AIRCRAFT SYSTEM... 40

(8)

LIST OF FIGURES

FIGURE 2-1. THE CONTINUOUS HOPFIELD NEURAL NETWORK... 3

FIGURE 2-2. THE ADDITIVE MODEL OF A SINGLE HOPFIELD NEURON... 4

FIGURE 2-3. THE HYPERBOLIC TANGENT FUNCTION ... 5

FIGURE 2-4. THE INVERSE OF HYPERBOLIC TANGENT FUNCTION ... 6

FIGURE 2-5. THE ATTRACTOR TRAJECTORY OF SECOND ORDER HOPFIELD NEURAL NETWORK . 9 FIGURE 2-6. THE SGN FUNCTION... 9

FIGURE 2-7. THE DISCRETE HOPFIELD NEURAL NETWORK WITHOUT SELF-LOOP FEEDBACK.... 10

FIGURE 2-8. EXAMPLE OF THE DISCRETE HOPFIELD MODEL... 15

FIGURE 3-1. THE HOPFIELD NN AS A REAL-TIME SISO CONTROLLER ... 16

FIGURE 4-1. THE INVERTED PENDULUM SYSTEM ... 30

FIGURE 4-2. THE SIX TRAINING CURVES FOR THE CONTROL OF IPS USING HOPFIELD NN ... 32

FIGURE 4-3. REAL-TIME SISO CONTROL ARCHITECTURE OF HOPFIELD NN CONTROLLER ... 32

FIGURE 4-4. THE ACTUAL RUNNING STABLE SITUATION FOR CASE 1 ... 34

FIGURE 4-5. THE CONTROL SIGNAL OF THE INVERTED PENDULUM SYSTEM FOR CASE 1... 34

FIGURE 4-6. THE ACTUAL RUNNING STABLE SITUATION FOR CASE 2 ... 35

FIGURE 4-7. THE CONTROL SIGNAL OF THE INVERTED PENDULUM SYSTEM FOR CASE 2... 35

FIGURE 4-8. THE ACTUAL RUNNING STABLE SITUATION FOR CASE 3 ... 36

FIGURE 4-9. THE CONTROL SIGNAL OF THE INVERTED PENDULUM SYSTEM FOR CASE 3... 36

FIGURE 4-10. BLOCK DIAGRAM OF AN ATTITUDE-CONTROL SYSTEM OF AN AIRCRAFT... 37

FIGURE 4-11. REAL CONTROL ARCHITECTURE OF HOPFIELD NN CONTROLLER ... 39

FIGURE 4-12. THE TRAINING DATA OF THE AIRCRAFT CONTROL SYSTEM ... 39

FIGURE 4-13. THE OUTPUT OF THE AIRCRAFT CONTROL SYSTEM BY HOPFIELD NN CONTROLLER ... 40

(9)

FIGURE 4-15. THE CONTROL SIGNAL THE AIRCRAFT CONTROL SYSTEM ... 41 FIGURE 5-1 THE INCLUSION OF MULTIPLEXER IN HOPFIELD NN... 42

(10)

CHAPTER 1

Introduction

Neural network has increasing applications in many fields: pattern recognition, identification and control of dynamical systems, system modeling. The most interesting character of neural network is that it can learn how to achieve the goal by learning algorithm and training data sets. There are many kinds of neural network such as single-layer network, multilayer feed-forward network, radial basis function network, Hopfield network, ... etc [1]. Each kind of network has different applications in many fields. Among those neural networks, the Hopfield neural network will be discussed in this thesis. The Hopfield neural network is first proposed by Hopfield J.J. in 1984 [2]. The Hopfield neural network has applied on many fields: optimization [3, 4], system identification, [5, 6], and image processing [7, 8]. In this thesis, we want to use the Hopfield neural network as a controller. The Hopfield neural network is trained by one most popular algorithm of neural network which is the back propagation algorithm [9, 10]. The well-known back propagation algorithm for training multilayer feed-forward network was proposed by Rumelhart in 1986 [11]. By using the same basis, it also can be applied on the Hopfield neural network. But in back propagation algorithm, there is an important problem about the choice of the learning rate. For smaller learning rate, we may have a convergent result. But the speed of the output convergence is very slow and need more time to train the network. For larger learning rate, the speed of training can be accelerated, but it will cause the training result to fluctuate and even leads to divergent result. The dynamic optimum learning rate algorithm proposed in [12, 13] can help us to solve the learning rate problem. The basic theme in [12, 13] is to find a stable and optimal learning rate for the next iteration in back propagation algorithm such that the neural network can maintain in convergence. Thus, we use the back propagation algorithm with

(11)

optimum learning rate to train the Hopfield neural network as a controller. The inverted pendulum system and the aircraft control system are used to verify the algorithm in the end of this thesis.

(12)

CHAPTER 2

The Hopfield Neural Network

In this chapter, the Hopfield neural network will be reviewed. First the structure of recurrent neural network which the overall Hopfield neural network belong to will be discussed. The Hopfield neural network can be divided into continuous part and discrete part, and the two parts will be discussed in Section 2.2 and Section 2.4. We will also talk about the energy function in the Hopfield neural network in Section 2.3 of this chapter.

2.1 The Recurrent Neural Network

Figure 2-1 shows a kind of recurrent neural network, which consists of a set of neurons form a multiple-loop feedback system. The output of each neuron is fed back to each of all the neurons in the neural network.

Hopfield neuron Hopfield neuron Hopfield neuron

(13)

When each neuron in Figure 2-1 is a Hopfield neuron (which will be discussed in the next section), Figure 2-1 is the so-called Hopfield neural network. It is actually a nonlinear closed-loop feedback system which will have dynamic responses in each of the output signals. The stability analysis of the Hopfield neural network plays a major role in the applicability of Hopfield neural network to engineering fields.

2.2 The Hopfield Neuron with Closed-Loop Dynamics

As mentioned in Section 2.1, we use the additive model of a neuron to form the continuous Hopfield neural network [14]. The Hopfield neuron is defined in Figure 2-2 as a continuous RC electrical network with a nonlinear activation function ϕ

( )

⋅ to confine vj to yield the final output signalxj. The dotted line ellipse in Figure 2-2 is the Hopfield neuron in Figure 2-1.

Figure 2-2. The additive model of a single Hopfield neuron

In Figure 2-2, the inputs x t (i

( )

i=1,...,N ) are fed-back from the outputs x t j

( )

( j=1,...,N ). The inputs x t are represented by potentials, and the synaptic weighting i

( )

(14)

summing junction with low input resistance and high output resistance. We also may have a bias current Ij in the additive model. The ϕ

( )

⋅ in this additive model is a nonlinear sigmoid function which is defined by hyperbolic tangent function [2, 14]:

( )

1 exp

(

(

)

)

tanh 2 1 exp j j j j j j j j a v a v x v a v ϕ ⎛ ⎞ − − = = = + − ⎝ ⎠ (2-1)

which has a slope of aj/2 at the origin as shown by

0 2 j j j v a d dv ϕ = = (2-2)

Hence we can say that aj is the gain parameter of neuron j . Figure 2-3 shows a plot of standard sigmoidal nonlinearity ϕ

( )

v .

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

v

ϕ

Figure 2-3. The hyperbolic tangent function

Now, we should also investigate the inverse function of ϕ

( )

⋅ . The inverse input- output relation of (2-1) may be written as:

( )

1 1 1 log 1 j j j j j x v x a x ϕ− ⎛ − ⎞ = = ⎜⎜ + ⎝ ⎠⎟⎟ (2-3)

(15)

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

x

1

ϕ

Figure 2-4. The inverse of hyperbolic tangent function

Figure 2-4 shows the corresponding plot of the inverse nonlinearity ϕ−1

( )

x .From Figure 2-2 with the closed-loop configuration in Figure 2-1, we can get the neural dynamics in the overall Hopfield neural network as follows [14]. By using the Kirchhoff’s law which states that the total current entering a junction is equal to that leaving the same junction, we can obtain the following dynamic node equation in this model:

( )

( )

( )

1 , 1,..., N j j j ji i j i j v t d C v t w x t I j N dt R = + =

+ = (2-4) The input x t is the feedback of the output of the nonlinear sigmoid function i

( )

ϕ

( )

⋅ , so the dynamic equation becomes:

( )

( )

(

( )

)

1 , 1,..., N j j j ji i j i j v t d C v t w v t I j dt R = ϕ = − +

+ = N (2-5) Eq. (2-5) completely describes the time evolution of the system. If each node is given an initial value vj

( )

0 , then the value v t and the nonlinear activation function output j

( )

( )

(

( )

j j

)

(16)

The stability analysis of the above continuous Hopfield neural network can be discussed via the energy (or Lyapunov) function of the Hopfield neural network, which will be introduced in the next section.

2.3 Stability Analysis of Hopfield Neural Network

The energy (Lyapunov) function [2, 14] of the continuous type Hopfield neural network can be defined by

( )

1 0 1 1 1 1 1 1 2 j N N N x N ji i j j j i j j j j E w x x x dx R ϕ − = = = = = −

∑∑

+

I x (2-6) In order for the Hopfield neural network to be asymptotically stable, the time derivative of the above energy function E must be negative. By differentiating the energy function E with respect to time and using the relationship of xj and vj in (2-3), we can get

1 1 N N j ji i j j j j v d dE w x I dt = = R dt ⎛ ⎞ = − ⎜⎜ − + ⎝ ⎠

∑ ∑

xj ⎟⎟ (2-7) The term inside the parentheses in (2-7) is actually equal to Cj dvj

dt via (2-4). We may thus simplify (2-7) to 1 N j j j j dv dx dE C dt = dt dt ⎛ ⎞ = − ⎝ ⎠

(2-8) Since 1

( )

j j

v =ϕ− x from (2-3), the above (2-8) becomes

( )

1 1 N j j j j d x dx dE C dt dt dt ϕ− = ⎛ ⎞ ⎜ ⎟ = − ⎜ ⎟ ⎝ ⎠

(2-9) By using the chain rule, (2-9) can be further simplified as:

( )

2 1 1 N j j j j dx dE d C dt dt dx ϕ − = ⎛ ⎞ ⎛ ⎞ = − ⎟ ⎜⎜ ⎝ ⎠ ⎝

xj ⎟⎟ (2-10)

(17)

It is obvious from Figure 2-4 that that ϕ−1

( )

xj is an increasing function of xj. It follows therefore that

( )

1 0 j j d x dx ϕ − > , for all j x (2-11) It is also true that

2 0 j dx dt ⎛ ⎞ ≥ ⎜ ⎟ ⎝ ⎠ for all xj (2-12) Therefore, according to (2-11) and (2-12), we have the final fact:

( )

2 1 1 0 N j j j j j dx dE d C dt dt dx ϕ − = ⎛ ⎞ ⎛ ⎞ j x = − ⎜ ⎟ ⎜⎜ ≤ ⎝ ⎠ ⎝

⎟⎟ (2-13)

Eq. (2-13) says that if the nonlinear activation function is defined as the hyperbolic tangent function shown in Figure 2-3, then the set of nonlinear differential equations defined in (2-5), which represents the dynamical equations of the continuous Hopfield neural network, is asymptotically stable. From (2-13), we also know that dE 0

dt = if 0 j

dx

dt = . The points where 0

j

dx

dt = are defined as the fixed points in the trajectory space, where the energy function of those fixed points will remain still. These fixed points are also sometimes called “attractors” due to the fact that the surrounding states will sometimes be attracted to the fixed points as the stable states. Thus, we use a second order example which means only

( )

E t

1

x and

2

(18)

Figure 2-5. The attractor trajectory of second order Hopfield neural network

The contours are the energy contour of Hopfield neural network, and the arrows are the state trajectory. The attractors are located near the lower left and upper right corners. All the other unstable states will be attracted to the fixed points. The arrows show the motion of the states.

2.4 The Discrete Hopfield Neural Network

The continuous mode of Hopfield neural network is based on an additive model, as previously discussed. If the nonlinear activation function ϕ

( )

⋅ in Figure 2-2 is replaced by the following sgn function [1, 14]:

(19)

Thus we can basically have a discrete Hopfield neural network, like Figure 2-7. The discrete Hopfield neural network eliminates the self-loop feedback as shown in Figure 2-1. In the continuous mode, the nonlinear activation sigmoid function is the hyperbolic tangent function ((2-1)). The gain parameter aj in (2-2) is the slope of the hyperbolic tangent function. If we let aj → ∞, then the input-output relation in a neuron of discrete mode becomes

1 for 0 1 for 0 j j j v x v + > ⎧ = ⎨− < (2-14)

( )

0 j ϕ = (2-15) 0

Figure 2-7. The discrete Hopfield neural network without self-loop feedback

(20)

(2-6), i.e., the for continuous Hopfield neural network. In discrete case, the gain parameter

( )

E t

j

a is infinite and this will make the term 1

( )

0 1 1 j N x j j x dx R ϕ − =

∑ ∫

very small (from (2-3) and Figure 2-4). There is also no bias current Ij in discrete case. Thus, the energy function E t

( )

of discrete Hopfield neural network becomes:

1 1 1 2 N N ji i j i j E w x x = = = −

∑∑

(2-16) The most important application of the discrete model is working as a content-addressable memory (CAM) [14]. In this application, a content-addressable memory is error-correcting in the sense to retrieve a stored pattern, given a reasonable subset of the information content of that pattern. However, the synaptic weighting factors of the network that produce the desired fixed points are unknown, and the problem is how to determine them. There are two phases to the operation of the discrete Hopfield network as a CAM, namely the storage phase and the retrieval phase. Now we introduce the process of the discrete Hopfield model as CAM:

1. Storage phase:

There are M N-dimensional vectors called fundamental memories denoted by ,

,1 ,2 .... ,N

μ μ μ μ

ξ = ⎣⎡ξ ξ ξ ⎤⎦ μ=1, 2,...,M . And each ξ is a binary code, it means μ,i that ξμ,i = +1 or . The fundamental memories are the stable states to be stored and memorized by the network. Then we use the following Hebb’s learning rule to define the weighting matrix of the discrete Hopfield network[14]:

1 − 1 1 W M T MI N μ=ξ ξμ μ ⎛ ⎞ =

− ⎠⎟ (2-17) where I is the identity matrix with N dimensions. We need to minus MI because the discrete model doesn’t have self-loop feedback. We also find that the weighting matrix is

(21)

symmetric, i.e., . The following theorem will explain why the weighting matrix in discrete Hopfield neural network be decided by (2-17).

T W =W

Theorem 1

The updating rule

1 1 W M T MI N μ μ μ ξ ξ = ⎛ ⎞ =

will minimize the energy function E t of discrete Hopfield neural network when the state

( )

X is the fundamental memory ξ . μ

Proof:

We use the vector and matrix form to express the energy function in (2-16). 1

2

T

E= − X WX (2-18) where X is a N dimensional column vector. We use the definition of weighting matrix in (2-17) to rewrite (2-18). 1 1 1 1 2 1 2 M T T M T T T E X MI X N X X MX X N μ μ μ μ μ μ ξ ξ ξ ξ = = ⎛ ⎞ = − ⎝ ⎛ ⎞ = − ⎝ ⎠

⎠ (2-19)

Because X and ξ are both N dimensional column vectors with μ +1 or elements, we can get the result of (2-19).

1 −

(

)

(

)

2 1 2 1 1 2 1 2 2 M T M T E X MN N M X N μ μ μ μ ξ ξ = = ⎛ ⎞ = − ⎝ = − −

(2-20)

(22)

the state X is equal to the fundamental memory ξ , μ

(

ξμTX

)

2 will reach the maximum. It means that the energy function E would reach the minimum if we choose the weighting matrix as (2-17).

2. Retrieval phase:

Now we start the algorithm to stabilize the system and retrieve the pattern. We get a initial wrong state x

( )

0 called “probe”, which is a noisy version of the correct stable state ξ . μ The initial probe has elements equal to ±1. Then we use the following formula to updatex n :

( )

(

1

)

( )

x n+ =sgnW x⋅ n (2-21) where the sgn function is defined by:

[ ]

1, 0 1, 0 previous state, 0 u u u u + > ⎧ ⎪ = − ⎪ <=sgn (2-22)

If W x n

( )

is greater than zero, neuron j will switch its states to or remain in that state if it is already there. Similarly, if

1 +

( )

W x n is less than zero, neuron j will switch

its states to −1 or remain in that state if it is already there. If W x n

( )

is exactly zero, neuron j is left in its previous state, regardless of whether it is +1 or −1. When

(

1

) (

)

x n+ =x n , the system reaches the stable state. It means that the state x n is

( )

transformed to one of the stable states ξ . Let us use an example to verify this process. μ

(23)

memories). Only the two states will be stable, the other unstable states will converge to the two stable states after some iteration. Then we compute the weighting matrix by (2-17):

[

]

[

]

1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 0 2 0 2 3 3 1 1 0 0 1 2 W ⎛⎡ ⎤ ⎡ ⎤− ⎡ ⎤⎞ ⎡ ⎤ ⎜⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎟ ⎢ ⎥ = ⎢ ⎥− − +⎢ ⎥ − − − = − − ⎢ ⎥⎣ ⎦ ⎢ ⎥⎣ ⎦ ⎝ ⎠ 2 2 2 0 −

]

Now suppose the initial wrong unstable states is x

( )

0 =

[

1 1 1′, we can get,

( )

(

( )

)

( )

(

( )

)

( )

0 1 1 1 sgn 0 sgn 4 1 3 0 1 4 1 1 2 sgn 1 sgn 4 1 1 3 4 1 x W x x W x x ⎛ ⎡ ⎤⎞ ⎡ ⎤ ⎜ ⎢ ⎥⎟ ⎢ ⎥ = ⋅ = ⎢ ⎥= −⎢ ⎥⎢ ⎥⎣ ⎦⎢ ⎥⎣ ⎦ ⎝ ⎠ ⎛ ⎡ ⎤⎞ ⎡ ⎤ ⎜ ⎢ ⎥⎟ ⎢ ⎥ = ⋅ = ⎢ ⎥= − =⎢ ⎥⎢ ⎥⎣ ⎦⎢ ⎥⎣ ⎦ ⎝ ⎠

Because x

( ) ( )

1 =x 2 , the system reaches its stable condition x n

(

+ =1

) (

x n . From

)

( )

0

x to x

( )

2 , the initial unstable states

[

1 1 1 ′

]

converges to the fundamental memory ξ1 =

[

1 −1 1

]

′.

(24)

Figure 2-8. Example of the discrete Hopfield model

In Figure 2-7, the left upper corner ξ1=

[

1 −1 1

]

′ and the right down corner are the two fundamental memories. The nearby unstable wrong states like

or

[

will converge to the two stable states.

[

2 1 1 1

ξ = − −

]

]

[

1 1 1 ′

]

1 1 −1 ′

(25)

CHAPTER 3

Training Algorithm of Continuous Hopfield Neural Network for

Control Applications

We have discussed how to find the weighting factors of discrete Hopfield neural network (NN) in Chapter 2. In this chapter, the training algorithm to find the weighting factors of continuous Hopfield NN will be proposed. The back-propagation skill is mainly adopted for this problem. Further the optimal training algorithm is also proposed to accelerate the learning speed. We assume the following unity feedback Single Input Single Output (SISO) control system using Hopfield NN as a controller:

Hopfield NN

Controller System plant

.. . .. . ... .. . 1 x x1 j x xj N x xN d + ej y -closed for t = 0 open for t > 0 (0) (0), (0) 0, . j j i e x x i j = ⎧⎪ ⎨ = ⎪⎩ j x j x

Figure 3-1. The Hopfield NN as a real-time SISO controller

The control goal is to design a Hopfield NN as a controller so that the output y will follow the input . The design process will include the training of weighting factors in Hopfield NN. Note that it can be shown in Figure 3-1 that the output

d

j

x of the Hopfield NN is the control input to the system plant and there is a switch placed between the error signal and

the input

j

e = − yd

j

x of Hopfield NN. This implies that {xj

( )

0 =ej

( )

0 ,xi

( )

0 = for i0 }. The reason for this initial arrangement is that Hopfield NN will need non-zero initializations for

j

(26)

all x to serve as a real-time controller. This will be explained in more details in later i section.

3.1 Back-propagation of continuous Hopfield neural network

The back-propagation learning algorithm is one of the most important historical developments in neural networks [14, 15]. The back-propagation learning algorithm is originally applied to multilayer feed-forward networks consisting of processing elements with continuous differentiable activation functions. Given a training set of input-output pairs {d n

( ) ( )

,y n }, the algorithm provides a procedure for the finding of weighting factors in back-propagation network. Now, we use the popular back-propagation algorithm in the continuous Hopfield NN to find the way for the training weighting factors. Let the output of neuron j (i.e.,xj) be the control input to the plant (see Figure 3-1). We define the error signal of the output

neuron

( )

j

e n

j at step n as the difference between y n and

( )

d n :

( )

( )

( ) ( )

j

e n =d ny n (3-1)

The error signal can be used to decide the cost function. The cost function is a measure of learning performance which can be defined as

( )

j e n

( )

{

( ) ( )

2 2 1 1 2 j 2 J = e n = d ny n

}

(3-2) To minimize the cost function , the update of the weighting factors can be obtained from the following rule:

J

(

1

)

( )

ji ji

w n+ =w n + Δwji (3-3) where Δwji

( )

n is defined by:

ji ji J w w η ∂ Δ = − ∂ (3-4)

(27)

The parameter η is the learning rate or step size of our continuous Hopfield NN back-propagation algorithm. In (3-3) and (3-4), we can find that the back-propagation algorithm applies a correction Δwji

( )

n to the synaptic weighting factor , which is proportional to the partial derivative

( )

ji w n ji J w

∂ . Thus, we have the following update rule:

(

1

)

( )

ji ji ji J w n w n w η ∂ + = − ∂ (3-5) According to the chain rule, we can get the gradient of

ji

J w

∂ in the following form:

ji j J J y w y wi ∂ ∂ ∂ = ∂ ∂ ∂ (3-6) Then (3-5) can be further expressed as

(

1

)

( )

ji ji ji J y w n w n y w η∂ ∂ + = − ∂ ∂ (3-7) We can have

(

)

2

(

1 2 J d y d y y y= ∂ ⎡ = −

)

⎢ ⎥ ∂ ∂ ⎣ ⎦ (3-8) Since we can not find the relation between y and wji directly, we have to apply the chain rule again for j

ji y w ∂ ∂ as follows: j j ji j j ji x v y y w x v w ∂ ∂ ∂ = ∂ ∂ ∂ ∂ ∂ (3-9) This implies that (3-7) can be further expressed as

(

1

)

( )

j j ji ji j j ji x v J y w n w n y x v w η∂ ∂ ∂ ∂ + = − ∂ ∂ ∂ ∂ (3-10) In (3-9), xj is the continuous Hopfield NN output, and it is also the control signal to control the system plant. The signal y is just the system plant output due to the control signal xj. Because the system plant is uncertain, the first part

j y x ∂ ∂ in (3-9) can be approximated by j y x Δ Δ as follows:

(28)

(

) ( )

( )

1 ( 1) j j j j y n y n y y x x x n x n + − ∂ Δ = ∂ Δ + − (3-11) For j j x v ∂ ∂ and j ji v w

∂ , (2-1) and (2-4) in Chapter 2 are repeated as follows as (3-12) and (3-13):

( )

1 exp

(

(

)

)

tanh 2 1 exp j j j j j j j j a v a v x v a v ϕ ⎛ ⎞ − − = = = + − ⎝ ⎠ (3-12) 1 N j j ji i i v d C v w x dt R = + =

(3-13) From (3-12), it is obvious that

( )

(

)

(

)

(

)

2 2 exp 1 exp j j j j j j j a a v x v v ϕ a v − ∂ ′ = = ∂ + j (3-14) For j ji v w

∂ in (3-9), we may obtain some hints from (3-13), which is the continuous Hopfield NN dynamic equation. From (3-12), we can rewrite (3-13) as:

( )

1 n j j ji i i dv v C w dt R = ϕ + =

v (3-15) The above (3-15) is a nonlinear differential equation, which describes the relationship between vj and wji. Thus j

ji v w

∂ can not be found in (3-15) directly.

However, the basic theme of all training algorithms is to force the system state to have minimum energy. Theorem 1 in Chapter 2 shows the weighting vector to get the minimum energy of a discrete Hopfield NN. This minimum energy weighting vector is then applied for the training of discrete Hopfield NN. The same philosophy can also be applied in the training of continuous Hopfield NN. From Chapter 2, we have the derivate of energy function E t

( )

for continuous Hopfield NN as

1 N j j dv dx dE C dt = dt dt ⎛ ⎞ = − ⎝ ⎠

j (3-16)

For minimum energy, we must let dE 0

dt = . From (3-16), it is obvious that if 0 j

dv

(29)

N ; then dE 0

dt = . Based on this, (3-15) can be rewritten as

1,..., j=

( )

1 n j ji i i v w v R = ϕ =

(3-17) Therefore we can have

( )

1 n j ji i v R w ϕ v = = ⋅

i (3-18) Up to this stage, we can find j

ji v w

∂ easily from the above (3-18) as follows:

( )

j i ji v R v w ϕ ∂ = ⋅ ∂ (3-19) Form (3-12), we can further express (3-19) as a more complete form:

( )

1 exp

(

(

)

)

1 exp j i i i ji i i v a v R v R w ϕ av ∂ − − = ⋅ = ⋅ ∂ + − (3-20) Now the three terms

j y x ∂ ∂ , j j x v ∂ ∂ , and j ji v w

∂ in (3-9) have been found, we can express ji

y w ∂ ∂ in the following form:

( )

( )

(

) ( )

( )

(

(

(

( )

( )

)

)

)

2

(

(

( )

( )

)

)

2 exp 1 exp 1 ( 1) 1 exp 1 exp j j ji j j ji j i j j j j i i j j i i j j x v y y w x v w y v R v x a a v n a v n y n y n R x n x n a v n a v n ϕ ϕ ∂ ∂ ∂ = ∂ ∂ ∂ ∂ ∂ Δ = ⋅ Δ − − − + − = ⋅ ⋅ + − + + − (3-21)

Finally we can find the

ji J w ∂ ∂ in (3-6) as:

(

) (

) ( )

( )

(

( )

)

( )

(

)

(

)

2

(

(

( )

( )

)

)

2 exp 1 exp 1 ( 1) 1 exp 1 exp ji ji j j j j ji j j j i i j j i i j j J J y w y w x v J y y x v w a a v n a v n y n y n d y R x n x n a v n a v n=∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂ = ∂ ∂ ∂ ∂ − − − + − = − − ⋅ ⋅ ⋅ + − + + − (3-22)

Therefore the final step to perform the back-propagation algorithm of the continuous Hopfield NN is to combine all the above equations to get

(30)

(

) (

) ( )

( )

(

( )

)

( )

(

)

(

)

(

(

( )

( )

)

)

(

) (

) ( )

( )

(

( )

)

( )

(

)

(

)

(

(

( )

( )

)

)

2 2 2 exp 1 exp 1 ( 1) 1 exp 1 exp 2 exp 1 exp 1 ( 1) 1 exp 1 exp ji ji j j j i i j j i i j j j j j i i j j i i j j J w w a a v n a v n y n y n d y R x n x n a v n a v n a a v n a v n y n y n d y R x n x n a v n a v n η η η ∂ Δ = − ⎡ + − ⎤ ⎢ ⎥ = − − − ⋅ ⋅ ⋅ + − + + − ⎢ ⎥ ⎣ ⎦ − − − + − = − ⋅ ⋅ ⋅ + − + + − (3-23)

The complete back propagation equation for the training of continuous Hopfield NN is therefore

(

)

( )

( ) ( )

(

)

(

) ( )

( )

(

( )

)

( )

(

)

(

)

2

(

(

( )

( )

)

)

1 2 exp 1 exp 1 ( 1) 1 exp 1 exp ji ji j j j i i j j i i j j w n w n a a v n a v n y n y n d n y n R x n x n a v n a v n η + = + − − − + − − ⋅ ⋅ ⋅ + − + + − (3-24)

Up to this stage, we still need to find the vj for next iteration. This can be easily obtained from (3-18) (repeated here for convenience, as (3-25)), as we assume minimum energy requirement.

(

)

(

)

(

( )

1 1 1 n j ji i v n R w n ϕ v n = + = ⋅

+ i

)

(3-25) The following algorithm summarizes the above steps to complete the training process.

(31)

Algorithm 3-1: Back-propagation learning for continuous Hopfield neural network

Step 0: Given training pair { d n

( ) ( )

, ,y n n=0,1,...,N }, with the following initial conditions:

1. aj: The slope of hyperbolic tangent function 2. xj

( )

0 : Initial value of continuous Hopfield NN

3. wji

( )

0 : Initial synaptic weighting factors of the continuous Hopfield NN.

Step 1: Define the error signal as (3-1).

( )

( ) ( )

j

e n =d ny n

Step 2: Define the cost function J using the error signal as (3-2).

( )

{

( ) ( )

}

2 2

1 1

2 j 2

J = e n = d ny n Step 3: Decide the back-propagation update rule in (3-5).

(

1

)

( )

ji ji ji J w n w n w η ∂ + = − ∂

Step 4: Separate the partial derivative

ji J w ∂ ∂ in (3-6). ji ji J J y w y w=∂ ∂ ∂ ∂ ∂

Step 5: Get the result of

j J y ∂ ∂ in (3-8).

(

)

2

(

( ) ( )

)

1 2 J d y d n y n y y= ∂ ⎡ = − ⎢ ⎥ ∂ ∂ ⎣ ⎦

Step 6: Separate the partial derivative term

ji y w ∂ ∂ in (3-9). j j ji j j ji x v y y w x v w ∂ ∂ ∂ = ∂ ∂ ∂ ∂ ∂

(32)

Step 7: Get the approximation form of j y x ∂ ∂ in (3-11).

(

) ( )

( )

1 ( 1) j j j j y n y n y y x x x n x n + − ∂ Δ = = ∂ Δ + −

Step 8: Get the result of j

j x v ∂ ∂ in (3-14).

( )

(

( )

)

( )

(

)

(

)

2 2 exp 1 exp j j j j j j j j a a v n x v v ϕ a v n − ∂ ′ = = ∂ +

Step 9: Get the result of j

ji v w ∂ ∂ in (3-20).

( )

1 exp

(

(

( )

( )

)

)

1 exp i i j i ji i i a v n v R v R w ϕ a v n − − ∂ = ⋅ = ⋅ ∂ + −

Step 10: Define the correction Δwji

( )

n as (3-23).

( ) ( )

(

)

(

) ( )

( )

(

( )

)

( )

(

)

(

)

2

(

(

( )

( )

)

)

2 exp 1 exp 1 ( 1) 1 exp 1 exp ji ji j j j i i j j i i j j J w w a a v n a v n y n y n d n y n R x n x n a v n a v n η η ∂ Δ = − = − − − + − − ⋅ ⋅ ⋅ + − + + −

Step 11: Complete the back-propagation in (3-24).

(

)

( )

(

( ) ( )

)

(

) ( )

( )

(

( )

)

( )

(

)

(

)

2

(

(

( )

( )

)

)

1 2 exp 1 exp 1 ( 1) 1 exp 1 exp ji j j j i i ji j j i i j j w n a a v n a v n y n y n w n d n y n R x n x n a v n a v n η + = − − − + − + − ⋅ ⋅ ⋅ + − + + −

Step 12: Solve the differential equation with minimum energy condition:

(

)

(

) (

1 1 1 n j ji i v n R w n x n = + = ⋅

+ i

)

Step 13: n= +n 1, if nN, GOTO Step 1.

Step 14: Stop.

(33)

In Section 3.1, we have developed the back-propagation algorithm for the training of weighting factors in continuous Hopfield NN. The back-propagation algorithm will train the continuous Hopfield NN to generate the control signal to control the plant such that the output signal of the plant will be as close as possible to the desired input signal. But the training speed is very slow in Algorithm 3.1 with a arbitrary fixed learning rate. It is better if we can find a better dynamic learning rate in each iteration so that the convergent speed can be increased [12, 13].

It is very important to choose an appropriate learning rate (or step size) in the training process. If the learning rate is too large, the learning process will jump to the next iteration in a larger step and this may cause divergence in the training process. If the learning is too small, the learning process will be slow, and yet the convergence is not guaranteed. Thus, how to choose a suitable learning rate is important. With the concept of dynamic optimal training in [12, 13], we will develop a similar optimal training algorithm for the training of Hopfield NN. This process is to decide the learning rate η in each iteration so that the error energy will be reduced as much as possible. This will not yield a stable training process, but the convergence speed is also the fastest. The error energy function (cost function) at step has been defined in (3-2) and is listed here as (3-32):

n

( ) ( )

{

2 1 2 J = d ny n

}

(3-26) The cost function in the next step (n+ ) is: 1

(

)

1

{

(

) (

)

2

1 1

2

J n+ = d n+ −y n+1

}

(3-27) Now, it is our purpose to find an optimum learning rate η such that opt J n

(

+ −1

) ( )

J n ≤ 0 and J n

(

+ −1

)

J

( )

n is maximized. Suppose the function G

( )

⋅ represents an input dependent function so that we can have the output y=G x

( )

j . This implies G

( )

⋅ may be a

(34)

linear transfer function, a nonlinear differential equation, or even a look-up table. Thus we can get the following equation:

(

) ( )

(

) (

)

{

}

( ) ( )

(

)

(

)

{

}

( ) ( )

(

)

(

(

)

)

{

}

( ) ( )

(

)

(

)

( ) ( )

2 2 2 2 2 2 2 2 1 1 1 1 1 1 2 2 1 1 1 1 2 2 1 1 1 1 2 2 1 1 1 1 2 2 j j N ji i i J n J n d n y n d n y n d n G x n d n y n d n G v n d n y n d n G R w n x d n y n ϕ ϕ = + − = + − + − ⎡ − ⎤ ⎡ ⎤ = + − + − ⎡ − ⎤ ⎡ ⎤ = + − + − ⎡ − ⎤ ⎧ ⎡ ⎛ ⎞⎤⎫ ⎪ ⎪ = + − ⋅ + − ⎡ − ⎤ ⎝ ⎠ ⎪ ⎣ ⎦⎪ ⎩

⎭ (3-28)

We have already known that v nj

(

+ is a function of the weighting factors 1

)

wji

(

n+ . So 1

)

we know that (3-28) is also a function of the uncertain weighting factors wji

(

n+ . Further 1

)

we may rewrite the update of weighting factors in Step 10 of Algorithm 3-1 as follows:

( )

( ) ( )

(

)

(

) ( )

( )

(

( )

)

( )

(

)

(

)

2

(

(

( )

( )

)

)

2 exp 1 exp 1 ( 1) 1 exp 1 exp ji j j j i i opt j j i i j j w n a a v n a v n y n y n d n y n R x n x n a v n a v n η Δ = − − − + − ⋅ − ⋅ ⋅ ⋅ + − + + − (3-29)

Where ηopt is the dynamical optimal learning rate to be decided. Thus, we have the uncertain

correction Δwji

( )

n with an uncertain learning rate η . According to (3-24), we also get the opt uncertain new weighting factors wji

(

n+ . As we have discussed, 1

)

J n

(

+ −1

) ( )

J n is a function of the uncertain weighting factors wji

(

n+ . Combine all the above relations, we 1

)

may express J n

(

+ −1

) (

J n

)

as a function of the uncertain variable η . It means that what opt we have to do is to find an optimum value for the variable ηopt such that

and

(

1

) ( )

0

J n+ −J nJ n

(

+ −1

)

J

( )

n

)

is maximized. Now, we know that

is a function of uncertain variable

(

1

) (

(35)

(

1

)

( )

( )

opt

J n+ −J n =H η (3-30)

In other neural networks, the function H

( )

⋅ may be a simple parabolic curve, thus we can find η easily. But in this continuous Hopfield NN optimum learning rate algorithm, the opt function H

( )

⋅ is very complicated, we can apply the Matlab routine fminbnd [13] to find

the optimal learning rate η from opt J n

(

+ −1

) ( )

J n . After using Matlab routine to find η , opt we have finished the process of optimum learning rate. At the end of this section, we combine the important result in Section 3.1 and 3.2 to perform the training algorithm in continuous Hopfield NN.

Algorithm 3-2: Back-propagation learning of continuous Hopfield network with optimal learning rate

Step 0: Given training pair { d n

( ) ( )

, ,y n n=0,1,...,N }, with the following initial conditions:

1. aj: The slope of hyperbolic tangent function 2. xj

( )

0 : Initial value of continuous Hopfield NN

3. wji

( )

0 : Initial synaptic weighting factors of the continuous Hopfield NN.

Step 1: Use the hyperbolic tangent function

( )

(

( )

)

(

( )

)

( )

(

)

1 exp 1 exp j j j j j j a v n x n v n a v n ϕ − − = = + − to get

initial Hopfield controller output x n . j

( )

Step 2: Use control signal x n to control system plant j

( )

G

( )

⋅ and get output y n .

( )

(36)

Matlab routine fminbnd to find the optimal learning rate η . opt

Step 4: Use the Algorithm 3-1 to get the new weighting factors:

( ) ( )

(

)

(

) ( )

( )

(

( )

)

( )

(

)

(

)

(

(

( )

( )

)

)

(

)

( )

2 2 exp 1 exp 1 ( 1) 1 exp 1 exp 1 j j j i i ji opt i i j j ji ji ji a a v n a v n y n y n w d n y n R x n x n a v n a v n w n w n w η ⎧ + − − − − Δ = ⋅ − ⋅ ⋅ ⋅ ⎪⎪ + − + + − ⎨ ⎪ + = + Δ ⎪⎩

Step 5: Use the new weighting factors to get the solution of the Hopfield NN differential equation with minimum energy requirement:

(

)

(

) (

1 1 1 n j ji i v n R w n x n = + = ⋅

+ i

)

Step 6: n= +n 1, if nN, GOTO Step 1.

Step 7: Stop.

3.3 Hopfield NN as a Real-Time Controller

The above mentioned back propagation training for Hopfield NN can only be performed in a batch off-line processing. Once the training process is completed, the Hopfield must be connected in a real-time environment to serve as a real-time controller. However, we know that the Hopfield NN is a recurrent dynamic system. It has dynamic response from initial excitations. The Hopfield NN dynamic equation is in (3-13) (repeated here for convenience as (3-31)), 1 N j j i v d C v w x dt R = + =

ji i (3-31) If the Hopfield NN is with zero initial conditions, i.e.,xi

( )

0 = for all 0 i, then it is obvious that Hopfield NN will not have any response at all for . Therefore we need to set a non-zero initial condition for the control configuration in Figure 3-1. In Figure 3-1,

0 t>

j x is

(37)

the plant. This implies that {xj

( )

0 =ej

( )

0 , xi

( )

0 = for i j0 ≠ }.To see the effect of this initial configuration, we have the following Theorem 2.

Theorem 2:

If wjj is negative, then the initial excitation to the Hopfield NN in Figure 3-1 will have a stable response in terms of the maximum decay of v t with respect to j

( )

ej

( )

0 .

Proof:

The following (3-32) is the solution of (3-31):

( )

1 1 1 0 N N t RC j ji i j ji i i i v R w x v R w x e − = = ⎛ = ⋅ + − ⋅ ⋅ ⎝ ⎠

⎞⎟ i (3-32)

Further, substituting

( )

into (3-32), we have

1 (0) 0 N j ji i v w x = =

( )

1 1 1 1 0 N N N t RC j ji i ji i ji i i i i v R w x w x R w x e − = = = ⎛ = ⋅ + − ⋅ ⋅ ⎝ ⎠

⎞⎟ (3-33) Since the output of Hopfield NN controller is a particular neuron output xj. Thus, we can rewrite (3-33) as:

( )

( )

1 1 1 1 0 0 N N N t RC j ji i jj j ji i ji i i i i i j v R w x w x w x R w x e − = = = ≠ ⎛ ⎞ ⎜ ⎟ = ⋅ + + − ⋅ ⋅ ⎜ ⎟ ⎝ ⎠

(3-34)

Now, the initial excitations of the Hopfield NN are xj

( )

0 = and ej xi

( )

0 = 0 for i≠ . j Therefore (3-34) becomes 1 1 1 N N t RC j ji i jj j ji i i i v R w x w e R w x e − = = ⎛ = ⋅ + − ⋅ ⋅ ⎝ ⎠

⎞⎟ (3-35) Eq. (3-35) shows that vj is a function of ej. Differentiating (3-35) with respect to ej, we can get: 1 t j RC jj j dv e w de − = ⋅ (3-36)

(38)

The first term 1 t RC e

in (3-36) is always positive, and the second term wjj is the self-feedback of Hopfield neural network. In order for the function vj to decay with increasing ej, wjj needs to be a negative number. Thus, if wjj is a negative number, then

j

v in (3-35) is a decreasing function of ej. It means that we should choose a large ej to get the fastest response of vj. Ii is obvious that the initial value ej =ej

( )

0 is the largest, since the initial output is always zero.

(39)

CHAPTER 4

Experimental Results

In this chapter, we use the algorithm introduced in Chapter 3 to control the inverted pendulum system in Section 4.1, and the aircraft attitude control in Section 4.2.

4.1 Example 1: The Inverted Pendulum System (IPS)

Inverted pendulum is a nonlinear and unstable system, and it is the most popular benchmark for new control algorithms to verify their advantages [16].

m

c

m u

l

θ

Figure 4-1. The inverted pendulum system

According to Figure 4-1, we let the angle θ which is between the pendulum and the vertical line be equal to the first state θ1, and the angular speed θ be the second state θ2. Then we can get the following state equation:

1 2 2 2 1 1 1 1 2 2 2 1 1

cos sin cos sin cos cos 4 4 3 3 c c c c ml g m m m m u m m l l m m m m θ θ θ θ θ θ θ θ θ θ = − + + = + ⎛ ⎞ ⎛ ⎞ − − ⎜ + ⎟ ⎜ + ⎟ ⎝ ⎠ ⎝ ⎠   (4-1) Where

(40)

1 2 : : : : : : : c

The constant of acceleration of gravity The mass attached to the pendulum The mass of based car

The length of pendulum arm

Angle between pendulum and vertical line Angular speed Control sig

g

m

m

l

u

θ θ nal

In our example, the parameters of the inverted pendulum are defined in the following values:

2 9.8 / sec ; 0.1 1 ; 0.5 c m k kg m

g

m

m

l

= = = = g

Thus, we can further express (4-1) as

1 2

2

1 2 1 1 1

2 2 2

1 1

215.6 sin cos sin 2 cos 14.667 cos 14.667 cos x u θ θ θ θ θ θ θ θ θ = − = + − −   (4-2)

The control objective is to stabilize the inverted pendulum with initial angle between 10 and . Note that the state equations in (4-2) are only used for simulation purpose. It is by no means used to design the Hopfield NN controller. For training data set, we generate 6 data set which correspond to six initial angles, i.e., {10°, 7°, 3°, -3°, -7°, -10°}. The six data sets are shown in Figure 4-2.

°

10° −

(41)

0 1 2 3 4 5 6 7 8 9 10 -15 -10 -5 0 5 10 15

Training data of inverted pendulum system

A ngl e ( D egr ee s ) Time (Second)

Figure 4-2. The six training curves for the control of IPS using Hopfield NN

The overall real control architecture of Hopfield NN controller is shown in Figure 4-3. The Hopfield NN in this application has two neurons and the first neuron output x1 is the control signal.

Figure 4-3. Real-time SISO control architecture of Hopfield NN controller

After training by the Algorithm 3-2 developed in Chapter 3, the trained weighting factors in Hopfield NN can be used to generate control signal. The values of capacitor and resistance are

(42)

10 uF and 1K Ohms respectively. The final four weighting factors in this application are shown in the following Table 4-1. Table 4-1 also shows the resistance values for the weighting factors.

Weighting factor w 11 w 12 w 21 w 22

Trained value -3.4275 -0.012878 -2.1702 0.2845

| Resistance | 0.2918Ω 77.6518Ω 0.4608Ω 3.5149Ω

Table 4-1. Trained weighting factors of IPS

The first weighting factor w11 is negative. It is the fact from Theorem 2 discussed in Chapter 3. Three cases with different initial angles and different initial angular speed will be adopted to test the Hopfield NN controller. There are two figures in each of those cases. The first one is about the final angle output θ1 in actual real time control case, which is a stable situation in this inverted pendulum system. The second figure is the control signal generated from the trained Hopfield NN.

(43)

Case 1. Initial angle θ1

( )

0 =10°, initial angular speed θ2

( )

0 =0

(

°/ sec

)

0 1 2 3 4 5 6 7 8 9 10 -15 -10 -5 0 5 10 15

Actual running case stable situation

A ngl e ( D egr ee s ) Time (Second)

Figure 4-4. The actual running stable situation for Case 1

0 0.5 1 1.5 2 2.5 -5 -4 -3 -2 -1 0 1

The control signal generated from Hopfield neural network

F or c e ( N ew to n) Time (Second)

(44)

Case 2. Initial angle θ1

( )

0 = −8°, initial angular speed θ2

( )

0 =4

(

°/ sec

)

0 1 2 3 4 5 6 7 8 9 10 -15 -10 -5 0 5 10 15

Actual running case stable situation

A ngl e ( D egr ee s ) Time (Second)

Figure 4-6. The actual running stable situation for Case 2

0 0.5 1 1.5 2 2.5 -1 0 1 2 3 4 5

The control signal generated from Hopfield neural network

F or c e ( N ew to n) Time (Second)

(45)

Case 3. Initial angle θ1

( )

0 = −5°, initial angular speed θ2

( )

0 = −3

(

°/ sec

)

0 1 2 3 4 5 6 7 8 9 10 -15 -10 -5 0 5 10 15

Actual running case stable situation

A ngl e ( D egr ee s ) Time (Second)

Figure 4-8. The actual running stable situation for Case 3

0 0.5 1 1.5 2 2.5 -1 0 1 2 3 4 5

The control signal generated from Hopfield neural network

F or c e ( N ew to n) Time (Second)

(46)

In above three cases, we can find that the system output angles θ will be stable in our desired range. It means that the algorithm discussed in Chapter 3 is useful to control the nonlinear inverted pendulum system.

4.2 Example 2: The aircraft attitude control system

The aircraft attitude control system is different from the inverted pendulum system. It is a simplified linear system [17]. The control surfaces of modern aircraft are controlled by electric actuators with electronics controls. Figure 4-10 illustrates the control block diagram of one axis of such a position control system.

Figure 4-10. Block diagram of an attitude-control system of an aircraft

The objective of the system is to have the output of the system, θy

( )

t , follow the unit step input θr

( )

t . The transfer function is defined as

( )

( )

( )

(

4500

)

361.2 y r s K G s s s s θ θ = = + (4-3)

Where K is gain parameter of preamplifier. When we have introduced the aircraft attitude control system, we must set the specifications as follows:

1. Steady state error due to unit ramp input ≤ 0.000443 2. Maximum overshoot ≤ 5 percent

(47)

4. Settling time ≤ 0.007 sec

Now, we will design the Hopfield NN controller for this problem so that the above specifications can be satisfied. The first specification is different from the other specification, so we discuss it first. It is the specification about steady state error due to unit ramp input. It must be satisfied by using preamplifier K. The system transfer function in (4-3) has a term in denominator, so it is a type 1 system. For type 1 system, the steady state error due to unit step input is zero, but it is a constant for unit ramp input. Thus we must choose a proper gain of preamplifier

s

K to reach the first specification. Now, we compute the velocity error constant kv of transfer function in (4-3):

( )

(

)

0 0 4500 lim lim 12.45847 361.2 v s s K k sG s s s s → → = = = + K (4-4) As we get the velocity error constant , we can compute the steady state error due to unit ramp input v k

(

)

ss e ramp :

(

)

1 1 0.08026 12.45847 ss v e ramp k K = = = 1 K (4-5)

According to the first specification, we should let the result of (4-5) be smaller than 0.000443. Thus we calculate the minimum value of gain of preamplifier K:

1

0.08026 0.000443 K 181.17

K ≤ ⇒ ≥ (4-6)

In order to reach the first specification, we choose the gain of preamplifier K equal to 181.17. Thus the transfer function G s becomes to

( )

( )

(

815265

)

361.2 G s s s = + (4-7) Now we hope the output of the system can reach the specifications in actual real time control case. The overall real control architecture of Hopfield NN controller is shown in Figure 4-3. The Hopfield NN in this application has two neurons and the first neuron output x1 is the control signal.

(48)

Figure 4-11. Real control architecture of Hopfield NN controller

For training data set, we can generate time response curve as shown in Figure 4-12 so that the above 2, 3, 4 specifications. That is, maximum overshoot = 0.91 percent, rise time = 0.00284 sec and settling time = 0.00424 sec in Figure 4-12.

0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0 0.2 0.4 0.6 0.8 1 1.2 1.4 Time Ma g n it u d e

Training data of aircraft control system

Figure 4-12. The training data of the aircraft control system

(49)

Hopfield NN can be used to generate control signal. The final four weighting factors in this application are:

Weighting factor w 11 w 12 w 21 w 22

Trained value -47.552 -0.000032 -44.98 -0.048

| Resistance | 0.021Ω 31250Ω 0.0222Ω 20.833Ω

Table 4-2. Trained weighting factors of aircraft system

The following Figure 4-13 is the output when the Hopfield NN is applied to the closed-loop control of the attitude control of aircraft.

0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0 0.2 0.4 0.6 0.8 1 1.2 1.4 Time Ma g n it u d e

Actual running of aircraft control system

Figure 4-13. The output of the aircraft control system by Hopfield NN controller

Figure 4-14 shows the response of Figure 4-13 in transient period (0 ~ 0.01 sec). It is obvious from Figure 4-14 that maximum overshoot is 3.77% ≤ 5 percent, rise time is 0.0028sec ≤ 0.005 sec and settling time is 0.0052 sec ≤ 0.007 sec. These data shows that the Hopfield NN controller indeed can be applied as a controller in this linear control system.

(50)

Figure 4-14. The plot of Figure 4-13 in transient period Figure 4-15 shows the control signal generated from the Hopfield NN controller.

0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 -0.2 0 0.2 0.4 0.6 0.8 1 1.2

The control signal generated from Hopfield neural network

M a g n it id e Time

Figure 4-15. The control signal the aircraft control system

In this problem, we have shown that the Hopfield NN controller can be used to control the linear system like the aircraft control system.

數據

Figure 2-1 shows a kind of recurrent neural network, which consists of a set of neurons form a  multiple-loop feedback system
Figure 2-2. The additive model of a single Hopfield neuron
Figure 2-3. The hyperbolic tangent function
Figure 2-4. The inverse of hyperbolic tangent function
+7

參考文獻

相關文件

Programming languages can be used to create programs that control the behavior of a. machine and/or to express algorithms precisely.” -

There are existing learning resources that cater for different learning abilities, styles and interests. Teachers can easily create differentiated learning resources/tasks for CLD and

After the desired content has been identified, the control point needs to determine which transfer protocol and data format should be used to transfer the content from the

• Thresholded image gradients are sampled over 16x16 array of locations in scale space. • Create array of

fostering independent application of reading strategies Strategy 7: Provide opportunities for students to track, reflect on, and share their learning progress (destination). •

Strategy 3: Offer descriptive feedback during the learning process (enabling strategy). Where the

Now, nearly all of the current flows through wire S since it has a much lower resistance than the light bulb. The light bulb does not glow because the current flowing through it

In addition that the training quality is enhanced with the improvement of course materials, the practice program can be strengthened by hiring better instructors and adding