A design of a household output water temperature control system based on the PID controller and feedforward control

Household bathroom products are facing the problems of input water temperature fluctuation and effluent temperature control delay, which brings trouble to consumers. This essay will propose a solution that controls the water temperature at the effluent end by adding a water tank and an electrical heater. The author establishes a mathematical model of the water tank and calculates the transfer functions of different parts of the control system. He also chooses a PID controller as the core of the closed-loop system. A feedforward control system is built into the design to reduce the effect of the disturbance. Simulink software is used to conduct the simulation experiment. The result of the simulation shows that the change in heat provided by the heater has the ability to control the temperature of the output water. Additionally, the feedforward control system can reduce the influence of the input water temperature effectively.


Introduction
As people's living standards are continuously improving, the development and growth of the household bathroom industry means that the market prospects are broad, the related products have gradually improved, and the user's experience also needs to be improved [1].In western countries,the number of sanitary appliances supplied has, in total, increased by 58% from 1998 to 2004.What's more,people are chasing the comfort and multifunctionality of the related products [1].In the application scenario of household water supply, a more prominent problem exists: the outlet temperature fluctuates when using the faucet, and the adjustment of the outlet temperature also has a large delay.The process of waiting for the effluent temperature to be adjusted to the appropriate temperature will result in the waste of water and power resources, and the user's experience in use will be reduced [2].The existing systems of water temperature control in domestic environments need to be perfected.It's not hard to spot by observation that most of the existing systems are open-loop and artificially regulated.Users control the water temperature just by adjusting the valve opening,which is difficult for users to do in a large delay system.Besides, due to the open-loop characteristic, existing systems are not equipped with the ability to resist disturbance, which brings trouble to users when they adjust the output water temperature manually.Studies have shown that current water treatment systems have the potential to reduce energy consumption by up to 45% [2].The problems can be solved by optimizing the control system.This paper will introduce a closed-loop control system for end-outlet water temperature controlled by a PID controller and design a scheme to improve the control effect of the system under disturbance of inlet water temperature by feedforward control.What's more, the system in this essay is self-controlled, which is able to change the way of controlling the outlet water temperature and improve users' experiences.The simulation experiments are finished in Simulink software.

Literature review
In previous studies, researchers have used it to control the temperature of the output water and introduced a fuzzy control algorithm into the system [3,4].These studies have effectively improved the control effect of the water tank outlet temperature, but most of them stay in the aspect of industrial control and do not take into account the use needs of the household environment.The design is more complex, and the cost is high, which is not conducive to large-scale application.The method of feedforward control is also applied to some extent, such as in greenhouse daytime temperature control and indoor climate control [5,6].Researchers have effectively achieved the goal of controlling a certain ambient temperature through feedforward control, but it has not solved the problem of water outlet temperature control.What's more, in terms of energy use, researchers designed a combined heating system with solar hot water and air source heat pumps and a data-driven electric water heater scheduling control system.This social interaction effectively saves energy and reduces waste.But the problem is that the improvement in the heating process cannot solve the problem of large water temperature delay [7,8].This paper will design a control system aiming at the outlet end and use a relatively simple and low-cost PID controller combined with a feedforward control method to improve the water supply system outlet temperature control in the household environment.

The mathematical model of PID controller and feedforward control system
PID controllers are the basic building parts of classical and modern automatic control systems [9].A PID controller contains three main parts: a proportional controller, an integral controller and a differential controller.The proportional controller is more inclined to process the current signal.The integral controller integrates the signal, which shows the accumulation of the system.The differential controller can show the tendency of the signal [10].The basic composition of the PID controller in the design is given in the figure below.From the structure in the figure above, the controller's output and the error have the relationship below: Where u(t) is the output of the PID controller, e(t) is the error of the system, Kp is the proportionality coefficient, Ki is the integral coefficient, and Kd is the differential coefficient.
The feedforward control is irreplaceable in control processes, especially in situations where a perfect tracking performance is wanted or a large disturbance appears in a control system,because the feedforward control can reduce the impact of perturbations perfectly [12].The components and the relationship between them in the feedforward control system are shown in the figure below.Where X is the input of the system, Y is the output, F is the disturbance, Wc(s) is the transfer function of the controller, the controlled object's transfer function is indicated as Wo(s) ,Wf(s) is the transfer function of the disturbance, the transfer function of the feedforward controller is expressed as WM(s).
To minimize the impact of perturbations on the system, WM(s) should satisfy the equation below:

Establishing the mathematical model of the water tank
To achieve the goal of controlling the water temperature at the end of the water supply system, a water tank is added to the design, which works with an electric heater [11].Figure 3 gives a basic representation of the physical model of the water tank and the heater.Where Ti is the temperature of the inflow (℃), mi is the rate of inflow(kg/s), T is the the water's temperature in the tank and the effluent (℃), m represents the mass of the water, m0 is the rate of effluent(kg/s), and Q is the heat supplied by the heater to the tank(kJ).
The inflow of the tank is the original water input, and the effluent of the tank is the final output of the system.Users can control the temperature of the effluent(T) by changing the heat exported by the heater.
The mathematical expression and the transfer function of the water tank is given below: According to the Law of Conservation of Energy, the energy balance around the tank gives: Where c is the specific heat capacity of water.Equation( 3) is established based on the principle that the heat input provided by input water and the heater minus the heat output equals to the change of the heat of the water in the tank.Then For steady state condition, mi=m0, then: Thinking of Ti as constant, then Laplace transforming for equation( 7): The transfer function of the tank model is: To figure out the transfer function of the disturbance, the paper regards the temperature of the tank's inflow as the disturbance quantity from the equation ( 7), thinking of Q as a constant, then Laplace transforming for equation (7): The transfer function of the disturbance is: The data for the tank and heater models is shown in Table 1.The Flow Rate of Water is mi and m0 in Figure 3; the Heat Capacity of Water is c in the equations before; and the mass of the water in the tank is m.  9) and( 11), G(s) and D(s) in the system is calculated below:  Closed-loop control systems provide greater accuracy, stability, adaptability, and safety.In this system, the PID controller works as the control unit.When a disturbance of the input water temperature(Ti) occurs, the temperature of the water in the tank and the output water(T) changes, and the detecting element is able to measure the output water temperature(T).Then the system calculates the error by subtracting the output temperature from the set point.The PID controller's input signal is the error.The commend to the valve is the PID controller's output signal, which is able to change the heat provided by the heater.Users can change the temperature of the effluent by setting the value of Q(the heat).
The source of the heat can be various.Taking into account the aim of designing a environment-friendly system, clean energy can be selected as the source of heat, such as solar power and wind power.

Improved closed-loop control system using feedforward control
Aiming at overcoming the effects of disturbance on the system, feedforward control can be brought into the feedback control system.It basically shows the feedforward control system of the design (Figure 5).In the feedforward control system,the disturbance of the input water temperature(Ti) is measured by the detecting element in advance.The disturbance signal and the PID controller's output signal are combined to form the command signal for the valve after being processed by the feedforward controller.So that the system can compensate for the disturbance in time.
To maximize the advantage of the feedforward control and reduce the influence of the disturbance, according to the equations ( 2)and ( 12

Simulation and analysis
Firstly, the author simulates the original water control system.Figure 6 shows a basic description of the existing temperature control systems in a household environment.Users control the output water temperature by changing the valve opening in the system.The system is open-loop and artificially regulated.In addition, the adjustment is difficult because of the delay.Omitting the heating time,the output result of the existing systems is shown in the figure below (Figure 7). Figure 7 shows that the existing system is greatly affected by the disturbance.The essay uses this result as a benchmark for improvement and comparison.
In terms of the improved design with the tank and the heater, the paper sets the heat input to 2000 J, then proceeds with the PID parameter setting.The classical technique is used in the process of PID controller parameter tuning [13].The final parameter is confirmed as:  In the simulation, the transfer function of the detecting element is regarded as a constant; the author set the constant as 0.1.Consider the disturbance as white noise, the acting process of the disturbance on the water tank has a delay linkage.The figure below gives the result of the simulation (Figure 8).The system in Figure 8 is a simulation of Figure 4, and the feedforward control system(Figure 5) is simulated in Figure 10.The gain of the feedforward controller is calculated in equation( 15), where K= -546.45.The following figure shows the simulation results of the feedforward control system (Figure 11).Comparing Figure 9 and Figure 11, the paper shows that the design of feedforward control greatly eliminates the effect of disturbance.
In the simulation of the feedforward control system, the author changed the thermal input value to 1750J.The figure below shows the result.The most obvious difference between Figure 11 and Figure 12 is the value of the output at steady state, from 36.534℃ to 31.967℃.Comparing Figure 7 and Figure 12, the improvement in the quality of control is obvious.

Conclusion
By making use of the PID controller, the design achieves the function of regulating the effluent temperature by changing the value of the heat input provided by the electrical heater.Additionally, the feedforward control system's design significantly lessens the impact of the disturbance, which will improve the user experience and save energy.The control system changes the existing systems into closed-loop and self-control systems, and has the potential to resolve the problem of water temperature regulation in the household environment.To optimize the control effect further, a direction of improvement is modifying the algorithm of the controller, such as the Smith predictor and fuzzy control.

Figure 2 .
Figure 2. The structure of feedforward control.

Figure 3 .
Figure 3.The physical model of the water tank and the heater.

5 .
The design of the control system 5.1.Closed-loop control system with PID Figure4shows the closed-loop control system's structure.

Figure 4 .
Figure 4.The closed-loop control system using PID controller.
)(13), the feedforward controller should meet the conditions below:

Figure 6 .
Figure 6.The simulation of the existing system.

Figure 7 .
Figure 7.The result of the existing systems.
The following figure shows the results of the basic simulation.This result is a closed-loop control system centered on a PID controller.

Figure 8 .
Figure 8.The simulation of the water temperature control system.

Figure 9 .
Figure 9.The feedback control system's result.

Figure 10 .
Figure 10.The simulation of the feedforward water temperature control system.

Figure 11 .
Figure 11.The simulate result of the system.

Figure 12 .
Figure 12.The result after changing the heat input.

Figure 13 .
Figure 13.The change of the output temperature.

Table 1 .
The Data of the mathematical model.