Recursive training based physics‑inspired neural network for electric water heater modeling

Aggregating flexibility from residential electric water heaters (EWHs) is fast gaining commercial interest. Flexibility modeling of an EWH involves highly precise and quick simulation of EWH water temperature using the EWH thermal dynamics model for various flexibility control actions. Since EWH tank water temperature data is usually unavailable or costly to obtain, developing an accurate and computationally inexpensive EWH thermal dynamics model with limited sensor data is essential for devising advanced control strategies for EWH flexibility aggregation. In this paper, we present a novel recursive training-based unsupervised physics-informed neural network (PINN) model for predicting tank water temperature which requires only historical EWH power consumption data to train the model. PINN models enable the integration of domain knowledge from traditional physical processes and methods into neural network (NN) models. Single-zone thermal grey-box differential equation model (DEM) is used as the basis to develop and demonstrate proof-of-concept of the proposed approach. Physics from the single-zone model is encoded into the PINN loss function to incorporate domain knowledge and the PINN architecture is structured to mimic the single-zone DEM. The recursive training approach enables the use of previous-step water temperature as an input to the simulation model. Two separate models for EWH ON- and OFF-states are developed and trained with real-world EWH power consumption data. Water temperature prediction results indicate that the proposed approach has similar performance as the traditional single-zone DEM model, thereby demonstrating the ability of the proposed model to learn the underlying physics behind the single-zone model without water temperature data. The proposed model has high accuracy and performs well outside the control set point temperatures indicating its suitability for simulating load shifting and other DR events. Additionally, EWH simulation results for two different scenarios with different water demand compositions are presented to study the effects of propagation errors on temperature prediction. The proposed approach


