Multi-objective optimization for electric water heater using mixed integer linear programming


Due to the capacity of thermal storage, electric water heater (EWH) is one of the best candidates for demand response programs. However, few attentions are given to the modeling and optimization of EWHs with thermostatically-controlled automatic water mixer (TCAWM). In this paper, differential thermodynamic model is established for EWHs with TCAWM and a piecewise linear approximation method is performed for the nonlinear thermodynamic model. The multi-objective optimization model is established by introducing an index reflecting the comfort degree of users, so that the optimal energy usage of the EWH can be obtained by mixed integer linear programming. Testing examples verify the effectiveness of the proposed method.


With the increasing penetration of renewable energy, the safety and stability of the power system are facing more challenges. In recent years, the rapid development of smart grid technologies has provided the basis for the rapid response of demand side resources [1,2,3,4]. Demand response (DR) plays an important role in the optimal allocation of demand side resources, and is effective in balancing the active power of the power systems [5,6,7]. The proper scheduling of residential loads is vital for saving energy costs without affecting daily power usage service [8,9,10].

Electric water heater (EWH) is one of the main contributors to electricity consumption, which accounts for as much as 30% of the household electricity [11, 12]. EWHs have good thermal energy storage capacities, so electric energy can be stored as heat energy in the EWH tank. EWHs are often considered in DR projects because of the capacity of load profiling by saving energy during peak hours that was previously stored during off-peak hours [13, 14].

Many EWH models and control strategies have been proposed for optimizing and controlling the energy usage of the EWH [15,16,17,18]. The performance of several different control strategies of an EWH under dynamic prices is analyzed in [15]. Reference [16] proposes a system for the real-time control of EWHs with wireless communications and machine-to-machine networking. A two-node EWH model, proposed in [17], can realize the control of an EWH in a computationally inexpensive and accurate way. Reference [18] introduces a systematic way to formulate an optimal load scheduling model of an EWH considering temperature constraints.

However, the details of the cold-water mixing process in many research works are usually neglected. The cold-water mixing process includes two processes. In the first process, the cold water entering the tank is mixed with hot water inside the EWH tank. And in the second process, when the heated water leaves the tank through the outlet pipe, it still needs to be fixed with cold water by the thermostatically-controlled automatic water mixer (TCAWM), so that the tap water temperature can keep constant. Many works [13, 17, 18] consider the cold-water mixing of the first process, but neglect the second one.

Reference [19] considers the equations of EWHs for two processes of cold-water mixing. The flow rate of the output water is controlled by TCAWM in order to keep the tap water temperature constant. However, when considering TCAWM, the dynamics of the EWHs becomes complex and nonlinear, and cannot be solved using standard optimization algorithms such as mixed integer linear programming (MILP). Heuristic algorithms, such as genetic algorithm (GA) and particle swarm optimization (PSO), are common optimization algorithms for nonlinear relations. However, the heuristic algorithms are direct, random, and easy to fall into local optimum, and have problems such as the long calculation time, weak global search ability [20].

To fill this gap, this paper detailedly formulates the piecewise linear approximation functions of the nonlinear thermodynamic model and then adopts a MILP method to optimize the energy usage of an EWH with TCAWM. By this way, the electricity cost can be saved and specific requests of users can be met.

The rest of the paper is organized as follows. Section 2 presents all mathematical formulas of the EWH with TCAWM multi-objective optimization model. Section 3 introduces the piecewise linear approximation method and further proposes the EWH with TCAWM multi-objective optimization model based on MILP. The testing results are discussed in Section 4. The conclusions are provided in Section 5.

An EWH with TCAWM multi-objective optimization model

The EWH with TCAWM consists of water tank heating system and automatic water mixing system. These two parts respectively reflect the heating process of water inside the tank and the mixing process of outflowing water, which has a great impact on electricity cost and user comfort level, as shown in Fig. 1.

Nonlinear thermodynamic model of EWH with TCAWM

The accurate simulations of temperature and energy flow are essential. The thermodynamic behavior of the EWH with TCAWM can be detailed introduced by formulas below.

Fig. 1

Energy flow inside EWH tank and TCAWM

We treat the water inside the EWH as a single body with uniform temperature, and assume that the process of heat transferring is instantaneous. Based on the above assumptions, the energy balance equation can be written as [17]:

$$\Delta E_{\text{in}} = \Delta E_{\text{input}} - \Delta E_{\text{loss}} - \Delta E_{\text{usage}}$$

where ΔEin is the total energy change inside the EWH tank during time interval [t, t+1]; ΔEinput is the energy change used to heat water during time interval [t, t+1]; ΔEloss is the standing loss caused by temperature difference at time interval [t, t+1]; and ΔEusage is the heat lost because of water usage during time interval [t, t+1].

The temperature relationship obtained from the energy balance relationship is:

$$T_{\text{in}} (t + 1) = \frac{{V_\text{tank} - V_{\text{usage}} (t + 1)}}{{V_\text{tank} }}(T_{\text{in}} (t + 1) - T_{\text{inlet}} ) + T_{\text{inlet}}$$

