Fix EQ constraint in case no hydro exist

This commit is contained in:
Max Parzen 2022-12-16 11:00:39 +00:00 committed by GitHub
parent bc8ac24c33
commit 9e61e30ff4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -216,6 +216,7 @@ def add_EQ_constraints(n, o, scaling=1e-1):
.T.groupby(ggrouper, axis=1) .T.groupby(ggrouper, axis=1)
.apply(join_exprs) .apply(join_exprs)
) )
if not n.storage_units_t.inflow.empty:
lhs_spill = ( lhs_spill = (
linexpr( linexpr(
( (
@ -228,6 +229,8 @@ def add_EQ_constraints(n, o, scaling=1e-1):
) )
lhs_spill = lhs_spill.reindex(lhs_gen.index).fillna("") lhs_spill = lhs_spill.reindex(lhs_gen.index).fillna("")
lhs = lhs_gen + lhs_spill lhs = lhs_gen + lhs_spill
else:
lhs = lhs_gen
define_constraints(n, lhs, ">=", rhs, "equity", "min") define_constraints(n, lhs, ">=", rhs, "equity", "min")