Back to Theses

 

Vibration Control using CMAC Neural Networks

Master’s Project

Electrical Engineering

20-April-1999 

Jon Frain

B.S.E.E., University of New Hampshire, 1997

 

1.0 Introduction  (Note Many of the diagrams' resolution suffered in the transfer to HTML)

The purpose of this project was to determine how well the CMAC (Cerebellar Model Articulation Controller) neural network performs in the area of vibration control. Specifically, a real-time experiment was conducted to determine the effectiveness of CMAC in a single-loop feedback control structure to electrically cancel a sinusoidal disturbance signal in an audio-speaker/microphone-speaker system. The feedback system diagram is shown in figure 1.1

wpe2.jpg (12121 bytes)

Figure 1.1: Block diagram of sine wave learning setup

 

The CMAC neural network, implemented using C code on a PC, was fed two digital signals:

    1. An input: the sinusoidal waveform used to excite the speaker.

    2. An error signal: the speaker output as measured by the microphone.

 

 The CMAC neural network has been successfully used in control systems for many years. Here at the University of New Hampshire, the CMAC neural network has been applied to areas such as pattern recognition, control of a biped robot and the control of an industrial robot.

The CMAC neural network outputs a digital signal, which was converted to an analog signal that attempted to cancel the disturbance in the system. The CMAC neural network accomplished this goal by learning the sinusoidal signal and outputting a signal of equal magnitude and opposite sign. The CMAC neural network constantly updates its weights to reduce the error.

Chapters two and three of this report provide the reader with a basic overview of neural networks, CMAC and vibration control. A brief section is also devoted to other work in the area of vibration control using neural networks. Chapter four contains an overview of version 2.1 of the UNH CMAC C code, developed by Dr. Thomas Miller [1], [21].

Chapter five contains information regarding the experiment. The results found in this section demonstrate that CMAC is an effective means of reducing the unwanted vibrations in a real-time manner. When possible, the results of this experiment have been compared with those obtained in a similar experiment that used a "weight smoothing CMAC" rather than the traditional CMAC approach used at the University of New Hampshire.

 

 

2.0 Overview of Neural Networks and CMAC

    1. What are Neural Networks?

    2. The ‘neuron’ is a specialized cell that is the basic anatomical unit in the nervous system. Neurons can connect to one another through the use of synapses. These synaptic contacts are the primary information-processing components of a neural system. Information is passed from neuron to neuron within the brains neural networks, allowing the brain to learn based on existing information. For the purpose of this report, a neural network is defined to be any computer algorithm, mathematical model, or piece of hardware that attempts to either:

      · Model the connectivity and functioning of the neurons found within the human brain, or

      · Attempts to duplicate the functioning of the human brain without trying to duplicate the physical connectivity of the brain.

      When discussing neural networks, a distinction should be made between those neural networks found in biological organisms and the (artificial) neural networks that are in some way modeled after those found in biological organisms. Generally, the word "artificial" is dropped when discussing the field of neural networks.

      Neural networks may be modeled, at least partially, on the connectivity and functionality in the human brain. The neural network may be modeled to function similarly to the human brain, without actually trying to model the properties of biological neurons. One of the initial goals of neural networks stemmed from a desire to create artificial systems capable of performing sophisticated, hopefully even "intelligent", computations similar to those performed by the human brain. Neurobiologists have shown that human nerve cells have no memory of their own, rather memory is made up of a series of connections, or associations, throughout the nervous system.

      Neural networks are "trained" using a set of data points. In other words, neural networks learn about a system based on the data that they are given. In many cases, what is learned can be generalized to other similar systems.

      Typical computers are excellent at performing fast arithmetic operations or doing exactly what they were programmed to do. They lack the ability to deal with noisy data, to operate completely in parallel efficiently or to adapt to a changing system. One of the goals of artificial neural networks is to reduce the shortcomings of typical computers. Another goal of artificial neural networks is to more closely resemble the functionality and behavior of biological neural networks.

 

    1. What is a Perceptron?

    2. In 1958, Frank Rosenblatt devised a machine called the perceptron that operated similarly to the human mind. The perceptron was an important precursor to modern neural networks because it was capable of "learning".

      Figure 2.1: A simple perceptron diagram

      A perceptron is a connected network that simulates an associative memory. The most basic perceptron is composed of an input layer and an output layer of nodes, each of which are fully connected to the other. See figure 2.1 for a diagram of the two-layer perceptron.

       

      Notice that the nodes in each layer have no connections to one another. "When layer 1 sends a signal to layer 2, the associated (adjustable) weights on the connections are applied and each receiving node on layer 2 sums up the incoming values. If the sum exceeds a given threshold, that node in turn fires an output signal" [5]. The Perceptron’s output could learn to match a desired output by adjusting the weights on the connections. The adjusting of weights to produce a particular output is called the "training" of the network. Training is the mechanism that allows the network to learn. Training is accomplished by passing a given set of inputs through the network and comparing the results with a set of desired outputs. If there is a difference between the actual and the desired outputs, the weights are adjusted to produce a set of outputs closer to the target values.

      The following paragraph, taken from [5], discusses the effect the perceptron had on neural network and artificial intelligence:

      "The introduction of the perceptron sparked a wave in neural network and artificial intelligence research. However, in 1969, Marvin Minsky and Seymour Papert published a book called Perceptrons: An Introduction to Computational Geometry, which emphasized the limitations of the perceptron and criticized claims on its usefulness. In effect, this killed funding for artificial intelligence and neural network research for 12-15 years".

    3. What is CMAC?

    4. James Albus developed the idea of a Cerebellar Model Articulation Controller (CMAC) in the early 1970’s ([18] and [19]). His goal was to use the perceptron to describe the behavior of the cerebellum. Neural network researchers failed to notice CMAC for quite some time. It wasn’t until the 1980’s that researchers began looking more closely into Albus’s CMAC. For a more comprehensive treatment of the subject refer to Miller, Kraft [1], [4], [6], [9] and [10].

      The Albus CMAC can be thought of as a set of overlapping, multi-dimensional layers (receptive fields), each of finite size. Albus’s CMAC is an alternative to what are called back-propagated neural networks. In Standard back-propagation, the output for a given input is calculated. Using the expected output (Teaching Input) the error between the actual and required output is computed. This error is propagated backwards, hence the name back-propagation, through the same links. The error for a non output-node is the weighted sum of error of nodes in upper layers. Two of the disadvantages of using backpropagation neural networks are that they require many iterations to converge and they generally require a large number of computations per iteration, slowing down the implementation. These disadvantages made it desirable to find alternatives.

      One of the benefits of CMAC is that it has local generalization, meaning that similar inputs produce similar outputs and dissimilar inputs produce nearly independent outputs. Another benefit of CMAC is its rapid convergence relative to backpropagation, meaning that the number of iterations required to converge is much smaller with CMAC. The rapid convergence time allows CMAC neural networks to work in real-time settings.

       

    5. How does CMAC work?

 

This description of CMAC has been summarized from that written by Miller, Glanz and Kraft [1]. This description explains CMAC in a mostly geometrical manner. Figure 2.2 shows a set-oriented block diagram of CMAC.

 

 

Figure 2.2: Set-oriented block diagram of CMAC

 

The input vector consists of N sensors and/or measurements of the desired goal. The input state space S consists of all possible N-dimensional input vectors to the CMAC. CMAC maps each input that it receives into a set of C points within its "conceptual" memory, A. As mentioned previously, inputs that are in a similar area within S will have their C points overlap and inputs that are not similar will not share points within the conceptual memory.

 

In most learning systems the entire input space is not used, which means that not all of the conceptual memory locations are used. Because of this, it is possible to map the conceptual memory locations (A) to the physical memory locations (A’). This results in a CMAC that will generate C physical memory locations. The contents of the physical memory locations are summed to generate the CMAC output f(s). Figure 2-2 contains the network diagram of a two-input CMAC that was implemented at the robotics laboratory at the University of New Hampshire by Miller [1].

 

                                                                    wpe1.jpg (17699 bytes)

 

Figure 2.3: Network diagram of a CMAC neural network with two inputs and one output

 

This CMAC utilizes input sensors to process the input state vector s. These input sensors have overlapping receptive fields, or regions of sensitivity, such that one input can excite more than one input sensor. As mentioned previously, CMAC can be thought of as a set of overlapping, multi-dimensional layers (receptive fields), each of finite size. The input sensors produce a binary output such that the output is ON if the input lies within the sensors receptive field and the output is off otherwise. Input generalization is controlled by the width of the receptive field. Input quantization is determined by the offset of adjacent receptive fields. Each input variable excites precisely C input sensors, where C is defined as the ratio of the generalization width to the quantization width. In this example, C is equal to 4 but in most applications C is between 32 and 256.

The binary outputs of the input sensors are fed to a series of state-space detectors, also called threshold logic units. The state-space detectors are used to produce logical AND functions, such that the output is ON only if all of the inputs are ON. The state-space detectors correspond to the memory locations A. CN memory locations would be

required if the receptive field detectors were fully connected to the state-space detectors. To reduce the number of state-space vectors to a reasonable number, the input sensors are connected such that only C state-space detectors are on for an input vector.

 

Since it is unlikely that all of the possible input vectors would be experienced, it is unnecessary to store the unique information of each individual receptive field. And so, the logical AND outputs of the state-space detectors are randomly connected to a set of multiple field detectors. Each multiple field detector produces a logical OR function such that the output is ON if any of the inputs is ON.

 

The output of each multiple field detector is connected, via an adjustable weight, to an output summing unit. The output for a specific input is the sum of all of the weights selected by the excited multiple field detectors. The set of all of the adjustable weights in figure 2.3 corresponds to the A’ memory locations of figure 2.2. The only fixed parameters in the design of a CMAC neural network, with a fixed number of inputs, are the number of input sensors and the number of state-space detectors. The design does have the freedom to adjust the level of quantization, the degree of generalization, the number of multiple field detectors and the adjustable weights.

 

It is desirable that the associative mapping used by a CMAC network creates a generalization between nearby points in the input space while distant points are not generalized. The random associative mapping can become problematic if two distinct state-space detector outputs map to the same multiple field detector, resulting in what are called "collisions". These collisions essentially represent the generalization of distant points. Collisions can be minimized through the use of a collision avoidance modification to the random hashing function.

 

 

    1.  

    2. Where have CMAC and Neural Networks been used?

 

The Robotics Laboratory at the University of New Hampshire has utilized CMAC for a wide range of problems including but not restricted to:

· "Pattern Recognition using a CMAC Based Learning System"[6]

· "Real-time Neural Network Control of a Biped Walking Robot"[7]

· "A CMAC-based cursive handwriting recognizer for the Windows for Pen Computing operating environment,"[8]

· "Deconvolution and nonlinear inverse filtering using a neural network"[9]

· "Analyzing Biological Signals with CMAC, A Neural Network"[10]

· "Real time dynamic control of an industrial manipulator using a neural network based learning controller." [22]

Some of the fields that have utilized neural networks (but not necessarily CMAC) as mentioned by [11] are:

· Financial/Economic Forecasting

· Bond Rating

· Bankruptcy Prediction

· Marketing/Scheduling

· Speech Recognition

· Optical Character Recognition

· Communications

· Industrial/Plant Applications

· Robotics

· Medical Diagnosis

· Biology

 

 

Neural networks have been used on a very limited basis in the field of vibration control. (Refer to the end of section 3.2 of this report).

 

3.0 Vibration Control

3.1 Overview

Vibrations, which occur in most machines, vehicles and structures are undesirable for many reasons. They can cause destructive motions and dynamic stresses that may lead to fatigue and/or failure of the structure or machine. They may adversely affect the performance of a system by counteracting the energy being put into the system. In the case of a submarine, a motor or engine may cause the hull to vibrate, making it more audible and vulnerable to enemy vessels. Vibrations can also produce noise, which is simply an undesired sound that could reduce productivity and/or cause hearing loss. Vibration control can be a very effective way of controlling noise or attenuating sound.

 

As stated by Beards [2]: "there are two factors which control the amplitude and frequency of vibration of a dynamic system: these are the excitation applied and the dynamic characteristics of the system. … The excitation arises from external sources, and these forces or motions may be periodic, harmonic or random in nature."

A control system is simply a system, typically electrical and/or mechanical, whose purpose is to cause another system to perform in a more desirable fashion. An example of a simple control system is the cruise control found in some cars. The driver "desires" to have the car travel at a fixed velocity. This "desired" velocity is compared with the actual velocity and the difference between the two is the error in the system. This error is used to change the position of the throttle in the proper direction allowing the vehicle to get closer to the "desired" velocity. The control system is always working in an effort to reduce the error signal to zero (or some other defined lower limit). The typical approach to vibration control, and most other linear control systems, is to first derive a model of the system to be controlled. Then, equations governing the model are derived. Finally, the vibration/noise in the system is minimized with the use of linear feedback. This approach is not practical or useful when dealing with non-linear systems.

 

 

 

Control systems can be broken down into two categories: adaptive and non-adaptive control systems. Non-adaptive control systems have fixed parameters that are used to control a system. These types of controllers have proven to be very successful in controlling linear, or almost linear, systems. An example of a non-adaptive control system is a PID (Proportional, Integral, Derivative) controller. This type of controller has three fixed parameters, or gains, that are used to control the behavior of a system. Adaptive control systems use adjustable parameters to modify the behavior of a system. The adjustable parameters are designed to change their values based on the current state of the system. In other words, the parameters adapt to better control the behavior of the system. This approach to controlling a system is useful when the system to be controlled can not be accurately modeled or if the system changes over time.

Neural network control systems can consist of thousands or millions of adjustable parameters, called weights. Neural networks have the ability to learn and store both linear and nonlinear functions. They are also able to adapt their weights as the system response changes.

3.2 Vibration Control using Neural Networks

Neural networks have been used on a limited basis in the field of vibration control. Gary Yen , at Oklahoma State University, performed "Frequency-Domain Vibration Control using (an) Adaptive Neural Network" [12] at the ASTREX (Advanced Space structures Technology Research Experiments) test facility. His results showed that the network not only did an excellent job of canceling power at the vibration frequencies, but it also compensated for the loss of actuators if one or more of them should fail.

 

A backpropagation neural network was used by Snyder and Tanaka to cancel the vibrations in a cantilever beam [13]. Their neural network controller was compared with a linear controller. Their neural network controller decreased the power in all the excited frequencies, including nonlinear frequencies, and cancelled the primary excitation vibration almost as well as the linear controller.

Ma and Sinha ran simulations demonstrating that a backpropagation neural network could cancel various excitation frequencies that changed during operation [14]. The network responded quickly to changes in the excitation frequency during their simulations. These experiments proved that neural networks can adapt to compensate for the change in excitation frequencies.

Work in the area of "Active Vibration Isolation Using Fuzzy CMAC Neural Networks" was performed at the Jet Propulsion Laboratory by Geng, Haynes, Wada and Garba [16].

They attempted to use strengths of both CMAC and Fuzzy Logic systems to control the vibration in a Hexapod Active Vibration Isolation (HAVI) system. The network successfully cancelled a single 100 Hz disturbance. The HAVI system proved that a modified CMAC neural network could be used for real-time vibration cancellation.

 

 

 

4.0 UNH CMAC Version 2.1 Code Overview

 

The University of New Hampshire Robotics laboratory has made it’s CMAC code freely available to everyone, as long as due credit is furnished whenever it is used. The C code and documentation[20] as well as a sample program and a windows based demonstration are available for download on the web[21].

 

 

4.1 UNH CMAC Parameters

 

 

These parameters are part of the integer CMAC written at the University of New Hampshire by Miller:

 

Beta

This parameter is associated with the "learning rate" of the CMAC. The learning rate for the UNH CMAC is defined as:

Learning Rate =

This is because the UNH CMAC is integer based and this method allows the learning rate to be implemented efficiently in the computer. The learning rate determines how quickly the CMAC will try to learn a signal. A learning rate of 0.5 means that the CMAC will output a value that is half way between the sampled value and the value that was predicted the last time this sample occurred. Using a low learning rate allows the CMAC to better handle noise in a system. The weights are updated according to the equation below. Note that the variable c is the generalization of the CMAC, and the amount each weight is updated is adjusted evenly through the weights.

weight(k+1) = weight(k) +

 

 

Collide_flag

A value of zero means that hashing collisions are allowed.

 

 

Field_shape

This parameter can be one of several constants and it sets the shape of the CMAC receptive fields.

ALBUS – Creates a conventional ALBUS CMAC with on-off receptive fields in a hyperdiagonal arrangement.

CUSTOM - Creates a CMAC with a user defined receptive field sensitivity function and arrangement.

LINEAR - Creates linearly-tapered receptive field sensitivity functions in a uniform arrangement. This arrangement is used for the CMACs in this project.

 

 

RECTANGULAR – Creates on-off receptive fields in a uniform arrangement.

 

SPLINE – Creates gaussian-like tapered receptive field sensitivity functions in a uniform arrangement.

Mem_size

This parameter defines the maximum number of integer memory words that can be stored by CMAC.

 

 

 

Num_cell

This parameter sets the number of weights that will be available to the CMAC during each iteration. This parameter is also known as the generalization parameter. In version 2.1, this parameter must be a power of 2, otherwise the code will not work properly.

 

Num_resp

This parameter defines the dimension of the output vector.

 

 

Num_state

This parameter informs the CMAC of how many input dimensions exist. For example, a value of 2 means that it is a two dimensional problem.

 

 

Quant

This variable determines the amount of sampling performed on the CMAC input variables. A value of 1 means that all of the integer points in the input space are available for training. If the value of quant is 2, then every other point in the input space is sampled.

 

 

 

 

4.2 Primary UNH CMAC Procedures

 

 

int allocate_cmac(int num_state,int *qnt_state,int num_resp,int num_cell,int memory,int field_shape,int collide_flag)

 

This procedure allocates a new CMAC as defined by the parameters. All of these parameters have been defined already except for *qnt_state. *qnt_state is a pointer to a vector of dimension num_state that defines the quantization parameters.

 

This procedure returns an integer value that defines the CMAC for later calls. A returned value of zero means that an error has occurred in the allocation process.

 

 

int deallocate_cmac(int cmac_id)

 

This procedure frees the storage associated with the CMAC specified by cmac_id. Cmac_id is defined as the value returned by the allocation procedure. This procedure returns TRUE if successful and FALSE if not.

 

 

int train_cmac(int cmac_id,int *state,int *respns,int beta1,int beta2)

 

This procedure is called to train the CMAC to learn based on a desired response. *state is a pointer to the CMAC input vector. *respns is a pointer to the desired response. Beta1 and beta2 represent right shift factors. Refer to the section entitled "Weight Magnitude Normalization" of [20] for more information regarding the use of beta1 and beta2.

 

 

int adjust_cmac(int cmac_id,int *state,int *drespns,int beta)

int cmac_response(int cmac_id,int *state,int *respns)

 

This procedure returns the CMAC output, or vector response, to the input vector specified. *respns is a pointer to the vector to receive the CMAC response.

 

 

 

 

5.0 Experimental Results and Data Analysis

5.1 Open-Loop learning of a Sine Wave

The CMAC procedure train_cmac can be used to train a system based on the desired response of the system. In this section, an example of the use of train_cmac, are given. This example shows how CMAC can be trained to learn a sine wave and how the proper weights can be blamed such that the phase shift in the system can be accounted for. A sine wave is used as a disturbance stimulus in section 5.3, and the information found in this section provides the basis for analyzing the success of the CMAC’s performance in the setup for section 5.3.

 

 

5.1.1 Setup and Procedure

 

 

Figure 5.1 contains a block diagram of the sine wave learning setup.

wpe6.jpg (9825 bytes)

Figure 5.1: Block diagram of sine wave learning setup

 

 

 

 

The 100 Hz sine wave, after going through an A/D converter, acts as the input to the CMAC. The output of the CMAC goes through a D/A converter and then it is low pass filtered. The CMAC output is low pass filtered in order to remove any high frequency components in the CMAC output.

 

The CMAC neural network is implemented on a computer using the UNH CMAC code. The inverse of the trained signal is output to the D/A converter. The inverse is sent because if the CMAC output signal is exactly 180 out of phase with and the same magnitude as the sine wave, then the output of the op-amp will be an easy to recognize dc signal.

 

The CMAC neural network was given the parameter values found in table 4.1 in order to learn the sine wave.

Table 5.1: Parameter values for learning sine wave

 

 

Parameter

value

CMAC parameter

Generalization

4

num_cell

Quantization

1

quant

Number of Inputs

2

num_state

Number of outputs

1

num_resp

Learning rate

.03125

Beta1

Number of iterations

800

N/A

Number of samples/iteration

250

N/A

Input Frequency

100 Hz

N/A

Sampling Rate

» 8.3 KHz

N/A

 

The CMAC procedure train_cmac was used to train the CMAC to learn the sine wave. The most recently sampled value was stored in the variable ‘response’. The sixth and seventh previous sampled values were stored in an array called ‘state’ and they were used as the inputs to the CMAC. The CMAC procedure ‘cmac_response’ was fed two vectors: the two previous disturbance samples and the current error response. Notice that the CMAC was trained using disturbance samples from six and seven sample points prior to the current sample, yet the output of the CMAC is obtained using the two previous samples. Doing this allows the CMAC to predict what the output should be. This prediction was then inverted and sent out to the D/A. The signal at the output of the op-amp did not change considerably. There were two main factors for the failure of the CMAC to cancel the sine wave. The first factor is the phase shifts and delays in the system that caused the CMAC output to be out of phase with the training signal. The second factor was that the voltage divider as well as the low pass filter attenuated the CMAC output signal. The magnitude of the CMAC output had to be scaled in order to produce a signal of equal magnitude with the training signal. (Note: It will be assumed that the attenuation factor has been taken care of for the remainder of this report.)

 

The inherent phase shift of the system was handled by modifying how the CMAC learned the sine wave. The CMAC was still fed the current sample as the desired response, but the inputs to the CMAC were changed from the previous two inputs to inputs that occurred 6 and seven samples prior to the current sample. The inputs to the procedure cmac_response were the two samples prior to the current sample. This caused the CMAC to predict what the output would be 6 samples from the current sample. This phase shift correction allowed the CMAC to produce a signal that was in phase with the training signal.

 

 

 

5.1.2 Results

 

Figure 5.2 contains plots of the sine wave being learned and the CMAC prediction of this sine wave. Note: the prediction by CMAC has been passed through a low pass filter to remove any high frequency components.

 

                                                                                  wpe3.jpg (13793 bytes)

Figure 5.2: Plot of sine wave and the CMAC low pass filtered prediction

 

Figure 5.3, on the following page, contains a plot of the actual CMAC output, prior to being low pass filtered. This shows the necessity of using a low pass filter on the CMAC output.

                                                                    

 

                                                                                              Figure 5.3: Plot of actual CMAC output

 

The samples in figures 5.2 and 5.3 were taken during the 800th, or last, iteration of the CMAC learning cycle. Some error still exists in the prediction, but the predicted signal is extremely close to being 180 degrees out of phase with the sine wave. This particular CMAC is able to perform 250 samples in about 3 periods of the 100 Hz wave. This means a sampling rate of approximately:

 

Sampling Rate

 

Two factors that will affect the maximum frequency that this setup will run satisfactorily at are the sampling rate and the low pass filter in the design.

 

 

5.2 Error Based Real-time Closed-loop Learning using a Sine Wave Input

 

The CMAC procedure adjust_cmac can be used to train a system based on the error of the system. In this section, an example of the use of adjust_cmac is given. This example shows how CMAC can learn to use an error signal and a sinusoidal stimulus input to produce an output that attempts to reduce the error as close to zero as possible.

 

 

5.2.1 Setup and Procedure

 

Figure 5.4 contains a block diagram of the setup used for this experiment. The goal is to cancel the signal output from the speaker. The function generator creates a sinusoidal signal that is sent to a speaker. The goal is to have the CMAC neural network reduce or cancel the signal that is sent out of the speaker, which will be referred to as the "noise" of the system for the rest of this report. The error signal in this system is defined as the noise as measured by the output of the microphone after it has been passed through a gain buffer. The CMAC neural network is fed samples of the error signal and the original sine wave from the function generator.

wpe4.jpg (12058 bytes)

Figure 5.4: Setup for error based learning with sine wave input

Figure 5.5 contains a block diagram of the gain and impedance buffer used to boost the output of the microphone. It consists of two gain stages, the first with a gain of 2 and the second with a gain of 50. After the gain stages, the signal is passed through a low pass filter, prior to being fed to the CMAC neural network.

 

wpe5.jpg (7714 bytes)

Figure 5.5: Block diagram of microphone gain buffer

 

Table 5.2 contains the parameter values used to train the CMAC to minimize the error in the system of figure 5.4. The results of this CMAC neural network can be found in section 5.2.2.

 

Table 5.2: Parameter Values for Training CMAC to minimize the error in the system

 

 

Parameter

value

CMAC parameter

Generalization

4

num_cell

Quantization

1

quant

Number of Inputs

2

num_state

Number of outputs

1

num_resp

Learning rate

.03125

Beta1

Number of iterations

800

N/A

Number of samples/iteration

250

N/A

Input Frequency

100 Hz

N/A

Sampling Rate

» 8.3 KHz

N/A

 

 

 

 

5.2.2 Results

Figure 5.6 contains a plot of samples of the disturbance signal and the prediction of the disturbance. The CMAC Prediction clearly has some high frequency components, but these can easily be removed via low-pass filtering. Other than the high frequency components, the prediction of the 100Hz sine wave was extremely accurate. (Note: the slight phase difference shown in the plot was accounted for by software).

 

 

Figure 5.6: Plot of CMAC prediction, system disturbance and system error

Figure 5.7 contains plots of the FFT of the disturbance and the FFT of the prediction. Frequency analysis of the two signals shows that the prediction is indeed very similar to the disturbance. Low pass filtering of the signal should allow the CMAC output to be almost identical to the disturbance signal.

 

 

Figure 5.7: Plots of the FFT of the disturbance and the prediction.

Figure 5.8 contains a plot of samples of the error in the system during the first and last iterations run by the CMAC. The error is measured based on the signal recorded on the microphone after it has passed through the gain/impedance buffer. Notice that the center of the error in the system drifts over time. This was visibly evident on the oscilloscope as a bouncing sinusoidal signal. The CMAC code handled the DC offset issue by keeping a running average and subtracting this mean from the sampled value. If anything, this demonstrates the robustness of the CMAC neural network solution.

 

 

Figure 5.8: Plot of initial and final system error

 

 

Figure 5.9 contains plots of the FFT of the initial and final error in the system. Figure 5.7 showed that the CMAC neural network was able to dramatically reduce the error in the system. Figure 5.9 reveals that CMAC also introduced several higher frequency components. The CMAC neural network was able to reduce the 100 Hz power of the error signal by 39dB. In other words, the 100 Hz. power in the error signal at the end of the last iteration was 0.012% of the 100 Hz. power during the first iteration.

 

 

 

 

Figure 5.9: Plots of the FFT of the initial and final error in the system

 

The autocorrelation function can be used to get a better idea of the power reduction in the error signal. Figure 5.10 contains plots of the FFT of the autocorrelation of both the initial and final error signals.

 

Figure 5.10: Plots of the FFT of the autocorrelation of initial and final system error.

 

 

 

5.2.3 Comparison with Smoothing CMAC

 

In his thesis entitled "Weight Smoothing in the CMAC Neural Network", Jeremy Palotta performed some experiments similar to those presented in this report. He attempted to implement CMAC such that the output given by CMAC would have a smoother shape. Table 5.3 contains the parameter values used for both experiments.

 

Table 5.3: Parameter values for typical CMAC and weight smoothing CMAC

 

Parameter

CMAC value

Smoothing CMAC value

Generalization

4

4

Quantization

1

1

Number of Inputs

2

2

Number of outputs

1

1

Learning rate

.03125

.05

Number of iterations

800

800

Number of samples/iteration

250

250

Input Frequency

100 Hz

70 Hz

Periods/Iteration

3

3

Sampling Rate

» 8.33 KHz

» 5.83 KHz

 

 

The sampling rate of the weight-smoothing CMAC is considerably smaller than that of the UNH CMAC. This is due to the increased number of calculations and the non-integer math involved with the weight-smoothing CMAC. To compensate for this difference, the typical CMAC was run at a higher frequency, thus making the number of periods/iteration of the sampled waveform identical.

The learning rate of the weight-smoothing CMAC was 0.05. The UNH CMAC code requires that all numbers be a power of two, meaning that a learning rate of 0.05 was not feasible. The options were .03125 or .0625 and I chose .03125. This relatively small difference would have very little, if any, noticeable affect upon the results. The only real affect would be the number of iterations required for CMAC to converge.  

 

Figure 5.11 contains plots of the CMAC prediction for the UNH CMAC (top) and the weight-smoothing CMAC (bottom). Both sets of samples contain three periods within the 250-sample iteration. The traditional CMAC visibly has more high frequency components, as seen by the spikes, especially at the peaks.

 

 

 

Figure 5.11: Plots of the prediction for the UNH CMAC and the smoothing CMAC

 

Figure 5.12 contains plots of the FFT of the predictions of both the UNH CMAC (top) and the weight-smoothing CMAC (bottom). Both signals have a strong frequency component at the disturbance signals frequency (70 or 100 Hz). The weight-smoothing CMAC actually has more significant frequency components just under 500 Hz, whereas the UNH CMAC has inserted frequency components, although very small in magnitude, up to half the sampling frequency.

 

 

 

Figure 5.12: Plots of the FFT of the predictions by the UNH and smoothing CMAC

Figure 5.13 contains plots of the FFT of the final system error for the UNH (top) and the weight-smoothing CMAC (bottom). The plots show that in terms of the system error, the weight-smoothing CMAC is far superior, especially at frequencies larger than 1000 Hz. Both CMACs do an excellent job at reducing the error.

 

 

 

Figure 5.13: plots of the FFT of the final system error

for the UNH CMAC and the smoothing CMAC

 

 

5.2.4 Parametric Study

This section of the report contains a parametric analysis of the CMAC neural network used in sections 5.2.1 and 5.2.2 of this report. Each of the following parameters are varied, with the others remaining fixed, in order to better gauge the robustness and the limitations of this CMAC neural network configuration.

 

It should be noted that some code had to be added in order to measure the maximum error in the system after each iteration. The error was measured as the peak sampled value from the microphone during each iteration of 250 samples. This code lowers the sampling rate due to the added array manipulations, but the lower sampling rate is not visibly noticeable, as will be seen in the next section.

 

 

 

5.2.4.1 Benchmark

A benchmark must be created in order to run a valid parametric study. Figure 5.14 contains a plot of the disturbance and the CMAC prediction. Figure 5.15 plots the system error during the first and last iteration. The results found in these plots are almost identical to those that are found in figures 5.6 and 5.8.

 

 

 

 

 

 

 

 

 

 

Figure 5.14: Plot of disturbance and CMAC prediction

 

 

 

 

 

 

 

 

 

Figure 5.15: Plot of initial and final system error

 

Figure

5.16 contains a plot of the maximum amplitude from the microphone during each iteration of 250 samples. This maximum amplitude is the maximum error in the system during each iteration. The plot shows that the CMAC neural network reaches a steady state value around the 50th iteration. The plot has been normalized to the initial error value. This plot will be used as the benchmark for use during the parametric analysis.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 5.16: Plot of the maximum system error per iteration

5.2.4.2 Frequency

This section evaluates the CMAC at various frequencies while leaving the parameters in table 5.4 constant.

Table 5.4: Fixed parameter values for frequency analysis

 

Parameter

value

CMAC parameter

Generalization

4

num_cell

Quantization

1

quant

Number of Inputs

2

num_state

Number of outputs

1

num_resp

Learning rate

.03125

Beta1

Number of iterations

800

N/A

Number of samples/iteration

250

N/A

Sampling Rate

» 8.3 kHz

N/A

 

One problem that the CMAC neural network faces with a different input frequency is the attenuation due to the low-pass filter at the output of the CMAC. At the cutoff frequency and beyond, the low-pass filter will attenuate the output of the CMAC. The magnitude of the CMAC output would have to be increased to compensate for this. The plots in figure 5.17 show the maximum error per iteration of the CMAC at the following frequencies:

80 Hz and 120 Hz. The CMAC neural network reaches a steady state value quicker for the 120 Hz signal, but it contains some major peaks during some of the iterations.

 

 

 

Figure 5.17: Plots of the maximum error per iteration for 80 Hz(left) and 120 Hz(right)

Figure 5.18 contains the CMAC prediction and the training signal when a 300 Hz wave is used. The sampled disturbance is clearly distorted and the CMAC prediction suffers. Figure 5.19 shows the system error per iteration. The results here are quite similar to those at 120 Hz.

 

 

 

 

Figure 5.18: Plot of the 300 Hz disturbance and the CMAC prediction

 

 

 

 

Figure 5.19: Plot of the system error per iteration at 300 Hz.

 

The CMAC neural network performs very poorly at input frequencies below 80 Hz. Figure 5.20 contains a plot of the 70 Hz disturbance and the CMAC prediction, during the final iteration, for a 70 Hz sine wave. Figure 5.21 contains a plot of the system error per iteration when a 70 Hz sine wave is used as the disturbance. The system error appears to have some periodicity to it. Around the 680th iteration the performance of the CMAC actually begins to get worse. It should be noted that if the CMAC starts learning a 100 Hz wave, the input could be dynamically lowered to 60 Hz while maintaining a low system error.

 

 

 

Figure 5.20: Plot of the 70 Hz disturbance and the CMAC prediction

 

 

 

 

Figure 5.21: Plot of the system error per iteration at 70 Hz.

 

 

The CMAC neural network also performs poorly at frequencies around 400 Hz. Figure 5.22 contains a plot of the system error per iteration when the input frequency is 400 Hz. The plot shows that the CMAC neural network is able to learn at this higher rate, but it then goes unstable around the 250th iteration.

 

 

 

Figure 5.22: Plot of the system error per iteration at 400 Hz.

 

The CMAC neural network is able to operate fine when the input frequency is set to 500 Hz as shown by the plot in figure 5.23.

 

 

 

Figure 5.23: Plot of the 500 Hz disturbance and the CMAC prediction

 

The plots in this section demonstrate that the CMAC is capable of working effectively over a wide range of frequencies without any alterations having to be made to the code. The main limitations that exist in this system are the sampling frequency and the low pass filter at the output of the CMAC neural network. This CMAC neural network should be able to work at even higher frequencies if a higher sampling rate was available. The quality of the low-pass filter will affect the need to adjust the output of the CMAC for frequencies that are near or above the cutoff frequency.

 

5.2.4.3 Learning Rate

This section evaluates the CMAC at various learning rates while leaving the parameters in table 5.5 constant.

 

Table 5.5: Fixed parameter values for learning rate analysis

 

Parameter

value

CMAC parameter

Generalization

4

num_cell

Quantization

1

quant

Number of Inputs

2

num_state

Number of outputs

1

num_resp

Number of iterations

800

N/A

Number of samples/iteration

250

N/A

Input Frequency

100 Hz

N/A

Sampling Rate

» 8.3 kHz

N/A

 

As mentioned previously in this report, the equation for the learning rate is:

Learning Rate =

And the equation for updating the CMAC weights is:

weight(k+1) = weight(k) + (Learning Rate)*(error)

Setting the learning rate too high could cause the CMAC output to go unstable. Setting it too low could prevent the CMAC from learning at all. And setting the learning rate between these boundaries should affect the number of iterations required to learn the system.

 

Figure 5.23, on the next page contains plots of the maximum system error per iteration for beta values of 1, 2, 3, 4, 10 and 100 corresponding to learning rates of 0.5, 0.25, 0.125, 0.0625, .00977 and 7.9e-31 respectively. The CMAC neural network appears to do a good job of learning the system initially for learning rates of 0.5 and 0.25, but then the system output starts to go unstable and the system error increases.

 

The CMAC neural network appears to converge at about the same point for learning rates of 0.125, 0.0625, 0.00977 and 7.9e-31. This result is not intuitive. One would expect that the CMAC neural network would require many more iterations to converge for the last two learning rates than it would for the first two.

 

 

 

 

 

Figure 5.24: Plots of the maximum system error per iteration for learning rates of 0.5, 0.25, 0.125, 0.0625, .00977 and 7.9e-31.

5.2.4.4 Generalization

This section evaluates the CMAC at various generalizations while leaving the parameters in table 5.6 constant.

Table 5.6: Fixed parameter values for generalization analysis

 

Parameter

value

CMAC parameter

Quantization

1

quant

Number of Inputs

2

num_state

Number of outputs

1

num_resp

Learning rate

.03125

Beta1

Number of iterations

800

N/A

Number of samples/iteration

250

N/A

Input Frequency

100 Hz

N/A

Sampling Rate

» 8.3 kHz

N/A

The generalization of the CMAC neural network is adjusted with the variable num_cell. The current version of the UNH CMAC code requires that this number be a power of 2. Figure 5.24 contains plots of the maximum system error per iteration for generalizations of 2, 4, 8, 16, 32 and 64.

The best results were obtained with a generalization of 16. The CMAC neural network was observed to converge the quickest at this generalization rate and the maximum system error was as low as it has ever been. When the generalization was changed to 32, the CMAC output was audibly distorted at first and then it converged. When the generalization was changed to 64, the CMAC output was never observed to truly converge and the signal on the oscilloscope was visibly distorted and remained that way for the entire run.

 

Low generalization values of 2 or 4 caused the CMAC neural network to take longer to converge. Once it did converge, the maximum system error was extremely similar to the results of a generalization of 8 or 16.

 

 

 

 

Figure 5.25: Plots of the maximum system error per iteration

for generalizations of 2, 4, 8, 16, 32 and 64.

5.3 Error Based Learning using a Triangle Wave Input

The setup used for this experiment is identical to those found in figures 5.4 and 5.5 of this report. The only difference was that a 100 Hz triangle wave input replaced the 100 Hz sine wave input. The parameter values from table 5.1 remained the same as well. Figure 5.26 contains a plot of the disturbance and the CMAC neural network prediction. Figure 5.27 contains a plot of the maximum system error for each iteration.

 

 

Table 5.26: Plots of the triangle wave disturbance and the CMAC approximation

 

 

 

 

 

Figure 5.27: Plot of the maximum system error per iteration for a 100 Hz triangle wave

Figure 5.28 contains a plot of the initial and final system error. The error in the system is not initially a triangle wave. This is because by the time the triangle wave gets to the microphone, many of the higher frequency components have been removed, creating a more rounded signal. This doesn’t present a problem, as the system error is still periodic and thus learnable by the CMAC neural network. Figure 5.29 shows the frequency domain components of the disturbance and the CMAC output.

 

 

 

Figure 5.28: Plot of the initial and final system error (triangle wave case)

 

 

 

Figure 5.29: Plots of the FFT of the triangle wave (disturbance)

and the CMAC output (prediction)

5.4 Error Based Learning using the Error Signal as the only Input

The setup used for this experiment is identical to those found in figures 5.4 and 5.5 of this report. The only difference was that the 100 Hz sine wave was not available as an input to the CMAC neural network. The CMAC neural network was only given the error signal with which to learn the system.

 

Table 5.6: Parameter values for error based learning

using the error signal as the only Input

 

Parameter

value

CMAC parameter

Generalization

8

num_cell

Quantization

1

quant

Number of Inputs

2

num_state

Number of outputs

1

num_resp

Learning rate

.03125

Beta1

Number of iterations

800

N/A

Number of samples/iteration

250

N/A

Input Frequency

100 Hz

N/A

Sampling Rate

» 8.3 KHz

N/A

 

 

 

Figure 5.30, on the following page, contains a plot of the initial CMAC input and CMAC’s prediction during the final iteration. Figure 5.31, also on the following page, contains a plot of the frequency domain information of the initial and final system error. These two plots show that the CMAC neural network has clearly inserted many higher frequencies by the end of the run. These plots demonstrate that the CMAC neural network requires a periodic disturbance signal, otherwise the CMAC neural network creates an unstable system with frequencies that didn’t initially exist within the system.

 

 

 

Figure 5.30: Plots of the initial system error and the CMAC prediction during the final iteration

 

 

 

Figure 5.31: Plots of the FFT of the initial system error and the CMAC prediction

 

 

6.0 Conclusion and Suggestions for Further Study

 

6.1 Summary

Neural networks have been used successfully in the area of controls for many years. Neural networks are capable of adapting to a changing system, making it an attractive alternative to typical PID controllers.

 

The CMAC neural network, and its real-time implementation by Miller, has been the implementation of choice at the University of New Hampshire since the late 1980’s. The CMAC neural network is an alternative to back-propagation networks. Miller demonstrated its usefulness as a real-time neural network solution. It has been used in areas such as pattern recognition, biped robot control and the control of a real-time industrial manipulator.

 

Vibrations, which occur in most machines, vehicles and structures are undesirable for many reasons. They can cause destructive motions and dynamic stresses that may lead to fatigue and/or failure of the structure or machine. In the past, engineers have attempted to control these vibrations with controllers such as the PID controller. In most cases, the system needed to be modeled before a linear control system could be designed. Any errors or nonlinearities in the system could limit the effectiveness of the controller. This created the need for a controller that could:

    1. Control a system without having a model of the system

    2. Adapt to a changing system

    3. Learn a non-linear system

 

Neural networks seemed like the logical choice based on these requirements. As of now, neural networks have only been used on a limited basis. The CMAC neural network, with its proven real-time capability, appears to be as deserving as any other neural network at tackling this problem.

 

This project showed the effectiveness and the robustness of the CMAC neural network in controlling the vibrations of a 100 Hz sine wave. This CMAC implementation was able to effectively cancel the vibrations even if the disturbance frequency was changed during the run. This CMAC implementation was also shown to work with a 500 Hz sine wave.

 

The limitation of this CMAC neural network was the high frequency components it inserted into the system. Without the low-pass filter at the output of the CMAC, the system could go unstable or have many undesired frequency components. In this case, a smoothing CMAC would be a better option as long as the disturbance frequency was within its limits.

 

6.1 Suggestions for Further Study

There are at least two experiments left to be performed using this CMAC neural network:

    1. Enclosed box with two speakers

    2. Vibrating Table

The enclosed box problem is essentially the same problem that the current CMAC has tackled with some minor adjustments. Instead of having the CMAC neural network electrically cancel the disturb