honeybee-openstudio 2.33.6 → 2.33.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/honeybee-openstudio.gemspec +1 -1
 - data/lib/measures/from_honeybee_model/measure.rb +45 -1
 - data/lib/to_openstudio/model.rb +7 -4
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 851a084f0894099724dc078d840065a7cdc937cb35b95cbce8987531ad3d0832
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: bbc0285689ba78e3edaaa00bab9ec0124cd61b99e505ea95a530c5b98ce56703
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 0ee011f3f35beed0b80fc15ee4108c9516806b93db9ca0b6f5c188a943ff62571271f384281ec5b2746dfb19696eea84488a68e71a2df660094d90988f1b15b2
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9fbb52f03d60d499b035ff0a639304d1b4e478724c20152b9c72defbddff004664729254260af1215d2825b2660b96ee06faeceeca2b8a0358791fbf93e71652
         
     | 
    
        data/honeybee-openstudio.gemspec
    CHANGED
    
    | 
         @@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            Gem::Specification.new do |spec|
         
     | 
| 
       6 
6 
     | 
    
         
             
              spec.name          = 'honeybee-openstudio'
         
     | 
| 
       7 
     | 
    
         
            -
              spec.version       = '2.33. 
     | 
| 
      
 7 
     | 
    
         
            +
              spec.version       = '2.33.7'
         
     | 
| 
       8 
8 
     | 
    
         
             
              spec.authors       = ['Tanushree Charan', 'Dan Macumber', 'Chris Mackey', 'Mostapha Sadeghipour Roudsari']
         
     | 
| 
       9 
9 
     | 
    
         
             
              spec.email         = ['tanushree.charan@nrel.gov', 'chris@ladybug.tools']
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
         @@ -36,6 +36,7 @@ require 'to_openstudio' 
     | 
|
| 
       36 
36 
     | 
    
         | 
| 
       37 
37 
     | 
    
         
             
            require 'fileutils'
         
     | 
| 
       38 
38 
     | 
    
         
             
            require 'pathname'
         
     | 
| 
      
 39 
     | 
    
         
            +
            require 'json'
         
     | 
| 
       39 
40 
     | 
    
         | 
| 
       40 
41 
     | 
    
         
             
            # start the measure
         
     | 
| 
       41 
42 
     | 
    
         
             
            class FromHoneybeeModel < OpenStudio::Measure::ModelMeasure
         
     | 
| 
         @@ -87,17 +88,19 @@ class FromHoneybeeModel < OpenStudio::Measure::ModelMeasure 
     | 
|
| 
       87 
88 
     | 
    
         
             
                  return false
         
     | 
| 
       88 
89 
     | 
    
         
             
                end
         
     | 
| 
       89 
90 
     | 
    
         | 
| 
      
 91 
     | 
    
         
            +
                # get the input arguments
         
     | 
| 
       90 
92 
     | 
    
         
             
                model_json = runner.getStringArgumentValue('model_json', user_arguments)
         
     | 
| 
       91 
93 
     | 
    
         
             
                schedule_csv_dir = runner.getStringArgumentValue('schedule_csv_dir', user_arguments)
         
     | 
| 
       92 
94 
     | 
    
         
             
                include_datetimes = runner.getBoolArgumentValue('include_datetimes', user_arguments)
         
     | 
| 
       93 
95 
     | 
    
         | 
| 
      
 96 
     | 
    
         
            +
                # load the HBJSON file
         
     | 
| 
       94 
97 
     | 
    
         
             
                if !File.exist?(model_json)
         
     | 
| 
       95 
98 
     | 
    
         
             
                  runner.registerError("Cannot find file '#{model_json}'")
         
     | 
| 
       96 
99 
     | 
    
         
             
                  return false
         
     | 
| 
       97 
100 
     | 
    
         
             
                end
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
101 
     | 
    
         
             
                honeybee_model = Honeybee::Model.read_from_disk(model_json)
         
     | 
| 
       100 
102 
     | 
    
         | 
| 
      
 103 
     | 
    
         
            +
                # setup the schedule directory
         
     | 
| 
       101 
104 
     | 
    
         
             
                if schedule_csv_dir && !schedule_csv_dir.empty?
         
     | 
| 
       102 
105 
     | 
    
         
             
                  schedule_csv_dir = Pathname.new(schedule_csv_dir).cleanpath
         
     | 
| 
       103 
106 
     | 
    
         
             
                  if !Dir.exist?(schedule_csv_dir)
         
     | 
| 
         @@ -107,11 +110,52 @@ class FromHoneybeeModel < OpenStudio::Measure::ModelMeasure 
     | 
|
| 
       107 
110 
     | 
    
         
             
                  honeybee_model.set_schedule_csv_dir(schedule_csv_dir, include_datetimes)
         
     | 
| 
       108 
111 
     | 
    
         
             
                end
         
     | 
| 
       109 
112 
     | 
    
         | 
| 
      
 113 
     | 
    
         
            +
                # translate the Honeybee Model to OSM
         
     | 
| 
       110 
114 
     | 
    
         
             
                STDOUT.flush
         
     | 
| 
       111 
115 
     | 
    
         
             
                honeybee_model.to_openstudio_model(model)
         
     | 
| 
       112 
116 
     | 
    
         
             
                STDOUT.flush
         
     | 
| 
       113 
117 
     | 
    
         | 
| 
      
 118 
     | 
    
         
            +
                # if there are any detailed HVACs, incorproate them into the OSM
         
     | 
| 
       114 
119 
     | 
    
         
             
                generated_files_dir = "#{runner.workflow.absoluteRootDir}/generated_files"
         
     | 
| 
      
 120 
     | 
    
         
            +
                unless $detailed_hvac_hash.nil? || $detailed_hvac_hash.empty?
         
     | 
| 
      
 121 
     | 
    
         
            +
                  runner.registerInfo("Translating Detailed HVAC systems in '#{generated_files_dir}'")
         
     | 
| 
      
 122 
     | 
    
         
            +
                  if $ironbug_exe.nil?
         
     | 
| 
      
 123 
     | 
    
         
            +
                    runner.registerError("No Ironbug installation was found on the system.")
         
     | 
| 
      
 124 
     | 
    
         
            +
                  end
         
     | 
| 
      
 125 
     | 
    
         
            +
                  FileUtils.mkdir_p(generated_files_dir)
         
     | 
| 
      
 126 
     | 
    
         
            +
                  $detailed_hvac_hash.each do |hvac_id, hvac_spec|
         
     | 
| 
      
 127 
     | 
    
         
            +
                    # write the JSON and OSM files
         
     | 
| 
      
 128 
     | 
    
         
            +
                    hvac_json_path = generated_files_dir + '/' + hvac_id + '.json'
         
     | 
| 
      
 129 
     | 
    
         
            +
                    osm_path = generated_files_dir + '/' + hvac_id + '.osm'
         
     | 
| 
      
 130 
     | 
    
         
            +
                    File.open(hvac_json_path, 'w') do |f|
         
     | 
| 
      
 131 
     | 
    
         
            +
                      f.write(hvac_spec.to_json)
         
     | 
| 
      
 132 
     | 
    
         
            +
                    end
         
     | 
| 
      
 133 
     | 
    
         
            +
                    model.save(osm_path, true)
         
     | 
| 
      
 134 
     | 
    
         
            +
                    # call the Ironbug console to add the HVAC to the OSM
         
     | 
| 
      
 135 
     | 
    
         
            +
                    ironbug_exe = '"' + $ironbug_exe + '"'
         
     | 
| 
      
 136 
     | 
    
         
            +
                    system(ironbug_exe + ' "' + osm_path + '" "' + hvac_json_path + '"')
         
     | 
| 
      
 137 
     | 
    
         
            +
                    # load the new model
         
     | 
| 
      
 138 
     | 
    
         
            +
                    translator = OpenStudio::OSVersion::VersionTranslator.new
         
     | 
| 
      
 139 
     | 
    
         
            +
                    o_model = translator.loadModel(osm_path)
         
     | 
| 
      
 140 
     | 
    
         
            +
                    if o_model.empty?
         
     | 
| 
      
 141 
     | 
    
         
            +
                      runner.registerError("Could not load Ironbug model from '" + osm_path.to_s + "'.")
         
     | 
| 
      
 142 
     | 
    
         
            +
                      return false
         
     | 
| 
      
 143 
     | 
    
         
            +
                    end
         
     | 
| 
      
 144 
     | 
    
         
            +
                    new_model = o_model.get
         
     | 
| 
      
 145 
     | 
    
         
            +
                    # replace the current model with the contents of the loaded model
         
     | 
| 
      
 146 
     | 
    
         
            +
                    handles = OpenStudio::UUIDVector.new
         
     | 
| 
      
 147 
     | 
    
         
            +
                    model.objects.each do |obj|
         
     | 
| 
      
 148 
     | 
    
         
            +
                      handles << obj.handle
         
     | 
| 
      
 149 
     | 
    
         
            +
                    end
         
     | 
| 
      
 150 
     | 
    
         
            +
                    model.removeObjects(handles)
         
     | 
| 
      
 151 
     | 
    
         
            +
                    # add new file to empty model
         
     | 
| 
      
 152 
     | 
    
         
            +
                    model.addObjects(new_model.toIdfFile.objects)
         
     | 
