openstudio-extension 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 7199026e992efc5a48c8c164cc26ff9a30b78266
4
- data.tar.gz: 8e609b0ab15f84fbbf05e15255eb8a38a031695f
3
+ metadata.gz: c4e2f50a7956aab9ba887ed122f081f9d1a593e9
4
+ data.tar.gz: 9883f17cccdb73a1f70ca70806c4a529f4d5837a
5
5
  SHA512:
6
- metadata.gz: 7e6c4367cd3d0b03a463e799461e1705ef9710b4974ee8d0638d369914369fe629e8dfa560e18312179cb133396a0a70730e7de2357c08a9fc7f9a60f8b2f724
7
- data.tar.gz: 0c7ad841664b252c48090e6b04b9efd44abe27d02defd91c383e351c1b334a1bbca40570e46e10efa6dd238db79e9d5e1b49398841997f1d6b46a387780f8c1a
6
+ metadata.gz: f41334de4ba12a02b02ba8c8963f912793c0885d922532f1b21af10656a368ab84baee8cdca6d9e75ec96cfd8d2dac35ccbf008201c2043c10717f5824058251
7
+ data.tar.gz: 78bd29c60ef04bef8e792095e4c919435e35f5f41fa3f9cd7a4dd64ed85c7d2184dbafaa367ea54bb4b8e5f57c06d0d7e5ed2f20e4519a24de9b9146d47d7739
data/README.md CHANGED
@@ -36,7 +36,7 @@ To use this and other extension gems, you will need Ruby 2.2.4 and OpenStudio 2.
36
36
  ### Windows Installation
37
37
  Install Ruby using the [RubyInstaller](https://rubyinstaller.org/downloads/archives/) for [Ruby 2.2.4 (x64)](https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.4-x64.exe).
38
38
 
39
- Install Dekit using the [mingw64](https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe) installer.
39
+ Install Devkit using the [mingw64](https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe) installer.
40
40
 
41
41
  Check the ruby installation returns the correct Ruby version (2.2.4):
42
42
  ```
@@ -61,23 +61,23 @@ ruby -e "require 'openstudio'" -e "puts OpenStudio::Model::Model.new"
61
61
 
62
62
  ### Mac Installation
63
63
  It is recommended that you install [rbenv](https://github.com/rbenv/rbenv) to easily manage difference versions of Ruby.
64
- rbenv can be installed view Homebrew:
65
- ```ruby
64
+ rbenv can be installed via [Homebrew](https://brew.sh/):
65
+ ```
66
66
  brew install rbenv
67
67
  rbenv init
68
68
  rbenv install 2.2.4
69
69
  ```
70
70
 
71
71
  Also install bundler
72
- ```ruby
72
+ ```
73
73
  gem install bundler -v 1.17
74
74
  ```
75
75
 
76
76
  Install [OpenStudio](https://www.openstudio.net/downloads).
77
77
 
78
- Add the RUBYLIB environment variable to your bash_profile file. It should point to the Ruby folder within the OpenStudio Application you just downloaded:
79
- ```ruby
80
- export RUBYLIB=“/Applications/OpenStudio-2.7.2/Ruby
78
+ Add the RUBYLIB environment variable to your `bash_profile` (or similar) file. It should point to the Ruby folder within the OpenStudio Application you just downloaded (replace 2.7.2 with the version you are using):
79
+ ```
80
+ export RUBYLIB=/Applications/OpenStudio-2.7.2/Ruby
81
81
  ```
82
82
 
83
83
 
@@ -180,7 +180,7 @@ The OpenStudio-extension gem can be used to easily initialize a new derivative e
180
180
 
181
181
  * First, call the rake task:
182
182
  ```ruby
183
- bundle exec rake init-new-gem
183
+ bundle exec rake init_new_gem
184
184
  ```
185
185
  * Enter the name of the gem repository (use dashes between words and the repo name should end with '-gem')
186
186
  * Enter the location of the directory where the gem directory should be created
@@ -388,14 +388,22 @@ module OsLib_CreateResults
388
388
  end
389
389
  end
390
390
 
391
+ # Get the electricity timeseries to determine the year used
392
+ elec = @sql.timeSeries(ann_env_pd, 'Zone Timestep', 'Electricity:Facility', '')
393
+ timeseries_yr = nil
394
+ if elec.is_initialized
395
+ timeseries_yr = elec.get.dateTimes[0].date.year
396
+ else
397
+ @runner.registerError('Peak Demand timeseries (Electricity:Facility at zone timestep) could not be found, cannot determine the informatino needed to calculate savings or incentives.')
398
+ end
391
399
  # Setup the peak demand time window based on input arguments.
392
400
  # Note that holidays and weekends are not excluded because
393
401
  # of a bug in EnergyPlus dates.
394
402
  # This will only impact corner-case buildings that have
395
403
  # peak demand on weekends or holidays, which is unusual.
396
404
  @runner.registerInfo("Peak Demand window is #{start_mo} #{start_day} to #{end_mo} #{end_day} from #{start_hr}:00 to #{end_hr}:00.")
397
- start_date = OpenStudio::DateTime.new(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(start_mo), start_day), OpenStudio::Time.new(0, 0, 0, 0))
398
- end_date = OpenStudio::DateTime.new(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(end_mo), end_day), OpenStudio::Time.new(0, 24, 0, 0))
405
+ start_date = OpenStudio::DateTime.new(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(start_mo), start_day, timeseries_yr), OpenStudio::Time.new(0, 0, 0, 0))
406
+ end_date = OpenStudio::DateTime.new(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(end_mo), end_day, timeseries_yr), OpenStudio::Time.new(0, 24, 0, 0))
399
407
  start_time = OpenStudio::Time.new(0, start_hr, 0, 0)
