# Variables Reduction in Sequential Resource Allocation Problems
## 4 Battery Storage Control
This two-scale structure is universal and inherent to any deregulated electricity market and we usually observe significant differences between both scales considering their prices, liquidity, and spread. Consider an agent who serves an energy consumer whose random demand is (partially) covered from a renewable energy generation facility whose energy output is also random. We denote by \(D_{t}\) the cumulative electricity demand of such facility (which stands for demand if \(D_{t}<0\) and surplus if \(D_{t}>0\)) for the delivery period \(t\). Assume that the time point \(t=0,\ldots,T-1\) corresponds to the beginning of the period \(t\) and agree that the demand \(D_{t}\) is observed after \(t\), at the end of the delivery period \(t\). Let us agree to model \(D_{t}=d_{t}+\varepsilon_{t}\), with a zero-mean random variable \(\varepsilon_{t}\) standing for the deviation of the realized demand \(D_{t}\) from its prediction \(d_{t}\), which is observable at time \(t\). Moreover, assume that at each time \(t=0,\ldots,T\), the producer can take a forward position which attempts to cover \(D_{t}\). Let us describe such position as \(d_{t}+f_{t}\) where \(f_{t}\) stands for the deviation of the total amount traded forward from the prediction \(d_{t}\). In generic situations, the quantity \(f_{t}\) can be considered to be a \"safety margin\" which must be purchased on the top of predicted demand \(d_{t}\) to avoid a potential energy shortage during delivery interval. However, we do not assume that \(f_{t}\) or \(d_{t}\) must always be positive. Moreover, introduce the control variable \(b_{t}\), standing for the decision to transfer the energy amount \(|b_{t}|\) from/to the battery, where \(b_{t}>0\) and \(b_{t}<0\) represent discharging and charging actions, respectively. Here, we agree that these control actions must be decided at time \(t\) (immediately before the delivery period \(t\) starts). With these assumptions, the energy to be balanced during delivery period \(t=0,\ldots,T\) using electricity grid is  
\[f_{t}+d_{t}-D_{t}+b_{t}=f_{t}+b_{t}-\varepsilon_{t}. \tag{28}\]  
Please note that on the right-hand side of this equation, the quantities \(f_{t}\) and \(b_{t}\) must be chosen at \(t\) whereas \(\varepsilon_{t}\) becomes observable after time \(t\). Now we turn to storage control costs and introduce electricity prices  
\[\Psi_{t}=(\Psi_{t}^{+},\Psi_{t}^{0},\Psi_{t}^{-})\qquad t=0,\ldots,T, \tag{29}\]  
with the interpretation that for delivery period \(t\), \(\Psi_{t}^{0}\) stands for the forward price, whereas \(\Psi_{t}^{+}\) and \(\Psi_{t}^{-}\) are the so-called upper and the lower balancing prices. **Remark 3**. : _Please note that \(\Psi_{t}^{0}\) stands for the price of energy from long-term market. In the sense of the above remark, this price can represent a forward, futures, or day-ahead price of electrical energy in front of delivery, depending on modeling._  
While the forward price \(\Psi_{t}^{0}\) is listed prior to the delivery period \(t\) and applies to energy traded in advance, the balancing prices \(\Psi_{t}^{+}\), \(\Psi_{t}^{-}\) are determined during delivery period \(t\) and apply for purchase and procurement of the grid energy. Usually, it holds that  
\[0\leq\Psi_{t}^{+}<\Psi_{t}^{0}<\Psi_{t}^{-}\qquad t=0,\ldots,T.\] (30  
**Remark 4**. : _Ideally, an understanding of the chemistry of a particular battery will suggest some generic penalization function. However, in practice, there are diverse approaches to assess (in economic terms) how the battery life is affected by visiting a deep discharge state. Here, the usual cycle life graph (as in Figure 1), does not detail all aspects required by our approach. The point is that the cycle life is determined by charge/discharge periods oscillating linearly between the minimal and the maximal capacity, rather by a certain strategy run within a random environment. Such life cycle diagrams do not provide any information whether it could be worth visiting a deep discharge state for a short period of time in order to catch an electricity price spike.