Design of Solar Water Heater Control System Based on Fuzzy Neural Network

According to the requirements of solar water heater control system designing, a fuzzy neural network control algorithm is presented for the system controlling, which is based on the characteristics of solar water heater, such as the uncertainty of the water heater temperature and the incapable of establishing an accurate mathematical model. By using the experimental data, the fuzzy neural network is trained offline by ANFIS toolbox, and the fuzzy neural network control program is written in C language. Then a solar water heater control system based on STC90C52RC micro-controller is established.


Introduction
Solar water heater control systems currently on the market are mostly used micro-controller ch ip, the system has single function, complicated operation, inconvenient control, poor anti-interference ab ility, and cannot better control the water temperature, even with heating function, often there will be insufficient heating or over-burning.It will not only cause a great security risk, but also waste a lot of energy [1] .As an important branch of the field of intelligent control, fu zzy control and artificial neural network represents the development of the future of control technology.The complementary function provides the conditions for jo int control.The fu zzy neural network is a neural network and fuzzy logic product of the combination [2][3][4] , which integrated the advantages of both.
So the paper based on fuzzy neural netwo rk carry on the design on the control system of solar water heaters.

Design of fuzzy neural network
In this paper, the temperature erro r, error change rate as input of the network, calcu late the parameters of the membership function and the corresponding fuzzy ru les by using the learning ability, so as to obtain an output that is electrically heated start time.The whole fu zzy neural network structure is shown in figure 1.
Figure 1.fuzzy neural network structure The input of this fuzzy neural network is: x e t e t t e t x e t t In the Eq, e(t ) is the current te mperature, Δe(t) is the rate of change of temperature.Assuming that each input has n membership, the fuzzy neural network in each layer of the relationship between input and output is as follows.
(1) The first layer is the input layer.The x1 and x2 respectively represent the temperature error and the rate of error change.Each input variable transfers to the next layer without any treat ment, the input of this layer and the output unit respectively are: (1) 1, 2.; 1, 2, , .
The second layer is a layer of language.Each note represents a linguistic variables, using gauss function as membership function, blur the input variables, and calculate the fuzzy membership of the input variab les.The input unit and output unit of this layer respectively: 1, 2 ; 1, 2, , .exp 1, 2.; 1, 2, , .
In the Eq, σ ij and c ij respectively represent the width and center of the Gauss function.
(3) The third layer is the rule layer.Each node represents a fuzzy rule, and one correspondence, which can obtain the input unit and output unit of this layer respectively are: 1, 2, , .
In the Eq, m = n 2 .The layer can be any AND operator with T paradig m, the excitation intensity of each fuzzy ru le can output by operation, which is ω i in the Eq. ( 4) The fourth layer is one layer.Every note of this layer are denoted by W, by normalization relevance grade of each rules, to calculate the ratio of incentive intensity at i point and incentive intensity of all ru les.The input unit and output unit respectively are: 1, 2, , .
The fifth layer is the rule of output layer.This layer is used to calculate the output of each fu zzy ru le, wh ich can obtain the input unit and output unit respectively are: 1, 2, , .
In the Eq, p i, q i , r i are conclusion parameters of the linear system.And f i is a linear co mb ination value of the conclusion parameter.
(6) The sixth layer is the overall output level.The unit of the layer is a fixed node, the su m of all input signal as the output.The input unit and output unit of the layer are respectively : (5) (6) (6) 1, 2, , .
For this fu zzy neural network, after determine the init ial membership functions, the total output of the system is linear co mbination of conclusion parameters.For many parameters used in the network, so a hybrid learning algorith m is used, which increases the least square method on the basis of gradient descent method [5] .
Objective function defined is: In the Eq, D is the desired output, which is teacher signal; Y is the actual output of the system.
In the mixed learn ing process, when learning to the fifth layer, the conclusion parameters are p i , q i , r i by least square method.Through reverse learn ing of maximu m gradient method, each parameter correction value of membership function by a layer of calculation is: Among them, i=1, 2; j=1, 2, …, 5;   2 is the local gradient layer,   1 is the concrete actual output.

Figure2 the simulation curves of fuzzy neural network
The paper identifies the parameters of conclusion section by way of off-line and collects a large nu mber of dates of temperature and irradiance which we need with the help of the equip ment data acquisition instrument of a solar energy Ltd test experiments.Import the data into MATLAB, through ANFIS simu lation toolbo x to simu lation training [6] , according to the above algorithm and the related parameters.
In order to improve the training efficiency, the number of network training set at 40 times, and the error curve of this simulation is shown in Figure 2.
As can be seen fro m Figure 2, after 40 rounds of training, at th is mo ment, the network error is 0.0068107.So when training to 40 times, the network perfo rmance has been reached.Then, the trained ANFIS neural network can be used as a method written into MCU to control.

Hardware design
The control system consists of STC90C52RC single-chip microcomputer and its expansion circuit, the circuit diagram is shown in Figure 3. (2) To detect the temperature of the water tank is an important part of control system, the paper adopts 1-wire digital temperature sensor DS18b20, which has small volume, high resolution, high speed, 9 bit dig ital form to reflect the temperature of the device, there is no need for A/D converter.
(3) The design idea of using pressure sensor for detecting water level, converts the water level detection into the water y ield detection, using the change of pressure value, by processing the sensor integrated circuit to output square wave frequency, which reflects the level of water in the water tank.So we can obtain continuous liquid level measurement, which is an innovation on the hardware in this paper.
(4) Through the relay to heat water tank, the normally open contact of the relay uses as a switch for the au xiliary heater.The use of the relay to control the electromagnetic value realize water operation, when the temperature is higher than the set temperature of 2℃, water automatically open, watering cooling.When it is lower than the set temperature of 2℃, water auto matically close, at the same time has temperature protection function.When the temperature is less than or equal to 3℃, auto matically open the electric heating.When the water temperature is equal to 10℃, automatically shut off the electric heating.
(5) K3 is the function key, K1 is +1 or heating, K2 is -1or watering.On order to prevent the jitter of keys, the paper adopts software elimination method.Namely when trigger the scan button, the delay scan to ensure there is the key output so as to eliminate the false triggering.

Software design
According to the design requirements of the system, the software design should have the following functions: (1) To co llect the water temperature and water level data; (2) Through the keys to achieve manual control water supply, heat, and a variety of user set; (3) The non-volatile RAM achieved power down protection data will be stored in the DS12C887; (4) The data collected d isplayed in a timely manner through the liquid crystal; (5) When the water level is too high or too lo w or the temperature is too high, give an alarm through the buzzer to remind the user operation.
According to the above requirements, the system uses a modular design, the program is co mpiled with the C language, short and simp le, fast running speed, easy programming and debugging.

Conclusion
In this paper, a fu zzy neural network control system is designed for solar water heater; the following works are done to improve the control performance: 1 Because the temperature of the solar water heater is uncertain, and the mathemat ical model of the solar water heater cannot be established, the fu zzy neural network is used to control the temperature, which could be fitter than traditional control algorithm.
2 The fu zzy neural network controller is designed, and the fuzzy neural network control algorithm of the system is deduced.Then the simu lation is done for the fuzzy neural network basing on the experimental data with the ANFIS toolbox.The simu lation results show that the system has reached the performance requirements after 40 times training; 3 Based on the control algorithm, the hard ware system for the solar water heater controlling is established with STC90C52RC microcontroller, which could realize the fuzzy neural network control of the water heater.

Figure 3
Figure 3 block diagram of the control circuit