400
408
  end_time = OpenStudio::Time.new(0, end_hr, 0, 0)
401
409
 
@@ -416,7 +424,6 @@ module OsLib_CreateResults
416
424
  # electricity_peak_demand
417
425
  electricity_peak_demand = -1.0
418
426
  electricity_peak_demand_time = nil
419
- elec = @sql.timeSeries(ann_env_pd, 'Zone Timestep', 'Electricity:Facility', '')
420
427
  # deduce the timestep based on the hours simulated and the number of datapoints in the timeseries
421
428
  if elec.is_initialized && day_types
422
429
  elec = elec.get
@@ -1001,7 +1001,7 @@ module OsLib_Reporting
1001
1001
  data_arrays << [setpoint.iddObject.name, 'Reset', desc, '', '']
1002
1002
 
1003
1003
  when 'OS:SetpointManager:Warmest'
1004
- setpoint = component.to_SetpointManagerWarmest
1004
+ setpoint = component.to_SetpointManagerWarmest.get
1005
1005
  source_units = 'C'
1006
1006
  if is_ip_units
1007
1007
  target_units = 'F'
@@ -1009,12 +1009,12 @@ module OsLib_Reporting
1009
1009
  target_units = source_units
1010
1010
  end
1011
1011
  min_sat_f = OpenStudio.convert(setpoint.minimumSetpointTemperature, source_units, target_units).get.round(1)
1012
- max_sat_f = OpenStudio.convert(setpoint.minimumSetpointTemperature, source_units, target_units).get.round(1)
1012
+ max_sat_f = OpenStudio.convert(setpoint.maximumSetpointTemperature, source_units, target_units).get.round(1)
1013
1013
  desc = "#{min_sat_f} #{target_units} to #{max_sat_f.round} #{target_units}"
1014
1014
  data_arrays << [setpoint.iddObject.name, 'Reset SAT per Worst Zone', desc, '', '']
1015
1015
 
1016
1016
  when 'OS:SetpointManager:WarmestTemperatureFlow'
1017
- setpoint = component.to_SetpointManagerWarmestTemperatureFlow
1017
+ setpoint = component.to_SetpointManagerWarmestTemperatureFlow.get
1018
1018
  source_units = 'C'
1019
1019
  if is_ip_units
1020
1020
  target_units = 'F'
@@ -1022,7 +1022,7 @@ module OsLib_Reporting
1022
1022
  target_units = source_units
1023
1023
  end
1024
1024
  min_sat_f = OpenStudio.convert(setpoint.minimumSetpointTemperature, source_units, target_units).get.round(1)
1025
- max_sat_f = OpenStudio.convert(setpoint.minimumSetpointTemperature, source_units, target_units).get.round(1)
1025
+ max_sat_f = OpenStudio.convert(setpoint.maximumSetpointTemperature, source_units, target_units).get.round(1)
1026
1026
  desc = "#{min_sat_f} #{target_units} to #{max_sat_f.round} #{target_units}, #{setpoint.strategy}"
1027
1027
  data_arrays << [setpoint.iddObject.name, 'Reset SAT & Flow per Worst Zone', desc, '', '']
1028
1028
  end
@@ -1899,7 +1899,7 @@ module OsLib_Reporting
1899
1899
  table = {}
1900
1900
  table[:title] = 'Exterior Lighting'
1901
1901
  table[:header] = columns
1902
- table[:source_units] = ['', 'W', '', '', 'kWh'] # used for conversion, not needed for rendering.
1902
+ table[:source_units] = ['', 'W', '', '', 'GJ'] # used for conversion, not needed for rendering.
1903
1903
  table[:units] = ['', 'W', '', '', 'kWh']
1904
1904
  table[:data] = []
1905
1905
 
@@ -3383,17 +3383,17 @@ module OsLib_Reporting
3383
3383
  if is_ip_units
3384
3384
  ee_power = elec_equip.powerPerFloorArea.to_f * 0.092903 # IP
3385
3385
  ee_power = "#{ee_power.round(2)} (W/ft^2)"