where Tin(t+1) is the water temperature in the EWH tank at sample t+1, after the hot water activity (WA) that occurs from sample t to sample t+1; Vusage(t+1) is the volume of water used during time interval [t, t+1]; Vtank is the volume of water in the full EWH tank; and Tinlet is the temperature of cold water flowing into the tank. And Tinlet is set to a constant.

Water temperature increases due to energy input, which can be expressed as:

$$\Delta E_{\text{input}} = \eta P_{0} u(t)\Delta t$$

where η is the heating efficiency; P0 is the rated heating power; u(t) is the equal to 1 if the EWH is on at sample t and to 0 if it is not; and Δt is the time step size.

The energy lost during the WA period is calculated as:

$$\Delta E_{\text{usage}} = c\rho V_{\text{usage}} (t{ + }1)(T_{\text{in}} (t) - T_{\text{inlet}} )$$

where c is the specific heat capacity of water; and ρ is the density of water.

In addition to the energy loss caused by the water usage, (5) represents the heat dissipation from the tank to the environment in one sampling interval [14].

$$\Delta E_{\text{loss}} = \frac{{T_{\text{in}} (t) - T_{\text{amb}} }}{R}\Delta t$$

where Tamb is the air temperature outside the EWH tank; and R is the water heater thermal resistance.

(1)–(5) can be substituted in ΔE=cmΔT, where ΔE is the difference in thermal energy, which is equivalent to ΔEin; m is the mass of the water in the tank; and ΔT is the water temperature difference generated when ΔE is supplied. The water temperature inside EWH tank equation is obtained as:

