A First Course in FUZZY and NEURAL CONTROL

(singke) #1
6.4. EXAMPLE: TEMPERATURE CONTROL 205

6.4.1 A neural network for temperature control


Wefirst demonstrate a very simple neural network control application, where the
neural network is intended to function as an ON/OFF controller. The objective
here is to train the neural network so that when the measured temperature is
higher than desired, the neural controller shuts OFF the furnace, and when the
measured temperature is below the desired temperature, the neural controller
turns ON the furnace. We must therefore train the neural network to recognize
the error between desired and measured temperatures and provide ON/OFF
control. Figure 6.2 illustrates the control loop in which a trained neural net-
work acts as the ON/OFF controller.


Figure 6.2. Neural network for ON/OFF control

In order to train a neural network, we mustfirst decide what type of patterns
we must use so that the trained network will be able to provide the desired
control actions for a wide range of variability in the error signal. Typically,
we wish to select a pattern that is oscillatory in nature and has some damping
associated with it. We therefore select a damped sinusoid and expect a trained
neural network to provide generalization for many other variations in the error
signal. For this example, we generate a training pattern vectorp(i),fori=1, 50.
We also generate a target vectort(i),fori=1, 50 so that each value inp(i)has
a corresponding target valuet(i). Since this is an ON/OFF controller design,
we set all positive values ofp(i)to have a targett(i)=+1, and for all negative
values ofp(i)we sett(i)=− 1. This is similar to a relay switch. Note that
since the pattern vector is assumed to represent the error signal that is the
difference ìreference minus measured,î training the neural network to a relay
characteristic would provide the necessary ON/OFF controller design.
First we generate the training pattern, in this case a damped sinusoid, from
which we develop the appropriate target vectors. We set the target as+1for
all positive values of the damped sinusoid and to− 1 for all negative values of
the damped sinusoid. This is illustrated in the followingMatlabcode.


w=2*pi;
time=0;
for i=1:50,
Free download pdf