Skip to content

PR 4/7: Pyomo multi-period DAE model#9

Open
bernalde wants to merge 1 commit intopr/pyomo-utils-singlestepfrom
pr/pyomo-model
Open

PR 4/7: Pyomo multi-period DAE model#9
bernalde wants to merge 1 commit intopr/pyomo-utils-singlestepfrom
pr/pyomo-model

Conversation

@bernalde
Copy link
Member

@bernalde bernalde commented Mar 3, 2026

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 model
  • tests/test_pyomo_models/test_model_multi_period.py — Multi-period tests (741 lines)
  • tests/test_pyomo_models/test_model_advanced.py — Advanced model tests
  • tests/test_pyomo_models/test_model_validation.py — Validation against scipy
  • tests/test_pyomo_models/test_physics_equations.py — Physics equation tests

Key Physics Encoded as Constraints

Psub = 2.698e10 * exp(-6144.96 / (Tsub + 273.15))     # Vapor pressure (log-transformed)
Rp = R0 + A1 * Lck / (1 + A2 * Lck)                   # Product resistance
dmdt = Ap / Rp * (Psub - Pch)                          # Sublimation rate
Kv * Av * (Tsh - Tbot) = dmdt * dHs                    # Energy balance

PR Chain

# PR Status
0 Sync upstream (#5) Merged
1 CI/CD for Pyomo (#6) Open
2 Pyomo dependencies (#7) Open
3 Utils & single-step (#8) Open
4 Multi-period model (this PR)
5 Optimizer functions Pending
6 Benchmarks Pending
7 Docs & examples Pending

Testing

~2075 lines of new tests covering model construction, discretization, physics constraints, and validation against scipy baseline.

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).
@bernalde bernalde force-pushed the pr/pyomo-utils-singlestep branch from 53ad6d9 to 389c49e Compare March 3, 2026 18:07
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.

1 participant