From 47efbc0af34a73ad1254ba54bbf896948b2ed321 Mon Sep 17 00:00:00 2001 From: Luke Kiernan Date: Mon, 29 Jun 2026 16:03:59 -0600 Subject: [PATCH] Use FunctionData get_domain in offer-curve validation (closes #33) Adopt the FunctionData sugar from InfrastructureSystems PR #492: - _validate_occ_subtype now uses IS.get_domain instead of first(get_x_coords(...)) to check the first breakpoint. - Clarify the _onvar_cost comment (the constant term is the cost at zero output, i.e. the y-intercept). Linked with the InfrastructureOptimizationModels PR. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/common_models/market_bid_plumbing.jl | 2 +- src/static_injector_models/thermal_generation.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common_models/market_bid_plumbing.jl b/src/common_models/market_bid_plumbing.jl index b2ae44d..6006b8f 100644 --- a/src/common_models/market_bid_plumbing.jl +++ b/src/common_models/market_bid_plumbing.jl @@ -234,7 +234,7 @@ function _validate_occ_subtype( ), ) fd = IS.get_function_data(IS.get_value_curve(curve)) - if !iszero(first(IS.get_x_coords(fd))) + if !iszero(first(IS.get_domain(fd))) throw( ArgumentError( "For ImportExportCost, the first breakpoint must be zero.", diff --git a/src/static_injector_models/thermal_generation.jl b/src/static_injector_models/thermal_generation.jl index 14f549b..f1494c6 100644 --- a/src/static_injector_models/thermal_generation.jl +++ b/src/static_injector_models/thermal_generation.jl @@ -192,7 +192,7 @@ end function _onvar_cost(container::OptimizationContainer, cost_function::Union{PSY.FuelCurve{PSY.LinearCurve}, PSY.FuelCurve{PSY.QuadraticCurve}}, d::T, t::Int) where {T <: PSY.ThermalGen} value_curve = PSY.get_value_curve(cost_function) cost_component = PSY.get_function_data(value_curve) - # In Unit/h + # Cost at zero output (y-intercept), in Unit/h. constant_term = PSY.get_constant_term(cost_component) fuel_cost = PSY.get_fuel_cost(cost_function) if typeof(fuel_cost) <: Float64