Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
94c3153
Merge remote-tracking branch 'upstream/main'
dangunter Apr 20, 2023
b8efdf4
Merge remote-tracking branch 'upstream/main'
dangunter May 22, 2023
056e81a
Merge remote-tracking branch 'upstream/main'
dangunter Jun 29, 2023
f88b9f3
Merge remote-tracking branch 'upstream/main'
dangunter Sep 8, 2023
2efd782
Merge remote-tracking branch 'upstream/main'
dangunter Sep 14, 2023
ce3458b
outputs
dangunter Nov 2, 2023
0cf8157
Merge remote-tracking branch 'upstream/main'
dangunter Nov 11, 2023
ba731e1
Merge remote-tracking branch 'upstream/main'
dangunter Dec 2, 2023
d29229f
Merge remote-tracking branch 'upstream/main'
dangunter Apr 4, 2024
eb9ec7a
Merge remote-tracking branch 'upstream/main'
dangunter Jun 3, 2024
39510a9
initial
dangunter Nov 13, 2025
97499d6
rename
dangunter Nov 13, 2025
9ee2b04
fix imports, add tests
dangunter Nov 13, 2025
1bdad43
ctor doc
dangunter Nov 13, 2025
c8a7eb5
forward ref for older pythons
dangunter Nov 13, 2025
0c4e2e1
changes for py39
dangunter Nov 13, 2025
40e64c4
tested dof action
dangunter Nov 14, 2025
7e5aa25
Merge remote-tracking branch 'upstream/main' into structured_flowsheet
dangunter Nov 15, 2025
cb9480e
testing dof
dangunter Nov 15, 2025
f20752c
looser timings and print them
dangunter Nov 17, 2025
f902adb
less lint
dangunter Nov 17, 2025
10e6b5e
larger tolerance
dangunter Nov 17, 2025
763c171
improved comments
dangunter Nov 17, 2025
b11f686
cleanup docs
dangunter Nov 17, 2025
244d741
more docstrings
dangunter Nov 17, 2025
5aa7b0e
minor tweak
dangunter Nov 20, 2025
af37157
docs and stuff
dangunter Nov 21, 2025
f8c56ec
save work
dangunter Nov 21, 2025
31f9cbc
better interactive usage
dangunter Nov 23, 2025
d295956
save work
dangunter Nov 26, 2025
4ace189
save work
dangunter Dec 2, 2025
3ad8a85
annotation tests/fixes
dangunter Dec 6, 2025
b7fc99c
save work yay
dangunter Dec 18, 2025
8bbb96b
save docs changes
dangunter Dec 20, 2025
6514832
myst
dangunter Dec 27, 2025
c594ddb
Merge remote-tracking branch 'upstream/main' into structured_flowsheet
dangunter Dec 27, 2025
260317f
markdown version
dangunter Dec 27, 2025
cb59353
removed old
dangunter Dec 27, 2025
a1fb58c
save work
dangunter Dec 31, 2025
a13a37d
tests failing but saving doctesting
dangunter Jan 2, 2026
aa57d28
documented annotation
dangunter Jan 4, 2026
6cd009e
fixed run_steps args
dangunter Jan 6, 2026
8691d8e
autodoc2 added
dangunter Jan 8, 2026
f041fbc
typos
dangunter Jan 8, 2026
c31c057
ok w/o connectivity
dangunter Jan 8, 2026
a512f75
Newcastle is playing well
dangunter Jan 11, 2026
9bf3fb7
added standard header
dangunter Jan 14, 2026
7a5fd49
hardly strictly docs
dangunter Jan 16, 2026
0d93c47
cli
dangunter Jan 18, 2026
7bf8daa
capture solver output
dangunter Jan 18, 2026
421b6b5
added variables
dangunter Jan 19, 2026
b73eb74
some cleanup of ModelVariable action
dangunter Jan 20, 2026
651baa5
better ModelVariables serialization
dangunter Jan 20, 2026
c9eec90
fixed tests, added headers
dangunter Jan 20, 2026
8b029b5
fixed timer report check for new obj
dangunter Jan 21, 2026
3a6d79a
tweaks
dangunter Jan 21, 2026
e1bf9b0
commented out mermaid diagrm by default for pygments/docs failure
dangunter Jan 22, 2026
7f4c9c9
structfs in docs
dangunter Jan 22, 2026
bfed876
removed no-index option
dangunter Jan 22, 2026
e5b416f
cleanup of ModelVariables
dangunter Jan 22, 2026
c60e736
put structfs into docs
dangunter Jan 22, 2026
3157ae2
install pandoc for docs
dangunter Jan 22, 2026
d6fe49b
make sure to use conda-forge
dangunter Jan 23, 2026
7e22f73
unused var
dangunter Jan 23, 2026
df1fcc3
tweak
dangunter Jan 23, 2026
bdc8893
fixed pylint warnings
dangunter Jan 25, 2026
603c81c
fixed pylint warnings
dangunter Jan 28, 2026
996d02e
fixed pylint warnings
dangunter Jan 28, 2026
a1fce65
fixed pylint warnings
dangunter Jan 28, 2026
9a6ede5
minor rename
dangunter Jan 28, 2026
f849862
add _load_module function now module arg can support python module na…
CopyDemon Jan 28, 2026
a9bc66b
update import path from relative path to module import
CopyDemon Jan 28, 2026
bf5f53e
format with black
CopyDemon Jan 28, 2026
30561b7
hey
dangunter Jan 29, 2026
0d7af99
identify code by either name/label or caption
dangunter Jan 29, 2026
ee6f5cb
before/after fix
dangunter Jan 29, 2026
43e6682
test for runner changes
dangunter Jan 29, 2026
3c280b6
Merge remote-tracking branch 'upstream/main' into structured_flowsheet
dangunter Jan 29, 2026
d1bd160
Merge remote-tracking branch 'origin/structured_flowsheet' into struc…
dangunter Jan 29, 2026
3951967
move error check
dangunter Jan 29, 2026
fb17e5b
safeguards for missing solver
dangunter Jan 29, 2026
60312c4
fix pandoc install cmd
dangunter Jan 29, 2026
e1e79c7
Fix runner_cli to support relative file paths and same-directory imports
CopyDemon Jan 29, 2026
b4ca4e6
format with black
CopyDemon Jan 29, 2026
3f0a36a
added --info flag to get information without running
dangunter Jan 30, 2026
bccf255
whitespace
dangunter Jan 30, 2026
d6f1d0f
Merge branch 'structured_flowsheet' of github.com:dangunter/idaes-pse…
dangunter Jan 30, 2026
a63f80f
fixed logic for module, added info
dangunter Jan 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
push:
branches:
- main
- '*_rel'
- "*_rel"
schedule:
# run daily at 5:00 am UTC (12 am ET/9 pm PT)
- cron: '0 5 * * *'
- cron: "0 5 * * *"
repository_dispatch:
# to run this, send a POST API call at repos/IDAES/idaes-pse/dispatches with the specified event_type
# e.g. `gh repos/IDAES/idaes-pse/dispatches -F event_type=ci_run_tests`
Expand Down Expand Up @@ -38,7 +38,7 @@ concurrency:

