Skip to content

Expose solved two-sided heat exchanger performance - #79

Merged
EvenSol merged 30 commits into
mainfrom
automation/studio-heat-exchanger-properties-20260804-0220
Aug 4, 2026
Merged

Expose solved two-sided heat exchanger performance#79
EvenSol merged 30 commits into
mainfrom
automation/studio-heat-exchanger-properties-20260804-0220

Conversation

@EvenSol

@EvenSol EvenSol commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • expose solved hot/cold inlet and outlet temperatures, pressures, and mass flows for native two-sided HeatExchanger units
  • report configured UA, positive heat-transfer magnitudes, flow-arrangement-aware signed terminal approach, effectiveness, and signed energy-closure residuals
  • classify thermodynamic sides by solved inlet temperatures rather than native insertion order
  • publish duty closure through workbook properties and Process Chat KPIs with explicit engineering units
  • preserve ProcessSystem, explicit direct-run, internal acyclic direct-run, clone-time, and failed-rerun provenance
  • invalidate published exchanger metrics when any solved boundary or active solution-mode/rating setting changes without a successful rerun
  • require an adapter-observed successful load/build/run, including successful native worker status, before publishing solved exchanger state
  • accept completed zero-duty process runs while retaining bounded warm-up retries

Engineering validation

  • Exact head: 2bc1581f7bda9b3b3d41a5ed654baa65abe8fa77; thirty bounded commits (three planned implementation commits and twenty-seven review repairs)
  • Fresh verified environment: Python 3.12.13, Java 17.0.19, NeqSim 3.16.0
  • Bootstrap resolution: online-new-snapshot; 48 public-PyPI wheels verified by manifest, size, and SHA-256
  • All 303 Studio tests passed in 18.295 s: deployment-safe imports, warm deployment, graph editor, material identity, solver diagnostics, schema/serialization, workbook/Process Chat mapping, cloning, and native graph conservation
  • Native counterflow benchmark at 100% flow: 2,389.153 kW duty, 0.832595 effectiveness, 4.330e-8% side-duty closure, 3.285e-8% system-energy residual
  • Native counterflow benchmark at 105% flow: 2,480.029 kW duty, 0.823109 effectiveness, 4.653e-8% side-duty closure, 3.489e-8% system-energy residual
  • Native co-current benchmark pairs inlet–inlet and outlet–outlet terminals and reports the physical negative outlet cross (about -50.54 K), with all system balances below 1e-6%
  • Native direct run(UUID) is hidden before explicit provenance recording and publishes 2,389.153 kW afterward; internal acyclic and clone-time direct-run paths capture valid provenance automatically
  • A serialized three-inlet mixer-plus-exchanger clone immediately retains positive exchanger duty and mass/component/energy closure below 1e-6% without another run
  • No-mixer closure returns explicit False; direct provenance is authorized only after a completed mixer-bearing pass, and successful capture clears/rebuilds both provenance caches atomically
  • Failed or timed-out reruns preserve previously trusted direct-run metrics when boundaries remain unchanged, but never recapture edited or mixed states
  • Full snapshots cover exchanger calculation ID; every boundary UUID, temperature, pressure, mass flow, and initialized enthalpy; flow arrangement; active UA, effectiveness, duty, delta-T/use-delta-T, outlet/approach target, design, limit, and rating configuration
  • Rating calculator replacement, rating-area edits, and calculator tube-count mutations invalidate solved metrics until a successful rerun
  • Native worker failures are detected through ProcessSystem.getRunStatus().isSuccess() after join and cannot be reported as completed simulations
  • Rewrapping an edited solved process defaults to untrusted state and withholds duty until a successful adapter-owned run
  • A completed three-unit zero-duty process is accepted after bounded warm-up attempts; timeout, failed native status, and all-attempt exception paths remain failures
  • Signed closure regression reports 4,800 kW / 200% when both sides lose 2,400 kW; counterflow crossover reports -5 K
  • Hot and cold mass flows close independently; component and total system balances remain below 1e-6%
  • Fixed-UA nearby trend is physical: duty increases with flow while effectiveness decreases
  • Regressions cover counterflow/co-current pairing, ProcessSystem/direct/internal-direct/clone provenance, failed reruns, stale rewraps, qualified ProcessModel names, active-setting/delta-T/rating invalidation, idle solves, stale inlets/outlets, reversed insertion order, terminal crossover, signed closure, negative native duty, level-3 enthalpy initialization, never-run/incomplete units, native sentinels, worker status, and the complete unit map
  • Fresh local Streamlit gate passed: root HTTP 200, /_stcore/health=ok twice, process live
  • Hosted Studio run 286 passed: https://github.com/EvenSol/neqsimweb2/actions/runs/30875556327
  • All thirty-six Copilot/Codex findings, including suppressed suggestions and one explicitly deferred performance refactor, were technically assessed, regression-tested where actionable, replied to or dispositioned, and resolved
  • Branch is thirty commits ahead and zero behind main; diff is limited to the shared model/builder adapters and conservation regression suite

