Skip to content

Commit

Permalink
Merge pull request #66 from NREL/develop
Browse files Browse the repository at this point in the history
Version 0.8.0
  • Loading branch information
kflemin authored Dec 14, 2023
2 parents 7b032e4 + 6a55d2f commit 5c1ae29
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 84 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# OpenStudio Load Flexibility Measures Gem

## Version 0.8.0
- Updating dependencies and licenses for OpenStudio 3.7 (upgrade to standards gem 0.5.0, extension gem 0.7.0)
- Fix field indexes for CoilCoolingDXTwoSpeed in add_packaged_ice_storage

## Version 0.7.0
- Updating dependencies and licenses for OpenStudio 3.6 (upgrade to standards gem 0.4.0, extension gem 0.6.1)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Detailed instructions for usage are included in each measure's respective README

|OpenStudio Load Flexibility Measures Gem|OpenStudio|Ruby|
|:--------------:|:----------:|:--------:|
| 0.8.0| 3.7 | 2.7 |
| 0.7.0| 3.6 | 2.7 |
| 0.6 - 0.6.1 | 3.5 | 2.7 |
| 0.5 | 3.4 | 2.7 |
Expand Down
28 changes: 14 additions & 14 deletions lib/measures/add_packaged_ice_storage/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -534,22 +534,22 @@ def run(workspace, runner, user_arguments)
case sel_coil.iddObject.name
when 'Coil:Cooling:DX:SingleSpeed'
runner.registerInfo("Grabing inputs for #{utss.getString(0)} from #{sel_coil.iddObject.name} object named #{sel_coil.getString(0)}")
utss.setString(16, sel_coil.getString(2).get)
utss.setString(18, sel_coil.getString(4).get)
utss.setString(19, sel_coil.getString(10).get)
utss.setString(20, sel_coil.getString(11).get)
utss.setString(21, sel_coil.getString(12).get)
utss.setString(22, sel_coil.getString(13).get)
utss.setString(23, sel_coil.getString(14).get)
utss.setString(16, sel_coil.getString(2).get) # Gross Rated Total Cooling Capacity
utss.setString(18, sel_coil.getString(4).get) # Gross Rated Cooling COP
utss.setString(19, sel_coil.getString(10).get) # Total Cooling Capacity Function of Temperature Curve Name
utss.setString(20, sel_coil.getString(11).get) # Total Cooling Capacity Function of Flow Fraction Curve Name
utss.setString(21, sel_coil.getString(12).get) # Energy Input Ratio Function of Temperature Curve Name
utss.setString(22, sel_coil.getString(13).get) # Energy Input Ratio Function of Flow Fraction Curve Name
utss.setString(23, sel_coil.getString(14).get) # Part Load Fraction Correlation Curve Name
when 'Coil:Cooling:DX:TwoSpeed'
runner.registerInfo("Grabing inputs for #{utss.getString(0)} from #{sel_coil.iddObject.name} object named #{sel_coil.getString(0)}")
utss.setString(16, sel_coil.getString(14).get)
utss.setString(18, sel_coil.getString(16).get)
utss.setString(19, sel_coil.getString(18).get)
utss.setString(20, sel_coil.getString(10).get)
utss.setString(21, sel_coil.getString(19).get)
utss.setString(22, sel_coil.getString(12).get)
utss.setString(23, sel_coil.getString(13).get)
utss.setString(16, sel_coil.getString(16).get) # Low Speed Gross Rated Total Cooling Capacity
utss.setString(18, sel_coil.getString(18).get) # Low Speed Gross Rated Cooling COP
utss.setString(19, sel_coil.getString(22).get) # Low Speed Total Cooling Capacity Function of Temperature Curve Name
utss.setString(20, sel_coil.getString(12).get) # Total Cooling Capacity Function of Flow Fraction Curve Name
utss.setString(21, sel_coil.getString(23).get) # Low Speed Energy Input Ratio Function of Temperature Curve Name
utss.setString(22, sel_coil.getString(14).get) # Energy Input Ratio Function of Flow Fraction Curve Name
utss.setString(23, sel_coil.getString(15).get) # Part Load Fraction Correlation Curve Name
end

