Skip to content

Commit

Permalink
fix: minor fixes to StockCommitment handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Tammevesky authored and Flix6x committed Jan 3, 2025
1 parent 0957f16 commit 19d6406
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions flexmeasures/data/models/planning/linear_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,10 @@ def ems_derivative_bounds(m, j):

def device_stock_commitment_equalities(m, c, j, d):
"""Couple device stocks to each commitment."""
if "d" not in commitments[c] or commitments[c]["d"] != d:
if (
"device" not in commitments[c].columns
or (commitments[c]["device"] != d).all()
):
# Commitment c does not concern device d
return Constraint.Skip
if not all(cl.__name__ == "StockCommitment" for cl in commitments[c]["class"]):
Expand Down Expand Up @@ -499,7 +502,7 @@ def ems_flow_commitment_equalities(m, c, j):
- Creates an inequality for one-sided commitments.
- Creates an equality for two-sided commitments and for groups of size 1.
"""
if "d" in commitments[c]:
if "device" in commitments[c].columns:
# Commitment c does not concern EMS
return Constraint.Skip
if "class" in commitments[c].columns and not all(
Expand Down

0 comments on commit 19d6406

Please sign in to comment.