env:
# default Python version to use for checks that do not require multiple versions
DEFAULT_PYTHON_VERSION: '3.10'
DEFAULT_PYTHON_VERSION: "3.10"
IDAES_CONDA_ENV_NAME_DEV: idaes-pse-dev
PYTEST_ADDOPTS: "--color=yes"

Expand All @@ -54,7 +54,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
Expand All @@ -76,10 +76,10 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Run Spell Checker
uses: crate-ci/typos@v1.24.5
with:
with:
config: ./.github/workflows/typos.toml

pytest:
Expand All @@ -90,7 +90,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os:
- linux
- win64
Expand All @@ -99,15 +99,14 @@ jobs:
runner-image: ubuntu-24.04
- os: win64
runner-image: windows-2022
- python-version: '3.11'
- python-version: "3.11"
# only generate coverage report for a single python version in the matrix
# to avoid overloading Codecov
cov-report: true


steps:
- uses: actions/checkout@v5

- uses: ./.github/actions/display-debug-info
- name: Set up Conda environment
uses: conda-incubator/setup-miniconda@v3
Expand All @@ -119,7 +118,7 @@ jobs:
- name: Set up idaes
uses: ./.github/actions/setup-idaes
with:
install-target: -r requirements-dev.txt
install-target: -r requirements-dev.txt
- name: Add pytest CLI options for coverage
if: matrix.cov-report
run: |
Expand All @@ -134,7 +133,7 @@ jobs:
name: coverage-report-${{ matrix.os }}
path: coverage.xml
if-no-files-found: error

upload-coverage:
name: Upload coverage report (Codecov)
needs: [pytest]
Expand All @@ -146,7 +145,7 @@ jobs:
steps:
# the checkout step is needed to have access to codecov.yml
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: coverage-report-${{ matrix.report-variant }}
Expand All @@ -170,13 +169,15 @@ jobs:
needs: [code-formatting, spell-check]
steps:
- uses: actions/checkout@v4

- name: Set up Conda environment
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: ${{ env.IDAES_CONDA_ENV_NAME_DEV }}
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
miniforge-version: latest
- name: Install pandoc
run: conda install -c conda-forge pandoc
- name: Set up idaes
uses: ./.github/actions/setup-idaes
with:
Expand Down Expand Up @@ -206,7 +207,7 @@ jobs:
# NOTE: using Conda instead of actions/setup-python in this job is not strictly necessary
# as it doesn't need to run on Windows or use the setup-idaes local action,
# but we do it for consistency with the other jobs

- name: Set up Conda environment
uses: conda-incubator/setup-miniconda@v3
with:
Expand All @@ -216,7 +217,7 @@ jobs:
- name: Set up idaes
uses: ./.github/actions/setup-idaes
with:
install-target: -r requirements-dev.txt
install-target: -r requirements-dev.txt
- name: Run pylint
run: |
echo "::group::Display pylint version"
Expand All @@ -240,7 +241,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Set up Conda environment
uses: conda-incubator/setup-miniconda@v3
with:
Expand All @@ -250,7 +251,7 @@ jobs:
- name: Set up idaes
uses: ./.github/actions/setup-idaes
with:
install-target: -r requirements-dev.txt
install-target: -r requirements-dev.txt
- name: Create empty pytest.ini file
run: |
echo "" > pytest.ini
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ PN = "PN"
hd = "hd"
Tge = "Tge"
iy = "iy"