Documentation impact

Documentation impact: none. The Studio workbook and Process Chat property surfaces are metadata-driven and self-label every new value with an explicit unit. The solved-state trust contract is documented by public docstrings and executable regressions; normal Studio workflows require no new user action.

Roadmap

Advances commits 41–50 (metadata-driven heat-exchanger properties), 51–60 (per-unit solved energy closure and nearby-point mapping), and supports commits 71–80 (UA/duty equipment-design evidence).

@EvenSol
EvenSol requested a review from Copilot August 4, 2026 00:32

EvenSol commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review exact head 4929feadf7a4a74b23be9359316b58e835d615f0. Please verify native two-sided heat-exchanger stream ordering, duty signs and units, completeness semantics, numerical scaling, workbook/Process Chat compatibility, and the nearby-point thermodynamic assertions.

Copilot AI left a comment

Copy link
Copy Markdown

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 extends the Process Chat / workbook model adapter to expose a richer, explicitly unit-labeled set of solved performance properties for native two-sided HeatExchanger units (hot/cold inlet/outlet conditions, UA, duty, effectiveness, and side-duty closure), and expands the conservation regression suite to validate these new surfaced properties (including nearby-point trend checks).

Changes:

  • Add explicit hot/cold inlet/outlet temperatures, pressures, and mass flows plus UA/duty/approach/effectiveness to HeatExchanger unit properties and KPIs.
  • Compute and publish hot-side and cold-side duties plus a duty-closure residual (kW and %).
  • Add regression tests for workbook/KPI mapping and for expected nearby-point exchanger trends (duty ↑ with flow, effectiveness ↓ with flow).

Reviewed changes

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

File Description
process_chat/process_model.py Adds heat-exchanger solved-property extraction, unit mapping, and KPI publishing for two-sided HeatExchanger.
tests/test_process_graph_conservation.py Adds unit tests validating the new workbook/KPI property exposure and extends native exchanger conservation tests with duty/effectiveness checks.

Comment thread process_chat/process_model.py
Comment thread process_chat/process_model.py Outdated
Comment thread tests/test_process_graph_conservation.py
Comment thread tests/test_process_graph_conservation.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4929feadf7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread process_chat/process_model.py Outdated
Comment thread process_chat/process_model.py
Comment thread process_chat/process_model.py Outdated

EvenSol commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review exact head 9970fec71573761e010c2fed176f5d8d382fa970. Please re-evaluate the complete repaired diff, including hot/cold classification, positive duty semantics, level-3 enthalpy initialization, incomplete/sentinel gating, units, native conservation, and regression coverage.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9970fec715

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread process_chat/process_model.py Outdated
Comment thread process_chat/process_model.py
@EvenSol
EvenSol requested a review from Copilot August 4, 2026 00:52

EvenSol commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review exact head 2ad5245a9910e92c91c2b035b919ae4a8b2bb160. Please verify the complete repaired diff, especially native calculation-marker gating, classified terminal-approach calculation, hot/cold ordering, positive duty semantics, units, and conservation regressions.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ad5245a99

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread process_chat/process_model.py

EvenSol commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review exact head 221091c5ae65ce808a2a8a3c69ecce9ba958daee. Please verify the complete repaired diff, especially coherent exchanger/boundary calculation identifiers, run-state gating, classified terminal approach, duty semantics, units, and native conservation.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

process_chat/process_model.py:2584

  • enthalpy_kW here is actually an enthalpy flow (power) in kW (computed from fluid.getEnthalpy()/1000). Using a name that implies specific enthalpy (or stored energy) is misleading, especially since other adapter code uses enthalpy_flow_kW. Renaming the local variable and the internal dict key would make the duty math easier to audit.
                    temperature_C = float(stream.getTemperature("C"))
                    pressure_bara = float(stream.getPressure("bara"))
                    flow_kg_hr = float(stream.getFlowRate("kg/hr"))
                    fluid = stream.getFluid()
                    fluid.init(3)
                    enthalpy_kW = float(fluid.getEnthalpy()) / 1000.0
                except Exception:

process_chat/process_model.py:2632

  • approachTemperature_K is computed as a raw minimum of terminal temperature differences, which can become negative (e.g., from floating noise or temperature crossover) even though this property is described/consumed as a physical approach temperature in K. Consider reporting the physical magnitude to keep the KPI/workbook contract non-negative.
        properties["approachTemperature_K"] = min(
            named_sides["hot"]["inlet"]["temperature_C"]
            - named_sides["cold"]["outlet"]["temperature_C"],
            named_sides["hot"]["outlet"]["temperature_C"]
            - named_sides["cold"]["inlet"]["temperature_C"],
        )

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 221091c5ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread process_chat/process_model.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