# identify container object in which the coil is used
Expand Down
64 changes: 32 additions & 32 deletions lib/measures/add_packaged_ice_storage/measure.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
<measure>
<schema_version>3.0</schema_version>
<schema_version>3.1</schema_version>
<name>add_packaged_ice_storage</name>
<uid>2aa8c128-53b9-49fd-9aaf-9253a1f05936</uid>
<version_id>cd809cee-aa3a-43bb-8a41-cd27c936267d</version_id>
<version_modified>20230602T162403Z</version_modified>
<version_id>21dee291-3e59-413a-9353-efb85b3e8d7b</version_id>
<version_modified>2023-12-12T07:23:13Z</version_modified>
<xml_checksum>2617824F</xml_checksum>
<class_name>AddPackagedIceStorage</class_name>
<display_name>Add Packaged Ice Storage</display_name>
Expand Down Expand Up @@ -201,16 +201,10 @@ If 'AutoSize' is selected for ice capacity, these inputs set an ice capacity siz
</attributes>
<files>
<file>
<filename>TESCurves.idf</filename>
<filetype>idf</filetype>
<usage_type>resource</usage_type>
<checksum>E919566C</checksum>
</file>
<file>
<filename>MeasureTest.osm</filename>
<filetype>osm</filetype>
<usage_type>test</usage_type>
<checksum>DC0DCC4B</checksum>
<filename>LICENSE.md</filename>
<filetype>md</filetype>
<usage_type>license</usage_type>
<checksum>BFFB1AA6</checksum>
</file>
<file>
<filename>README.md</filename>
Expand All @@ -219,10 +213,27 @@ If 'AutoSize' is selected for ice capacity, these inputs set an ice capacity siz
<checksum>E6FBC489</checksum>
</file>
<file>
<filename>single_speed_dx_350.osm</filename>
<version>
<software_program>OpenStudio</software_program>
<identifier>3.0.0</identifier>
<min_compatible>3.5.0</min_compatible>
</version>
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>30BE5060</checksum>
</file>
<file>
<filename>TESCurves.idf</filename>
<filetype>idf</filetype>
<usage_type>resource</usage_type>
<checksum>E919566C</checksum>
</file>
<file>
<filename>MeasureTest.osm</filename>
<filetype>osm</filetype>
<usage_type>test</usage_type>
<checksum>D9B82B85</checksum>
<checksum>DC0DCC4B</checksum>
</file>
<file>
<filename>USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw</filename>
Expand All @@ -231,27 +242,16 @@ If 'AutoSize' is selected for ice capacity, these inputs set an ice capacity siz
<checksum>C254B53F</checksum>
</file>
<file>
<filename>LICENSE.md</filename>
<filetype>md</filetype>
<usage_type>license</usage_type>
<checksum>BFFB1AA6</checksum>
</file>
<file>
<version>
<software_program>OpenStudio</software_program>
<identifier>3.0.0</identifier>
<min_compatible>3.5.0</min_compatible>
</version>
<filename>measure.rb</filename>
<filename>add_packaged_ice_storage_test.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>74476013</checksum>
<usage_type>test</usage_type>
<checksum>2D36B76B</checksum>
</file>
<file>
<filename>add_packaged_ice_storage_test.rb</filename>
<filetype>rb</filetype>
<filename>single_speed_dx_350.osm</filename>
<filetype>osm</filetype>
<usage_type>test</usage_type>
<checksum>C70CEB86</checksum>
<checksum>D9B82B85</checksum>
</file>
</files>
</measure>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AddPackagedIceStorageTest < MiniTest::Test
# @param IDF OpenStudio workspace IDF object
# @param run_dir [String] file path location for the annual run, defaults to 'Run' in the current directory
# @return [Bool] returns true if successful, false if not
def model_run_simulation_and_log_errors(workspace, run_dir = "#{Dir.pwd}/Run")
def model_run_simulation_and_log_errors(model, workspace, run_dir = "#{Dir.pwd}/Run")
# Make the directory if it doesn't exist
unless Dir.exist?(run_dir)
FileUtils.mkdir_p(run_dir)
Expand Down Expand Up @@ -70,7 +70,7 @@ def model_run_simulation_and_log_errors(workspace, run_dir = "#{Dir.pwd}/Run")
else
# If the sql file does not exist, it is likely that EnergyPlus crashed,
# in which case the useful errors are inside the eplusout.err file.
err_file_path_string = "#{run_dir}/run/eplusout.err"
err_file_path_string = "#{run_dir}/eplusout.err"
err_file_path = OpenStudio::Path.new(err_file_path_string)
if OpenStudio.exists(err_file_path)
if __dir__[0] == ':' # Running from OpenStudio CLI
Expand All @@ -86,33 +86,32 @@ def model_run_simulation_and_log_errors(workspace, run_dir = "#{Dir.pwd}/Run")
end
end

