Skip to content

Commit

Permalink
catching and checking yet another edge case for piecewise
Browse files Browse the repository at this point in the history
  • Loading branch information
bknueven committed May 6, 2022
1 parent de38eec commit 45b7c47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions egret/model_library/transmission/tx_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,15 +675,14 @@ def validate_and_clean_cost_curve(curve, curve_type, p_min, p_max, gen_name, t=N
_insert_last_point(p_max, values, pop=False)

# now that we've extended the cost curve, we need to catch the
# case that p_min == p_max and we're at one of the extremes
# case that p_min == p_max and we're on one of the points
# of the cost curve. The logic below fails in this case.
if math.isclose(p_min, p_max):
of, cf = values[0]
if math.isclose(p_min, of):
return [(p_min,cf)]
ol, cl = values[-1]
if math.isclose(p_max, ol):
return [(p_max,cl)]
for o, c in values:
if math.isclose(p_min, o):
return [(p_min,c)]
if math.isclose(p_max, o):
return [(p_max,c)]

cleaned_values = list()
last_slope = None
Expand Down
Loading

0 comments on commit 45b7c47

Please sign in to comment.