Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for nothings in VOM table data parser #1236

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions src/parsers/power_system_table_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -833,11 +833,14 @@
cost_pairs = get_cost_pairs(gen, cost_colnames)
var_cost, fixed = create_pwinc_cost(cost_pairs)
end
parse_maybe_nothing(x) = isnothing(x) ? 0.0 : tryparse(Float64, x)
vom_cost = parse_maybe_nothing(getfield(gen, Symbol("variable_cost")))
vom_data = LinearCurve(vom_cost)

startup_cost, shutdown_cost = calculate_uc_cost(data, gen, fuel_price)

op_cost = ThermalGenerationCost(
FuelCurve(var_cost, UnitSystem.NATURAL_UNITS, fuel_price),
FuelCurve(var_cost, UnitSystem.NATURAL_UNITS, fuel_price, vom_data),
fixed * fuel_price,
startup_cost,
shutdown_cost,
Expand All @@ -855,9 +858,12 @@
cost_pairs = get_cost_pairs(gen, cost_colnames)
var_cost = create_pwl_cost(cost_pairs)
startup_cost, shutdown_cost = calculate_uc_cost(data, gen, fuel_price)
parse_maybe_nothing(x) = isnothing(x) ? 0.0 : tryparse(Float64, x)
vom_cost = parse_maybe_nothing(getfield(gen, Symbol("variable_cost")))
vom_data = LinearCurve(vom_cost)

op_cost = ThermalGenerationCost(
CostCurve(var_cost, UnitSystem.NATURAL_UNITS),
CostCurve(var_cost, UnitSystem.NATURAL_UNITS, vom_data),
gen.fixed_cost,
startup_cost,
shutdown_cost,
Expand Down Expand Up @@ -901,14 +907,13 @@
cost_colnames::_HeatRateColumns,
) where {T <: RenewableGen}
@warn "Heat rate parsing not valid for RenewableGen replacing with zero cost"
parse_maybe_nothing(x) = isnothing(x) ? 0.0 : tryparse(Float64, x)
vom_cost = parse_maybe_nothing(getfield(gen, Symbol("variable_cost")))
vom_data = LinearCurve(vom_cost)
var_cost = CostCurve(;
value_curve = LinearCurve(0.0),
power_units = UnitSystem.NATURAL_UNITS,
vom_cost = if isnothing(gen.variable_cost)
LinearCurve(0.0)
else
LinearCurve(gen.variable_cost)
end,
vom_cost = vom_data,
)
op_cost = RenewableGenerationCost(var_cost)
return op_cost
Expand All @@ -921,10 +926,13 @@
cost_colnames::_CostPointColumns,
) where {T <: RenewableGen}
cost_pairs = get_cost_pairs(gen, cost_colnames)
parse_maybe_nothing(x) = isnothing(x) ? 0.0 : tryparse(Float64, x)
vom_cost = parse_maybe_nothing(getfield(gen, Symbol("variable_cost")))
vom_data = LinearCurve(vom_cost)

Check warning on line 931 in src/parsers/power_system_table_data.jl

View check run for this annotation

Codecov / codecov/patch

src/parsers/power_system_table_data.jl#L929-L931

Added lines #L929 - L931 were not covered by tests
var_cost = CostCurve(;
value_curve = cost_pairs,
power_units = UnitSystem.NATURAL_UNITS,
vom_cost = isnothing(gen.variable_cost) ? 0.0 : gen.variable_cost,
vom_cost = vom_data,
)
op_cost = RenewableGenerationCost(var_cost)
return op_cost
Expand Down
Loading