3386
- ee_total_power = ((elec_equip.powerPerFloorArea.to_f * space.floorArea) * 0.092903) * elec_equip.multiplier
3386
+ ee_total_power = ((elec_equip.powerPerFloorArea.to_f * space.floorArea))
3387
3387
  else
3388
3388
  ee_power = elec_equip.powerPerFloorArea.to_f
3389
3389
  ee_power = "#{ee_power.round(2)} (W/m^2)"
3390
- ee_total_power = ((elec_equip.powerPerFloorArea.to_f * space.floorArea)) * elec_equip.multiplier
3390
+ ee_total_power = ((elec_equip.powerPerFloorArea.to_f * space.floorArea))
3391
3391
  end
3392
3392
  end
3393
3393
 
3394
3394
  if elec_equip.electricEquipmentDefinition.designLevelCalculationMethod == 'Watts/Person'
3395
3395
  ee_power = "#{elec_equip.powerPerPerson.to_f.round(2)} (W/person)"
3396
- ee_total_power = (elec_equip.powerPerPerson.to_f * space.numberOfPeople) * elec_equip.multiplier
3396
+ ee_total_power = (elec_equip.powerPerPerson.to_f * space.numberOfPeople)
3397
3397
  end
3398
3398
 
3399
3399
  if elec_equip.electricEquipmentDefinition.designLevelCalculationMethod == 'EquipmentLevel'
@@ -35,6 +35,6 @@
35
35
 
36
36
  module OpenStudio
37
37
  module Extension
38
- VERSION = '0.1.1'.freeze
38
+ VERSION = '0.1.2'.freeze
39
39
  end
40
40
  end
@@ -163,10 +163,7 @@ module OpenStudio
163
163
  end
164
164
 
165
165
  if !conflicts.empty?
166
- conflicts.each do |conflict|
167
- puts conflict
168
- end
169
- raise 'Conflicting file names found'
166
+ raise "Conflicting file names found: #{conflicts.join(', ')}"
170
167
  end
171
168
 
172
169
  return false
@@ -194,24 +191,36 @@ module OpenStudio
194
191
  end
195
192
 
196
193
  ##
197
- # Module method used to set the measure argument for measure_dir_name to argument_value
198
- # argument_name must appear in the OSW or exception will be raised
194
+ # Module method used to set the measure argument for measure_dir_name to argument_value,
195
+ # argument_name must appear in the OSW or exception will be raised. If step_name is nil
196
+ # then all workflow steps matching measure_dir_name will be affected. If step_name is
197
+ # not nil, then only workflow steps matching measure_dir_name and step_name will be affected.
199
198
  ##
200
199
  # @param [Hash] in_osw Initial OSW object as a Hash, keys should be symbolized
200
+ # @param [String] measure_dir_name Directory name of measure to set argument on
201
+ # @param [String] argument_name Name of the argument to set
202
+ # @param [String] argument_value Value to set the argument name to
203
+ # @param [String] step_name Optional argument, if present used to select workflow step to modify
201
204
  #
202
- # @return [Hash] Output OSW with measure argument set
205
+ # @return [Hash] Output OSW with measure argument set to argument value
203
206
  #
204
- def self.set_measure_argument(osw, measure_dir_name, argument_name, argument_value)
207
+ def self.set_measure_argument(osw, measure_dir_name, argument_name, argument_value, step_name = nil)
205
208
  result = false
206
209
  osw[:steps].each do |step|
207
210
  if step[:measure_dir_name] == measure_dir_name
208
- step[:arguments][argument_name.to_sym] = argument_value
209
- result = true
211
+ if step_name.nil? || step[:name] == step_name
212
+ step[:arguments][argument_name.to_sym] = argument_value
213
+ result = true
214
+ end
210
215
  end
211
216
  end
212
217
 
213
218
  if !result
214
- raise "Could not set '#{argument_name}' to '#{argument_value}' for measure '#{measure_dir_name}'"
219
+ if step_name
220
+ raise "Could not set '#{argument_name}' to '#{argument_value}' for measure '#{measure_dir_name}' in step '#{step_name}'"
221
+ else
222
+ raise "Could not set '#{argument_name}' to '#{argument_value}' for measure '#{measure_dir_name}'"
223
+ end
215
224
  end
216
225
 
217
226
  return osw
@@ -0,0 +1 @@
1
+ require_relative 'openstudio/extension'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstudio-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katherine Fleming
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2019-05-23 00:00:00.000000000 Z
13
+ date: 2019-09-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -166,6 +166,7 @@ files:
166
166
  - lib/measures/openstudio_extension_test_measure/measure.xml
167
167
  - lib/measures/openstudio_extension_test_measure/resources/os_lib_helper_methods.rb
168
168
  - lib/measures/openstudio_extension_test_measure/tests/OpenStudioExtensionTestMeasure_Test.rb
169
+ - lib/openstudio-extension.rb
169
170
  - lib/openstudio/extension.rb
170
171
  - lib/openstudio/extension/core/CreateResults.rb
171
172
  - lib/openstudio/extension/core/check_air_sys_temps.rb