Skip to content

Simulate > OpenStudio Simulation: minimal OpenStudio/EnergyPlus run from SAM_UI (#229) - #237

Merged
michaldengusiak merged 11 commits into
sow/2026-Q4from
claude/openstudio-mcp-server-1jmjlo
Oct 18, 2026
Merged

michaldengusiak merged 11 commits into
sow/2026-Q4from
claude/openstudio-mcp-server-1jmjlo

Conversation

@michaldengusiak

@michaldengusiak michaldengusiak commented Oct 17, 2026 •

Copy link
Copy Markdown

Owner acceptance and authorized merge - 2026-10-18

The owner has accepted the documented explicit-EPW numerical residuals for G1 integration and authorized merging #237 followed by #238 after passing checks. This supersedes all earlier HOLD wording below. No GitHub approval review is fabricated and no repository protection is bypassed.

This is a one-time acceptance of the prescribed two-cell/Boston evidence, not a change to comparator tolerances or a claim of bit identity. Maximum energy residual is 3.134337021037936e-7 kWh, maximum peak residual 2.735980331181054e-10 kW; maximum relative residual about 1.9433e-11. CLI-only repeats also vary and all 163 normalized IDF objects have matching engineering fields. The precise source of run-to-run variation is not claimed proven.

Real native cancellation/process cleanup, concurrent-edit isolation, the 608/608 exact persisted Tas baseline comparison and the actually executed real-run test are PASS. Evidence and limitations are committed in documentation/OpenStudio-Simulation-PR229.md and documentation/evidence/g1-20261018/. No new simulation or local broad suite was run for this acceptance-only update; earlier local/full-suite/engine results remain attributed to their tested content.

Current documentation-only final candidate: 9abfc03469bb46c29e46b2dd3feb1961e09f8a5b. Final-head CI pending. #237 merges first; #238 stays draft until dependency and final gates pass. Numerical engine disagreement, HungaryHouse Tas crash, missing input manifests and producer deployment remain separate follow-ups.


Earlier implementation and acceptance history follows.

Closes #229 (part of #227; tracker SAM-BIM/SAM#206).

Behavior

Adds Simulate > OpenStudio Simulation beside Energy Simulation. The run freezes a deep copy, uses SAM_OpenStudio's existing conversion/results pipeline, and writes a separate result model, manifest, weather, OSM/OSW and SQL. The open model and existing Tas workflow are preserved. #238 adds the unified selector and comparison workflow after this PR.

Current acceptance: HOLD - 2026-10-18

Owner authorization covers focused testing, evidence-only final heads and later merging after all gates pass. No additional pin approval is needed solely for these evidence commits. The required explicit-EPW equality gate remains unmet; no acceptance waiver or numerical tolerance has been introduced.

Final evidence-only head: b4c5ad9279c58b0a5db0874333db2a696106b145. Freshly tested UI source: b7483443f53dd53a4d16f159d6bc327c901a7770; same-dependency pre-PR Q4 baseline: ebe5e09b30b95e43e5d047b3aef2d8c5f01110e9. Both Release builds succeeded. Final diff is documentation/evidence only; git diff b7483443 b4c5ad92 --check passes. No product fix was made.

Newly executed check Result
Real native cancellation PASS: Cancel while run-owned OpenStudio/EnergyPlus processes were observed alive; both terminate, manifest Cancelled, exit -1, no completed result model. No external kill used.
Concurrent-edit isolation PASS: rename committed before run completion; snapshot/result retain old space name, saved disposable live model retains edit; snapshot hash unchanged.
Existing Energy Simulation vs pre-PR Q4 PASS for the box case: same model/weather/settings/dependency binaries; 608/608 persisted numerical values exactly equal. Does not claim byte-identical TSDs or full hourly-native audit.
Prescribed two-cell + explicit Boston EPW Both runs succeed; UI records Weather=File, exit 0, 13 warnings, 0 severe/fatal, 31 results. Source/weather provenance matches. Four model energy/peak values are not identical: HOLD under original G1 step 12.
Opt-in RealRun test PASS 1/1, actually executed with valid model/EPW/CLI; detailed output Succeeded, no NOT RUN, TRX verified.

Standalone/benchmark stored values and deltas:

Metric Standalone Benchmark Difference
Heating kWh 31072.86245449682 31072.862454810253 -3.134337021037936e-7
Cooling kWh 5764.530483239447 5764.530483144583 9.486393537372351e-8
Peak heating kW 19.82144246485972 19.821442464872938 -1.3216094885137863e-11
Peak cooling kW 14.079292685507252 14.07929268578085 -2.735980331181054e-10

A second CLI-only run also varies (heating delta -6.598711479455233e-7 kWh versus CLI 1). All three generated IDFs have identical engineering fields after matching generated aperture/frame names and object order: 163 objects, normalized SHA-256 3b0dbe8f96a18c8b99b311811b2cccdc15c7b34046a549a0981a385cdf0da397, without rounding or dropping physical fields. This supports existing same-engine conversion/order reproducibility rather than a newly established UI mapping defect, but does not meet literal identity. No physics, units, tolerances, comparison arithmetic or deployment changed.

Exact pins, commands, input hashes, assertions, screenshots and limitations: PR record, section Windows G1 acceptance execution; portable evidence. Full machine-local runs/builds/logs/TRX: C:\TasOut\pr237-g1-20261018 (must be copied/provisioned on another machine). Original fixtures preserved; only disposable HungaryHouse copy renamed.

All 14 dependency source pins were held fixed on sow/2026-Q4; eight engine/core/interop DLL hashes match across the two UI builds. Important pins: SAM 618db819300df8b698b3bbe5174a203244134738, SAM_OpenStudio d4216f3525c01ca762c1b3e9b6d099733d037f54, SAM_Tas a34a298dde2803de514081a0ed72ac3ff790997b, SAM_Validation 68eded0060047af714853a02a152fb9c960bfeb1, containing #15 merge 912ae94ef68af20b437fc92ec7e8891fd1cb640f. Runtime OpenStudio 3.10 / EnergyPlus 25.1 / Tas 9.5.7 / Windows x64. SAM_COMMIT=618db819300df8b698b3bbe5174a203244134738 supplied for benchmark provenance.

Historical successful Both/partial, saved box equality, 2835/2835 suite and presentation evidence were inspected, not rerun. These do not waive the failed explicit-EPW requirement. The final-head hosted workflow builds but does not run WPF tests.

Final-head CI and merge gates

Build 39113785793 PASS; SPDX 39113785833 PASS, at final head b4c5ad9279c58b0a5db0874333db2a696106b145. Completed build log inspected: all 14 dependencies select sow/2026-Q4, including SAM_Validation, SAM_SQLite, SAM_OpenStudio and SAM_Tas. No Validation feature branch is selected. Log preserved at C:\TasOut\pr237-g1-20261018\logs\pr237-final-build-39113785793.log.

Live metadata: OPEN, non-draft, no submitted reviews or review threads; base sow/2026-Q4. Owner merge authorization does not bypass acceptance/protection. #238 is held dependent on this PR. No UI merge, PROJECT_PROGRESS closeout or task-branch cleanup has occurred; checkouts clean, evidence committed and pushed.

Next: owner/domain review of the strict identical-value specification, or a separately reviewed deterministic-conversion fix if bit identity is required. Do not merge either UI PR until that acceptance decision is resolved. Numerical Tas/OpenStudio disagreement, HungaryHouse Tas crash, unavailable input manifests and producer deployment remain separate follow-ups.


The original G1 procedure below is retained as the acceptance source; its step-12 identity requirement has not been relaxed. Current results are above and in the dated committed record.

Manual G1 acceptance (owner, Windows x64)

Prerequisites

  1. OpenStudio 3.10.0 installed. In a new terminal, openstudio --version should print 3.10.0. If it is not on PATH, the default install C:\openstudio-3.10.0\bin is also found.

  2. Build this branch with the usual sibling layout. Either:

    • SAM_Deploy BuildAll, which builds SAM_OpenStudio with Platform=x64 before SAM_UI; or
    • by hand, in this order: SAM, SAM_SQLite, SAM_OpenStudio with /p:Platform=x64, the other dependencies, then SAM_UI (claude/openstudio-mcp-server-1jmjlo).

    The SAM_UI build fails early with a clear message if the native OpenStudio DLLs are missing.

  3. Check the deployed folder. After the build, %APPDATA%\SAM (or wherever you launch SAM Analytical.exe from) must contain:

    • openstudiolib.dll, openstudio_csharp.dll, openstudio_model_csharp.dll, openstudio_translators_csharp.dll;
    • OpenStudio.dll, SAM.Analytical.OpenStudio.dll, System.Data.SQLite.dll;
    • runtimes\win-x64\native\SQLite.Interop.dll.

A. Real run with embedded weather
4. Copy SAM_OpenStudio\tests\resources\models\rawModel-WindowsWeatherDataDDYAdiabaticAirPanel.sam to a scratch folder, open it in SAM Analytical, and Save it. Note the file's SHA-256 with certutil -hashfile <file> SHA256.
5. Run Simulate > OpenStudio Simulation. Pick the scratch folder, then answer Yes (use the model's weather data). The progress window should step through: Freezing/converting, Saving OSM, Writing OSW, Running OpenStudio/EnergyPlus, Reading results. Check that the main window stays responsive while it runs.
6. Expected summary: finished, a run folder <model>_OpenStudio_<timestamp>_<id>, a result model with N results, Weather: Embedded, and EnergyPlus: exit code 0, … 0 severe, 0 fatal.
7. In the run folder, check that these exist:

  • snapshot.json, weather.epw, <model>.osm, <model>.osw;
  • run\eplusout.sql, run\eplusout.err;
  • <model>_OpenStudio.json, openstudio-run.json.

In openstudio-run.json, status should be Succeeded, engine.fatalCount should be 0, and engine.cliPath should be your 3.10 openstudio.exe. Report severeCount and warningCount.
8. Original model preserved:

  • The title bar or undo history shows no new modification.
  • Save again and re-hash: the hash equals step 4's. (If SAM writes a timestamp on save, compare in a JSON diff instead; the only expected difference is the timestamp.)
  • Energy Simulation results already in the model (if any) are still there.
  1. Result model correct:
    • Open <model>_OpenStudio.json in SAM Analytical. Space results show for Cell 1 and Cell 2.
    • Results > Remove lists only … - SAM.Analytical.OpenStudio entries, with no Tas results.
    • The model has one Analytical Model Simulation Result (heating/cooling kWh and peak kW).

B. Explicit EPW, compared with the benchmark CLI (same code path)
10. Repeat step 5 but answer No and pick SAM_OpenStudio\tests\resources\weather\USA_MA_Boston-Logan.Intl.AP.725090_TMYx.2004-2018.epw. The summary should say Weather: File.
11. Run benchmark-openstudio --model <fixture>.sam --weather <same epw> --out bench.json. The exe is under SAM_OpenStudio\benchmark\SAM.Analytical.OpenStudio.Benchmark\bin\.
12. Compare bench.json model.consumptionHeating/consumptionCooling/peakHeatingLoad/peakCoolingLoad with the result model's Analytical Model Simulation Result. They should be identical: same pipeline, same inputs.

C. Cancel and isolation
13. Start another run, then press Cancel while it shows Running OpenStudio/EnergyPlus. Expected:

  • openstudio.exe and energyplus.exe disappear in Task Manager;
  • the summary says cancelled;
  • the manifest status is Cancelled;
  • there is no <model>_OpenStudio.json.
  1. Start a run and, while it runs, edit the open model, for example rename a space. The run completes. Its snapshot.json and result model have the old name, and the open model keeps your edit.

D. Tas unchanged
15. On the same model, run Simulate > Energy Simulation (Tas) with your usual settings, once with this build and once with a sow/2026-Q4 build. The dialog and workflow should be identical, and the results equal within Tas run-to-run reproducibility.

E. Failure reporting
16. (Optional) Temporarily rename the OpenStudio install so openstudio.exe is not found, then run. Expected: the summary says failed with "openstudio.exe was not found …" and SAM_UI does not crash. Restore the install afterwards.
17. Run dotnet test WPF/SAM.Analytical.UI.WPF.Tests -c Release. The full suite should pass. OpenStudioSimulationTests.RealRun_… must not print NOT RUN.

Adds Simulate > OpenStudio Simulation. The open model is frozen to a
snapshot JSON and SAM_OpenStudio's existing ToOpenStudio pipeline runs on
the copy read back from it (in process; EnergyPlus runs out of process
under SAM_OpenStudio's job object). Results are attached with
SAM_OpenStudio's AddResults plus the model-level result, to a copy with
every earlier result removed, and saved as <model>_OpenStudio.json in a
new run folder together with the OSM/OSW, run outputs, the weather used
and an openstudio-run.json manifest (status, SHA-256 of snapshot and
weather, CLI, error counts, diagnostics). The run is on a worker thread
with the existing ProgressWindowHost for progress and cancel. The open
model and the Tas workflow are not changed.

Build: SAM.Analytical.UI.WPF references SAM_OpenStudio\build (OpenStudio.dll
is IL-only, so no x64 platform change) and copies the x64 native files;
CI clones and builds SAM_SQLite and SAM_OpenStudio (x64) before SAM_UI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fgbs3ko6Xix9Ut15onTY7R
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fgbs3ko6Xix9Ut15onTY7R
The platform-override edit cut the "# Convert build order -> solution
paths (robust: ...)" comment, leaving "(robust: ...)" after a closing
brace; pwsh rejected the script before any build ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fgbs3ko6Xix9Ut15onTY7R
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fgbs3ko6Xix9Ut15onTY7R
SAM_UI's own SAM.Analytical.UI.AnalyticalModelParameter shadows
SAM.Analytical.AnalyticalModelParameter inside SAM.Analytical.UI.WPF, so
the hosted build failed with CS0117 (no WeatherData). Qualified as
Modify/Simulate.cs already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fgbs3ko6Xix9Ut15onTY7R
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fgbs3ko6Xix9Ut15onTY7R
JsonArray.Add(string) binds to the generic Add<T>, whose value cannot be
written with ToJson's JsonSerializerOptions (no TypeInfoResolver), so a
run with any diagnostic threw InvalidOperationException while writing
openstudio-run.json - from a finally on the worker thread, i.e. a real
run with a warning would have failed or crashed SAM_UI. Values are now
added with JsonValue.Create, and the manifest write can no longer
throw. Regression test: a manifest with diagnostics and an error
(fails before, passes after).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fgbs3ko6Xix9Ut15onTY7R
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fgbs3ko6Xix9Ut15onTY7R
@michaldengusiak
michaldengusiak merged commit ec1b18c into sow/2026-Q4 Oct 18, 2026
2 checks passed
@michaldengusiak
michaldengusiak deleted the claude/openstudio-mcp-server-1jmjlo branch October 18, 2026 20:37
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