Skip to content

Phase 1: Unified "Run Simulation" (Tas / OpenStudio / Both) on one frozen snapshot + Tas/OpenStudio comparison report and lightweight view (gate G2) #231

Open

Description

@michaldengusiak

Parent: #227 · Implementation: draft PR #238 (stacked on #237), with SAM-BIM/SAM_Validation#14.

Goal

Give SAM_UI one "Run Simulation" workflow with three choices: Tas only, OpenStudio/EnergyPlus only, or Both: Tas + OpenStudio/EnergyPlus.

For Both:

  • one immutable model and weather snapshot;
  • the engines run one after the other;
  • each engine keeps its own outputs;
  • SAM_Validation's comparison runs automatically when both results are available;
  • a lightweight WPF comparison window opens with the results, diagnostics, input provenance and reports.

The view only presents SAM_Validation's comparison; it adds no new comparison engine. This issue is part of the current end-to-end validation milestone (Phase 1), not Phase 2 parallel execution.

Context / reuse

Scope

A. Unified "Run Simulation" command

A new Simulate > Run Simulation ribbon command opens a small dialog with three choices. Each choice says what it runs and needs, and whether the producers were found:

Choice What runs Outputs Results shown
Tas only The existing Tas Energy Simulation workflow, unchanged (same dialog, same settings and options, same Part O handling; results written to the open model as today). As today (TBD/TSD, model results) As today
OpenStudio/EnergyPlus only #229's OpenStudio run on a frozen copy (snapshot, ToOpenStudio, openstudio.exe). Run folder with snapshot.json, weather.epw, OSM/OSW, run\eplusout.sql, <model>_OpenStudio.json, openstudio-run.json #229's run summary and diagnostics; the open model is not changed
Both: Tas + OpenStudio/EnergyPlus One immutable snapshot and one weather file; benchmark-tas then benchmark-openstudio, one after the other; then SAM_Validation's comparison when both results are available. One run folder: snapshot.json and weather.epw (read-only, hashed), separate tas\ and openstudio\ working folders, benchmark-TAS.json, benchmark-OpenStudio.json, both producer logs, comparison.*, engine-comparison-run.json The comparison window opens on completion