Introduction
To reduce greenhouse gases and achieve carbon emissions reduction targets, many governments are rapidly increasing the share of highly intermittent renewable energy sources in their country's energy mix. These resources are distributed over the grid as opposed to the centralized generation units. Due to their inherent nature and distributed setup, renewable generation will pose considerable challenges to grid stability in the future. This calls for increased power system flexibility for the reliable operation of modern smart energy systems.
Power system flexibility needs are expected to increase by 66% in the EU from 2018 to 2040 under sustainable development scenarios (Iea 2022). The required flexibility will increase significantly once the renewable energy shares increase above 30 percent of annual electricity production in Europe (Huber et al. 2014). Traditional flexibility sources like conventional generators alone will not suffice to meet increasing flexibility requirements. Digitalization of the electricity grid resulting in smart grids presents an opportunity to tap more flexible resources from the demand side. Demand-side flexibility (DSF) is seen as one of the key contributing factors to tackling increasing flexibility needs. IEA estimates a global DSF potential of 4000 TWh/year or 15 percent of global electricity demand (Zhongming et al. 2017). A study estimates 12-23 GW of DSF in the northern European system with a total peak load of 77 GW (Söder et al. 2018). Additionally, DSF can provide various ancillary services such as frequency regulation, reactive power management, etc., to the grid at a lower cost. However, technical challenges involved in harnessing and realizing the full potential of DSF should be addressed first in order to develop appropriate solutions.
In the domestic sector, Electric Water Heaters (EWHs) have a great potential for providing DSF as they are power-intensive devices with thermal storage capabilities. A basic analysis commissioned by NVE shows that EWHs in Europe have an approximate daily flexibility capacity of 20 GW (Norges vassdrags-og energidirektorat 2021) which is equal to the total installed capacity in Czech Republic and more than the generation capacity in Finland. Aggregated flexibility potential of EWHs from 50% of Norwegian households is estimated to be around 1000 MWh/h (Lakshmanan et al. 2021). Aggregated control and operation of distributed EWHs can significantly address the flexibility needs at both distribution and transmission levels. Thus, it is of great importance to develop tools that can aggregate flexibility from EWHs for providing grid solutions.
Estimating near-term flexibility available from EWHs requires the prediction of future water temperature for different control actions considering future hot water demand. It is crucial to maintain the tank water temperature within a range, both for the user's comfort and to avoid legionella bacteria growth. Various control strategies for EWH have been explored in the literature and can be classified into model-based control (Ahmed et al. 2018;Nehrir et al. 2007;Vrettos et al. 2012) and model-free control (Ruelens et al. 2016;Cao et al. 2020;Kazmi et al. 2016). As the name suggests, model-based control requires an EWH model for finding optimum control action as opposed to model-free control. Most approaches in the model-based control use a simplified model with low accuracy or assume access to data that is not possible/expensive in real world or use a complex model with high computational complexity. Most popular model-free control techniques such as reinforcement learning require a temperature sensor for online training or a simulator model for offline training. In-built temperature sensor from EWHs usually does not provide data and it is expensive to install and collect data from a new sensor. Therefore, an EWH model is required for developing model-free control. Thus, the control strategy for scheduling domestic EWHs for flexibility activation without affecting user comfort and severe rebound effect requires precise knowledge of appliance thermal dynamics and hot water usage profile.
EWH modeling can be classified into white-box, grey-box, and black-box based models. White-box or physics-based modeling of EWHs requires complete individual system information of each EWH which is either very difficult to obtain or unavailable to aggregators (Hossain et al. 2021). These models are developed using detailed knowledge of the underlying physical processes (Farooq et al. 2015) with few or no assumptions and do not require input-output data. However, they require significant effort to develop and tune the parameters such as friction parameter, mixing ratio, thickness of tank wall, etc. Even though white-box based models have good generalization capabilities, they have low accuracy compared to data-driven models (Farooq et al. 2015).
The grey-box differential equation model (DEM) based on energy flow analysis is a less complex approach compared to white-box modeling. Grey-box models use simplified mathematical structure from white-box models and require input-output data to estimate parameters such as thermal capacity and thermal resistance. Most studies use single-zone grey-box model for EWH modeling due to its simplicity and analytical tractability (Paull et al. 2010;Xiang et al. 2019;Ahmed et al. 2018). Single-zone models assume uniform tank water temperature which is quite simplistic. A DEM for singlezone EWH that uses only power consumption for parameter estimation and average water usage estimation is proposed in Shad et al. (2015). Despite its simplicity, accuracy of single-zone model is not suited for precise control of EWHs (Xu et al. 2014). Some grey-box approaches include thermal stratification effects in their models, assuming two or more thermal zones inside the EWH (Farooq et al. 2015;Nel et al. 2016;Alvarez et al. 2019;Zuñiga et al. 2017) and need more than one first-order differential equation for each thermal zone. While multiple-zone grey-box models have higher accuracy than single-zone models, they are computationally expensive.
Alternatively, data-driven black-box models can model non-linear dynamics and provide faster computation during temperature estimation but require expensive and extensive data collection (Han and Jentzen 2018). Moreover, black-box models cannot guarantee learning underlying EWH physical processes (Karniadakis et al. 2021). Therefore, there is a need for computationally efficient models that require limited data but also capture the detailed physics of EWH operation.
Scientific machine learning (SML) is an emerging field that seeks to integrate traditional engineering methods into machine learning-based techniques to utilize prior domain knowledge and physical phenomena in the learning process (Rackauckas et al. 2020). SML-based physics-informed neural networks (PINN) have been explored for modeling building thermal dynamics (Drgoňa et al. 2021;Gokhale et al. 2022) and for estimating battery state of charge (Luzi et al. 2019). PINN is gaining popularity across many fields and their application in power systems are discussed in Huang and Wang (2022).
SML-based approaches replacing traditional methods are gaining interest due to their speed and comparable performance. A recursive training based unsupervised PINN is proposed in this paper for developing EWH water temperature prediction model where the current water temperature is used as an important variable for accurate prediction of future water temperature. This paper provides proof-of-concept for applying SMLbased approaches for developing data-driven temperature prediction models for EWHs when only historical power consumption data is available. The goal is to replace DEM with computationally efficient PINN models that can achieve similar or better performance. In addition to learning the physics of EWH operation, results from the proposed approach provide plenty of scope and insights for further developing advanced highprecision PINN-based EWH models for large-scale flexibility aggregation. The proposed model can also be easily extended to multiple-zone stratified model as the physics of each zone is similar to the single-zone model.
The main contributions of this paper are: • Developing an unsupervised PINN-based temperature prediction model for EWHs when only historical power consumption data is available. • Formulating a recursive training approach to model previous temperature as an input parameter in unsupervised learning setting. • Demonstrating that the proposed model performs comparably with traditional single-zone DEM.
The rest of the paper is organized as follows. "Background" section provides theoretical background on single-zone DEM and summarizes parameter and water-rate estimation steps. Under the "Methodology" section, the loss functions, the PINN architecture and the recursive training procedure are discussed. Simulation results are presented, compared and discussed in "Results and discussion" section and the conclusion and future work are summarized in "Conclusion and future work" section.

