Skip to content

Commit

Permalink
Add constraint to limit maximum battery expansion in Germany
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaraBuettner committed Apr 11, 2024
1 parent 2dd69b7 commit bf3135a
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions etrago/tools/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,44 @@ def _rule(m):

network.model.max_line_ext = Constraint(rule=_rule)


def _max_battery_expansion_germany(self, network, snapshots):
"""
Set maximum expanded capacity of batteries in Germany.
Parameters
----------
network : :class:`pypsa.Network
Overall container of PyPSA
snapshots : pandas.DatetimeIndex
List of timesteps considered in the optimization
Returns
-------
None.
"""
home_battery_capacity = network.storage_units[
network.storage_units.carrier=="battery"].p_nom_min.sum()

batteries = network.storage_units[(
network.storage_units.carrier=="battery")
&(network.storage_units.bus.isin(
network.buses[network.buses.country=="DE"].index))]

def _rule_max(m):
batteries_opt = sum(
m.storage_p_nom[index]
for index in batteries.index
)
return batteries_opt <= (
1
) * (self.args["extra_functionality"]["max_battery_expansion_germany"]
+ home_battery_capacity)

network.model.max_battery_ext = Constraint(rule=_rule_max)


def _fixed_battery_expansion_germany(self, network, snapshots):
"""
Define the overall expanded capacity of batteries in Germany.
Expand Down

0 comments on commit bf3135a

Please sign in to comment.