$$\begin{aligned} T_{\text{in}} (t + 1) & = T_{\text{in}} (t){\text{e}}^{{ - \frac{\Delta t}{{c\rho V_{\text{tank}} R^{\prime}}}}} + (\eta P_{0} u(t)R^{\prime} + \frac{{T_{\text{amb}} }}{R}R^{\prime} \\ & \quad + c\rho B(t)R^{\prime}T_{\text{inlet}} )\left(1 - {\text{e}}^{{ - \frac{\Delta t}{{c\rho V_{\text{tank}} R^{\prime}}}}} \right) \\ \end{aligned}$$
$$\left\{ \begin{array}{l} B(t) = \frac{{V_{\text{usage}} (t + 1)}}{\Delta t} \hfill \\ R^{\prime} = \frac{R}{c\rho B(t)R + 1} \hfill \\ \end{array} \right.$$

where B(t) is the flow rate of hot water leaving the EWH tank at sample t.

It can be seen from (6) that variables determining the water temperature inside the EWH tank include the previous temperature, ambient temperature, thermodynamic parameters, hot water consumption and so on.

As shown in Fig. 2, the mixing valve can automatically control the water valve to ensure the fixed tap water temperature, the following formula is available [21]:

Fig. 2

Automatic water mixing system

$$\left\{ \begin{array}{l} \Delta E_{\text{tap}} = \Delta E_{\text{cw}} + \Delta E_{\text{usage}} \hfill \\ B_{\text{tap}} = B_{\text{cw}} (t) + B(t) \hfill \\ \end{array} \right.$$

where ΔEtap is the energy change of the tap water during time interval [t, t+1]; ΔEcw is the energy supplied by cold water during time interval [t, t+1]; Btap is the fixed flow rate of the tap water; and Bcw(t) is the flow rate of cold water in automatic water mixing system at sample t.

Substituting ΔE=cmΔT into (8), the relationship between the water flow rates can be obtained:

$$K = \frac{B(t)}{{B_{\text{cw}} (t)}} = \frac{{T_{\text{tap}} (t) - T_{\text{cw}} }}{{T_{\text{in}} (t) - T_{\text{tap}} (t)}}$$

where Tcw is the temperature of cold water used to mix hot water flowing from the tank; and Ttap(t) is the current tap water temperature at sample t. According to the above analysis, Tcw is equal to Tinlet, and both of them will be treated as a constant.

Different water events are considered as having different requirements for the tap temperature. To a certain extent, the temperature expected by the user Texp reflects comfort demands. With the outflowing hot water and the inflowing cold water, the temperature in the EWH tank Tin(t) gradually decreases.

Initially Tin(t)≥Texp, the control valve is used to adjust the flow rate of hot water and cold water for maintaining the fixed tap temperature. Under this condition, Ttap(t)=Texp, indicating that there is no user thermal discomfort. With the outflow of hot water in the tank and the injection of cold water, the water temperature inside the tank Tin(t) gradually decreases until Tin(t)≤Texp, then the cold water valve is switched off so that the hot water is no longer mixed with cold water. The current tap water is all supplied by the hot water in the tank. Under this condition, Ttap(t)=Tin(t), which leads to user thermal discomfort.

The relationship between the tap water flow rate and hot water flow rate can be obtained by transforming (9) as following:

$$B(t) = \left\{ \begin{array}{l} B_{\text{tap}} \frac{{T_{\exp } - T_{\text{inlet}} }}{{T_{\text{in}} (t) - T_{\text{inlet}} }} \quad T_{\text{in}} (t) \ge T_{\exp } \hfill \\ B_{\text{tap}} \quad\quad\quad\quad \quad T_{\text{in}} (t) < T_{\exp } \hfill \\ \end{array} \right.$$

Equations (6) and (10) are the formulas of the nonlinear thermodynamic model for the EWH with TCAWM.

Objective function

Cost and user comfort level are both important during the implementation of DR. Optimizations for the operation of an EWH with TCAWM have to account for user comfort level. The difference between the current tap water temperature Ttap(t) and the most desirable temperature Texp offered by users during the WA period determines the comfort level. To simplify our presentation, we use the comfort index D to quantify user thermal discomfort during the WA period. The smaller the deviation, the higher the user comfort level.

Based on the analysis above, we take the following two objectives into account when we establish the multi-objective optimization model.

The objective function for EWH electricity cost optimization can be expressed as following:

$$\hbox{min} \, C = \sum\limits_{t}^{{}} {p(t)P(t)}$$

where C is the electricity cost of a single EWH over 24 hours; p(t) is the electricity price at sample t; and P(t) is the power consumption of the EWH at sample t.

The objective function for user comfort level optimization can be expressed as follows:

$$\hbox{min} \, D = \left\{ \begin{aligned} 0\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;T_{\text{in}} (t) \ge T_{\exp } \hfill \\ \sum\limits_{{t = t_{1} }}^{{t_{n} }} {\left| {T_{\text{tap}} (t) - T_{\exp } } \right|} \;\;\;\;\;\;\;T_{\text{in}} (t) < T_{\exp } \hfill \\ \end{aligned} \right.$$

where tn represents the time samples during the WA period.

Objective function transformation

There are many methods for dealing with multi-objective problems. The most common methods are the weighted summation method and the ε-constraint method [22]. The weighted summation method can obtain the solution in different situations by changing weighting factors, which is also the most simple and effective method for solving multi-objective optimization problems [23, 24]. Then we adopt the weighted summation method to combine the objective functions of multi-objective optimization problem to construct a single objective function. The objective function can be written as:

$$f = \hbox{min} \left( {\alpha \mu C + \beta D} \right)$$

where α and β are the weighting factors, α+β=1; and μ is the scale factor, μ>0. α is also called user preference factor, 0≤α≤1. The smaller the value of α, the higher requirement for comfort, the larger the value of α, the more attention the user pays to the electricity saving. α is only set by the user. If the user is not satisfied with the control result for the given α, it can be reset.


  1. 1)

    Electric power constraint

    $$P(t)= P_{0} u(t)$$
  1. 2)

    Temperature limit constraints

The water temperature at the beginning of the WA is not lower than the most comfortable temperature:

$$T_{\hbox{max} } \ge T_{\text{in}} (t) \ge T_{\text{inlet}}$$

where Tmax is the maximum temperature that the EWH tank can withstand.

  1. 3)

    Switch on/off signal constraints

The switch on/off signal is determined by the on/off status of the EWH. At the same time, only one of signals status is equal to 1 and the other is equal to 0. Taking Fig. 3 as an example to explain the relationship between the switch on/off signal and the on/off status.

Fig. 3

Switch on/off signal diagram

As shown in the Fig. 3, in the third period, u(t) changes from 1 to 0, at this moment the switching-off signal y(3)=1 is executed. In the seventh period, u(t) changes from 0 to 1, and the switching-on signal x(3)=1 is executed. Under other situations, x(t)=y(t)=0. Equation (16) explicitly shows the linear relation of switch on/off signals x(t) and y(t) using the on/off status u(t).

$$x(t + 1) - y(t + 1) = u(t + 1) - u(t)$$

where x(t) is equal to 1 if the EWH is switched on at sample t and to 0 if it does not; and y(t) is equal to 1 if the EWH is switched off at sample t and to 0 if it does not.

  1. 4)

    Minimum time for continuous heating and closure constraints

Frequency of switch on/off signal will affect the EWH life-time and operating costs. Limiting the minimum time for continuous heating and closure is necessary [25]:

$$\sum\limits_{{j = {\text{max}} (t - T_{\text{on}} + 1,1)}}^{t} {x(j)} \le u(t)$$
$$\sum\limits_{{j = {\text{max}} (t - T_{\text{off}} + 1,1)}}^{t} {y(j)} \le 1 - u(t)$$

where Ton is the minimum time of continuous heating; and Toff is the minimum time of continuous closure.

Since the switch on/off signal occurs in pair, the longer the minimum time for continuous heating or closure, the less the number of actioning, decreasing the impact on the EWH life-time. Since j=max(t−Ton+1,1) in (17), j=1 indicates that the continuous heating time of EWH is less than Ton, and the minimum heating time constraint is required in this case, whereas j=t−Ton+1 indicates that the continuous heating time has exceeded Ton with the start of next cycle. The constraint is satisfied within the next Ton period. The principle of (18) is the same as described above.