Background
Thermostat temperature settings determine the ON/OFF states of the EWH. When water temperature reaches a lower threshold temperature T lo , the in-built controller turns on the heater and vice-versa when the temperature reaches a higher threshold temperature T hi . The evolution of water temperature profile depends upon EWH characteristics, current water temperature T(t), future hot water demand, ambient temperature T amb , inlet water temperature T in , etc. This section presents the theory behind singlezone EWH model and also summarizes the steps involved in parameter estimation and water rate estimation when only power consumption data is available.

Single-zone DEM
The single-zone DEM assumes that water inside the EWH is perfectly mixed and the water temperature is uniform. It also assumes that the EWH has a single heating element. The schematic representation of single-zone DEM model is shown in Fig. 1. The energy balance equation representing single-zone DEM is calculated as follows.
where C = ρ c p V is the thermal capacity(Ws/ • C), ρ represent the water density (1000 kg/m 3 ), c p is specific heat capacity (4196 Ws/Kg • C ) of water. Q flow represents energy loss due to hot water demand and is a function of the water demand and the temperature difference between T(t) and T in . Q loss represents natural heat loss to the atmosphere due to the temperature difference between T(t) and T amb . Q H represents the energy gain due to the heating element converting electrical energy into thermal energy. Water temperature can be obtained by solving Eq. (1).
The Ordinary Differential Equation (ODE) describing temperature rate Ṫ (t) in the single-zone thermal model (Shad et al. 2015) is given in Eq. (2). where G = A/R is the thermal conductance(W/ • C) of the tank, V is the volume of the tank, A is the surface area of the tank, and R is the thermal resistance of the tank. W d (t) denotes the hot water demand. Q(t) is the rate of energy input and is a function of water temperature in a thermostatically controlled water heater as described in Eq. (3). Q 0 denotes the nominal power rating of the EWH and Q(t − δ t) denotes the previous value of consumed power. (1) (2) Analytical solution to Eq. (2). is given as: where t and t 0 represents current and initial time step and T (t 0 ) represents temperature at initial time-step. Eq. (4) can be used estimate water temperature at any time-step.

Parameter and water rate estimation
There are multiple parameters in the single-zone DEM model that needs to be estimated. T amb and T in are assumed to be constant for simplicity. Thermostat set-points T hi and T lo are assumed based on literature review (Lakshmanan et al. 2021). These values are easily available for a particular geographical area and from the EWH's technical specifications sheet.
Physical parameters C and G need to be estimated solely from power consumption data. Using the method proposed in Shad et al. (2015), C and G in Eq. (2) are estimated and the steps are summarized as follows.
• It can be fairly assumed that maximum OFF duration Max off and minimum ON duration Min on happen when hot water demand is zero. • Max off and Min on can be obtained from the power consumption data and water demand is assumed zero. • Replacing (t − t 0 ) in Eq. (4) using Max off and Min on and solving the pair of the obtained equation provides an estimated value for C and G.
Hot water demand W d (t) is stochastic to some extent and can not be assumed constant.
The duration for which EWH stays on or off depends upon the hot water demand during that duration. The average water rate during a particular event is also estimated using the method proposed in Shad et al. (2015) and is summarized as follows.
• From the power consumption data, the duration of each ON event and OFF event can be obtained. ON/OFF event represents the operation/non-operation of EWH between two control commands (turn-on and turn-off ). • Calculated duration along with estimated parameters C and G can be used in Eq. (4) to obtain the average water demand during a particular event.