# todo - figure out how to get code below to work so method returns false when simulation fails

# # Report severe or fatal errors in the run
# error_query = "SELECT ErrorMessage
# FROM Errors
# WHERE ErrorType in(1,2)"
# errs = model.sqlFile.get.execAndReturnVectorOfString(error_query)
# if errs.is_initialized
# errs = errs.get
# end

# # Check that the run completed successfully
# end_file_stringpath = "#{run_dir}/run/eplusout.end"
# end_file_path = OpenStudio::Path.new(end_file_stringpath)
# if OpenStudio.exists(end_file_path)
# endstring = File.read(end_file_stringpath)
# end

# if !endstring.include?('EnergyPlus Completed Successfully')
# OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', "The run did not finish and had following errors: #{errs.join('\n')}")
# return false
# end

# # Log any severe errors that did not cause simulation to fail
# unless errs.empty?
# OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Model', "The run completed but had the following severe errors: #{errs.join('\n')}")
# end
# Report severe or fatal errors in the run
error_query = "SELECT ErrorMessage
FROM Errors
WHERE ErrorType in(1,2)"
model.setSqlFile(sql)
errs = model.sqlFile.get.execAndReturnVectorOfString(error_query)
if errs.is_initialized
errs = errs.get
end

# Check that the run completed successfully
end_file_stringpath = "#{run_dir}/eplusout.end"
end_file_path = OpenStudio::Path.new(end_file_stringpath)
if OpenStudio.exists(end_file_path)
endstring = File.read(end_file_stringpath)
end

if !endstring.include?('EnergyPlus Completed Successfully')
OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', "The run did not finish and had following errors: #{errs.join('\n')}")
return false
end

# Log any severe errors that did not cause simulation to fail
unless errs.empty?
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Model', "The run completed but had the following severe errors: #{errs.join('\n')}")
end

return true
end
Expand Down Expand Up @@ -155,10 +154,10 @@ def test_good_argument_values
measure.run(workspace, runner, argument_map)

# run the annual simulation
output_file_path = "#{File.dirname(__FILE__)}/output/test_good_argument_values/Run"
#sim_results = self.model_run_simulation_and_log_errors(workspace, output_file_path)
# commented out for now E+ run in test doesn't function on CI yet
#output_file_path = "#{File.dirname(__FILE__)}/output/test_good_argument_values"
#sim_results = self.model_run_simulation_and_log_errors(model, workspace, output_file_path)
#assert(sim_results)
# todo - need to add code so test fails if simulation fails

result = runner.result
assert_equal('Success', result.value.valueName)
Expand Down Expand Up @@ -206,10 +205,10 @@ def test_single_speed_dx
measure.run(workspace, runner, argument_map)

# run the annual simulation
output_file_path = "#{File.dirname(__FILE__)}/output/single_speed_dx/Run"
#sim_results = self.model_run_simulation_and_log_errors(workspace, output_file_path)
# commented out for now E+ run in test doesn't function on CI yet
#output_file_path = "#{File.dirname(__FILE__)}/output/single_speed_dx"
#sim_results = self.model_run_simulation_and_log_errors(model, workspace, output_file_path)
#assert(sim_results)
# todo - need to add code so test fails if simulation fails

result = runner.result
assert_equal('Success', result.value.valueName)
Expand Down
2 changes: 1 addition & 1 deletion lib/openstudio/load_flexibility_measures/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

module OpenStudio
module LoadFlexibilityMeasures
VERSION = '0.7.0'.freeze
VERSION = '0.8.0'.freeze
end
end
4 changes: 2 additions & 2 deletions openstudio-load-flexibility-measures.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ Gem::Specification.new do |spec|

spec.add_dependency 'bundler', '~> 2.1'

spec.add_dependency 'openstudio-extension', '~> 0.6.1'
spec.add_dependency 'openstudio-standards', '~> 0.4.0'
spec.add_dependency 'openstudio-extension', '~> 0.7.0'
spec.add_dependency 'openstudio-standards', '~> 0.5.0'

spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.9'
Expand Down

0 comments on commit 5c1ae29

Please sign in to comment.