Skip to content

Commit

Permalink
option to specify n_tranches
Browse files Browse the repository at this point in the history
  • Loading branch information
ktehranchi committed Sep 19, 2024
1 parent 5493636 commit c54bdcb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/r2x/parser/parser_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,6 @@ def optimize_pwl_points(a, b, c, x_min, x_max, num_tranches):
x_optimal = np.sort(result.x)
y_optimal = a * x_optimal**2 + b * x_optimal + c

# Remove any duplicate x-values and cooresponding y-values
x_optimal = np.unique(x_optimal)
y_optimal = np.unique(y_optimal)

return x_optimal.round(2), y_optimal.round(2)


Expand Down
3 changes: 2 additions & 1 deletion src/r2x/parser/plexos.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,8 @@ def _construct_value_curves(self, mapped_records, generator_name):
constant_term=heat_rate_base.magnitude,
)
if self.config.feature_flags.get("quad2pwl", None):
fn = construct_pwl_from_quadtratic(fn, mapped_records)
n_tranches = self.config.feature_flags.get("quad2pwl", None)
fn = construct_pwl_from_quadtratic(fn, mapped_records, n_tranches)
elif not heat_rate_incr2 and heat_rate_incr:
fn = LinearFunctionData(
proportional_term=heat_rate_incr.magnitude, constant_term=heat_rate_base.magnitude
Expand Down

0 comments on commit c54bdcb

Please sign in to comment.