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

Rh/fix compact marketbid #1147

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion src/core/optimization_container.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ function get_objective_expression(v::ObjectiveFunction)
if iszero(v.variant_terms)
return v.invariant_terms
else
return JuMP.add_to_expression!(v.variant_terms, v.invariant_terms)
# JuMP doesn't support expression conversion from Affn to QuadExpressions
if isa(v.invariant_terms, JuMP.GenericQuadExpr)
return JuMP.add_to_expression!(v.invariant_terms, v.variant_terms)
else
return JuMP.add_to_expression!(v.variant_terms, v.invariant_terms)
end
end
end
get_sense(v::ObjectiveFunction) = v.sense
Expand Down
15 changes: 0 additions & 15 deletions src/devices_models/devices/common/objective_function/market_bid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -302,21 +302,6 @@ function _add_pwl_term!(
device_base_power,
)

compact_status = validate_compact_pwl_data(component, data, base_power)
if !uses_compact_power(component, V()) && compact_status == COMPACT_PWL_STATUS.VALID
error(
"The data provided is not compatible with formulation $V. Use a formulation compatible with Compact Cost Functions",
)
# data = _convert_to_full_variable_cost(data, component)
elseif uses_compact_power(component, V()) && compact_status != COMPACT_PWL_STATUS.VALID
@warn(
"The cost data provided is not in compact form. Will attempt to convert. Errors may occur."
)
data = convert_to_compact_variable_cost(data)
else
@debug uses_compact_power(component, V()) compact_status name T V
end

cost_is_convex = PSY.is_convex(data)
if !cost_is_convex
error("MarketBidCost for component $(name) is non-convex")
Expand Down
2 changes: 1 addition & 1 deletion src/services_models/service_slacks.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function reserve_slacks!(
container::OptimizationContainer,
service::T,
) where {T <: PSY.Reserve}
) where {T <: Union{PSY.Reserve, PSY.ReserveNonSpinning}}
time_steps = get_time_steps(container)
variable = add_variable_container!(
container,
Expand Down
Loading