Jump to content

Battery Storage: Difference between revisions

From mintOC
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
|nd        = 1
|nd        = 1
|nx        = 1
|nx        = 1
|nw        = 1
|nw        = 2
}}
}}


The '''battery storage problem''' is a classical benchmark in optimal control for energy systems. This description is taken from [[#OCPjl | [1]]].
The '''battery storage problem''' models the optimal operation of a grid-scale battery energy storage system (BESS) over a 24-hour scheduling horizon.
 
The operator minimises total electricity cost given a fixed, time-varying demand profile and a time-of-use electricity price signal.
It models the optimal operation of a grid-connected battery over a finite time horizon.
Both signals are piecewise-constant, stepping every four hours through six daily blocks.
The single state is the energy stored in the battery (state of charge), and the single control is the net power flow.
The two non-negative controls represent charging power and discharging power separately, which avoids the need for integer variables while keeping the physics transparent.
Positive control corresponds to charging (energy flows into the battery from the grid), while negative control corresponds to discharging (energy flows from the battery to the grid).
The optimal strategy is to charge during cheap night-time periods and discharge during expensive morning and evening peak periods, yielding an energy-arbitrage policy.
The objective is to minimise the total electricity cost, given by the integral of the product of a time-varying price signal and the net power drawn from the grid, subject to capacity constraints on the stored energy and power limits on the control.
The optimal strategy is to charge when prices are low and discharge when prices are high, yielding an energy-arbitrage policy that exhibits bang–bang structure when there is no regularisation term.


== Mathematical formulation ==
== Mathematical formulation ==
Line 17: Line 15:
<math>
<math>
  \begin{array}{lll}
  \begin{array}{lll}
  \displaystyle \min_{u} && \int_0^{t_\mathrm{f}} p(t)\, u(t)\, \mathrm{d}t \\[6pt]
  \displaystyle \min_{P_c,\,P_d} && \displaystyle\int_0^{T} p(t)\,\bigl(P_{\mathrm{load}}(t) - P_d(t) + P_c(t)\bigr)\,\mathrm{d}t \\[8pt]
  \text{subject to} \\
  \text{subject to} \\[4pt]
\quad \dot{x}(t) &=& u(t), \\
\quad \dot{x}(t) &=& \dfrac{\eta_c\,P_c(t) - P_d(t)/\eta_d}{E_{\mathrm{cap}}}, \\[8pt]
\quad x(0) &=& x_0, \\
\quad x(0) &=& x_0, \\
\quad x(t_\mathrm{f}) &=& x_0, \\
\quad x(T) &=& x_0, \\
\quad x(t) &\in& [0,\, E_{\max}] \quad \forall\, t \in [0, t_\mathrm{f}], \\
\quad x(t) &\in& [x_{\min},\, x_{\max}] \quad \forall\, t \in [0, T], \\
\quad u(t) &\in& [-P_{\max},\, P_{\max}] \quad \forall\, t \in [0, t_\mathrm{f}],
\quad P_c(t) &\in& [0,\, P_{\max}] \quad \forall\, t \in [0, T], \\
\quad P_d(t) &\in& [0,\, P_{\max}] \quad \forall\, t \in [0, T],
  \end{array}
  \end{array}
</math>
</math>
</p>
</p>


where <math>p(t) = p_0 + \Delta p\,\sin\!\bigl(2\pi t / t_\mathrm{f}\bigr)</math> is the electricity price at time <math>t</math>.
where <math>x(t)</math> is the state of charge (SoC, dimensionless fraction of <math>E_{\mathrm{cap}}</math>), <math>P_c(t) \geq 0</math> is the charging power (kW), <math>P_d(t) \geq 0</math> is the discharging power (kW), and <math>P_{\mathrm{grid}}(t) = P_{\mathrm{load}}(t) - P_d(t) + P_c(t)</math> is the net power drawn from the grid.
The cyclic boundary condition <math>x(t_\mathrm{f}) = x_0</math> ensures that the battery returns to its initial state of charge at the end of the horizon.
The cyclic boundary condition <math>x(T) = x_0</math> enforces a daily cycling constraint so the battery ends each day at the same charge level it started.
Charging (<math>u > 0</math>) incurs a positive cost <math>p(t)\,u(t) > 0</math>, while discharging (<math>u < 0</math>) generates revenue.
 
=== Price and demand profiles ===
 
Both <math>p(t)</math> and <math>P_{\mathrm{load}}(t)</math> are piecewise-constant step functions defined on six consecutive 4-hour blocks:
 
{| border="1" align="center" cellpadding="5" cellspacing="0"
|- bgcolor=#c7c7c7
! Block !! Time interval (h) !! <math>p(t)</math> (€/kWh) !! <math>P_{\mathrm{load}}(t)</math> (kW)
|-
| align=center | 1 || align=center | [0, 4)  || align=right | 0.08 || align=right | 30
|-
| align=center | 2 || align=center | [4, 8)  || align=right | 0.20 || align=right | 60
|-
| align=center | 3 || align=center | [8, 12) || align=right | 0.30 || align=right | 80
|-
| align=center | 4 || align=center | [12, 16)|| align=right | 0.15 || align=right | 50
|-
| align=center | 5 || align=center | [16, 20)|| align=right | 0.28 || align=right | 70
|-
| align=center | 6 || align=center | [20, 24]|| align=right | 0.10 || align=right | 35
|}
 
The price pattern is cheap at night (blocks 1 and 6), expensive at the morning peak (block 3), and moderately expensive at the evening peak (block 5).
The demand profile follows a corresponding load curve with low overnight consumption and a mid-morning peak.


== Parameters ==
== Parameters ==
Line 39: Line 61:
! Symbol !! Value !! Description
! Symbol !! Value !! Description
|-
|-
| align=center | <math>E_{\max}</math> || align=right | 1 || Battery capacity (normalised)
| align=center | <math>E_{\mathrm{cap}}</math> || align=right | 200 kWh || Battery energy capacity
|-
| align=center | <math>P_{\max}</math>          || align=right | 50 kW  || Maximum charge / discharge power
|-
| align=center | <math>\eta_c</math>            || align=right | 0.95    || Charging efficiency
|-
|-
| align=center | <math>P_{\max}</math> || align=right | 1 || Maximum charge/discharge power
| align=center | <math>\eta_d</math>             || align=right | 0.95    || Discharging efficiency
|-
|-
| align=center | <math>p_0</math> || align=right | 1 || Mean electricity price
| align=center | <math>x_{\min}</math>           || align=right | 0.10    || Minimum state of charge
|-
|-
| align=center | <math>\Delta p</math> || align=right | 0.5 || Price amplitude
| align=center | <math>x_{\max}</math>           || align=right | 0.90    || Maximum state of charge
|-
|-
| align=center | <math>x_0</math> || align=right | 0.5 || Initial (and final) state of charge
| align=center | <math>x_0</math>               || align=right | 0.50    || Initial (and final) state of charge
|-
|-
| align=center | <math>t_\mathrm{f}</math> || align=right | 1 || Length of the scheduling horizon
| align=center | <math>T</math>                 || align=right | 24 h    || Scheduling horizon
|}
|}


