9_nnc_part1.pdf

Upload: jason-chiang

Post on 03-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 9_NNC_Part1.pdf

    1/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 11

    111Instructor: Dr. Song

    Dept. of Mechanical Engineering

    Contribution from Mr. Ning Ma is greatly appreciated.

    Control of Smart StructuresTopic 9Introduction to Neural Networks and

    Its Application to Control of SMAs

    Part 1

    Introduction to Neural Networks

  • 7/28/2019 9_NNC_Part1.pdf

    2/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 12

    222Instructor: Dr. Song

    Dept. of Mechanical Engineering

    Outline

    Introduction to neural networks.

    Application of neural networks in system

    identification and control.

    Implementation of neural networks using Matlab.

  • 7/28/2019 9_NNC_Part1.pdf

    3/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 13

    333Instructor: Dr. Song

    Dept. of Mechanical Engineering

    Introduction to Neural Networks What is neural networks?

    Why use neural networks?

    General architecture of neural networks.

    Models of a neuron.

    Connections.

    Learning of neural networks.

  • 7/28/2019 9_NNC_Part1.pdf

    4/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 14

    444Instructor: Dr. Song

    Dept. of Mechanical Engineering

    What is Neural Networks

    A neural network is a massively parallel distributed

    processor made of simple processing units, which has anatural propensity for storing experiential knowledge and

    making it available for use. It resembles the brain in two

    respects:1. Knowledge is acquired by the network from its environmentthrough a learning process.

    2. Interneuron connection strengths, known as synaptic weights, are

    used to store the acquired knowledge.

    This definition is adapted from Aleksander and Morton (1990)

  • 7/28/2019 9_NNC_Part1.pdf

    5/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 15

    555Instructor: Dr. Song

    Dept. of Mechanical Engineering

    Why use neural networks Nonlinear function mapping.Nonlinear function mapping of neural networks

    makes it possible to approximate the physical world which is inherently

    nonlinear.

    Learning and adaptation. Networks are trained using past data measured

    from the plant. A well-trained network then has the ability to generalize

    when presented with inputs not appearing in the training data. Networks

    have also a build-in capability to adapt their synaptic weights to changes.

    Parallel distributed processing.Networks have a highly parallel structure

    which lends itself to a higher degree of error tolerance than conventional

    schemes and fast computing. Multivariable systems.Neural Networks naturally process many inputs and

    have many outputs.

  • 7/28/2019 9_NNC_Part1.pdf

    6/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 16

    666Instructor: Dr. SongDept. of Mechanical Engineering

    General Architecture of Neural Networks

    The neural network architecture is defined by the basic

    processing elements: neurons, and the way in which they are

    interconnected.

    In literature, there are several types of neural networks

    presented. Each type of neural networks is characterized by

    its architecture.

    Due to their various architectures, those types of neural

    networks show different performances for a certain

    application.

  • 7/28/2019 9_NNC_Part1.pdf

    7/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 17

    777Instructor: Dr. SongDept. of Mechanical Engineering

    Models of A Neuron (1)

    Three basic elements of the

    neuron model:

    A set of connecting links;

    An adder for summing the

    input signals; An activation function.

  • 7/28/2019 9_NNC_Part1.pdf

    8/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 18

    888Instructor: Dr. SongDept. of Mechanical Engineering

    Models of A Neuron (2)

    In mathematical view, the

    neuron may be described by

    following equations:

    )

    1

    ( kkk

    m

    j

    jkjk

    buy

    and

    xwU

    +=

    = =

  • 7/28/2019 9_NNC_Part1.pdf

    9/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 19

    999Instructor: Dr. SongDept. of Mechanical Engineering

    Models of A Neuron (3)Three basic types of activation function:

  • 7/28/2019 9_NNC_Part1.pdf

    10/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 110

    101010Instructor: Dr. SongDept. of Mechanical Engineering

    Connections The neurons by themselves are not very powerful in terms of

    computation or representation. But, their interconnectionsallows us to encode relations between the variables giving

    different powerful processing capabilities.

    In general, three fundamental types of interconnections of

    neural networks are defined in literature : single-layer

    feedforward networks, multilayer feedforward networks and

    recurrent networks.

    There exist numerous neural network architectures, such as

    Hopfield nets, Boltzmann machine, etc.

  • 7/28/2019 9_NNC_Part1.pdf

    11/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 111

    111111Instructor: Dr. SongDept. of Mechanical Engineering

    Single-Layer Feedforward NetworksThis type of networks consists of a input layer of input

    nodes and a output layer of neurons

  • 7/28/2019 9_NNC_Part1.pdf

    12/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 112

    121212Instructor: Dr. SongDept. of Mechanical Engineering

    Multilayer Feedforward NetworksThe multilayer feedforward networks distinguish themselves by thepresence of one or more hidden layers. In addition, the neurons ineach layer have as their inputs the output signals of the precedinglayer only.

  • 7/28/2019 9_NNC_Part1.pdf

    13/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 113

    131313Instructor: Dr. SongDept. of Mechanical Engineering

    Recurrent NetworksThe recurrent network distinguishes itself in that it has at lest onefeedback loop. The feedback loop can be either self-feedback loop orglobal feedback loop.Moreover, the feedback loop and the unit-delayelements result in a nonlinear dynamicalbehavior of the network.

  • 7/28/2019 9_NNC_Part1.pdf

    14/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 114

    141414Instructor: Dr. SongDept. of Mechanical Engineering

    Learning of Neural Networks Learning is a process by which the free parameters of a neural network are

    adapted through a process of stimulation by the environment in which the

    network is embedded. The type of learning is determined by the manner inwhich the parameter changes take place.

    The learning process involves three events:

    The neural network is stimulated by the environment.

    The neural network undergoes changes in its free parameters.

    The neural network responds in a new way to the environment.

    In literature, there exist many learning algorithms.

    Learning algorithms can be classified into two main group: supervised learningand unsupervised learning.

  • 7/28/2019 9_NNC_Part1.pdf

    15/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 115

    151515Instructor: Dr. SongDept. of Mechanical Engineering

    Back-Propagation Learning Algorithm Back-Propagation (BP) learning algorithm is based on the error-correction

    learning.

    BP learning algorithm is the most efficient algorithm used in adaptingMultilayer Feedforward Networks.

    BP learning consists of two passes through the different layers of the network: a

    forward pass and abackward pass.

    In the forward pass, the input is applied to the network, and its effectpropagates through the layers. Finally, a set of outputs is produced as the

    actual response of the network. During this forward pass the synaptic

    weights of the network are fixed.

    During the backward pass, though, the synaptic weights are all adjusted inaccordance with an error-correction rule. The actual response of the

    network is subtracted from the target response to generate the error signal.

    This error is then back-propagated through the network, against the

    direction of synaptic connections, and hence the term back-propagation.

  • 7/28/2019 9_NNC_Part1.pdf

    16/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 116

    161616Instructor: Dr. SongDept. of Mechanical Engineering

    Application of neural networks in system

    identification and control.

    Brief review of application of neural network in system

    identification and control. System identification using neural networks.

    Control themes using neural networks.

  • 7/28/2019 9_NNC_Part1.pdf

    17/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 117

    171717Instructor: Dr. SongDept. of Mechanical Engineering

    Brief review of application of neural network in

    system identification and control. The nonlinear mapping property of the neural network are

    central to its use in the system identification and control. The ability of the ANN to represent an arbitrary nonlinear

    relations is already established. It could be stated that any

    continuous function can be approximated by just a multi-

    layer network, if there are a sufficient number of hidden

    neurons in the networks.

    For networks application in system identification and

    control, the key questions are how many hidden layers

    should be used and how many neurons are required in each

    layer.

  • 7/28/2019 9_NNC_Part1.pdf

    18/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 118

    181818Instructor: Dr. SongDept. of Mechanical Engineering

    System Identification Using Neural NetworksFeedforward Modeling

    Plant

    LearningAlgorithm

    NeuralNetw orkModel

    U

    d

    d

    ym

    error

    yp

    +

    +

    +

    _

  • 7/28/2019 9_NNC_Part1.pdf

    19/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 119

    191919Instructor: Dr. SongDept. of Mechanical Engineering

    System Identification Using Neural NetworksInverse Modeling

    Direct method

    Plant

    LearningAlgorithm

    NeuralNetw orkInverse

    Model

    U

    d

    ym

    error

    yp+

    _

  • 7/28/2019 9_NNC_Part1.pdf

    20/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 120

    202020Instructor: Dr. SongDept. of Mechanical Engineering

    System Identification Using Neural NetworksInverse Modeling

    Direct method

    Conceptually the simplest approach is directinverse training [Psaltis et al, 1988] as shownschematically in right figure. The output of the

    plant is used as input to the neural network.Then, the output of the network is compared

    with the plants input. The error is used to trainthe neural network.

    It is clear that the training procedure will force

    the network to represent the inverse model ofthe plant. However, this training method hastwo drawbacks. First, it is not goal directed[Jordan and Rumelhart, 1991]. Second, if the

    nonlinear system is not invertible, an incorrectinverse can be obtained.

    Plant

    LearningAlgorithm

    NeuralNetw orkInverseModel

    U

    d

    ym

    error

    yp

  • 7/28/2019 9_NNC_Part1.pdf

    21/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 121

    212121Instructor: Dr. SongDept. of Mechanical Engineering

    System Identification Using Neural NetworksInverse Modeling

    Specialized method (the NN Models output is used)

    Plant

    LearningAlgorithm

    NeuralNetw orkInverse

    Model

    U

    d

    ym

    error

    yp

    NeuralNetw ork

    Model

    r

    _+

  • 7/28/2019 9_NNC_Part1.pdf

    22/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 122

    222222Instructor: Dr. SongDept. of Mechanical Engineering

    System Identification Using Neural NetworksInverse Modeling

    Specialized method

    The other approach to overcome these

    problems was known as specialized inverselearning [Psaltis et al, 1988], which isillustrated in right figure. In this approach,the network inverse model precedes the

    plant. The command signal is fed into thisnetwork and the output of the network will

    be sent to the plant, as well as anestablished network feedforward model

    parallel with the plant. The error signal for

    the training algorithm in this case is thedifference between the output of thenetwork feedforward model and thecommand signal. This approach trends to

    make unity transfer function from thecommand signal to the output of the plant.

    Plant

    LearningAlgorithm

    NeuralNetw orkInverseModel

    U

    d

    ym

    error

    yp

    NeuralNetw orkModel

    r

  • 7/28/2019 9_NNC_Part1.pdf

    23/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 123

    232323Instructor: Dr. SongDept. of Mechanical Engineering

    Control themes Using Neural Networks

    Direct inverse control. Model reference control.

    Internal Model control.

    Predictive control.

  • 7/28/2019 9_NNC_Part1.pdf

    24/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 124

    242424Instructor: Dr. SongDept. of Mechanical Engineering

    Direct Inverse Control

    Plant

    NeuralNetw orkInverse

    Model

    U

    d

    ypr

  • 7/28/2019 9_NNC_Part1.pdf

    25/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 125

    252525Instructor: Dr. SongDept. of Mechanical Engineering

    Model Reference Control (MRC)

    NN Controller

    Represents desired performance

  • 7/28/2019 9_NNC_Part1.pdf

    26/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 126

    262626Instructor: Dr. SongDept. of Mechanical Engineering

    Internal Model Control (IMC)

    Limited to open-loop stable systems.

    Linear Filter

    Inverse Model

    (NN Controller)

    NN Plant Model

    Plant

    27

  • 7/28/2019 9_NNC_Part1.pdf

    27/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 127

    272727Instructor: Dr. SongDept. of Mechanical Engineering

    Predictive Control

    NN Controller

    Iterative optimization

    NN Plant Model

    (predict the plant future)

    Iterative algorithm

    Optimal solution

    28

  • 7/28/2019 9_NNC_Part1.pdf

    28/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 128

    282828Instructor: Dr. SongDept. of Mechanical Engineering

    Implementation of Neural Networks Using Matlab

    Introduction to fundamental commands and

    concepts in Matlab Neural Network Toolbox.

    Example: construct a Multilayer Feedforward

    Network.

    29

  • 7/28/2019 9_NNC_Part1.pdf

    29/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 129

    292929Instructor: Dr. SongDept. of Mechanical Engineering

    Introduction to fundamental functions and concepts

    in Matlab Neural Network Toolbox

    A neural network is represented as an object in Matlab toolbox.

    Using Matlab, users can construct Feedforward Networks, RecurrentNetworks, Radial Basis Networks, Competitive Neural Networks, etc.

    For different types of neural networks, Matlab provides corresponding

    functions to create and train the neural networks.

    Users can specify the weights, activation functions, learning algorithms,

    initial values and bias respectively.

    The following introduction and example are only applicable to Multilayer

    Feedforward Networks.

    30

  • 7/28/2019 9_NNC_Part1.pdf

    30/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 130

    303030Instructor: Dr. SongDept. of Mechanical Engineering

    Introduction to fundamental functions and concepts

    in Matlab Neural Network Toolbox(2)

    newff(PR,[S1 S2...SNl],{TF1 TF2...TFNl},BTF,BLF,PF)

    creates a new N layer feed-forward backpropagation network. PR - R x 2 matrix of min and max values for R input elements.

    Si - Size of ith layer, for Nl layers.

    TFi - Transfer function of ith layer, default is Hyperbolic tangent sigmoidtransfer function.

    BTF - Backpropagation network training function, default is Gradient descentwith momentum and adaptive learning rate backpropagation.

    BLF - Backpropagation weight/bias learning function, default is Gradientdescent with momentum weight and bias learning function.

    PF - Performance function, default is Mean squared error performancefunction.

    31

  • 7/28/2019 9_NNC_Part1.pdf

    31/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 131

    313131Instructor: Dr. SongDept. of Mechanical Engineering

    Introduction to fundamental functions and concepts

    in Matlab Neural Network Toolbox(3)

    train (NET,P,T,Pi,Ai,VV,TV)

    net - Neural Network created by function newff().

    P - Network inputs.

    T - Network targets, default = zeros.

    Pi - Initial input delay conditions, default = zeros.

    Ai - Initial layer delay conditions, default = zeros. VV - Structure of validation vectors, default = [].

    TV - Structure of test vectors, default = [].

    Train function trains a network net according to net.trainFcn and

    net.trainParam. Before start of training, two parameters must be specified.

    Net.trainparam.epochs: the upper limit of training iteration.

    Net.trainparam.goal: the value of performance function.

    32

  • 7/28/2019 9_NNC_Part1.pdf

    32/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 132

    323232Instructor: Dr. SongDept. of Mechanical Engineering

    Introduction to fundamental functions and concepts

    in Matlab Neural Network Toolbox(4)

    sim(net,P,Pi,Ai,T)

    Simulate the well-trained network

    net - Network.

    P - Network inputs.

    Pi - Initial input delay conditions, default = zeros.

    Ai - Initial layer delay conditions, default = zeros. T - Network targets, default = zeros.

    Return the output of the network.

    gensim(net,st)

    Generate Simulink block of the network.

    net - Neural network.

    st - Sample time (default = 1).

    33

  • 7/28/2019 9_NNC_Part1.pdf

    33/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 133

    333333Instructor: Dr. SongDept. of Mechanical Engineering

    0 20 40 60 80 100 120 140 160 180 200-4

    -2

    0

    2

    4the input signal

    time

    input

    signalmagnitude

    0 20 40 60 80 100 120 140 160 180 200-15

    -10

    -5

    0

    5the output signal

    time

    outputsignalmagnitude

    Example: construct a Multilayer

    Feedforward Network.The systems input and measured output are shown in the figures below. From these data, a

    Multilayer Feedforward Network is employed to model the unknown system.

    34

  • 7/28/2019 9_NNC_Part1.pdf

    34/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 134

    343434Instructor: Dr. SongDept. of Mechanical Engineering

    Example: construct a Multilayer

    Feedforward Network.

    A Multilayer Feedforward Network was used to model the system. The

    network has one hidden layer in which there are eight neurons. The inputsof the network are current value of input to the system and previous value

    inputs to the system, because we consider this is a dynamic process.

    Input Layer Hidden Layer (8 cells) Output Layer

    U(k)

    U(k-1)

    U(k-2)

    9 I d i N l N k d I A li i C l f SMA P 135

  • 7/28/2019 9_NNC_Part1.pdf

    35/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 135

    353535Instructor: Dr. SongDept. of Mechanical Engineering

    Matlab Code%Using first 500 data to train the networkU=u(1:500);U_delay1=[0 u(1:499)];U_delay2=[0 0 u(1:498)];

    Y=y(1:500);

    %construct the input matrix to the networkP=[U;U_delay1;U_delay2];

    %define the feedforward neural network with two layers

    Netexample=newff([minmax(U);minmax(U_delay1);minmax(U_delay2)],[8 1],{'tansig''purelin'},'trainlm');

    %set up the train parameters

    Netexample.trainparam.epochs=2000;Netexample.trainparam.goal=0.01;

    %train the network

    predictor=train(Netexample,P,Y);%test and verify the network using later 500 data

    U=u(501:999);U_delay1=u(500:998);U_delay2=u(499:997);P=[U;U_delay1;U_delay2];

    NetOutput=sim(Netexample,P);

    9 I t d ti t N l N t k d It A li ti t C t l f SMA P t 136

  • 7/28/2019 9_NNC_Part1.pdf

    36/36

    9. Introduction to Neural Networks and Its Application to Control of SMAs Part 136

    Comparison of Networks output and

    systems output

    500 550 600 650 700 750 800 850 900 950 1000-25

    -20

    -15

    -10

    -5

    0

    5the plot of the real output and Networks output

    time instant

    output/prediction

    Network outputreal output