## 4 Energy Management Strategies in Residential BESS without RES
### Dynamic Optimization  
Considering that the actual energy demand might differ from the forecasted demand leads to the notion that applying dynamic optimization at the discharging zones is vital. The optimizer takes under consideration any possible updates on the power demand forecast profile and the present values of the SOC and Voltage of the BESS which are determined by the KiBaM model. The division of the day into charging and discharging zone(s) implies that rolling horizons cannot be used at this dynamic optimization algorithm since this will result to collision between zones of different type (charging and discharging). Thus, the prediction and control horizons are decreased by 1 sample after the end of each slot of the discharging zone. At the beginning of each discharging zone both horizons are reset to the initial value \(N\). The dynamic optimization algorithm defines the optimal discharge profile by utilizing the sequential quadratic programming method. As it is thoroughly analyzed in [23] the non-linear problem is formulated as:  
\[\underset{x}{\text{min}}F(\text{x})\text{subject to}\left\{ \begin{array}{c}G( \text{x})\ =\ 0\\ H(\text{x})\ =\ \geq 0\end{array} \right. \tag{20}\]  
The discretized dynamic model consists of the equality constraints \(G(\text{x})\ =\ 0\). By setting an initial guess \(x_{0}\) the sequential quadratic programming method iterates are:  
\[x_{k+1}\ =\ x_{k}+a_{k}\Delta x_{k},k\ =\ 0,1,\ldots \tag{21}\]  
where \(\alpha_{k}\) is the relaxation factor and \(\Delta x_{k}\) is the solution of quadratic programming sub-problem. Figure 7: EMS at autumn/winter ToU tariff. \[\min_{\Delta x}\
abla F(x_{k})^{T}\Delta x+\frac{1}{2}\Delta(x)^{T}A_{k}\Delta x \tag{22}\]  
\[\text{Subject to }\left\{ \begin{array}{l}G(x_{k})+\
abla G(x_{k})^{T}\,\Delta x \ =\ 0\\ H(x_{k})+\
abla H(x_{k})^{T}\,\Delta x\geq 0\end{array} \right. \tag{23}\]  
\(A_{k}\) denotes an approximation of the Hessian of the Lagrangian function:  
\[L(x,\lambda,\sigma)\ =\ F(x)-\lambda^{T}G(x)-\sigma^{T}H(x) \tag{24}\]  
The decision variables of the optimization problem are the maximum permitted energy supply at the household from the BESS at the current and upcoming steps of the horizon. The optimizer aims to determine an optimal discharge schedule so as to prevent premature ageing of the BESS. In order to achieve that, a capacity loss constraint is set. The optimizer aims to cover the maximum possible load of the household with respect to the capacity loss constraint. Furthermore, a weight factor \(w_{i}\) is set for each slot of the discharging zone. The weight factor is utilized to prioritize the cover of the load at time slots with low uncertainty regarding the matching of forecasted demand with actual demand. The dynamic optimization problem is stated as:  
\[\min_{x}f(x)\ =\ \sum_{i\ =\ Is}^{N}\left(E_{d_{i}}-E_{s_{i}}\right)^{2}- \sum_{i\ =\ Is}^{N}\left(w_{i}E_{s_{i}}\right)^{2} \tag{25}\]  
\[\text{s.t.}:\ E_{s_{i}}\leq E_{d_{i}},i\ =\ Is,\ldots,N \tag{25a}\]  
\[\frac{E_{s_{i}}}{Q_{nom}\cdot V_{i}}\leq C_{rate_{max}},i\ =\ \ Is,\ldots,N \tag{25b}\]  
\[\sum_{i\ =\ Is}^{N}E_{s_{i}}\leq E_{bat_{i}},i\ =\ \ Is,\ldots,N \tag{25c}\]  
\[SOC_{\min}\geq SOC_{i}-\frac{E_{s_{i}}}{V_{i}},i\ =\ \ Is,\ldots,N \tag{25d}\]  
\[Q_{loss_{i}}\leq Q_{loss_{i}}\,i\ =\ \ Is,\ldots,N \tag{25e}\]  
where \(E_{d_{i}}\) symbolizes the energy demand at each step (time slot) of the horizon in kWh, \(E_{s_{i}}\) the maximum permitted energy supply at each step in kWh, \(w_{i}\) the weight factor at each step, \(E_{bat_{i}}\) the available energy at the battery stack at each step in kWh, \(V_{i}\) the battery's voltage at each step in V, \(Q_{nom}\) the nominal capacity of the battery in Ah, \(C_{rate_{max}}\) the maximum permissible discharge rate, \(Q_{loss\_{sp}}\) the capacity loss set point in Ah, \(Q_{loss_{i}}\) the estimated capacity loss based on the optimal discharge schedule at each step in Ah, \(N\) the total number of steps, \(ts\) the number of the current step and \(i\) the step of the horizon.