Skip to content

Commit

Permalink
Convert FuelCurve to CostCurve in results_data
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielKS committed Jul 8, 2024
1 parent 58d18b9 commit cfac230
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/test_data/results_data.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# Will be superseded by https://github.com/NREL-Sienna/PowerSystems.jl/issues/1143
function linear_fuel_to_linear_cost(fc::FuelCurve{LinearCurve})
fuel_cost = get_fuel_cost(fc)
!(fuel_cost isa Float64) && throw(ArgumentError("fuel_cost must be a scalar"))
old_vc = get_value_curve(fc)
new_vc = LinearCurve(
get_proportional_term(old_vc) * fuel_cost,
get_constant_term(old_vc) * fuel_cost,
)
return CostCurve(new_vc, get_power_units(fc), get_vom_cost(fc))
end

function add_re!(sys)
re = RenewableDispatch(
"WindBusA",
Expand Down Expand Up @@ -31,9 +43,11 @@ function add_re!(sys)

for g in get_components(HydroEnergyReservoir, sys)
tpc = get_operation_cost(g)
cc = get_variable(tpc)
(cc isa FuelCurve) && (cc = linear_fuel_to_linear_cost(cc))
smc = StorageCost(;
charge_variable_cost = PSY.get_variable(tpc),
discharge_variable_cost = PSY.get_variable(tpc),
charge_variable_cost = cc,
discharge_variable_cost = cc,
fixed = PSY.get_fixed(tpc),
start_up = 0.0,
shut_down = 0.0,
Expand Down

0 comments on commit cfac230

Please sign in to comment.