Multi-objective optimization model based on MILP

Piecewise linear approximation of thermodynamic model

The EWH with TCAWM multi-objective optimization problem described above is a complex nonlinear optimization problem. In order to solve the optimization problem, the nonlinear relationship of the water temperature in the tank is converted into linear relationship by piecewise linearization.

Equation (6) can be transformed into the following equation:

$$\begin{aligned} T_{\text{in}} (t + 1) & = T_{\text{in}} (t) + [R^{\prime}(\eta P_{0} u(t) + \frac{{T_{\text{amb}} }}{R} \\ & \quad + c\rho B(t)T_{\text{inlet}} ) - T_{\text{in}} (t)](1 - \text{e}^{{ - \frac{\Delta t}{{c\rho V_{\text{tank}} R^{\prime}}}}} ) \\ \end{aligned}$$

We perform Taylor series expansion on the exponential function in (19), that is exx+1. Equation (19) can be modified into the following equation:

$$\begin{aligned} T_{\text{in}} (t + 1) & = T_{\text{in}} (t)( 1- \frac{\Delta t}{{c\rho RV_{\text{tank}} }}) + \frac{\Delta t}{{c\rho V_{\text{tank}} }}(\eta P_{0} u(t) \\ & \quad + \frac{{T_{\text{amb}} }}{R}) + \frac{\Delta t}{{V_{\text{tank}} }}\left( {T_{\text{inlet}} - T_{\text{in}} (t)} \right)B(t) \\ \end{aligned}$$

Combining (10) with (20), the temperature in the EWH tank can be expressed as the following piecewise function:

$$T_{\text{in}} (t + 1) = \left\{ \begin{aligned} T_{\text{in}} (t)( 1- \frac{\Delta t}{{c\rho RV_{\text{tank}} }}) + \frac{\Delta t}{{c\rho V_{\text{tank}} }}(\eta P_{0} u(t) + \frac{{T_{\text{amb}} }}{R}) \hfill \\ \, + \frac{\Delta t}{{V_{\text{tank}} }}(T_{\text{inlet}} - T_{\exp } )B_{\text{tap}} \quad T_{\text{in}} (t) \ge T_{\exp } \hfill \\ T_{\text{in}} (t)( 1- \frac{\Delta t}{{c\rho RV_{\text{tank}} }}) + \frac{\Delta t}{{c\rho V_{\text{tank}} }}(\eta P_{0} u(t) + \frac{{T_{\text{amb}} }}{R}) \hfill \\ \, + \frac{\Delta t}{{V_{\text{tank}} }}(T_{\text{inlet}} - T_{\text{in}} (t))B_{\text{tap}} \quad T_{\text{in}} (t) < T_{\exp } \hfill \\ \end{aligned} \right.$$

Now, to transform (21) into a linear form, we first define a new set of binary variables δ(t) as follows:

$$\delta (t) = \left\{ {\begin{array}{*{20}c} 1 & {T_{\text{in}} (t) \ge T_{\exp } } \\ 0 & {T_{\text{in}} (t) < T_{\exp } } \\ \end{array} } \right.$$

The definition of δ(t) in (22) has the following explicit equivalent linear form:

$$\frac{{T_{\text{in}} (t) - T_{\exp } }}{M} \le \delta (t) \le 1 + \frac{{T_{\text{in}} (t) - T_{\exp } }}{M}$$

where M is a coefficient that has sufficient large positive value.

The equivalence between the implicit relation (22) and its explicit form (23) can be verified as follows: if Tin(t)<Texp, then from (23), we see that −εδ(t)≤1−ε, where ε is a positive number less than 1. Since δ(t) is a binary variable, the only choice here is δ(t)=0. Similarly, when Tin(t)>Texp, we can come to conclusion that εδ(t)≤1+ε, implying that δ(t)=1.

With the explicit characterization of δ(t) in (23), it is now possible to express Tin(t) through the equivalent explicit inequalities. The linear form of tank water temperature Tin(t) can be written as:

$$ \begin{aligned} - M\delta (t) \le T_{\text{in}} (t + 1) - [T_{\text{in}} (t)( 1- \frac{\Delta t}{{c\rho RV_{\text{tank}} }}) + \frac{\Delta t}{{c\rho V_{\text{tank}} }} \hfill \\ \, \cdot (\eta P_{0} u(t) + \frac{{T_{\text{amb}} }}{R}) + \frac{\Delta t}{{V_{\text{tank}} }}(T_{\text{inlet}} - T_{\text{in}} (t))B_{\text{tap}} ] \le M\delta (t) \hfill \\ \end{aligned} $$
$$ \begin{aligned} - M(1 - \delta (t)) \le T_{\text{in}} (t + 1) - [T_{\text{in}} (t)( 1- \frac{\Delta t}{{c\rho RV_{\text{tank}} }}) + \frac{\Delta t}{{c\rho V_{\text{tank}} }} \hfill \\ \, \cdot (\eta P_{0} u(t) + \frac{{T_{\text{amb}} }}{R}) + \frac{\Delta t}{{V_{\text{tank}} }}(T_{\text{inlet}} - T_{\exp } )B_{\text{tap}} ] \le M(1 - \delta (t)) \hfill \\ \end{aligned} $$

Equation (21) is equivalent to (24), (25). If δ(t)=0 (or Tin(t)<Texp), (24) is zero on both sides, which implies that Tin(t+1)=Tin(t)[1Δt/(cρRVtank)]+Δt(ηP0u(t)+Tamb/R)/(cρVtank)+Δt(Tinlet−Tin(t))Btap/Vtank, since M is an arbitrary large positive value, (25) is always satisfied. On the contrary, If δ(t)=1 (or Tin(t)>Texp), (25) is zero on both sides, which implies that Tin(t+1)=Tin(t)[1Δt/(cρRVtank)]+Δt(ηP0u(t)+Tamb/R)/(cρVtank)+Δt(Tinlet−Texp)Btap/Vtank, since M is large enough, (24) is always satisfied.


Generally, linear programming with integer requirements is called integer linear programming (ILP). MILP is that the required solution has both real and integer requirements. Efficient MILP software such as the branch-and-cut algorithm has been developed, and optimized commercial solvers with large-scale capabilities are currently available. The mainstream commercial solvers are CPLEX and GUROB.

The difficulty of solving MILP problems, however, is caused by the presence of integer decision variables. Integer variables lead to combinatorial complexity, which becomes very high when the problem size is very large. As a result, the difficulty of working on finding the best solution for the MILP problem has grown exponentially.

MILP is used to solve planning problems with both linear real variables and linear integer variables, as is shown in (26).

$$ \left\{ \begin{aligned} & \!{\mathop{{\text{min}}}\limits_{{\varvec{w}},{\varvec{v}}} }\ \varvec{f}^{\text{T}} (\varvec{w},\varvec{v}) \hfill \\ & \text{s.t.} \, \varvec{A}_{{{\text{ineq}}1}} \varvec{w} + \varvec{A}_{{{\text{ineq}}2}} \varvec{v} \le \varvec{b}_{\text{ineq}} \hfill \\ \, & \,\,\,\quad \varvec{A}_{{{\text{eq}}1}} \varvec{w} + \varvec{A}_{{{\text{eq}}2}} \varvec{v} = \varvec{b}_{\text{eq}} \hfill \\ & \,\,\,\quad\varvec{l}_{{{\text{b}}1}} \le \varvec{w} \le \varvec{u}_{{{\text{b}}1}} \hfill \\ & \,\,\,\quad \varvec{l}_{{{\text{b}}2}} \le \varvec{v} \le \varvec{u}_{{{\text{b}}2}} \hfill \\ \end{aligned} \right. $$

where \(\varvec{f}^{\text{T}} (\varvec{w},\varvec{v})\) is the objective function of a MILP problem; f is a linear function vector whose elements are constant; w, v are the solution vectors, the elements of w are integers; Aineq1 and Aineq2 are the inequality matrices; Aeq1 and Aeq2 are the equality matrices; bineq is inequality vector; beq is equality vector; lb1 and lb2 are the lower-bounds; and ub1 and ub2 are the upper-bounds. In particular, there are restrictions on the variables w to be the integer, both the equality constraints and the inequality constraints to be linear.

Formulation of optimization model based on MILP

Mathematical formulas of the nonlinear thermodynamic model for the EWH with TCAWM are listed in (1) to (10). Formulas (20) to (25) describe the piecewise linear approximation of nonlinear thermodynamic equations. The linear formulation of the multi-objective optimization model based on MILP is designed to optimize the energy usage of an EWH with TCAWM, which can be summarized by the following: ① a linearized version of the objective function (13); ② subject to (14)–(18), (23)–(25).

Decision variables in the proposed multi-objective model include not only real variables (temperature inside the tank Tin(t)), but also integer variables (on/off status variable u(t), switch-on signal x(t), switch-off signal y(t), and the auxiliary variable δ(t)). Then the MILP method is adopted. By introducing the auxiliary variable, the nonlinear thermodynamic characteristics of water temperature can be expressed in piecewise linearized form. Using electric power constraint, temperature limit constraints, switch on/off signal constraints, and minimum time for continuous heating and closure constraints, a multi-objective optimization for operating an EWH with TCAWM is established. A MILP formulation is proposed in order to solve the optimization problem more efficiently. Moreover, the multi-objective optimization model based on MILP is solved by CPLEX optimization toolbox.

Testing results

In the following testing examples, the multi-objective optimization model based on MILP optimizes the operation of an EWH over 24 hours. The value of the parameter R is the same as that in [17]. Other parameters are as follows: Vtank is 150 L, P0 is 3.5 kW, c is 4200 J/(kg·°C), R is 17.922 K·day/kWh, Η is 100%.

Electricity price signal in the testing examples uses time-of-use (TOU) pricing implemented in Jiangsu province. The price is 0.5583 RMB during the peak hours from 08:00 a.m. to 21:00 p.m. and the price is 0.3583 RMB during off-peak hours from 21:00 p.m. to 08:00 a.m. of the next day.

Assume that the WA1 occurs during the period from 12:00 p.m. to 12:30 p.m. for kitchen water, the WA2 occurs from 18:00 p.m. and 19:00 p.m. in the evening, and the most desirable temperature Texp is 40 °C.

The research objective of this paper is the EWH considering automatic water mixing system placed indoors. Tamb can be obtained by collecting the value of air temperature outside the EWH tank in the past one day through the temperature sensor installed in the room, and calculating the average value. Because water temperature does not change obviously during the day, the water temperature outside the tank Tinlet takes a constant value of 15 °C.

Linear form and nonlinear form of tank water temperature

In order to examine the accuracy of linear form (24), (25), Figure 4 illustrates the curves of water temperature obtained, respectively, by applying the nonlinear form (6) and the linear forms (24), (25) with the same EWH power consumption and WAs. The consumer hot water demand period is WA2 and Δt takes 2 min.

Fig. 4

Temperature curves using linear formula and nonlinear formula

A magnified view of the curves shows that the simulation results under different tank temperature formulas have small differences and the temperature curves almost coincide, which shows effectiveness of the piecewise linear approximation method for the EWH with TCAWM thermodynamic function.

Optimization results of EWH based on MILP

The performance of the proposed multi-objective optimization model is examined in this section. The hot water demand period includes WA1 and WA2. Δt takes 6 min. In order to test the optimization model considering both electricity savings and user comfort demands, Table 1 and Fig. 5 respectively show the optimization results while the user preference factor α takes different values.

Table 1 Results of different control schemes
Fig. 5

Power consumption curves, tank temperature curves and tap water temperature curves of different control schemes

In Table 1, the electricity cost is as high as 16.4 RMB when the optimal comfort scheme is applied without considering cost savings. The electricity cost is obviously saved while adopting the optimal electricity cost scheme without considering user comfort demands, and the electricity cost is only 4.9 RMB.

With the multi-objective optimization scheme, different requirements for user comfort level are achieved by changing the user preference factor α. It can be seen from Table 1 that the electricity cost gradually decreases and the comfort index value D gradually increases with the increase of α.

It can be seen from Fig. 5 that the optimal comfort scheme results in the most power consumption. Consequently, the water tank temperature is maintained within a higher temperature limit, and the tap water temperature can be completely maintained at the most desirable temperature Texp during the hot water demand period.

Under multi-objective optimization scheme, we assume that α is equal to 0.5, indicating that both the cost saving requirements and user comfort needs should be satisfied. Figure 5 shows that the EWH heating process is mainly concentrated on the morning and afternoon when the electricity price is low. Considering the user comfort requirements, the EWH is heated again before water usage happened, therefore the tap water temperature can be maintained at 40 °C for a comparatively long time.

Curve of the optimal cost scheme is special. Compared with the other two schemes, water tank temperature curve is generally lower and tap temperature is also decreased faster, which caused by the lowest requirement for user comfort.

Comparison with heuristic algorithms

GA is a typical heuristic algorithm with a wide range of applications and the strong search ability, which is suitable for solving complex nonlinear optimization problems. Therefore, taking GA as an example to solve the EWH with TCAWM multi-objective optimization problem with nonlinear equations. The objective function is also used as the fitness function, and the coding method adopts real number coding to control EWH start from 12:00 a.m. and run for 24 hours to 12:00 a.m. of the next day, with water events and user preference factors the same as that of the model using MILP.

In order to ensure the convergence of the multi-objective optimization model based on GA testing results below, we compare the value of termination condition Vexitflag (if the optimization result converges, Vexitflag is equal to 1; otherwise, Vexitflag is equal to 0) to select the proper result. Considering the inconsistent convergence of GA, the results listed below are the average of the testing results that the program runs 5 times independently.

Figure 6 shows the power consumption curves and tap water temperature curves of the two optimization models with MILP and GA, respectively. Δt takes 6 min.

Fig. 6

Optimization results of different schemes under two modeling methods

As seen from Fig. 6, no matter which algorithm is selected for modeling, EWH usually heats for a long time before 08:00 a.m..

As observed from Fig. 6b, d, f, the model using MILP can better meet the requirement for user comfort, that is, the tap water temperature remains within a higher temperature level.

For example, the model using MILP considering both electricity cost and user comfort level can ensure that the change of tap water temperature during the WA2 period is not obvious, although the tap water temperature is much lower than that in the WA1. The cost of the MILP model is 4.9 RMB, and the cost of the GA model is 4.7 RMB, respectively.

Additionally, a comparative study on the MILP and GA to find out an optimal solution is presented by evaluating the performance of the solution and the execution time of computation. Δt is 2 min.

  1. 1)

    Comparison in optimization performance

The optimization is to solve the extreme value problem including constraints. The objective function is minimized with the premise of all constraints. The smaller the objective function obtained by the optimization, the better the effect of optimizations. According to the modeling process, the performance of the optimization can be judged by comparing the value of the objective function. Figure 7 shows the objective function values optimized by different modeling methods for different economic needs and comfort requirements.

Fig. 7

Objective function values of different modeling methods

It can be seen from Fig. 7 that: ① regardless of whether users prefer savings in electricity bills or comfort demands, the multi-objective model based on MILP performs better than the multi-objective model based on GA; ② the higher requirement for user comfort, i.e. the smaller the user preference factor α, the better the effect of multi-objective model based on MILP; ③ when users pay more attention to electricity cost, i.e. the bigger the user preference factor α, the performance of solution using GA and MILP tends to be more similar.

  1. 2)

    Comparison in execution time

The execution time is also an important element to test the optimization effect apart from the objective function. Figure 8 demonstrates the execution time of the optimization solutions using GA and MILP with different user comfort requirements.

Fig. 8

Execution time of different modeling methods

We can clearly see that MILP has shorter execution time than GA in Fig. 8. Especially, when the user preference factor α is 1/5, 1/2, 4/5, respectively, the effect of multi-objective optimization model based on MILP is better because the execution time is reduced by more than half. While α is equal to 1/2, the execution time of the solution using GA is 54 s with the execution time in MILP modeling only about 10 s.

Aggregated power of EWH load group

In order to evaluate the effectiveness of the proposed multi-objective optimization scheme, this section takes the load group composed of 20 EWHs as an example. Both the most desirable temperature and time of the hot water usage, are uniformly distributed. In addition, the consumer hot water demand period includes WA1 and WA2, and Δt takes 6 min.

Figure 9 shows curves of the aggregated power obtained by applying two control methods. The following two control schemes are considered in this simulation.

Fig. 9

Aggregated power curves of EWH load group

  1. 1)

    Multi-objective optimization scheme: α takes 1/2 when the operation of EWHs is optimized.

  2. 2)

    Unoptimized scheme: EWHs work without adopting the proposed multi-objective optimization scheme.