Methodology
Prior knowledge from EWH thermal dynamics can be employed in PINN loss functions and in designing PINN architecture. Two separate temperature prediction models with one-minute prediction intervals for ON-and OFF-events of an EWH are developed. (3) This section describes data preparation, setting up physics-based loss functions, PINN architecture, and recursive training steps for the proposed approach.

Data preparation
The training data set used in this work contains minute-wise continuous power consumption data. The number of ON/OFF events and their duration can be inferred from power consumption data. From the data set, ON and OFF events are separated for training ON-and OFF-dynamics models respectively. Average water rates are estimated for randomly selected events and used for training.

Loss functions
Custom loss functions developed to train the neural network (NN) are explained here.
Since temperature data is unavailable, it is necessary that developed loss functions well represent the physics of EWH in order for the NN to learn. Multiple loss functions that represent the physics are developed and listed here.

Temperature range
In a thermostat-controlled EWH, under normal operation, the water temperature will not exceed T hi and will not drop below T lo . This knowledge is modeled as a loss function L 1 and is shown in Eq. (5).
Loss function L 1 penalizes the network during training when the predicted temperature is not between T hi and T lo .

Temperature change
When the EWH is OFF, water temperature continues to decrease until T lo before the EWH turns on. So in the OFF-dynamics model, the difference between two consecutive predictions for two consecutive time steps of an event should be positive. For the OFFdynamics model, this information is modeled as a loss function L off 2 as shown in (Eq. 6).
When the EWH is ON, water temperature will increase when water rate is sufficiently low or will decrease/stay the same when water rate is sufficiently high. Since the estimated average water rate is used in this model, water temperature will not decrease at any instant when EWH is ON according to DEM. For the ON-dynamics model, this information is modeled as loss function L on 2 as shown in Eq. (7). (5)

Total temperature change per event
The water temperature at start (T start ) and end of an event (T end ) is known for a particular event. T start and T end are equal to thermostat control set-points T hi and T lo for OFF events. T start and T end are equal to T lo and T hi for ON events. Time t end can be inferred from the power consumption data. This information is modeled as loss function L 3 as shown in Eq. (10).
T spd and T prd spd represent actual and predicted set points difference. L 3 loss function ensures that the predicted temperature t end is equal to the set-point temperature for a particular event.

Relevant-ODE
L 1 -L 3 loss functions do not reflect the influence of water temperature T(t) on the rate of change in water temperature Ṫ (t) . Temperature change is continuous in the real world. Hence, Ṫ (t) also changes continuously. The predictions can have constant Ṫ (t) and still satisfy L1-L3 losses. For a constant water rate, Ṫ (t) will decrease when T(t) moves closer to T hi when EWH is ON and Ṫ (t) will decrease when T(t) moves closer to T lo when EWH is OFF.
In a supervised PINN model, generally relevant ODE is used to model an additional loss function to incorporate prior scientific knowledge. ODE used in this work is given in Eq. (2). The goal is to minimize the difference between the gradient of the network's output with respect to its inputs and the gradient calculated using DEM. This ensures that PINN solutions are consistent with the known physics. The modeled loss function L 4 is shown in Eq. (11).
dT (x i ) dt is calculated using Eq. (2). L4 loss function ensures that for a constant water rate, Ṫ (t) will decrease when T(t) moves closer to T hi when EWH is on and Ṫ (t) will decrease when T(t) moves closer to T lo when EWH is off.
All loss values are scaled and combined together for training the PINN.

