Skip to content

Scenario workflow: 11-12. scenario osw writer - #20

Open
JieXiong9119 wants to merge 1 commit into
scenario-workflowfrom
scenario-workflow-11-12-scenario-osw-writer
Open

JieXiong9119 wants to merge 1 commit into
scenario-workflowfrom
scenario-workflow-11-12-scenario-osw-writer

Conversation

@JieXiong9119

Copy link
Copy Markdown

Why do we need this PR

BOSS only writes baseline/in.osw. This PR also writes one OSW per BuildingSync PackageOfMeasures scenario, which is the core of the scenario workflow roadmap. It combines roadmap PR 11 (writer API) and PR 12 (step assembly), because the writer can't be tested meaningfully without step assembly.

Core change explanation

  • New API: Boss.write_baseline_and_scenario_osws(xml, out, epw, std) writes baseline/in.osw plus scenarios/<scenario_id>/in.osw for each package scenario that has at least one mapped measure.
    • It returns the baseline path, a result for every scenario (:written or :skipped, with the OSW path, skipped measure IDs and warnings) and the parser warnings.
    • write_baseline_osw, run_baseline_osw and the CLI are unchanged.
  • Scenario OSWs: each scenario is a deep copy of the baseline. Mapped steps are inserted before openstudio_results as complete step hashes, so baseline steps are never changed. This includes the baseline SetLightingLoadsByLPD step, which is also the LED mapping target.
  • Step order: scenario_measure_map.json now declares workflow_phases (envelope → internal_loads → hvac_equipment → controls_operations), and every step has a workflow_phase. Mapped steps are stable-sorted by phase, then by package reference order. The mapper validates the phases. Map files without phases still load.
  • Scenario IDs: IDs become folder names, so missing or unsafe IDs (including Windows reserved names) are skipped with structured warnings. IDs that match except for letter case are all skipped.
  • Preflight: if any mapped measure has no measure.rb on the scenario measure_paths, the writer raises before writing anything and tells you to run bundle exec rake measures:install_external.
  • External measures: repo entries in config/external_measure_repos.yml can set an optional scenario_only flag.
    • buildingsync-measures-gem is added, pinned to develop @ c40c2ed. It provides modify_envelope_insulation.
    • Because it is scenario_only, it goes on scenario OSW measure_paths only, never the baseline.

Which files are affected

  • lib/BOSS/boss.rb
  • lib/BOSS/scenario_measure_mapper.rb
  • lib/BOSS/scenario_measure_map.json
  • lib/BOSS/external_measure_repo_manager.rb
  • config/external_measure_repos.yml
  • spec/tests/unit/boss_spec.rb, scenario_measure_mapper_spec.rb, scenario_measure_map_spec.rb, external_measure_repo_manager_spec.rb
  • spec/tests/integration/scenario_osw_generation_spec.rb (new; generates OSWs only and does not simulate)
  • docs/scenario_workflow_translation_plan.md (PR 10 marked Done; PR 11/12 In Progress; handoff notes added)

What kind of tests are done

  • bundle exec rspec spec/tests/unit spec/tests/integration/scenario_osw_generation_spec.rb: 128 examples, 0 failures (after bundle exec rake measures:install_external).
  • Smoke check on building_151.xml with the real installed repos: 12 scenario OSWs written; Scenario4, 5, 6 and 18 skipped (unmapped HVAC and daylighting measures).
  • bundle exec rubocop on changed files: no new offenses beyond spec Metrics/BlockLength and the existing class << self indentation in boss.rb.
  • Scenario simulations not run (PR 14 / PR 18 scope).

Out of scope

  • Running scenario OSWs (PR 14), CLI command (PR 15), README updates (PR 16).
  • Mappings for the deferred HVAC and daylighting measures.

Note for reviewers

CI already runs rake measures:install_external before rspec, so it will now also clone buildingsync-measures-gem. The new integration spec depends on that install.

@JieXiong9119 JieXiong9119 self-assigned this Nov 6, 2026
@JieXiong9119
JieXiong9119 changed the base branch from develop to scenario-workflow November 6, 2026 05:16
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