As shown in Fig. 9, it is clear that, compared to unoptimized scheme, the aggregated power has been shifted from the peak hours to the off-peak hours when the multi-objective optimization scheme is applied. Electricity price (i.e. TOU pricing) is higher prices during peak hours, and lower during off-peak hours. Due to the users’ desire for economic requirement, the proposed scheme optimizes the on/off status of an EWH by reasonably transferring power demand to off-peak hours, which realizes load shedding and peak load shaving. In this way, all users participate in the DR program by responding to electricity price signal. Therefore, we can believe that the proposed multi-objective optimization scheme is beneficial to both the electric power operators and users.


In this paper, multi-objective optimization model of an EWH with TCAWM based on MILP is proposed, satisfying users’ desire for both economic need and comfort requirement. The main contributions of this paper can be summarized as follows:

  1. 1)

    The thermodynamic model of an EWH with TCAWM not only can reflect change of the current tap water temperature but also is useful to quantify the user thermal discomfort.

  2. 2)

    A piecewise linear approximation method is proposed in order to establish the multi-objective optimization model using MILP.

  3. 3)

    Compared with the multi-objective optimization model using GA, the proposed model using MILP can remarkedly decrease the execution time with better performance.

The simulation results have verified that this proposed method can greatly improve the performance of optimizing the operation of an EWH with TCAWM, which can make up for the shortage of the existing optimization model. By considering the TCAWM and adopting an efficient optimization method, the multi-objective optimization model is able to balance the cost-saving and user comfort.


  1. [1]

    Chen YW, Chen X, Maxemchuk N (2012) The fair allocation of power to air conditioners on a smart grid. IEEE Trans Smart Grid 3(4):2188–2195

    Article  Google Scholar 

  2. [2]

    Marzband M, Azarinejadian F, Savaghebi M et al (2018) Smart transactive energy framework in grid-connected multiple home microgrids under independent and coalition operations. Renew Energy 126:95–106

    Article  Google Scholar 

  3. [3]

    He Y, Chen Y, Yang Z et al (2018) A review on the influence of intelligent power consumption technologies on the utilization rate of distribution network equipment. Prot Control Mod Power Syst 3:1–11

    Article  Google Scholar 

  4. [4]

    Marzband M, Sumper A, Domínguez-García JL et al (2013) Experimental validation of a real time energy management system for microgrids in islanded mode using a local day-ahead electricity market and MINLP. Energy Convers Manag 76:314–322

    Article  Google Scholar 

  5. [5]

    Mehdi T, Fatemeh S, Mousa M et al (2018) A two stage hierarchical control approach for the optimal energy management in commercial building microgrids based on local wind power and PEVs. Sustain Cities Soc 41:332–340

    Article  Google Scholar 

  6. [6]

    Tavakoli M, Shokridehaki F, Funsho AM et al (2018) CVaR-based energy management scheme for optimal resilience and operational cost in commercial building microgrids. Int J Electr Power Energy Syst 100:1–9

    Article  Google Scholar 

  7. [7]

    Marzband M, Fouladfar MH, Akorede MF et al (2018) Framework for smart transactive energy in home-microgrids considering coalition formation and demand side management. Sustain Cities Soc 40:136–154

    Article  Google Scholar 

  8. [8]

    Zhao Z, Lee WC, Shin Y et al (2013) An optimal power scheduling method for demand response in home energy management system. IEEE Trans Smart Grid 4(3):1391–1400

    Article  Google Scholar 

  9. [9]

    Chen Q, Zhao X, Gan D (2017) Active-reactive scheduling of active distribution system considering interactive load and battery storage. Prot Control Mod Power Syst 2:1–11

    Article  Google Scholar 

  10. [10]

    Marzband M, Javadi M, Pourmousavi SA et al (2018) An advanced retail electricity market for active distribution systems and home microgrid interoperability based on game theory. Electr Power Syst Res 157:187–199

    Article  Google Scholar 

  11. [11]

    Belov A, Vasenev A, Havinga PJM et al (2017) Enhancing user comfort models for demand response solutions for domestic water heating systems. In: Proceedings of international conference on smart cities and green ICT systems, Rome, Italy, 23–25 April 2016, pp 201–212

  12. [12]

    Ericson T (2009) Direct load control of residential water heaters. Energy Policy 37(9):3502–3512

    Article  Google Scholar 

  13. [13]

    Kondoh J, Lu N, Hammerstrom DJ (2011) An evaluation of the water heater load potential for providing regulation service. IEEE Trans Power Syst 26(3):1309–1316

    Article  Google Scholar 

  14. [14]

    Dolan PS, Nehrir MH, Gerez V (1996) Development of a Monte Carlo based aggregate model for residential electric water heater loads. Electr Power Syst Res 36(1):29–35

    Article  Google Scholar 

  15. [15]

    Lu N, Katipamula S (2005) Control strategies of thermostatically controlled appliances in a competitive electricity market. In: Proceedings of IEEE PES general meeting, San Francisco, USA, 12–16 June 2005, pp 202–207

  16. [16]

    Booysen MJ, Engelbrecht JAA, Molinaro A (2013) Proof of concept: large-scale monitor and control of household water heating in near real-time. In: Proceedings of international conference on applied energy, Pretoria, South Africa, 1–4 July 2013, 8 pp

  17. [17]

    Nel PJC, Booysen MJ, Merwe BVD (2017) A computationally inexpensive energy model for horizontal electric water heaters with scheduling. IEEE Trans Smart Grid 9(1):48–56

    Article  Google Scholar 

  18. [18]

    Du P, Lu N (2011) Appliance commitment for household load scheduling. IEEE Trans Smart Grid 2(2):411–419

    Article  Google Scholar 

  19. [19]

    Belov A, Kartak V, Vasenev A et al (2016) A hierarchical scheme for balancing user comfort and electricity consumption of tank water heaters. In: Proceedings of IEEE PES innovative smart grid technologies conference, Minneapolis, USA, 6–9 September 2016, 5 pp

  20. [20]

    Michalewicz Z, Janikow CZ, Krawczyk JB (1992) A modified genetic algorithm for optimal control problems. Comput Math Appl 23(12):83–94

    Article  Google Scholar 

  21. [21]

    Belov A, Meratnia N, Zwaag BJVD et al (2017) An efficient water flow control approach for water heaters in direct load control. J Eng Appl Sci 9(11):2106–2120

    Google Scholar 

  22. [22]

    Keane A, Ochoa LF, Borges CLT et al (2013) State-of-the-art techniques and challenges ahead for distributed generation planning and optimization. IEEE Trans Power Syst 28(2):1493–1502

    Article  Google Scholar 

  23. [23]

    Bao YQ, Li Y, Wang B et al (2017) Demand response for frequency control of multi-area power system. J Mod Power Syst Clean Energy 5(1):20–29

    Article  Google Scholar 

  24. [24]

    Wei J, Lei Z, Hui Z et al (2016) Research on power sharing strategy of hybrid energy storage system in photovoltaic power station based on multi-objective optimization. IET Renew Power Gener 10(5):575–583

    Article  Google Scholar 

  25. [25]

    Arroyo JM, Conejo AJ (2002) Optimal response of a thermal unit to an electricity spot market. IEEE Trans Power Syst 15(3):1098–1104

    Article  Google Scholar 

Download references


This work was supported by National Natural Science Foundation of China (No. 51707099), Natural Science Fund for Colleges and Universities of Jiangsu Province (No. 16KJB470009), and China Postdoctoral Science Foundation (No. 2017M611859).

Author information



Corresponding author

Correspondence to Yu-Qing BAO.

Additional information

CrossCheck date: 4 April 2019

Rights and permissions

Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (, which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

WU, M., BAO, YQ., ZHANG, J. et al. Multi-objective optimization for electric water heater using mixed integer linear programming. J. Mod. Power Syst. Clean Energy 7, 1256–1266 (2019).

Download citation


  • Demand response
  • Electric water heater
  • Thermostatically-controlled automatic water mixer
  • Mixed integer linear programming