Skip to content

Commit

Permalink
refactor: change default Pmin value when adding new plant
Browse files Browse the repository at this point in the history
  • Loading branch information
rouille committed Sep 8, 2022
1 parent 9c37517 commit 107f4a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion powersimdata/input/changes/plant.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def add_plant(obj, info):
if plant["Pmax"] < 0:
raise ValueError(f"Pmax >= 0 must be satisfied for plant #{i + 1}")
if "Pmin" not in plant.keys():
plant["Pmin"] = 0
share = obj.grid.model_immutables.plants["pmin_as_share_of_pmax"][
plant["type"]
]
plant["Pmin"] = share * plant["Pmax"] if share is not None else 0
if plant["Pmin"] < 0 or plant["Pmin"] > plant["Pmax"]:
err_msg = f"0 <= Pmin <= Pmax must be satisfied for plant #{i + 1}"
raise ValueError(err_msg)
Expand Down

0 comments on commit 107f4a7

Please sign in to comment.