Network architecture
A simple feed-forward artificial neural network is used to develop the proposed architecture. A priori knowledge from single-zone model is used to define the network architecture. More precisely, the initial layers are structured to mimic the differential equation defined in Eq.
(2). This ensures that physics from single-zone model is embedded in the NN architecture and inputs are processed according to it before feeding it to neural layers. The schematic representation of the proposed architecture for the ONand OFF-dynamics model is shown in Fig. 2 neurons, activation functions, etc., were selected heuristically. The inputs to the models are previous time step temperature, average water rate, and other relevant inputs to Eq.
(2) which are assumed constant. The output is current water temperature. There is also another constant input representing the time step (60s) of the prediction. This input is constant for all predictions and yet relevant to training the network. Without the time input, there is no time reference in the network. The time input is also required to calculate the L 4 loss function as it requires a gradient of NN with respect to the input time-step.
The proposed architecture mimicking the DEM requires previous step temperature as an input. However, the goal is to learn the underlying EWH thermal dynamics in the absence of temperature data. A recursive training approach is selected to train the network.

Recursive training
In time series data, the current value is highly correlated with the immediate past values. Hence, previous step temperature is highly relevant for current temperature prediction model. Recursive training is an iterative training approach in which the next input is created based on the output from the previous training input. During training, new input is created recursively after processing the previous input. In this case, the previous step temperature input is created based on the PINN output to the previous input. The pseudo-code for recursive training approach is given as follows.
First, the network weights are initialized randomly. For each event, the initial point for previous step temperature is required and is available. It is known that the initial temperature for an event is equal to T hi or T low depending upon whether it is an OFF or ON event. T hi or T low will act as an initial point for previous step temperature. The next input is created based on the output predicted by PINN. This process repeats until the end of an event. Since the event duration is known, once an event ends, the input is reset to T hi or T low for the next event and the steps are repeated. Once all events are completed, the loss value is calculated for the epoch and the weights are updated. The same procedure is repeated for the next remaining epochs.
The flow chart summarizing the entire model development is shown in Fig. 3. Once the NN is trained to reduce total custom loss function, ON-and OFF-dynamics models can be used recursively to predict the water temperature and power consumption can be inferred from the T prd (t) for the future events. The schematic representation of the procedure to use the trained model is shown in Fig. 4. The model requires an initial point for starting the prediction. If the initial point is the beginning of the ON-event, it will continue to use the ON-dynamics model until T prd (t) reaches T hi , after which it switches to the OFF-dynamics model. This continues till the end of the simulation period.