process_chat/process_model.py:3460

  • Same issue as run(): clearing _direct_unit_run_provenance at the start of rerun() can drop previously trusted direct-run exchanger metrics when the rerun fails, even if the old snapshot is still valid. Since _capture_heat_exchanger_state_snapshots() already clears/rebuilds provenance atomically on successful runs, keeping the existing cache until success better matches the "retain prior trusted snapshot on failure" contract.
        self._direct_unit_run_provenance.clear()

process_chat/process_model.py:3423

  • Clearing _direct_unit_run_provenance at the start of run() can inadvertently hide previously trusted direct-run heat-exchanger properties if the current run fails or times out. list_units()/_extract_unit_properties() will then call _heat_exchanger_operating_properties() without the required provenance (inlet UUIDs differ from exchanger UUID for direct runs) and return {} even though the old snapshot is still valid and should be preserved on failed runs.

This issue also appears on line 3460 of the same file.

        self._direct_unit_run_provenance.clear()

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ddf5647ff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread process_chat/process_model.py Outdated
Comment thread process_chat/process_model.py Outdated

EvenSol commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

Copilot suppressed-review disposition for the 5ddf5647ffc21405be22744fd91b016d96ddca70 review: both findings were technically valid and are accepted in 57fbfa882ac397817f7c85c69919007f867c0df9. run() and rerun() no longer clear direct-run provenance before attempting execution; a failed/timed-out run therefore preserves the prior trusted snapshot and provenance when boundaries are unchanged, while every successful capture still clears and atomically rebuilds both caches. Native regression test_failed_rerun_preserves_unchanged_direct_run_provenance is published in 13740ca0a3105f718487ac8922141eb94824c33f. All 300 tests pass in the verified NeqSim 3.16.0 environment, and the fresh Streamlit root/health gate is healthy.

EvenSol commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review exact head 13740ca0a3105f718487ac8922141eb94824c33f. Please assess the complete repaired diff, especially adapter-owned solved-state trust, failed-run cache retention, active heat-exchanger solution-mode invalidation, builder success gating, units, numerical robustness, Process Chat compatibility, and native conservation.

@EvenSol
EvenSol marked this pull request as draft August 4, 2026 03:12
@EvenSol
EvenSol marked this pull request as ready for review August 4, 2026 03:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 13740ca0a3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread process_chat/process_model.py Outdated
Comment thread process_chat/process_model.py

EvenSol commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review exact head 4da2e82226f5ecd443e24fcc819a598c861d091b. Please assess the full repaired diff, especially zero-duty completion semantics, timeout/exception failure handling, native delta-T/use-mode snapshot invalidation, adapter-owned solved-state trust, units, numerical robustness, Process Chat compatibility, and native conservation.

@EvenSol
EvenSol marked this pull request as draft August 4, 2026 03:29
@EvenSol
EvenSol marked this pull request as ready for review August 4, 2026 03:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4da2e82226

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread process_chat/process_model.py
Comment thread process_chat/process_model.py

EvenSol commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review exact head 2bc1581f7bda9b3b3d41a5ed654baa65abe8fa77. Please reassess the complete diff, with particular attention to native asynchronous ProcessSystem.getRunStatus() handling, legitimately completed zero-duty processes, rating-calculator signature coverage, solved-state provenance/invalidation, thermodynamic units and signs, numerical robustness, Process Chat compatibility, and the new native regressions.

@EvenSol
EvenSol marked this pull request as draft August 4, 2026 03:47
@EvenSol
EvenSol marked this pull request as ready for review August 4, 2026 03:48
@EvenSol
EvenSol marked this pull request as draft August 4, 2026 03:52
@EvenSol
EvenSol marked this pull request as ready for review August 4, 2026 03:52

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2bc1581f7b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread process_chat/process_model.py
Comment thread process_chat/process_model.py
@EvenSol
EvenSol merged commit 8d45965 into main Aug 4, 2026
1 check passed

EvenSol commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review exact head 04d873d1b3fb59931247fe8f12bbbb567bc83205. Please reassess the complete diff, especially final-attempt success semantics after zero-duty warm-ups, native inactive/locked-inactive invalidation, asynchronous worker status, rating configuration, provenance, thermodynamic signs/units, and the two new regressions. Local exact-head evidence: 64 focused native graph tests and all 305 Studio tests passed; fresh Streamlit root/health probes are healthy.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d459655c7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread process_chat/process_model.py

EvenSol commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review exact head 6993da88d341340987d3fd5033dcde78fd1168ee. Please reassess the complete diff, especially inactive/locked-inactive snapshot capture across a subsequent successful process run, final-attempt success semantics, worker status, rating configuration, provenance, thermodynamic signs/units, and the latest native regression. Exact-head local evidence: all 305 tests passed and fresh Streamlit root/health probes are healthy.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 8d459655c7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

2 participants