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

Run run_analysis in parallel #1230

Merged
merged 17 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Features
- Update the stochastic schedule generator to produce updated other/TV plug load and ceiling fan schedules ([#1220](https://github.com/NREL/resstock/pull/1220))
- Update to new OS-HPXML defaults for duct insulation; 25% rectangular supply ducts and 100% rectangular return ducts (previously 100% round supply/return ducts) ([#1233](https://github.com/NREL/resstock/pull/1233))
- Update to OpenStudio v3.8.0 ([#1225](https://github.com/NREL/resstock/pull/1225))
- Introduce a new optional `buildstock_csv_path` argument that supports parallel resstock runs using `run_analysis.rb` ([#1230](https://github.com/NREL/resstock/pull/1230))

Fixes
- Remove old HPWH options from options_lookup ([#1190](https://github.com/NREL/resstock/pull/1190))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ started_at,Simulation start time.
completed_at,Simulation end time.
completed_status,"Simulation Success, Fail, or Invalid."
build_existing_model.applicable,The measure was applied to the workflow.
build_existing_model.buildstock_csv_path,Absolute/relative path of the buildstock CSV file. Relative is compared to the 'lib/housing_characteristics' directory.
build_existing_model.sample_weight,Number of buildings this simulation represents.
build_existing_model.units_represented,The number of dwelling units this simulation represents. Should always be one.
build_existing_model.emissions_electricity_folders,"Relative paths of electricity emissions factor schedule files with hourly values. Paths are relative to the resources folder. If multiple scenarios, use a comma-separated list. File names must contain GEA region names."
Expand Down
11 changes: 11 additions & 0 deletions measures/BuildExistingModel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ Builds the OpenStudio Model using the sampling csv file, which contains the spec
## Arguments


**Buildstock CSV File Path**

Absolute/relative path of the buildstock CSV file. Relative is compared to the 'lib/housing_characteristics' directory.

- **Name:** ``buildstock_csv_path``
- **Type:** ``String``

- **Required:** ``false``

<br/>

**Building Unit ID**

The building unit number (between 1 and the number of samples).
Expand Down
13 changes: 12 additions & 1 deletion measures/BuildExistingModel/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# http://nrel.github.io/OpenStudio-user-documentation/reference/measure_writing_guide/

require 'openstudio'
require 'pathname'
require_relative '../../resources/hpxml-measures/HPXMLtoOpenStudio/resources/meta_measure'

# in addition to the above requires, this measure is expected to run in an
Expand All @@ -30,6 +31,12 @@ def modeler_description
def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args = OpenStudio::Measure::OSArgumentVector.new

arg = OpenStudio::Measure::OSArgument.makeStringArgument('buildstock_csv_path', false)
arg.setDefaultValue('buildstock.csv')
arg.setDisplayName('Buildstock CSV File Path')
arg.setDescription("Absolute/relative path of the buildstock CSV file. Relative is compared to the 'lib/housing_characteristics' directory.")
args << arg

arg = OpenStudio::Measure::OSArgument.makeIntegerArgument('building_id', true)
arg.setDisplayName('Building Unit ID')
arg.setDescription('The building unit number (between 1 and the number of samples).')
Expand Down Expand Up @@ -238,7 +245,11 @@ def run(model, runner, user_arguments)
measures_dir = File.join(File.dirname(__FILE__), '../../measures')
hpxml_measures_dir = File.join(File.dirname(__FILE__), '../../resources/hpxml-measures')
lookup_file = File.join(resources_dir, 'options_lookup.tsv')
buildstock_csv_path = File.absolute_path(File.join(characteristics_dir, 'buildstock.csv')) # Should have been generated by the Worker Initialization Script (run_sampling.rb) or provided by the project

buildstock_csv_path = args[:buildstock_csv_path]
unless (Pathname.new buildstock_csv_path).absolute?
buildstock_csv_path = File.absolute_path(File.join(characteristics_dir, buildstock_csv_path))
end

if not args[:os_hescore_directory].nil?
os_hescore_directory = args[:os_hescore_directory]
Expand Down
17 changes: 13 additions & 4 deletions measures/BuildExistingModel/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@
<schema_version>3.1</schema_version>
<name>build_existing_model</name>
<uid>dedf59bb-3b88-4f16-8755-2c1ff5519cbf</uid>
<version_id>cd41a0d4-10df-49fa-bd4b-7a4e393f198b</version_id>
<version_modified>2024-05-07T20:17:04Z</version_modified>
<version_id>744949f6-b7ea-42ed-8d88-6b4efe99de5c</version_id>
<version_modified>2024-05-16T19:37:41Z</version_modified>
<xml_checksum>2C38F48B</xml_checksum>
<class_name>BuildExistingModel</class_name>
<display_name>Build Existing Model</display_name>
<description>Builds the OpenStudio Model for an existing building.</description>
<modeler_description>Builds the OpenStudio Model using the sampling csv file, which contains the specified parameters for each existing building. Based on the supplied building number, those parameters are used to run the OpenStudio measures with appropriate arguments and build up the OpenStudio model.</modeler_description>
<arguments>
<argument>
<name>buildstock_csv_path</name>
<display_name>Buildstock CSV File Path</display_name>
<description>Absolute/relative path of the buildstock CSV file. Relative is compared to the 'lib/housing_characteristics' directory.</description>
<type>String</type>
<required>false</required>
<model_dependent>false</model_dependent>
<default_value>buildstock.csv</default_value>
</argument>
<argument>
<name>building_id</name>
<display_name>Building Unit ID</display_name>
Expand Down Expand Up @@ -323,7 +332,7 @@
<filename>README.md</filename>
<filetype>md</filetype>
<usage_type>readme</usage_type>
<checksum>3B1D5629</checksum>
<checksum>52F0E677</checksum>
</file>
<file>
<filename>README.md.erb</filename>
Expand All @@ -340,7 +349,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>50818B89</checksum>
<checksum>B302DB7E</checksum>
</file>
</files>
</measure>
10 changes: 2 additions & 8 deletions measures/UpgradeCosts/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.1</schema_version>
<name>upgrade_costs</name>
<uid>ef51212c-acc4-48d7-9b29-cf2a5c6c4449</uid>
<version_id>6610ed99-de5c-4dfd-909c-73e985f0e234</version_id>
<version_modified>2024-05-08T20:02:12Z</version_modified>
<version_id>9634dc0a-f7ef-4ecd-af52-dd8f09a7ba21</version_id>
<version_modified>2024-05-16T18:30:06Z</version_modified>
<xml_checksum>9BF1E6AC</xml_checksum>
<class_name>UpgradeCosts</class_name>
<display_name>Upgrade Costs</display_name>
Expand Down Expand Up @@ -161,12 +161,6 @@
<usage_type>test</usage_type>
<checksum>3472996A</checksum>
</file>
<file>
<filename>SFD_2story_CS_UA_AC2_FuelBoiler_FuelTankWH.xml</filename>
<filetype>xml</filetype>
<usage_type>test</usage_type>
<checksum>DED12E0D</checksum>
</file>
<file>
<filename>SFD_2story_CS_UA_GRG_ASHPV_FuelTanklessWH.osw</filename>
<filetype>osw</filetype>
Expand Down
1 change: 1 addition & 0 deletions resources/data/dictionary/inputs.csv
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ started_at,Simulation start time.
completed_at,Simulation end time.
completed_status,"Simulation Success, Fail, or Invalid."
build_existing_model.applicable,The measure was applied to the workflow.
build_existing_model.buildstock_csv_path,"Absolute/relative path of the buildstock CSV file. Relative is compared to the 'lib/housing_characteristics' directory."
build_existing_model.sample_weight,Number of buildings this simulation represents.
build_existing_model.units_represented,The number of dwelling units this simulation represents. Should always be one.
build_existing_model.emissions_electricity_folders,"Relative paths of electricity emissions factor schedule files with hourly values. Paths are relative to the resources folder. If multiple scenarios, use a comma-separated list. File names must contain GEA region names."
Expand Down
1 change: 0 additions & 1 deletion tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def display_usage(command_list)
'Lint/UselessAssignment',
'Style/AndOr',
'Style/FrozenStringLiteralComment',
'Style/HashSyntax',
'Style/Next',
'Style/NilComparison',
'Style/RedundantParentheses',
Expand Down
Loading