Skip to content

Commit

Permalink
use model in build functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed Feb 28, 2024
1 parent f1c8bd4 commit 1677242
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/multi_optimization_container.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ end

function init_optimization_container!(
container::MultiOptimizationContainer,
::Type{T},
network_model::PSI.NetworkModel{<:PM.AbstractPowerModel},
sys::PSY.System,
) where {T <: PM.AbstractPowerModel}
)
PSY.set_units_base_system!(sys, "SYSTEM_BASE")
# The order of operations matter
settings = PSI.get_settings(container)
Expand Down Expand Up @@ -190,7 +190,7 @@ function init_optimization_container!(
@debug "Initializing Container Subproblem $index" _group =
PSI.LOG_GROUP_OPTIMIZATION_CONTAINER
sub_problem.settings = deepcopy(settings)
PSI.init_optimization_container!(sub_problem, T, sys)
PSI.init_optimization_container!(sub_problem, network_model, sys)
end

return
Expand Down
5 changes: 5 additions & 0 deletions src/multiproblem_template.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ struct MultiProblemTemplate <: PSI.AbstractProblemTemplate
sub_templates::Dict{String, PSI.ProblemTemplate}
end

PSI.get_device_models(template::MultiProblemTemplate) = template.base_template.devices
PSI.get_branch_models(template::MultiProblemTemplate) = template.base_template.branches
PSI.get_service_models(template::MultiProblemTemplate) = template.base_template.services
PSI.get_network_model(template::MultiProblemTemplate) = template.base_template.network_model

function MultiProblemTemplate(
base_template::PSI.ProblemTemplate,
problem_keys::Vector{String},
Expand Down
2 changes: 1 addition & 1 deletion src/problems/multi_region_problem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function build_pre_step!(model::PSI.DecisionModel{MultiRegionProblem})
@info "Initializing Optimization Container For a DecisionModel"
init_optimization_container!(
PSI.get_optimization_container(model),
PSI.get_network_formulation(PSI.get_template(model)),
PSI.get_network_model(PSI.get_template(model)),
PSI.get_system(model),
)
@info "Initializing ModelStoreParams"
Expand Down

0 comments on commit 1677242

Please sign in to comment.