Our optimization formulation is designed to work in conjunction with the mean field model (Kizilkale and Malhame 2014), where each EWH is modeled by assuming that the reservoir is made up of n fully mixed equal volume layers. The cold water inlet is in the bottom layer, and hot water is drawn from the top layer. Our formulation uses an aggregated EWH model by considering a group of homogeneous EWHs as one large thermal battery. We thus model the EWHs as a single-layer large reservoir with a controllable mean water temperature given a sufficiently good approximation of the energy that the EWH population is capable of absorbing as well as of the losses (mostly due to hot water draw events). Thermal energy conservation for the aggregated EWH model, also called the system dynamics, is expressed as:
$$\begin{aligned} e_{t+1} = e_{t} + { x }(e_{t}) -\ell (e_{t}). \end{aligned}$$
(1)
Here \(e_t\) is the stored energy (i.e., the system state) at time step t; \(x(e_t)\) is the decision variable that represents the quantity of energy injected into the reservoir, which depends on the current system state; and \(\ell (e_t)\) is the system loss due to hot water extraction and heat transfer by conduction.
The heat transfer by conduction, denoted \(\ell _1(e_t) \), is
$$\begin{aligned} \ell _1(e_t) = K A\left( \frac{e_{t}}{{C^p} \rho V} + {N^{\text {ewh}}}({T^L} - {T^{\text {env}}})\right) t \end{aligned}$$
(2)
where we have the following quantities are that exogenous inputs: K is the thermal conductivity per unit length of EWHs, A is the total surface area of all the EWHs, \(C^p\) is the hot-water specific heat, \(\rho \) is the water density, V is the total volume of hot water in the EWHs, \({N^{\text {ewh}}}\) is the number of EWHs in the model, \(T^L\) is the inlet water temperature, and \( {T^{\text {env}}}\) is the environment temperature.
We model the hot water extraction process as a time process on a finite state space that satisfies the Markov property. Specifically, we adopted the model in Kizilkale and Malhame (2014) where extraction is modeled as a continuous-time Markov chain. It is denoted \(\theta _t\), \(t \ge 0\), and takes values in \(\varTheta = \{1,2, \)...\(,{\mathfrak {I}}\}\), with the identical infinitesimal generator \(\varLambda = \{\lambda _{ij}, i, j,= 1,\ldots ,{\mathfrak {I}}\}\), where each state consists of different drawn water volumes depending on the type of event such as shower or hand washing. In a continuous time Markov chain, the useful information that we use to calculate the probability of a given state is the distribution of the waiting time at every state. The infinitesimal generator parameters, also called transition rate parameters or matrix, describe the rate of movement between states. Hence, \(\lambda _{ij}\) describes the rate of transition to state j from state i. This transition rate is then used to calculate the probability of occurrence of each state, denoted \({\mathfrak {p}}_{i}\) and defined as
$$\begin{aligned} \begin{aligned} {\mathfrak {p}}_{i}&= \frac{\varPi _i}{\sum _{k=0}^K \varPi _k} \\ \varPi _0&= 1, \quad \varPi _i = \frac{\lambda _{0,1} \lambda _{1,2} \ldots \lambda _{i-1,i}}{\lambda _{1,0} \lambda _{2,1} \ldots \lambda _{i,i-1}} \text { for } i \ge 1. \end{aligned} \end{aligned}$$
(3)
Given this, we can aggregate the losses due to extraction by considering the expected flow of drawn hot water for each type of event i as follows:
$$\begin{aligned} \ell _2 = \rho {C^p} ({T^{\text {mix}}} - {T^L}) \sum _{i=1}^{{\mathfrak {I}}} {N^{\text {ewh}}} {\mathfrak {p}}_i {\dot{V}}^{\text {mix}}_i. \end{aligned}$$
(4)
Here we assume that the end-user mixes hot and cold water together to obtain the desired temperature \({T^{\text {mix}}}\) and the desired flow \({\dot{V}}^{\text {mix}}_k\), with the flow depending on the type of extraction i.
The water temperature must be bounded below to prevent bacterial contamination (especially from Legionella pneumophila, for which the growth potential is almost zero above \({46}^{\circ }\hbox {C}\) (Lacroix 1999)) and bounded above for end-user safety. The zone between these two bounds is the comfort zone that we represent for the aggregate of the EHWs using the constraints:
$$\begin{aligned} \begin{aligned} {e^{\text {max}}}&= {N^{\text {ewh}}} \rho V {C^p} ({T^{\text {max}}} - {T^L})&\qquad \forall t,s \\ {e^{\text {min}}}&= {N^{\text {ewh}}} \rho V {C^p} ({T^{\text {min}}} - {T^L})&\qquad \forall t,s \end{aligned} \end{aligned}$$
(5)
Note that these expressions are also bounds on the energy that can be stored in the set of EWHs. In other words, the maximum quantity of energy the system is able to absorb, \( x (e_{t})\), depends on its mean current state, \(e_t\), because as this state approaches the upper bound, it is able to accept less energy. Moreover, the EWHs will consume a minimum quantity of energy to prevent the system in aggregate from going below the lower limit of the comfort zone.
To bound the aggregated power consumption of the EWHs, we considered the MFC module of Kizilkale and Malhame (2014) as a black box and used it to calculate the minimum and maximum electric power that the EWH population can consume for all reachable values of \(e_t\). Note that not all members of the EWH population reach the same energy level. They are distributed with a certain variance and skewness, where this distribution is not normal because of the comfort zone constraint that trims the tails of the probability density function. Furthermore, the variance and skewness depend on the control. The variance tells us how far the extreme energy states are from the average. We figure out that when the population average is next to the boundaries, the population is more squeezed, in contrary to the case when the population’s mean is far from the boundaries. The former gives us less energy state diversity. The skewness is also important because it shows that the distribution of the EWHs is not symmetric around the mean (i.e., the probability of having EWHs with energy state higher than the average is greater than the probability of having EWHs with less energy). Therefore, we expect that asking the EWH population to reduce its mean temperature is an easier job that increasing it, because the pool size of EWHs which temperature is higher than the mean is larger, hence more flexibility to reduce the mean with minimum individual disturbance in this case. We expect also that with higher diversity, less violation of individual comfort zones will occur.
We conducted a study of the distribution of the EWH population state around a finite set of system states \(e_t\) in order to randomly generate initial EWH states following this precalculated probability density function. For every discrete value of a target energy level \(e_t\), we begin the simulation assuming that the energy state of the EWH population follows a normal distribution with mean \(\mu \) and variance 1. The tails of the distribution are truncated because we have lower and upper bounds on the inner temperature of the hot water inside the EWH tank, but as shown in Figs. 1, 2 and 3, the area under the probability density function near the bounds is sufficiently small to argue that ignoring the truncation is a fair assumption. The MFC is asked to control the EWH population so that its mean energy state reaches \(e_t\). When the population mean converges to \(e_t\), we calculate its variance and skewness around \(e_t\); we denote this density function by \({f(e_t)}\). Then, for every \(e_t\), the state of the EWH population is initialized so that its state distribution follows \({f(e_t)}\). The MFC is next asked to ensure that the mean population temperature is between its lower and upper limits, \({T^{\text {min}}}\) and \({T^{\text {max}}}\). The lower and upper aggregated power consumption bounds can then be calculated. We use this simulation to initialize the energy state of the EHW population, to reflect as much as possible a reasonable initial state of the population, before applying our target control trajectory.
Figures 1, 2 and 3 show the distribution of the thermal energy of the population as its mean moves towards the lower bound, the upper bound, and the middle of the comfort zone. We can see that the thermal energy distribution has a clear negative skew due to the hot water draw events. These result in thermal losses and cause a large portion of the EWHs to have a temperature below the mean population temperature. Furthermore, the distribution variance shrinks as the mean approaches the bounds, which affects the population’s diversity.
Figures 4, 5 and 6 are concerned with bounding the power consumption of the EWHs. Figure 4 shows the simulated results of the minimum and maximum power consumption for 200 EWHs. The feasible region of \( x (e_{t})\) is the region between the two monotonically nonincreasing functions. We will need to integrate these bounds in our model. To integrate the upper bound, we apply a linear regression, as shown in Fig. 5. For the lower bound, we use a convex quadratic regression, as shown in Fig. 6; the resulting quadratic function is then outer-approximated by a piecewise linear function formed using supporting hyperplanes.