PR 4/7: Pyomo multi-period DAE model#9
Open
bernalde wants to merge 4 commits into
Open
Conversation
This was referenced Mar 3, 2026
fa26a34 to
65fc2c3
Compare
b8a82c3 to
53ad6d9
Compare
53ad6d9 to
389c49e
Compare
389c49e to
518df8b
Compare
3c852b8 to
07c52ee
Compare
518df8b to
c4356ba
Compare
c4356ba to
15eb233
Compare
15eb233 to
38607c8
Compare
4347637 to
bbda9c5
Compare
bernalde
commented
May 7, 2026
Member
Author
bernalde
left a comment
There was a problem hiding this comment.
I found several blocking issues in the core model formulation and in the new test coverage. The main concerns are that the product-temperature constraint is applied to the wrong variable/direction, scaled solves return scaled rather than physical units, warmstart initializes dmdt 10x too high, the cake-length ODE does not match the existing scipy drying-rate update, and one new Pyomo test fails when networkx is not installed.
bernalde
commented
May 7, 2026
bernalde
commented
May 7, 2026
Member
Author
bernalde
left a comment
There was a problem hiding this comment.
Review summary:
- Blocking issues: the default scaled
create_multi_period_model()result does not expose the documented unscaled model attributes and cannot be passed towarmstart_from_scipy_trajectory;dmdt[0]is unconstrained but is returned as part of the solution trajectory. - Nonblocking issues: none.
- Questions: none.
- Tests run and outcomes:
PYTHONPATH=/tmp/LyoPRONTO_pr9 pytest tests/test_pyomo_models -m "pyomo and not slow" -n 0 --tb=short --maxfail=10passed with 67 passed, 9 skipped, 14 deselected;RUN_SLOW_TESTS=1 PYTHONPATH=/tmp/LyoPRONTO_pr9 pytest tests/test_pyomo_models/test_model_multi_period.py::TestModelOptimization::test_optimization_runs tests/test_pyomo_models/test_model_validation.py::TestOptimizationComparison::test_optimization_improves_over_scipy tests/test_pyomo_models/test_model_validation.py::TestOptimizationComparison::test_optimized_solution_satisfies_constraints -n 0 --tb=short --maxfail=3passed with 3 passed;ruff check lyopronto/pyomo_models/model.py tests/test_pyomo_models/test_model_advanced.py tests/test_pyomo_models/test_model_multi_period.py tests/test_pyomo_models/test_model_validation.py tests/test_pyomo_models/test_physics_equations.pypassed;git diff --check origin/pr/pyomo-utils-singlestep...HEADpassed. - Merge as-is: no. I would not merge this until the blocking issues above are addressed.
bernalde
commented
May 7, 2026
Member
Author
bernalde
left a comment
There was a problem hiding this comment.
Propagating review feedback from the lower Pyomo PRs where the same issue still applies.
This PR adds the core multi-period Pyomo model: lyopronto/pyomo_models/model.py (640 lines): - Multi-period differential-algebraic equation (DAE) formulation - Orthogonal collocation discretization for time integration - Physics constraints: vapor pressure, sublimation rate, heat transfer - Equipment capability constraints - Product temperature limits - Variable scaling for numerical stability - Support for both Tsh and Pch optimization Key features: - Uses Pyomo DAE transformations from IDAES - Implements same physics as scipy-based calculators - Warmstart from scipy solution for faster convergence - Configurable time discretization (number of periods) Tests (4 files): - test_model_multi_period.py: Multi-period model construction - test_model_advanced.py: Advanced model features - test_model_validation.py: Input validation - test_physics_equations.py: Physics equation verification This is the core model used by the optimizer functions (PR 5).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Full trajectory optimization model. Discretizes the drying process into multiple time periods, encoding the physics (vapor pressure, product resistance, energy balance, mass transfer) as Pyomo constraints. Supports both finite-difference and collocation discretization. Log-transform for vapor pressure to avoid numerical issues with exponentials.
PR 4 of 7 in the Pyomo integration series.
Changes
lyopronto/pyomo_models/model.py— Full multi-period DAE modeltests/test_pyomo_models/test_model_multi_period.py— Multi-period tests (741 lines)tests/test_pyomo_models/test_model_advanced.py— Advanced model teststests/test_pyomo_models/test_model_validation.py— Validation against scipytests/test_pyomo_models/test_physics_equations.py— Physics equation testsKey Physics Encoded as Constraints
PR Chain
Testing
~2075 lines of new tests covering model construction, discretization, physics constraints, and validation against scipy baseline.