Both: rules

  • Immutable snapshot. snapshot.json and weather.epw are written once and marked read-only. Their SHA-256 is checked before each engine starts and before comparing; a changed file stops the run with a diagnostic. Edits to the open model during the run never reach it.
  • Independent outputs. Each engine writes only to its own working folder, document and log. One engine's failure never deletes or changes the other's outputs.
  • Statuses:
    • Compared: both producers succeeded and SAM_Validation compared the documents.
    • Partially completed: exactly one engine produced a successful B1a document. Its results are kept and shown alone, the failed engine's error and log are shown, and no comparison is made.
    • Failed: neither succeeded.
    • Cancelled.
  • Never manufacture results.
    • A failed engine's metrics are never filled in, estimated or shown as 0.
    • A document whose state is Failure, or from a producer that exited non-zero, is not compared.
    • Not-equivalent (informational) and unit-mismatch metrics are never coloured or counted as passing.
  • Execution order. The engines run one after the other in this milestone. Running them in parallel stays in Phase 2 (Phase 2: SAM_Multitasker assessment and background job-runner design (Tas COM/STA + licence constraints) #234/Phase 2: Parallel Tas + OpenStudio runs from SAM_UI with jobs panel, progress and cancel (gate G4) #235).

Migration: no workflow is removed or broken.

  • Simulate > Energy Simulation (Tas) stays as is. Run Simulation > Tas only calls exactly the same code path.
  • Simulate > OpenStudio Simulation (Phase 1: Minimal OpenStudio/EnergyPlus run from SAM_UI without disrupting Tas (gate G1, first PR) #229) stays. Run Simulation > OpenStudio only calls the same path.
  • Compare Tas / OpenStudio stays as the place to open existing comparison run folders or B1a documents.
  • The tooltips of the existing commands point to Run Simulation. Retiring any of them is a separate, later owner decision.

B. Report

The report is Markdown, CSV and JSON written by SAM_Validation's WriteReports, plus the provenance and assumption sections in the view. It covers:

  • Inputs side by side: SAM vs Tas vs OpenStudio, with units and the tolerance band for each.
  • Results side by side: model level and per space (identified by SAM GUID and name), with units.
  • Simulation assumptions: route, engine versions, design-day source, conditioning pairing, peak definition (OpenStudio coincident vs Tas building-profile maximum), the producers' workflow settings.
  • Metrics missing on either side, each with a reason.
  • Diagnostics: EnergyPlus warning/severe/fatal counts and the head of eplusout.err; Tas warnings; producer exit codes and logs.

C. Lightweight WPF comparison view (Phase 1)

A single window built from standard WPF controls. It opens automatically after Run Simulation > Both, and from Compare Tas / OpenStudio for existing runs.

  1. Run selection and status.
    • Load a comparison run folder or two B1a documents; show each run's model, snapshot hash, weather source and hash, engine version and timestamp.
    • A banner gives the run status: Compared / Partially completed / Failed / Cancelled.
    • It also shows NOT THE SAME INPUTS when SAM_Validation's provenance gate finds mismatches.
  2. Model-level results grid: metric, unit, Tas value, OpenStudio value, absolute difference, percentage difference, band. All values come from ComparisonResult.
  3. Per-space results grid: a space filter (GUID + name, aligned by AlignSpaces) with the same columns. Unmatched spaces are listed with their alignment diagnostic.
  4. Missing, non-equivalent and unavailable metrics are always visible, never hidden as zero:
  5. Input-provenance panel: the provenance gate status and mismatches, snapshot and weather hashes, design-day source, and the input-manifest status per engine (SAM_OpenStudio#30 / Phase 1: Tas input manifest: per-space record of what Tas actually received #230; not available until implemented).
  6. Diagnostics panel:
    • gate statuses and counts; unmatched, duplicate and ambiguous spaces; model-total reconciliation;
    • B1a warnings/notes;
    • each producer's exit code, duration, error and log;
    • for OpenStudio, warning/severe/fatal counts.
  7. Report actions: Open report (comparison.md), Export… (all three files through WriteReports), Open run folder.

The view is read-only: it never changes the open model or any run folder.

Not in Phase 1: charts, time-series plots, dashboards or charting/dashboard frameworks, editing tolerance profiles in the UI, multi-run trend views, parallel engine runs.

Out of scope

Parallel execution (#234/#235); deciding pass/fail for engineering acceptance (#232/#233); any comparison logic outside SAM_Validation; removing existing simulation commands.

Depends on

The view's provenance panel uses the tolerances from #232 / SAM-BIM/SAM#209 once they exist.

Acceptance criteria

  • Run Simulation:
  • Both:
    • Both B1a documents carry the same canonicalModelHash and weather hash, and the provenance gate passes.
    • If one engine fails, the other engine's outputs and B1a document are kept and shown, the status is Partially completed, and no comparison or report pretends otherwise.
    • Running twice on an unchanged model reproduces identical inputs (snapshot and weather hashes) and comparable results.
  • Every metric in the schema is either compared or listed as missing, not equivalent or not reported, with a reason.
  • View:
    • For the same two B1a files, every value, difference, band and availability equals SAM_Validation's comparison.csv, which shows that SAM_UI computes nothing.
    • Missing, non-equivalent and not-compared metrics are never shown as 0 or styled as passing.
    • A provenance mismatch shows the banner.
    • Export writes the three report files.
    • The view never changes the open model or any run folder.
  • The existing Energy Simulation, OpenStudio Simulation and Compare commands still work unchanged.

Validation gate G2

Check Where Result
Unit tests on report assembly from committed B1a fixtures GitHub CI NOT RUN
View model: values, availability labels and bands equal SAM_Validation's output for the committed fixtures (SAM.Analytical.Benchmark.Compare.Tests/Fixtures/Regression/*), including TasOnly / informational rows GitHub CI / local PASS locally (#238); CI pending
Both orchestration with fake producers: one snapshot/weather, immutability check, compare and reports; partial completion when one engine fails; cancel GitHub CI / local to be re-run with this scope in #238
Real Tas only, OpenStudio only and Both runs on cases A and B, viewed in the window and exported Local, licensed Tas + OpenStudio 3.10 NOT RUN

Activity

  1. changed the title [-]Phase 1: Engine comparison run on one frozen snapshot + Tas/OpenStudio comparison report (gate G2)[/-] [+]Phase 1: Engine comparison run on one frozen snapshot + Tas/OpenStudio comparison report and lightweight WPF comparison view (gate G2)[/+] on Oct 17, 2026
  2. changed the title [-]Phase 1: Engine comparison run on one frozen snapshot + Tas/OpenStudio comparison report and lightweight WPF comparison view (gate G2)[/-] [+]Phase 1: Unified "Run Simulation" (Tas / OpenStudio / Both) on one frozen snapshot + Tas/OpenStudio comparison report and lightweight view (gate G2)[/+] on Oct 17, 2026
  3. added a commit that references this issue on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions