Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow simulating whole SFA/MF buildings: SchedulesFilePath for each building #1478

Conversation

joseph-robertson
Copy link
Collaborator

@joseph-robertson joseph-robertson commented Sep 5, 2023

Pull Request Description

Instead of storing this on header SoftwareInfo/extension/SchedulesFilePath, this PR allows for different sets of schedules across units of a building by storing on Building/BuildingDetails/BuildingSummary/extension/SchedulesFilePath. Therefore, SoftwareInfo/extension/SchedulesFilePath is deprecated.

Checklist

PR Author: Check these when they're done. Not all may apply. strikethrough and check any that do not apply.

PR Reviewer: Verify each has been completed.

  • Schematron validator (EPvalidator.xml) has been updated
  • Sample files have been added/updated (via tasks.rb)
  • Tests have been added/updated (e.g., HPXMLtoOpenStudio/tests and/or workflow/tests/hpxml_translator_test.rb)
  • Documentation has been updated
  • Changelog has been updated
  • openstudio tasks.rb update_measures has been run
  • No unexpected changes to simulation results of sample files

@joseph-robertson joseph-robertson self-assigned this Sep 5, 2023
@shorowit
Copy link
Contributor

shorowit commented Sep 6, 2023

I think we should add the same Building ID argument as the HPXMLtoOS measure:

arg = OpenStudio::Measure::OSArgument.makeStringArgument('building_id', false)
arg.setDisplayName('BuildingID')
arg.setDescription("The ID of the HPXML Building. Only required if there are multiple Building elements in the HPXML file. Use 'ALL' to run all the HPXML Buildings (dwelling units) of a multifamily building in a single model.")
args << arg

If the HPXML has multiple buildings and a single Building ID is specified, only create schedules for that one dwelling unit. If the HPXML has multiple buildings and 'ALL' is specified, create unique schedules for each dwelling unit where the random seed is multiplied by the building index (1..n), which ensures that the results are deterministic.

"Do we want to continue to support SchedulesFilePath at the header level SoftwareInfo/extension?" Ideally yes, so that it's not a breaking change for software tools.

@joseph-robertson joseph-robertson marked this pull request as ready for review September 19, 2023 23:43
BuildResidentialHPXML/measure.rb Outdated Show resolved Hide resolved
BuildResidentialScheduleFile/measure.rb Show resolved Hide resolved
BuildResidentialScheduleFile/measure.rb Show resolved Hide resolved
BuildResidentialScheduleFile/measure.rb Outdated Show resolved Hide resolved
HPXMLtoOpenStudio/measure.rb Show resolved Hide resolved
HPXMLtoOpenStudio/tests/test_validation.rb Outdated Show resolved Hide resolved
docs/source/workflow_inputs.rst Outdated Show resolved Hide resolved
tasks.rb Outdated
Comment on lines 232 to 235
# Logic that can only be applied based on file name
if ['base-schedules-detailed-occupancy-stochastic-hpxml-header.xml'].include? hpxml_file
hpxml.header.schedules_filepaths << '../../HPXMLtoOpenStudio/resources/schedule_files/occupancy-stochastic.csv'
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Demonstrate backward compatibility.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you make the change I proposed where the BuildResSchedule measure sometimes writes to the HPXML Header and sometimes to the Building Header, I assume we can remove this new HPXML sample file as we'd end up testing both pathways through our existing sample files.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, it feels like we're missing a sample file where we actually vary the schedules across the HPXML buildings. How about creating a new base-multiple-buildings-detailed-occupancy-stochastic.xml based on base-multiple-buildings.xml?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, I'm realizing that the problem with your first comment here is that tasks.rb uses BuildResidentialHPXML to first create the HPXML (with SchedulesFilePath at building header) and then uses BuildResidentialScheduleFile to re-write the HPXML file (with SchedulesFilePath at the HPXML header)...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I suppose I can make a similar change to BuildResidentialHPXML?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ugh, even then it gets complicated. You'd have to "move" a schedule from HPXML header to building header when going from 1 building to 2 buildings using BuildResidentialHPXML...

Copy link
Contributor

Choose a reason for hiding this comment

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

When we create sample files, there's no need to specify a schedule file path to BuildResidentialHPXML if we are going to use BuildResidentialScheduleFile to create the schedules (and add the path), no? Or maybe I'm not following.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But tasks.rb uses the schedules_filepaths argument to queue up running BuildResidentialScheduleFile. Even so, (it's not in this PR) but say you had an HPXML file with a single building (and SchedulesFilePath is in the HPXML header). If you went to add a building to the HPXML file, then you're assuming the existing schedule file applies to the second building?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'd propose we save addressing this in #1457.

Copy link
Contributor

@shorowit shorowit left a comment

Choose a reason for hiding this comment

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

Good stuff, @joseph-robertson, this is pretty close. A few comments/suggestions below.

BuildResidentialHPXML/measure.rb Outdated Show resolved Hide resolved
BuildResidentialScheduleFile/measure.rb Outdated Show resolved Hide resolved
BuildResidentialScheduleFile/measure.rb Outdated Show resolved Hide resolved
BuildResidentialScheduleFile/measure.rb Show resolved Hide resolved
HPXMLtoOpenStudio/measure.rb Show resolved Hide resolved
tasks.rb Outdated
Comment on lines 232 to 235
# Logic that can only be applied based on file name
if ['base-schedules-detailed-occupancy-stochastic-hpxml-header.xml'].include? hpxml_file
hpxml.header.schedules_filepaths << '../../HPXMLtoOpenStudio/resources/schedule_files/occupancy-stochastic.csv'
end
Copy link
Contributor

Choose a reason for hiding this comment

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

If you make the change I proposed where the BuildResSchedule measure sometimes writes to the HPXML Header and sometimes to the Building Header, I assume we can remove this new HPXML sample file as we'd end up testing both pathways through our existing sample files.

tasks.rb Outdated
Comment on lines 232 to 235
# Logic that can only be applied based on file name
if ['base-schedules-detailed-occupancy-stochastic-hpxml-header.xml'].include? hpxml_file
hpxml.header.schedules_filepaths << '../../HPXMLtoOpenStudio/resources/schedule_files/occupancy-stochastic.csv'
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, it feels like we're missing a sample file where we actually vary the schedules across the HPXML buildings. How about creating a new base-multiple-buildings-detailed-occupancy-stochastic.xml based on base-multiple-buildings.xml?

Copy link
Contributor

@shorowit shorowit left a comment

Choose a reason for hiding this comment

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

This looks good. I'll merge when the CI comes back happy.

@shorowit shorowit merged commit 36c3b08 into whole_sfa_mf_models_unit_multiplier Sep 21, 2023
5 checks passed
@shorowit shorowit deleted the whole_sfa_mf_models_unit_multiplier_schedules branch September 21, 2023 21:57
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