Skip to content

Commit

Permalink
Merge pull request #209 from NREL/rjf/powercurve-typo
Browse files Browse the repository at this point in the history
improve error message for power_type arg
  • Loading branch information
robfitzgerald authored Oct 2, 2023
2 parents b461d11 + 3a99709 commit ad61d89
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@ def __init__(
self.step_size_seconds = data["step_size_seconds"] # seconds

if self.energy_type is None:
pt = data.get("power_type")
if pt is None:
pt_msg = "no power_type argument"
else:
pt_msg = f"invalid energy type '{data['power_type']}'"
raise AttributeError(
f"TabularPowercurve initialized with invalid energy type {self.energy_type}"
f"TabularPowercurve configuration has {pt_msg}; "
f"should be one of {{electric, gasoline}} "
)

charging_model = sorted(data["power_curve"], key=lambda x: x["energy_kwh"])
Expand Down

0 comments on commit ad61d89

Please sign in to comment.