Skip to content

Commit

Permalink
update add to expression
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigomha committed Jan 1, 2025
1 parent af057bd commit 125fde5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/devices_models/devices/common/add_to_expression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,33 @@ function add_to_expression!(
return
end

function add_to_expression!(

Check warning on line 1237 in src/devices_models/devices/common/add_to_expression.jl

View check run for this annotation

Codecov / codecov/patch

src/devices_models/devices/common/add_to_expression.jl#L1237

Added line #L1237 was not covered by tests
container::OptimizationContainer,
::Type{T},
::Type{U},
devices::IS.FlattenIteratorWrapper{V},
model::DeviceModel{V, W},
network_model::NetworkModel{X},
) where {
T <: Union{ActivePowerRangeExpressionUB, ActivePowerRangeExpressionLB},
U <: Union{ActivePowerVariableSlackUB, ActivePowerVariableSlackLB},
V <: PSY.Device,
W <: AbstractDeviceFormulation,
X <: PM.AbstractPowerModel,
}
variable = get_variable(container, U(), V)
if !has_container_key(container, T, V)
add_expressions!(container, T, devices, model)

Check warning on line 1253 in src/devices_models/devices/common/add_to_expression.jl

View check run for this annotation

Codecov / codecov/patch

src/devices_models/devices/common/add_to_expression.jl#L1251-L1253

Added lines #L1251 - L1253 were not covered by tests
end
expression = get_expression(container, T(), V)
for d in devices, t in get_time_steps(container)
mult = get_expression_multiplier(U(), T(), d, W())
name = PSY.get_name(d)
_add_to_jump_expression!(expression[name, t], variable[name, t], mult)
end
return

Check warning on line 1261 in src/devices_models/devices/common/add_to_expression.jl

View check run for this annotation

Codecov / codecov/patch

src/devices_models/devices/common/add_to_expression.jl#L1255-L1261

Added lines #L1255 - L1261 were not covered by tests
end

function add_to_expression!(
container::OptimizationContainer,
::Type{T},
Expand Down

0 comments on commit 125fde5

Please sign in to comment.