diff --git a/doc/release_notes.rst b/doc/release_notes.rst index b1b56416..70927880 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -12,6 +12,8 @@ Upcoming Release * Carriers of generators can now be excluded from aggregation in clustering network and simplify network. +* Fix EQ constraint for the case no hydro inflow is available + * Bugfix in the reserve constraint will increase demand related reserve requirements PyPSA-Eur 0.6.1 (20th September 2022) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 5124852f..8a964593 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -216,18 +216,21 @@ def add_EQ_constraints(n, o, scaling=1e-1): .T.groupby(ggrouper, axis=1) .apply(join_exprs) ) - lhs_spill = ( - linexpr( - ( - -n.snapshot_weightings.stores * scaling, - get_var(n, "StorageUnit", "spill").T, + if not n.storage_units_t.inflow.empty: + lhs_spill = ( + linexpr( + ( + -n.snapshot_weightings.stores * scaling, + get_var(n, "StorageUnit", "spill").T, + ) ) + .T.groupby(sgrouper, axis=1) + .apply(join_exprs) ) - .T.groupby(sgrouper, axis=1) - .apply(join_exprs) - ) - lhs_spill = lhs_spill.reindex(lhs_gen.index).fillna("") - lhs = lhs_gen + lhs_spill + lhs_spill = lhs_spill.reindex(lhs_gen.index).fillna("") + lhs = lhs_gen + lhs_spill + else: + lhs = lhs_gen define_constraints(n, lhs, ">=", rhs, "equity", "min")