--- jupytext: text_representation: extension: .md format_name: myst format_version: 0.13 jupytext_version: 1.13.8 kernelspec: display_name: 'Python 3' name: python3 --- (battery)= # battery A battery that is a part of a power system. | | | |---|---| |Input connections|{ref}`reserve_group`, {ref}`busbar`| |Output connections|{ref}`reserve_group`, {ref}`busbar`| |License|SHOP_OPEN| |Release version|15.2.0.0| ```{contents} :local: :depth: 1 ``` ## Introduction A battery can be used to temporarily store energy in a power system. The battery can charge and discharge power where the power losses are given by the [charge efficiency](battery:charge_efficiency) $\eta_c$ and [discharge efficiency](battery:discharge_efficiency) $\eta_d$. The battery energy balance is ```{math} :label: energy-balance e_{i,t+1} = e_{i,t} + \eta_c pc_{i,t} - \frac{1}{\eta_d} pd_{i,t}, ``` where $e_{i,t}$ expresses the [initial energy](battery:initial_energy) in battery $i$ at the beginning of time step $t$, and $pc_{i,t}$, $pd_{i,t}$ the power charge and discharge respectively. The charge and discharge power is limited by the [maximum charge power](battery:max_charge_power) $PC_i$ ```{math} :label: max-charge 0 \leq pc_{i,t} \leq PC_{i} ``` and the [maximum discharge power](battery:max_discharge_power) $PD_i$ ```{math} :label: max-discharge 0 \leq pd_{i,t} \leq PD_{i}. ``` ## Connection Batteries can be connected to [busbars](busbar) if used in combination with [](ac_line) and/or [](dc_line). If busbars are not created explicitly, a copper plate representation is used where all sources and loads are connected to the same point. ## MIP The battery net-discharge curve is discontinuous. Therefore, batteries are typically modelled with separate charge and discharge variables. This is, in reality, a relaxation that allows simultaneous charging and discharging. This will typically not occur simply since it is not optimal to waste energy. However, in situations with surplus renewable generation or negative electricity price, the optimization might exploit this relaxation. This can be avoided by using mixed-integer programming and is activated with the [](battery:charge_discharge_mip) attribute. Given the binary variable $\delta_{i,t}$ which takes the value 0 when charging and 1 when discharging, the additional restrictions will ensure that charging and discharging does not occur simultaneously: ```{math} :label: mip-charge pc_{i,t} \leq PC_{i} (1-\delta_{i,t} ) ``` ```{math} :label: mip-discharge pd_{i,t} \leq PD_{i} \delta_{i,t} ``` ## Schedules Schedules for batteries can be given as both [charge](battery:charge_schedule), [discharge](battery:discharge_schedule), [net-discharge](battery:net_discharge_schedule), [minimum energy](battery:min_energy_constraint) and [maximum energy](battery:max_energy_constraint). Net-discharge represents discharge minus charge. All series can take the special value $nan$ to deactivate the schedule at a given time step. ## Operating costs The battery can also have a fixed [charge cost](battery:charge_cost) and [discharge cost](battery:discharge_cost), typically associated with degradation. ## Results The results show the battery [charge](battery:power_charge), [discharge](battery:power_discharge) and [net discharge](battery:net_power_discharge). Net discharge will always represent the difference between discharge and charge. However, the charge and discharge are also useful quantities as they can reveal situations where simultaneous charging and discharging occurs. These situations will also issue a warning. The battery state-of-charge is shown in by the [energy](battery:energy) attribute, and the dual value of the energy balance is given by the [energy value](battery:energy_value). ## Examples - [](battery-wind-solar) - [](battery_reserves) - [](battery_rolling_max_discharge) ## References - Optimal microgrid operation considering battery degradation using stochastic dual dynamic programming {cite}`Aaslid2019b` - Non-linear charge-based battery storage optimization model with bi-variate cubic spline constraints {cite}`Aaslid2020` - Pricing electricity in constrained networks dominated by stochastic renewable generation and electric energy storage {cite}`Aaslid2021` - Stochastic Optimization of Microgrid Operation With Renewable Generation and Energy Storages {cite}`Aaslid2022a` - Stochastic operation of energy constrained microgrids considering battery degradation {cite}`Aaslid2022b` - Operating a Battery in a Hydropower-Dominated System to Balance Net Load Deviations {cite}`Naversen2019` ## Attributes ```{code-cell} ipython3 :tags: ['remove-input', 'full-width'] from IPython.core.display import HTML HTML("""
""") ``` (battery:charge_efficiency)= ### charge_efficiency
Data type: double. Unit: NO_UNIT.
Charge efficiency coefficient. (battery:discharge_efficiency)= ### discharge_efficiency
Data type: double. Unit: NO_UNIT.
Discharge efficiency coefficient. (battery:max_charge_power)= ### max_charge_power
Data type: double. Unit: MW.
Maximum charge power. (battery:max_discharge_power)= ### max_discharge_power
Data type: double. Unit: MW.
Maximum discharge power. (battery:max_energy)= ### max_energy
Data type: double. Unit: MWH.
Maximum energy storage capacity. (battery:initial_energy)= ### initial_energy
Data type: double. Unit: MWH.
Initial energy storage. (battery:discharge_cost)= ### discharge_cost
Data type: double. Unit: NOK/MWH.
Battery discharge cost. (battery:charge_cost)= ### charge_cost
Data type: double. Unit: NOK/MWH.
Battery charge cost. (battery:max_charge_power_constraint)= ### max_charge_power_constraint
Data type: timeseries. Unit: MW.
Maximum charge power constraint. (battery:max_discharge_power_constraint)= ### max_discharge_power_constraint
Data type: timeseries. Unit: MW.
Maximum discharge power constraint. (battery:max_energy_constraint)= ### max_energy_constraint
Data type: timeseries. Unit: MWH.
Maximum energy storage constraint. (battery:min_energy_constraint)= ### min_energy_constraint
Data type: timeseries. Unit: MWH.
Minimum energy storage constraint. (battery:charge_discharge_mip)= ### charge_discharge_mip
Data type: timeseries. Unit: NO_UNIT.
MIP variable to prevent simultaneous charging and discharging. (battery:charge_schedule)= ### charge_schedule
Data type: timeseries. Unit: MW.
Battery charging schedule. (battery:discharge_schedule)= ### discharge_schedule
Data type: timeseries. Unit: MW.
Battery discharging schedule. (battery:net_discharge_schedule)= ### net_discharge_schedule
Data type: timeseries. Unit: MW.
Battery net-discharging schedule. (battery:fcr_n_up_cost)= ### fcr_n_up_cost
Data type: timeseries. Unit: NOK/MWH.
The cost of allocating fcr_n_up on this battery. (battery:fcr_n_down_cost)= ### fcr_n_down_cost
Data type: timeseries. Unit: NOK/MWH.
The cost of allocating fcr_n_down on this battery. (battery:fcr_d_up_cost)= ### fcr_d_up_cost
Data type: timeseries. Unit: NOK/MWH.
The cost of allocating fcr_d_up on this battery. (battery:fcr_d_down_cost)= ### fcr_d_down_cost
Data type: timeseries. Unit: NOK/MWH.
The cost of allocating fcr_d_down on this battery. (battery:frr_up_cost)= ### frr_up_cost
Data type: timeseries. Unit: NOK/MWH.
The cost of allocating frr_up on this battery. (battery:frr_down_cost)= ### frr_down_cost
Data type: timeseries. Unit: NOK/MWH.
The cost of allocating frr_down on this battery. (battery:rr_up_cost)= ### rr_up_cost
Data type: timeseries. Unit: NOK/MWH.
The cost of allocating rr_up on this battery. (battery:rr_down_cost)= ### rr_down_cost
Data type: timeseries. Unit: NOK/MWH.
The cost of allocating rr_down on this battery. (battery:historical_discharge)= ### historical_discharge
Data type: timeseries. Unit: MW.
Battery discharge before the start of the optimization period. (battery:rolling_max_discharge_limit)= ### rolling_max_discharge_limit
Data type: xyt. Unit: x: MINUTE and y: MWH.
Input to specify rolling battery discharge constraints that limit the maximum total energy discharged within a rolling time window. The x-values represent the length of the rolling time window and the y-values specify the maximum allowed energy discharged. Each (x, y) point in each xy curve represents a rolling ramping constraint. (battery:power_charge)= ### power_charge
Data type: timeseries. Unit: MW.
Power charged from battery. (battery:power_discharge)= ### power_discharge
Data type: timeseries. Unit: MW.
Power discharged from battery. (battery:net_power_discharge)= ### net_power_discharge
Data type: timeseries. Unit: MW.
Net power discharged from battery. (battery:energy)= ### energy
Data type: timeseries. Unit: MWH.
Energy stored in battery. (battery:energy_value)= ### energy_value
Data type: timeseries. Unit: NOK/MWH.
Battery energy dual value. (battery:fcr_n_up_delivery)= ### fcr_n_up_delivery
Data type: timeseries. Unit: MW.
Resulting battery fcr_n_up delivery. (battery:fcr_n_down_delivery)= ### fcr_n_down_delivery
Data type: timeseries. Unit: MW.
Resulting battery fcr_n_down delivery. (battery:fcr_d_up_delivery)= ### fcr_d_up_delivery
Data type: timeseries. Unit: MW.
Resulting battery fcr_d_up delivery. (battery:fcr_d_down_delivery)= ### fcr_d_down_delivery
Data type: timeseries. Unit: MW.
Resulting battery fcr_d_down delivery. (battery:frr_up_delivery)= ### frr_up_delivery
Data type: timeseries. Unit: MW.
Resulting battery frr_up delivery. (battery:frr_down_delivery)= ### frr_down_delivery
Data type: timeseries. Unit: MW.
Resulting battery frr_down delivery. (battery:rr_up_delivery)= ### rr_up_delivery
Data type: timeseries. Unit: MW.
Resulting battery rr_up delivery. (battery:rr_down_delivery)= ### rr_down_delivery
Data type: timeseries. Unit: MW.
Resulting battery rr_down delivery.