honeybee-openstudio 2.33.5 → 2.33.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00f670b33c2af46ca1d82b6371e3ce1e3d95ea9f316061c0582294cc132400e1
4
- data.tar.gz: f8ff5c43f625828eb63e0888eafa05da02b3b14fcef8c80cad8ed3a499d5c222
3
+ metadata.gz: 851a084f0894099724dc078d840065a7cdc937cb35b95cbce8987531ad3d0832
4
+ data.tar.gz: bbc0285689ba78e3edaaa00bab9ec0124cd61b99e505ea95a530c5b98ce56703
5
5
  SHA512:
6
- metadata.gz: '081054756a71ee870f430a644f9d313b41e9a1a899e9147c56404480d85559d0776216dabb53c40c62c1dbae9a5d901833b8620b8d54236c5f9d438b80df685d'
7
- data.tar.gz: 89064bfe113ed82ecb7aeafc2d9f174ed82f6a127a86829dc08c7396269f78ce790805b537674854f177ee646e68d10783da71e9803272a92a87151f0e099f32
6
+ metadata.gz: 0ee011f3f35beed0b80fc15ee4108c9516806b93db9ca0b6f5c188a943ff62571271f384281ec5b2746dfb19696eea84488a68e71a2df660094d90988f1b15b2
7
+ data.tar.gz: 9fbb52f03d60d499b035ff0a639304d1b4e478724c20152b9c72defbddff004664729254260af1215d2825b2660b96ee06faeceeca2b8a0358791fbf93e71652
@@ -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.5'
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
 
@@ -53,11 +53,29 @@ module Honeybee
53
53
  hash[:latent_heat_recovery] = hvac.latentHeatRecoveryEffectiveness
54
54
  hash[:heating_air_temperature] = hvac.maximumHeatingSupplyAirTemperature
55
55
  hash[:cooling_air_temperature] = hvac.minimumCoolingSupplyAirTemperature
56
- if hvac.heatingLimit == 'NoLimit'
57
- hash[:heating_limit] = hvac.heatingLimit
56
+ unless hvac.isHeatingLimitDefaulted
57
+ if hvac.heatingLimit == 'NoLimit'
58
+ hash[:heating_limit] = {type: 'NoLimit'}
59
+ elsif hvac.heatingLimit == 'LimitCapacity'
60
+ if hvac.isMaximumSensibleHeatingCapacityAutosized
61
+ hash[:heating_limit] = {type: 'Autosize'}
62
+ end
63
+ unless hvac.maximumSensibleHeatingCapacity.empty?
64
+ hash[:heating_limit] = hvac.maximumSensibleHeatingCapacity
65
+ end
66
+ end
58
67
  end
59
- if hvac.coolingLimit == 'NoLimit'
60
- hash[:cooling_limit] = hvac.coolingLimit
68
+ unless hvac.isCoolingLimitDefaulted
69
+ if hvac.coolingLimit == 'NoLimit'
70
+ hash[:cooling_limit] = {type: 'NoLimit'}
71
+ elsif hvac.coolingLimit == 'LimitCapacity'
72
+ if hvac.isMaximumTotalCoolingCapacityAutosized
73
+ hash[:cooling_limit] = {type: 'Autosize'}
74
+ end
75
+ unless hvac.maximumTotalCoolingCapacity.empty?
76
+ hash[:cooling_limit] = hvac.maximumTotalCoolingCapacity
77
+ end
78
+ end
61
79
  end
62
80
  unless hvac.heatingAvailabilitySchedule.empty?
63
81
  schedule = hvac.heatingAvailabilitySchedule.get
@@ -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}'")
@@ -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.5
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-13 00:00:00.000000000 Z
14
+ date: 2023-01-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json_pure