Line 57: Line 83:


<gallery caption="Reference solution plots" widths="500px" heights="300px" perrow="1">
<gallery caption="Reference solution plots" widths="500px" heights="300px" perrow="1">
  Image:Battery_Storage.png | State of charge and optimal power schedule for a reference solution.
  Image:Battery_Storage.png| State of charge and optimal power schedule for a reference solution.
</gallery>
</gallery>


== Miscellaneous and Further Reading ==
== Miscellaneous and Further Reading ==
The battery storage optimal control problem arises in the operation of grid-scale energy storage, demand-response programs, and behind-the-meter storage systems.
The battery storage optimal control problem arises in the operation of grid-scale energy storage, demand-response programs, and behind-the-meter storage systems.
When efficiency losses are incorporated (separate charging efficiency <math>\eta_c \in (0,1]</math> and discharging efficiency <math>\eta_d \in (0,1]</math>), the state equation becomes
Formulating charging and discharging as two separate non-negative controls avoids the need for complementarity constraints or integer variables; the NLP relaxation is typically tight for cost profiles of this type because the optimizer has no incentive to charge and discharge simultaneously when round-trip efficiency is less than one.
<math>\dot{x} = \eta_c\,u^+ - u^-/\eta_d</math>,
Numerical solutions generally exhibit a bang–bang structure in each control: the battery charges at full power during the cheapest blocks and discharges at full power during the most expensive blocks, with smooth transitions determined by the SoC bounds.
where <math>u^+ = \max(u,0)</math> and <math>u^- = \max(-u,0)</math>, and the problem acquires a mixed-integer character that can be handled by complementarity constraints.
A detailed formulation and further discussion can be found in [[#OCPjl|[1]]].


== References ==
== References ==
<span id="OCPjl">[1]</span> Caillau, J.-B., Cots, O., Gergaud, J., & Martinon, P. OptimalControlProblems.jl: a collection of optimal control problems with ODE's in Julia. https://github.com/control-toolbox/OptimalControlProblems.jl<br>
<span id="Rahbar2015">[1]</span> Rahbar, N., Chai, C. C., & Zhang, R. (2015). Energy cooperation optimization in microgrids with renewable energy integration. IEEE Trans. Smart Grid, 6(3), 1482–1493.<br>
<span id="Nottrott2013">[2]</span> Nottrott, A., Kleissl, J., & Washom, B. (2013). Energy dispatch schedule optimization and cost benefit analysis for grid-connected, photovoltaic-battery storage systems. Renewable Energy, 55, 230–240.<br>




[[Category:ODE model]]
[[Category:ODE model]]
[[Category:Energy systems]]
[[Category:MIOCP]]

Latest revision as of 11:26, 4 September 2026

Battery Storage
State dimension: 1
Differential states: 1
Discrete control functions: 2


The battery storage problem models the optimal operation of a grid-scale battery energy storage system (BESS) over a 24-hour scheduling horizon. The operator minimises total electricity cost given a fixed, time-varying demand profile and a time-of-use electricity price signal. Both signals are piecewise-constant, stepping every four hours through six daily blocks. The two non-negative controls represent charging power and discharging power separately, which avoids the need for integer variables while keeping the physics transparent. The optimal strategy is to charge during cheap night-time periods and discharge during expensive morning and evening peak periods, yielding an energy-arbitrage policy.

Mathematical formulation

minPc,Pd∫0Tp(t)(Pload(t)−Pd(t)+Pc(t))dtsubject tox˙(t)=ηcPc(t)−Pd(t)/ηdEcap,x(0)=x0,x(T)=x0,x(t)∈[xmin,xmax]∀t∈[0,T],Pc(t)∈[0,Pmax]∀t∈[0,T],Pd(t)∈[0,Pmax]∀t∈[0,T],

where x(t) is the state of charge (SoC, dimensionless fraction of Ecap), Pc(t)≥0 is the charging power (kW), Pd(t)≥0 is the discharging power (kW), and Pgrid(t)=Pload(t)−Pd(t)+Pc(t) is the net power drawn from the grid. The cyclic boundary condition x(T)=x0 enforces a daily cycling constraint so the battery ends each day at the same charge level it started.

Price and demand profiles

Both p(t) and Pload(t) are piecewise-constant step functions defined on six consecutive 4-hour blocks:

Block Time interval (h) p(t) (€/kWh) Pload(t) (kW)
1 [0, 4) 0.08 30
2 [4, 8) 0.20 60
3 [8, 12) 0.30 80
4 [12, 16) 0.15 50
5 [16, 20) 0.28 70
6 [20, 24] 0.10 35

The price pattern is cheap at night (blocks 1 and 6), expensive at the morning peak (block 3), and moderately expensive at the evening peak (block 5). The demand profile follows a corresponding load curve with low overnight consumption and a mid-morning peak.

Parameters

These fixed values are used within the model:

Symbol Value Description
Ecap 200 kWh Battery energy capacity
Pmax 50 kW Maximum charge / discharge power
ηc 0.95 Charging efficiency
ηd 0.95 Discharging efficiency
xmin 0.10 Minimum state of charge
xmax 0.90 Maximum state of charge
x0 0.50 Initial (and final) state of charge
T 24 h Scheduling horizon

Reference Solutions

Here is one local solution to the above control problem.

Miscellaneous and Further Reading

The battery storage optimal control problem arises in the operation of grid-scale energy storage, demand-response programs, and behind-the-meter storage systems. Formulating charging and discharging as two separate non-negative controls avoids the need for complementarity constraints or integer variables; the NLP relaxation is typically tight for cost profiles of this type because the optimizer has no incentive to charge and discharge simultaneously when round-trip efficiency is less than one. Numerical solutions generally exhibit a bang–bang structure in each control: the battery charges at full power during the cheapest blocks and discharges at full power during the most expensive blocks, with smooth transitions determined by the SoC bounds.

References

[1] Rahbar, N., Chai, C. C., & Zhang, R. (2015). Energy cooperation optimization in microgrids with renewable energy integration. IEEE Trans. Smart Grid, 6(3), 1482–1493.
[2] Nottrott, A., Kleissl, J., & Washom, B. (2013). Energy dispatch schedule optimization and cost benefit analysis for grid-connected, photovoltaic-battery storage systems. Renewable Energy, 55, 230–240.