Skip to content

Commit

Permalink
Merge branch 'whole_sfa_mf_models_unit_multiplier' into whole_sfa_mf_…
Browse files Browse the repository at this point in the history
…models_unit_multiplier_schedules
  • Loading branch information
joseph-robertson committed Sep 6, 2023
2 parents fced723 + 3858f39 commit 7b84afc
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
7 changes: 7 additions & 0 deletions HPXMLtoOpenStudio/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,13 @@ def prefix_all_unit_model_objects(unit_model, unit_number)
unit_model.objects.each do |model_object|
next if model_object.name.nil?

if unit_number == 0
# OpenStudio is unhappy if these schedules are renamed
next if model_object.name.to_s == unit_model.alwaysOnContinuousSchedule.name.to_s
next if model_object.name.to_s == unit_model.alwaysOnDiscreteSchedule.name.to_s
next if model_object.name.to_s == unit_model.alwaysOffDiscreteSchedule.name.to_s
end

model_object.setName(make_variable_name(model_object.name, unit_number))
end
end
Expand Down
8 changes: 4 additions & 4 deletions HPXMLtoOpenStudio/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>hpxm_lto_openstudio</name>
<uid>b1543b30-9465-45ff-ba04-1d1f85e763bc</uid>
<version_id>fa9fd9a3-f3d1-4b3b-bc24-834fa38b9761</version_id>
<version_modified>2023-09-06T16:28:54Z</version_modified>
<version_id>44a8c879-a715-47b0-9ba3-1198364ac7a7</version_id>
<version_modified>2023-09-06T16:34:24Z</version_modified>
<xml_checksum>D8922A73</xml_checksum>
<class_name>HPXMLtoOpenStudio</class_name>
<display_name>HPXML to OpenStudio Translator</display_name>
Expand Down Expand Up @@ -130,7 +130,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>EB375001</checksum>
<checksum>C67F4C5A</checksum>
</file>
<file>
<filename>airflow.rb</filename>
Expand Down Expand Up @@ -304,7 +304,7 @@
<filename>meta_measure.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>4461180A</checksum>
<checksum>215D8388</checksum>
</file>
<file>
<filename>minitest_helper.rb</filename>
Expand Down
26 changes: 15 additions & 11 deletions HPXMLtoOpenStudio/resources/meta_measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ def run_hpxml_workflow(rundir, measures, measures_dir, debug: false, output_vars

# Remove unused objects automatically added by OpenStudio?
remove_objects = []
# FIXME: Need to revert this code
# if model.alwaysOnContinuousSchedule.directUseCount == 0
# remove_objects << ['Schedule:Constant', model.alwaysOnContinuousSchedule.name.to_s]
# end
# if model.alwaysOnDiscreteSchedule.directUseCount == 0
# remove_objects << ['Schedule:Constant', model.alwaysOnDiscreteSchedule.name.to_s]
# end
# if model.alwaysOffDiscreteSchedule.directUseCount == 0
# remove_objects << ['Schedule:Constant', model.alwaysOffDiscreteSchedule.name.to_s]
# end
if model.alwaysOnContinuousSchedule.directUseCount == 0
remove_objects << ['Schedule:Constant', model.alwaysOnContinuousSchedule.name.to_s]
end
if model.alwaysOnDiscreteSchedule.directUseCount == 0
remove_objects << ['Schedule:Constant', model.alwaysOnDiscreteSchedule.name.to_s]
end
if model.alwaysOffDiscreteSchedule.directUseCount == 0
remove_objects << ['Schedule:Constant', model.alwaysOffDiscreteSchedule.name.to_s]
end
model.getScheduleConstants.each do |sch|
next unless sch.directUseCount == 0

remove_objects << ['Schedule:Constant', sch.name.to_s]
end

# Translate model to workspace
forward_translator = OpenStudio::EnergyPlus::ForwardTranslator.new
Expand All @@ -68,7 +72,7 @@ def run_hpxml_workflow(rundir, measures, measures_dir, debug: false, output_vars
success = report_ft_errors_warnings(forward_translator, rundir)

# Remove objects
remove_objects.each do |remove_object|
remove_objects.uniq.each do |remove_object|
workspace.getObjectByTypeAndName(remove_object[0].to_IddObjectType, remove_object[1]).get.remove
end

Expand Down
4 changes: 2 additions & 2 deletions ReportSimulationOutput/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>report_simulation_output</name>
<uid>df9d170c-c21a-4130-866d-0d46b06073fd</uid>
<version_id>a02eab2d-797b-4fdb-8ce2-1c62205d403a</version_id>
<version_modified>2023-09-06T03:14:40Z</version_modified>
<version_id>388e9ca4-5b27-4cd6-9777-c30e7a1bda0c</version_id>
<version_modified>2023-09-06T15:44:36Z</version_modified>
<xml_checksum>9BF1E6AC</xml_checksum>
<class_name>ReportSimulationOutput</class_name>
<display_name>HPXML Simulation Output Report</display_name>
Expand Down
3 changes: 1 addition & 2 deletions workflow/tests/hpxml_translator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,7 @@ def _verify_outputs(rundir, hpxml_path, results, hpxml_header, hpxml_bldg, unit_
end
end
assert_equal(0, num_unused_objects)
# FIXME: Revert once the meta_measure.rb code is reverted
# assert_equal(0, num_unused_schedules)
assert_equal(0, num_unused_schedules)
assert_equal(0, num_unused_constructions)

# Check for Output:Meter and Output:Variable warnings
Expand Down

0 comments on commit 7b84afc

Please sign in to comment.