# Household Energy Management
## 3 Elastic Energy Management  
The concept of the developed elastic energy management algorithm (EEM) is shown in Figure 4. The purpose of this algorithm is to ensure the implementation of DSM&R in households (single-family and multi-family homes) in which RES can be installed, defining the currently available total power \(P_{RES}\).  
The EEM algorithm operates continuously in the first loop, checking if:  
* when RES is used, there is an overproduction of power (\(\Delta P<0\)) relative to the power consumed by all connected appliances (\(P_{h}\)), according to the dependence \[\Delta P(i)\geq P_{h}(i)-P_{RES}(i),\] (2)
* there was no change in the total power of all switched-on appliances (\(\Delta P_{h}(i)\)) by the \(\Delta P_{\textit{hys}}\) value set in the algorithm according to the dependence \[|\,\Delta P_{h}(i)\,|\,\leq\Delta P_{\textit{hys}},\] (3)
* when the DSO indicates the need to limit the transfer to the NPS of the excess generated power by RES to a value not greater than \(P_{RES\_DSO}\), at the indicated time (\(t_{RES1}\), \(t_{RES2}\)), information is sent to the inverter about limiting the generated power (\(P_{\textit{threshold}}\)) to the value determined with the dependency \[P_{\textit{threshold}}=P_{\textit{RES\_DSO}}(i)-\,|\,\Delta P(i)\,|\,,\] (4)
* no information was sent from DSO about the need to reduce the load \(P_{h}(i)\) to at least \(P_{h\_DSO}\) in the desired time interval (\(t_{DR1}\), \(t_{DR2}\)), specified individually for each household (in this case, status of \(DSO=0\)).  
If any of the conditions  
\[\Delta P(i)\geq 0\text{ and }DSO=0,\text{ and }\mid\Delta P_{h}(i)\mid\leq\Delta P_{ hys} \tag{5}\]  
is not met, then the EEM algorithm goes into operation in the second loop, in which the parameters of the appliances switched on are read and one of the two algorithms is started: EEM1 or EEM2. If the status of \(DSO=0\), then the EEM1 algorithm is launched, the goal of  
Figure 4: EEM Algorithm.  
which is to reduce the power of appliances in time zones with a higher energy price. In the case when \(DSO=1\), the EEM2 algorithm is activated, which reduces the appliance power to the level in the time interval requested by DSO (\(t_{DR1},t_{DR2}\)) so that the sum of the power of all switched-on appliances is not greater than \(P_{h\_DSO}\). This functionality of EEM2 is dictated by the fact that households do not have a clearly defined timetable for switching on specific appliances with their specific operating functions. The goal of EEM2 is to support actions taken at the TSO and DSO level in the reduction of peak demand phenomenon, especially in critical situations for NPS. In order to ensure the effective operation of the EEM algorithm, instructions for:  
* limitation of transferring excess power generated to NPS by RES (\(P_{RES\_DSO}\)) in a given time (from \(t_{RES1}\) to \(t_{RES2}\)),
* reduction of the power consumed from NPS (\(P_{h\_DSO}\)) in a given time (from \(t_{DR1}\) to \(t_{DR2}\)) should be given by DSO well in advance. A detailed description of the operation of the EEM1 and EEM2 algorithms is presented in the following sections.  
The introduction of the condition (3) to the EEM algorithm (Figure 4) solves the problem of excessive triggering of the EEM1 algorithm (Figure 5). Without this condition, switching on an appliance, e.g., a refrigerator could modify the power settings for other appliances. For the next iteration (\(i\)) the total power value of all connected \(P_{\textit{H}s}(i)\) appliances is compared with the \(P_{h}(i{-}1)\) value from the previous iteration. Examples illustrating the impact of condition (3) on the launch of the EEM1 algorithm are shown in Figure 5.  
The developed EEM algorithm includes two groups of appliances:  
* classic appliances that can be controlled only in a binary way (on or off),
* smart appliances whose control method depends on their parameters defined by (1).