Skip to content

Move EM/DM to IOM#160

Closed
acostarelli wants to merge 1 commit into
mainfrom
ac/move-op-models
Closed

Move EM/DM to IOM#160
acostarelli wants to merge 1 commit into
mainfrom
ac/move-op-models

Conversation

@acostarelli

@acostarelli acostarelli commented Jun 29, 2026

Copy link
Copy Markdown
Member

I also combined E/D Problems into one

I'm open to disagreement about this. I don't really know what other infrastructure systems need, but this code seems non-specific to power.

The domain-neutral build/solve/run lifecycle now lives in IOM. POM keeps only
the power-specific extension-point implementations:

- Delete the moved methods (build!/solve!/run!/build_model!/build_pre_step!/
  reset!/handle_initial_conditions!/build_if_not_already_built!/execute_emulation!/
  solve_and_write_initial_conditions!). Re-export build!/solve!/run! from IOM and
  import build_problem!/build_initial_conditions! to extend the IOM generics.
- Collapse the problem-type hierarchy to a single linear chain
  AbstractPowerOperationProblem -> GenericPowerOperationProblem ->
  DefaultPowerOperationProblem. The decision<->emulation distinction is the
  wrapper's job (DecisionModel/EmulationModel), so the *Decision*/*Emulation*
  problem types are removed; constructors, validate_*, exports, and test mocks
  are rebound accordingly.
- Drop the duplicated timer constants; import BUILD_PROBLEMS_TIMER from IOM so
  build_problem! timings aggregate into IOM's printout.

Point [sources] at the IOM ac/move-op-models branch for co-development (revert to
main before merge). Refresh the stale IOM/POM split notes in .claude/CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors PowerOperationsModels (POM) to rely on InfrastructureOptimizationModels (IOM) for the domain-neutral operation-model lifecycle, while POM retains only power-specific extension-point implementations and a simplified power problem-type taxonomy.

Changes:

  • Removes POM-owned lifecycle methods and re-exports build!/solve!/run! from IOM; imports build_problem! and build_initial_conditions! as POM’s IOM extension points.
  • Collapses the power problem-type hierarchy into a single linear chain (AbstractPowerOperationProblem → GenericPowerOperationProblem → DefaultPowerOperationProblem) and updates constructors/tests accordingly.
  • Drops duplicated timer constants in POM and imports BUILD_PROBLEMS_TIMER from IOM so build timings aggregate under IOM’s timer output.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/PowerOperationsModels.jl Imports/re-exports IOM lifecycle functions; updates exports and imports BUILD_PROBLEMS_TIMER.
src/core/problem_types.jl Simplifies the power problem-type hierarchy to a single linear chain.
src/core/definitions.jl Removes locally defined timer constants (now owned by IOM).
src/operation/decision_model.jl Updates defaulting constructors and consolidates validate_template dispatch for template-driven problems.
src/operation/emulation_model.jl Updates default problem type and validate_time_series! dispatch to the new generic problem type.
src/initial_conditions/initialization.jl Removes solve_and_write_initial_conditions! (lifecycle-owned behavior moved to IOM).
test/test_utils/mock_operation_models.jl Rebinds mock problem types to GenericPowerOperationProblem.
test/test_utils.jl Updates progress meter test to target IOM’s implementation.
test/test_device_thermal_generation_constructors.jl Updates test constructors to use GenericPowerOperationProblem.
Project.toml Pins InfrastructureOptimizationModels to the ac/move-op-models branch for co-development.
test/Project.toml Pins InfrastructureOptimizationModels to the ac/move-op-models branch for tests.
.claude/CLAUDE.md Updates repository split notes to reflect lifecycle ownership in IOM and the collapsed problem chain.
Comments suppressed due to low confidence (1)

test/Project.toml:41

  • The test environment also pins InfrastructureOptimizationModels to the ac/move-op-models branch. If this PR is intended to be mergeable on its own, please revert this to main (or a tag/commit SHA) before merge so tests run against a stable dependency ref.
[sources]
InfrastructureOptimizationModels = {rev = "ac/move-op-models", url = "https://github.com/Sienna-Platform/InfrastructureOptimizationModels.jl"}
InfrastructureSystems = {rev = "IS4", url = "https://github.com/Sienna-Platform/InfrastructureSystems.jl"}
PowerSystems = {rev = "psy6", url = "https://github.com/Sienna-Platform/PowerSystems.jl"}
PowerFlows = {rev = "psy6", url = "https://github.com/Sienna-Platform/PowerFlows.jl"}
PowerNetworkMatrices = {rev = "psy6", url = "https://github.com/Sienna-Platform/PowerNetworkMatrices.jl"}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 21 to 25
throw(
IS.ArgumentError(
"GenericPowerDecisionProblem subtypes require a template. Use DecisionModel subtyping instead.",
"GenericPowerOperationProblem subtypes require a template. Use DecisionModel subtyping instead.",
),
)
Comment on lines 30 to 34
if counts.static_time_series_count < 1
error(
"The system does not contain Static Time Series data. A EmulationModel can't be built.",
)
end
Comment thread src/core/problem_types.jl

"""
Supertype for rolling-horizon (emulation) operation problems solved by `EmulationModel`.
Default concrete template-driven operation problem. The `M` used when a

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is confusing.

Comment thread src/core/problem_types.jl

"""
Supertype for single-period (decision) operation problems solved by `DecisionModel`.
Operation problems whose build/validate behavior is fully driven by the

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't like this docstring

@acostarelli acostarelli changed the title Move operation lifecycle to IOM; collapse power problem types Move EM/DM to IOM Jun 30, 2026
@acostarelli acostarelli requested a review from luke-kiernan June 30, 2026 12:28
@acostarelli

Copy link
Copy Markdown
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move emulation model definition out of POM Move decision model definition out of POM

2 participants