【Detailed Explanation of Practical Cases of MATLAB Data Processing (19)】—Using Neuro-fuzzy Control to Control the Washing Machine

1. Problem description

In the early 1990s, Panasonic Corporation of Japan launched a neuro-fuzzy control fully automatic washing machine. This washing machine can automatically judge the softness and hardness of the texture of the clothes, the amount of clothes, the degree and nature of dirt, etc., and apply neuro-fuzzy control technology to automatically generate fuzzy washing machines . Control rules and membership functions, preset laundry water level, water flow intensity and washing time, and adjust these parameters in real time during the entire laundry process to achieve the best laundry effect.
The main controlled parameters of the washing machine are washing time and water flow intensity, and the main factors affecting this output parameter are the
degree of turbidity and turbidity of the laundry, and the latter can be described by the rate of change of turbidity. During the washing process, the turbidity change rate of oil stains is small, and the turbidity change rate of muddy stains is large. Therefore, the turbidity and its rate of change can be used as the input parameters of the control system, while the washing time and water flow intensity can be used as the control quantities, that is, the output of the system. In fact, it is difficult to use a certain mathematical model to describe the input and output in the laundry process. There are great uncertainties in the operation of the system, and the control process largely depends on the operator's experience, so conventional control methods are difficult to work, so fuzzy control is introduced.

2. Fuzzy control of washing machine

According to the above basic principles of fuzzy control, the fuzzy reasoning block diagram for determining the washing time can be obtained, the input quantity is the turbidity of the washing water and its change rate, and the output quantity is the washing time, as shown in the figure below. Taking into account the need for proper control performance and simplified procedures. The fuzzy word set that defines the input turbidity is { clear, rather turbid, turbid, very turbid }, the fuzzy word set that defines the change rate of turbidity is { zero, small, medium, large }, and the fuzzy word set that defines the output variable washing time Sets are { short, shorter, standard, long }. Word sets describing input/output variables all have fuzzy properties and can be represented by fuzzy sets. Therefore, the problem of determining the fuzzy concept is directly transformed into the problem of obtaining the membership function of the fuzzy set. The fuzzy control rules of the washing machine can be summarized into 16 rules, as follows:
insert image description here

Fuzzy Control Rule Table of Washing Machine
washing time Turbidity
clear Turbid turbidity Very muddy
rate of change
zero short shorter standard standard
very small standard standard standard standard
middle standard long long long
big standard standard long long

The process of fuzzy control is as follows: first, the turbidity information obtained by the washing machine is sent to the information processing unit by the sensor, divided into turbidity degree and turbidity change rate, and sent to the fuzzy controller. For the input fuzzy quantity, it needs to be converted into a fuzzy variable. Through the single chip computer, use the look-up table method to make a decision according to the fuzzy reasoning rule. The result is considered to be a fuzzy variable. Modify the washing time, thus completing a fuzzy control algorithm process.

The general fuzzy control washing machine expresses "expert experience" through fuzzy control rules, and makes control decisions by looking up tables during operation, which is a big step forward compared to computer-controlled washing machines that require operators to set programs. However, this kind of washing machine is not ideal because the rule table needs to occupy a large amount of memory space, and the response speed of table lookup is slow, and it can only be controlled according to the programmed rules. The combination of neural network and fuzzy control can solve these problems.

The neural network fuzzy control of the washing machine uses the network trained off-line, and the best output can be obtained through online calculation. The response speed of this control mode is fast, and the neural network has self-learning function and associative ability. For samples that did not appear in the training, it can also make control decisions by associating the function of memory, and the performance is very flexible.

The control system of the neural network fuzzy controller of the washing machine contains multiple neuro-fuzzy links. The following only introduces
the controller that determines the washing time by taking the input variables of turbidity and turbidity change rate. The neuro-fuzzy controller has no difference from the general fuzzy controller in the selection of input/output parameters and the determination of fuzzy domain and fuzzy subset, but the neural network is introduced in the reasoning means. Let x1~x7 be the fuzzy subset of input turbidity, x8~x14 be the fuzzy subset of input turbidity change rate, and y1~y8 be the fuzzy subset of output control quantity. It can be seen from the figure above that there are 16 control rules, and each rule has a pair of samples, so there are 16 pairs of samples in total. For example, when the turbidity is "clear" and the turbidity change rate is "zero", the attack should be "short", this sample can be expressed as: x = [ 1 , 0.6 , 0.1 , 0 , 0 , 0 ,
0 , 1.0 , 0.5 , 0 , 0 , 0 , 0 , 0 ] T , y = [ 1.0 , 0.5 , 0 , 0 , 0 , 0 , 0 , 0 ] T x=[1,0.6,0.1,0,0, 0,0,1.0,0.5,0,0,0,0,0]^T,y=[1.0,0.5,0,0,0,0,0,0]^Tx=[1,0.6,0.1,0,0,0,0,1.0,0.5,0,0,0,0,0]T,y=[1.0,0.5,0,0,0,0,0,0]T

The following table shows the amount of fuzziness for each input parameter:

The fuzzy amount of the input parameter
input parameters amount of blur
Turbidity clear 1 0.6 0.1 0 0 0 0
Turbid 0 0.6 0.6 0 0 0 0
turbidity 0 0 0.6 1 0 0 0
Very muddy 0 0 0 0 1 0.6 0
Turbidity change rate zero 1 0.5 0 0 0 0 0
very small 0 0.5 1 0.4 0 0 0
middle 0 0 0 0.4 1 0.6 0
big 0 0 0 0 0 0 0.8
washing time short 1 0.5 0 0 0 0 0 0
shorter 0.4 0.8 1 0.8 0.4 0.2 0 0
standard 0 0 0 0.2 0.6 1 0.6 0.2
long 0 0 0 0 0 0.2 0.5 0.8

According to the fuzzy rules, the training samples P and T of the network can be obtained, and the complete MATLAB code is as follows.

3. Running results

The error curve is as follows:
insert image description here
After 266 iterations of the network, the error effect meets the requirements:
insert image description here

4. Complete code

For the complete code, please refer to the resource:
https://download.csdn.net/download/didi_ya/87740580 .


Ok, the above is the whole content of this article, if it is helpful to you, remember to like it~

Guess you like

Origin blog.csdn.net/didi_ya/article/details/130425238