Results and discussion
The proposed approach was tested using real-world power consumption data for an EWH available from the open-source data set Pecan Street Dataport (Dataport 2022). The frequency of power measurements is 1 min. An EWH was chosen randomly and was assumed to have a single heating element and uniform water tank temperature. The predicted temperature profiles were compared with temperature profiles estimated by single-zone DEM as true temperature data is unavailable in the data set. The presented discussions are still relevant as the goal is to demonstrate that PINN can replace DEM methods and can have similar performance.
Max off and MIN on were obtained from power consumption data and the parameters were estimated. The estimated parameters were used in the loss function L 4 . The obtained values are presented in Table 1. 50 random events each for ON-and OFF-dynamics model were selected. The duration of events were obtained from power consumption data and the average water demand for selected events were estimated using the duration and estimated parameters. The duration and water demand of selected events are presented in Figs. 5 and 6. The selected events well reflect the actual distribution of the water demand and the duration of EWH operation. It can be observed from Fig. 6 that water demand is higher during ON events than during OFF events. It is fair to assume that this is due to major activities such as taking showers, washing clothes, etc. This also indicates that temperature will fall quickly during demand response and supports the goal of this work.
The duration and water demand were used to create inputs to the NN. The models were built in Python using the Keras library and Adam optimizer was used for  training. The proposed approach is generic and applies to any EWH with power consumption data.
The models were trained and their performance for the training dataset was analyzed first. Different error metrics were calculated and presented in Table 2 and  Table 3 for both models. For the OFF-dynamics model, the mean absolute error (MAE) for training dataset shows that PINN predictions differ on average only by 0.15 • C from DEM predictions. OFF-dynamics model predictions for three different events with different water demands are shown in Fig. 7. It shows that PINN predictions are similar to DEM predictions. However, event-1 predictions seem to be inaccurate compared to events 2 and 3. This can be explained by the fact that water demand is very high for event 1 and high water demand is not well represented in the OFF-training dataset as can be seen in Fig. 6. This shows the importance of having an evenly distributed dataset for training.   Fig. 8. It can also be seen in Table 3 that the error is higher (MAE = 0.25 • C) for ON-dynamics model compared to the OFF-dynamics model. However, in Fig. 8, the predictions for events 1 and 2 appear almost accurate. The inaccurate prediction for events with very high water demand like event-3 is the reason for high error in ON-dynamics model predictions. This can again be explained by the non-uniform distribution of water demands in the ON-training dataset and can be seen in Fig. 6.
In general, performance analysis for individual events from the training dataset indicates that the proposed model is capable of modeling the thermal dynamics of EWH between control set-points fairly accurately. However, during Demand response (DR), EWH operates outside control set-point temperatures. Thus it is important to assess the model's performance outside the thermostat control range. It was assumed that there was no thermostat-based control and the evolution of the temperature profile predicted by PINN was examined for the case when EWH was not turned ON/OFF when it reaches T lo /T hi . The results were compared with the temperature profile provided by DEM and are shown in Figs. 9 and 10. It can be seen that PINN is able to capture the non-linear temperature evolution for both ON and OFF events without thermostat control. This shows that the proposed model can be used for flexibility modeling of EWH for load shifting during a DR event.
The combined performance of OFF-dynamics and ON-dynamics models in simulating EWH for future events is evaluated through two constructed scenarios. Scenario 1 consists of three ON and OFF events each. Scenario 2 consists of five ON and OFF events each. Water demands during events for scenarios 1 and 2 are presented in Tables 4 and 5. Water demands were carefully selected to be different from the data present in the training dataset. Since PINN is based on a single-zone DEM model, the same is used for comparison purposes. The temperature predicted by PINN and DEM models for both scenarios are presented in Figs. 11 and 12. The plots show that for both scenarios, temperature predicted by PINN is fairly similar to the temperature predicted by DEM at least in the first few events. A lag in PINN predictions compared to DEM predictions can be observed in the later stages of the scenarios. This is due  to the effect of error propagation from initial stages occurring in recursive prediction strategy and is a very well-known phenomenon. Different error metrics were calculated for both scenarios to compare the performance of PINN with DEM and are shown in Table 6. The MAE for scenario-1 with the simulated duration of almost 7.5 h shows that PINN predictions can differ on average only by 0.22 • C from DEM predictions. For scenario-2 with the simulated duration of almost 12 h, MAE is 0.47 • C. This clearly shows the impact of error propagation from initial stages.  Also, mean error metrics can be misleading as they can not explain the impact of the propagated error. Though the error values are small, the plots show that the error for a single point will be large when the time step is further from zero. This would cause the entire event to lag by large time-steps if not corrected. This is not desirable for DR programs as the aggregator would have to pay a huge penalty for not fulfilling contractual obligations in terms of flexibility delivered or user comfort. However, the more accurate predictions for the first few events in initial stages is promising since aggregator participating in DR programs usually requires shorter simulation periods. Power consumption for scenarios 1 and 2 can be inferred from predicted temperatures and is presented in Figs. 13 and 14. The plots show that inferred power consumption using PINN model closely matches the actual power consumption. The lag in output observed for PINN model is due to an error in the time step at which the model switches between the ON-and OFF-dynamics model. This in turn is due to the propagating error from initial stages as explained earlier. Precision, Recall, and F1 scores were calculated based on the correct prediction of EWH ON and OFF states using inferred power consumption data and are presented in Table 7. The results for scenario-1 show that PINN can infer 92% of actual ON states correctly and 95% of total inferred ON states are actual ON states. The performance degrades for scenario-2 as the values are 82% and 85%, respectively. This is expected as scenario-2 is simulated for a longer period.
This analysis emphasizes the impact of propagating error from initial stages on flexibility modeling if not corrected. For example, consider two cases where EWH power  . 13 The power inferred from the predicted temperatures from PINN for the scenario-1 compared to actual power consumption consumption data is available after simulation in one case and not available in another case. EWH power consumption data can be used to correct the lag in predicted events simulation since the true power consumption of a simulated event is available after sometime. Non-intrusive load monitoring (NILM) can be used as a correcting strategy for the case where EWH power consumption data is not available after simulation. NILM is a technique to disaggregate individual appliance power consumption from total power consumption from household smart meter measurements (Garcia et al. 2020;Zufferey et al. 2020). As aggregators can have access to total consumption through smart meter data, it is possible to infer EWH consumption to a good extent from total power consumption using NILM techniques. An aggregator can compare the NILM output and PINN simulation. The PINN simulation model can be readjusted for the accounted error and EWH can be simulated again. For example, consider an aggregator simulated EWH for the next 24 h. After 12 h, the aggregator can use NILM to infer EWH consumption for the past 12 h from total consumption data. PINN results and NILM results can be compared for these 12hrs and any observed deviation can be noted. The aggregator can then reset PINN simulation for the next 12 h based on NILM results as it can provide the actual time-step of recent event start/end. It should be noted that such approaches are suitable only for short-term decision-making problems.
To summarize, individual event analysis and simulation beyond control set-points indicate that the proposed model learns the physics described in Eq. (2) and the trained model has high prediction accuracy for individual events. Average water demand in the  training set should be uniformly distributed. The propagating error is of concern for simulating EWH for longer periods using the proposed approach. The advantages of the proposed approach are: • The proposed approach is generic and can be used for any water heater.
• Neural network based EWH temperature prediction model can be developed without having actual temperature data. • Recursive approach allows previous step temperature as input and thus NN can mimic the differential equation. • Can easily be integrated into decision support tools for DR programs. This is mainly because the previous temperature input allows starting point of the simulation from any point in the temperature range of interest. This makes it convenient to simulate DR event without additional steps required.
The disadvantages of the proposed approach are: • Temperature stratification effects in the water tank are not captured.
• The average water demand doesn't reflect real-world scenarios making the proposed approach slightly less accurate for flexibility modeling. However, the proposed approach can be easily modified to adapt to stochastic water demand input. • It is not possible to predict the time-step of interest directly. Recursively moving towards the time-step of interest might not be desirable at sometimes.

Conclusion and future work
This paper presents a framework for developing PINN based EWH simulation model with only historical power consumption data. The proposed approach is generic and can be applied to any EWH. Training dataset preparation involving thermal parameter estimation and water demand estimation is described. The PINN architecture is structured to mimic DEM and physics-based custom loss functions are designed to facilitate unsupervised learning. A recursive training procedure supporting previous time-step temperature to be modeled as a PINN input is introduced for learning EWH thermal dynamics. Two different models representing EWH ON and OFF states are trained with real-world EWH power consumption data from open-source data set available in Pecan Street Dataport. The temperature prediction results for individual events show that the proposed approach has comparable performance to traditional single-zone-DEM. The results promise the possibility of employing unsupervised learning for advanced thermal modeling of EWH using PINN. The trained model also showed considerably good results when the EWH was simulated outside the thermostat control range. The proposed model was also used to simulate EWH for two scenarios with different event compositions. The usability of the proposed approach for EWH simulation during a DR event is demonstrated through these two analyses. However, the recursive prediction strategy introduces propagation errors into the prediction results necessitating measures to reduce or correct propagating errors.