# more chemE abbreviations
HDA = "HDA"
1 change: 1 addition & 0 deletions docs/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def run_apidoc(clean=True, dry_run=False, **kwargs):
"apidoc",
"../idaes",
"../idaes/*tests*",
"../idaes/core/util/structfs", # handled by apidoc2
],
60,
dry_run,
Expand Down
26 changes: 23 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

# For importing from idaes.<modules..>
sys.path.insert(0, os.path.abspath(".."))
sys.path.insert(0, os.path.abspath("."))


# -- General configuration ------------------------------------------------
Expand All @@ -36,8 +37,25 @@
"sphinxarg.ext",
"sphinx.ext.doctest",
"sphinx_copybutton",
"nbsphinx",
# MystMD extensions
"myst_parser",
"autodoc2",
]

# Myst autodoc2 (experimental)
autodoc2_packages = [
"../idaes/core/util/structfs",
]
autodoc2_output_dir = "reference_guides/core/util"
autodoc2_render_plugin = "myst"
autodoc2_docstring_parser_regexes = [
# render docstrings in matching files as Markdown
("../idaes/core/util/structfs/.*", "myst"),
]
autodoc2_no_index = True
autodoc2_index_template = None # don't write index.rst

# Put type hints in the description, not signature
autodoc_typehints = "description"

Expand All @@ -51,8 +69,7 @@
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = ".rst"

source_suffix = [".rst", ".md"]
# The encoding of source files.
#
# source_encoding = 'utf-8-sig'
Expand Down Expand Up @@ -85,7 +102,10 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ["apidoc/*tests*"]
exclude_patterns = [
"apidoc/*tests*",
"../idaes/core/util/structfs",
]

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand Down
7 changes: 7 additions & 0 deletions docs/examples/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Examples
========

.. toctree::
:maxdepth: 1

structfs/index
86 changes: 86 additions & 0 deletions docs/examples/structfs/flash_flowsheet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
###############################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES).
#
# Copyright (c) 2018-2025 by the software owners: The Regents of the
# University of California, through Lawrence Berkeley National Laboratory,
# National Technology & Engineering Solutions of Sandia, LLC, Carnegie Mellon
# University, West Virginia University Research Corporation, et al.
# All rights reserved. Please see the files COPYRIGHT.md and LICENSE.md
# for full copyright and license information.
#
###############################################################################
"""
Simple Flash flowsheet for use in testing.
"""

from pyomo.environ import ConcreteModel, SolverFactory
from idaes.core import FlowsheetBlock

# Import idaes logger to set output levels
import idaes.logger as idaeslog
from idaes.models.properties.activity_coeff_models.BTX_activity_coeff_VLE import (
BTXParameterBlock,
)
from idaes.models.unit_models import Flash
from idaes.core.util.structfs.fsrunner import FlowsheetRunner


FS = FlowsheetRunner()

# # Flash Unit Model
#
# Author: Jaffer Ghouse
# Maintainer: Andrew Lee
# Updated: 2023-06-01


@FS.step("build")
def build_model(ctx):
"""Build the model."""
m = ConcreteModel()
m.fs = FlowsheetBlock(dynamic=False)
m.fs.properties = BTXParameterBlock(
valid_phase=("Liq", "Vap"), activity_coeff_model="Ideal", state_vars="FTPz"
)
m.fs.flash = Flash(property_package=m.fs.properties)
# assert degrees_of_freedom(m) == 7
ctx.model = m


@FS.step("set_operating_conditions")
def set_operating_conditions(ctx):
"""Set operating conditions."""
m = ctx.model
m.fs.flash.inlet.flow_mol.fix(1)
m.fs.flash.inlet.temperature.fix(368)
m.fs.flash.inlet.pressure.fix(101325)
m.fs.flash.inlet.mole_frac_comp[0, "benzene"].fix(0.5)
m.fs.flash.inlet.mole_frac_comp[0, "toluene"].fix(0.5)
m.fs.flash.heat_duty.fix(0)
m.fs.flash.deltaP.fix(0)


@FS.step("initialize")
def init_model(ctx):
""" "Initialize the model."""
m = ctx.model
m.fs.flash.initialize(outlvl=idaeslog.INFO)


@FS.step("set_solver")
def set_solver(ctx):
"""Set the solver."""
ctx.solver = SolverFactory("ipopt")


@FS.step("solve_initial")
def solve(ctx):
"""Perform the initial model solve."""
ctx["results"] = ctx.solver.solve(ctx.model, tee=ctx["tee"])


@FS.step("solve_optimization")
def solve_o(ctx):
ctx["results"] = ctx.solver.solve(ctx.model, tee=ctx["tee"])
Loading
Loading