Skip to content

Scenario workflow: 10. baseline workflow builder - #18

Merged
JieXiong9119 merged 1 commit into
scenario-workflowfrom
scenario-workflow-10-baseline-osw-builder
Nov 5, 2026
Merged

JieXiong9119 merged 1 commit into
scenario-workflowfrom
scenario-workflow-10-baseline-osw-builder

Conversation

@JieXiong9119

Copy link
Copy Markdown

Why do we need this PR

This is PR 10 of the scenario workflow plan. Baseline OSW assembly was mixed into the file-writing code in write_baseline_osw. Moving it into a separate builder lets later scenario PRs reuse the baseline workflow without writing it to disk first.

Core change explanation

  • Added a private BOSS.build_baseline_osw(bsync_reader) that loads the template, runs the eight baseline populators, calls configure_osw, orders measure and file paths (local → gem → external), and returns the OSW hash.
  • write_baseline_osw now validates the XML, builds the reader, calls the builder, and writes baseline/in.osw. Its public API, CLI behavior and output layout are unchanged.
  • run_baseline_osw is unchanged.

Which files are affected

  • lib/BOSS/boss.rb
  • spec/tests/unit/boss_spec.rb
  • docs/scenario_workflow_translation_plan.md

What kind of tests are done

  • New unit tests check that:
    • the workflow steps generated for building_151 and all_measures_applied_example are identical to the pre-refactor output,
    • a missing XML file raises an error,
    • output paths with spaces work,
    • writing the OSW does not start a run,
    • the builder is private and returns a fresh hash on each call,
    • measure and file paths keep their exact order.
  • bundle exec rspec spec/tests/unit: 112 examples, 0 failures.
  • bundle exec rubocop lib/BOSS/boss.rb spec/tests/unit/boss_spec.rb: the only new offense is Metrics/BlockLength on the spec's top-level block.
  • Baseline simulation for building_151 and all_measures_applied_example: both succeeded, all 8 steps completed. I checked the generated models against the source XML; they match apart from defaults used where the XML has no data.
  • Not yet run: the full integration spec (bundle exec rspec spec/tests/integration/write_and_run_osws_spec.rb) and bundle exec rake.

Out of scope / Follow-up work

  • The integration spec always stubs San Francisco weather, so all_measures_applied_example (Denver, climate zone 5B) runs with the wrong weather file. Fix by stubbing weather per fixture.
  • BOSS doesn't map the XML's operating hours to the model's building hours (both runs warn about this). Handle this in input-mapping work.
  • Running the external measures requires rake measures:install_external; without it, the run fails with "Cannot find measure 'replace_baseline_windows'".

@JieXiong9119
JieXiong9119 merged commit 277c0da into scenario-workflow Nov 5, 2026
1 check passed
@JieXiong9119
JieXiong9119 deleted the scenario-workflow-10-baseline-osw-builder branch November 6, 2026 05:10
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