| 
      
 153 
     | 
    
         
            +
                  end
         
     | 
| 
      
 154 
     | 
    
         
            +
                end
         
     | 
| 
      
 155 
     | 
    
         
            +
             
     | 
| 
      
 156 
     | 
    
         
            +
                puts 'Done with Model translation!'
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
                # copy the CSV schedules into the directory where EnergyPlus can find them
         
     | 
| 
       115 
159 
     | 
    
         
             
                if schedule_csv_dir && !schedule_csv_dir.empty?
         
     | 
| 
       116 
160 
     | 
    
         
             
                  if Dir.exist?(schedule_csv_dir)
         
     | 
| 
       117 
161 
     | 
    
         
             
                    runner.registerInfo("Copying exported schedules from '#{schedule_csv_dir}' to '#{generated_files_dir}'")
         
     | 
    
        data/lib/to_openstudio/model.rb
    CHANGED
    
    | 
         @@ -92,10 +92,6 @@ module Honeybee 
     | 
|
| 
       92 
92 
     | 
    
         
             
                  # create all openstudio objects in the model
         
     | 
| 
       93 
93 
     | 
    
         
             
                  create_openstudio_objects(log_report)
         
     | 
| 
       94 
94 
     | 
    
         | 
| 
       95 
     | 
    
         
            -
                  if log_report
         
     | 
| 
       96 
     | 
    
         
            -
                    puts 'Done with Model translation!'
         
     | 
| 
       97 
     | 
    
         
            -
                  end
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
95 
     | 
    
         
             
                  @openstudio_model
         
     | 
| 
       100 
96 
     | 
    
         
             
                end
         
     | 
| 
       101 
97 
     | 
    
         | 
| 
         @@ -127,6 +123,8 @@ module Honeybee 
     | 
|
| 
       127 
123 
     | 
    
         
             
                  $programtype_setpoint_hash = Hash.new  # hash to track Setpoint objects
         
     | 
| 
       128 
124 
     | 
    
         
             
                  $interior_afn_srf_hash = Hash.new  # track whether an adjacent surface is already in the AFN
         
     | 
| 
       129 
125 
     | 
    
         
             
                  $shw_for_plant = nil  # track whether a hot water plant is needed
         
     | 
| 
      
 126 
     | 
    
         
            +
                  $detailed_hvac_hash = Hash.new  # track the detailed HVAC systems that have been assigned
         
     | 
| 
      
 127 
     | 
    
         
            +
                  $ironbug_exe = nil  # ironbug executable; will be overwritten by any detailed HVACs
         
     | 
| 
       130 
128 
     | 
    
         | 
| 
       131 
129 
     | 
    
         
             
                  # create all of the non-geometric model elements
         
     | 
| 
       132 
130 
     | 
    
         
             
                  if @hash[:properties].key?(:energy)
         
     | 
| 
         @@ -572,6 +570,11 @@ module Honeybee 
     | 
|
| 
       572 
570 
     | 
    
         
             
                            end
         
     | 
| 
       573 
571 
     | 
    
         
             
                          end
         
     | 
| 
       574 
572 
     | 
    
         
             
                        end
         
     | 
| 
      
 573 
     | 
    
         
            +
                      elsif system_type == 'DetailedHVAC'
         
     | 
| 
      
 574 
     | 
    
         
            +
                        $detailed_hvac_hash[hvac[:identifier]] = hvac[:specification]
         
     | 
| 
      
 575 
     | 
    
         
            +
                        unless hvac[:ironbug_exe].nil?
         
     | 
| 
      
 576 
     | 
    
         
            +
                          $ironbug_exe = hvac[:ironbug_exe]
         
     | 
| 
      
 577 
     | 
    
         
            +
                        end
         
     | 
| 
       575 
578 
     | 
    
         
             
                      elsif TemplateHVAC.types.include?(system_type)
         
     | 
| 
       576 
579 
     | 
    
         
             
                        template_system = TemplateHVAC.new(hvac)
         
     | 
| 
       577 
580 
     | 
    
         
             
                        template_system.to_openstudio(@openstudio_model, hvac['rooms'])
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: honeybee-openstudio
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.33. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.33.7
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Tanushree Charan
         
     | 
| 
         @@ -11,7 +11,7 @@ authors: 
     | 
|
| 
       11 
11 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       12 
12 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       13 
13 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       14 
     | 
    
         
            -
            date: 2023-01- 
     | 
| 
      
 14 
     | 
    
         
            +
            date: 2023-01-27 00:00:00.000000000 Z
         
     | 
| 
       15 
15 
     | 
    
         
             
            dependencies:
         
     | 
| 
       16 
16 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       17 
17 
     | 
    
         
             
              name: json_pure
         
     |