openstudio-extension 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile +2 -0
- data/Jenkinsfile +2 -2
- data/README.md +12 -23
- data/Rakefile +2 -0
- data/bin/console +1 -0
- data/lib/change_log.rb +4 -3
- data/lib/measures/openstudio_extension_test_measure/measure.rb +2 -0
- data/lib/measures/openstudio_extension_test_measure/tests/openstudio_extension_test_measure_test.rb +2 -0
- data/lib/openstudio-extension.rb +2 -0
- data/lib/openstudio/extension.rb +8 -10
- data/lib/openstudio/extension/core/CreateResults.rb +178 -1
- data/lib/openstudio/extension/core/os_lib_constructions.rb +6 -1
- data/lib/openstudio/extension/core/os_lib_geometry.rb +255 -77
- data/lib/openstudio/extension/core/os_lib_model_generation.rb +2519 -84
- data/lib/openstudio/extension/core/os_lib_reporting.rb +133 -30
- data/lib/openstudio/extension/rake_task.rb +2 -0
- data/lib/openstudio/extension/runner.rb +8 -5
- data/lib/openstudio/extension/runner_config.rb +16 -1
- data/lib/openstudio/extension/version.rb +3 -1
- data/openstudio-extension.gemspec +11 -10
- metadata +14 -29
- data/lib/openstudio/extension/core/os_lib_cofee.rb +0 -259
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cc5634df3c8c1a9c8a711707cd6b6a9d07b4a0f0f01aed1726576e244a0c5b2
|
4
|
+
data.tar.gz: 8e433cbc4b7cc8b6737544771bb5273d8a7a267b8153ea936a2af3dccb61b486
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 455200a3b2e03ae2b5ef3d15f67690297c04f7886ce31a5f358f02a907a394a5cc0f0ba57b7b44efa96633443f4d23316e391716548cbcaf70af11881389fe44
|
7
|
+
data.tar.gz: 9f478fb250845c5e99b9d1d12ba4261b5b7c82fb2f69bffcd594c5ec1f8a5463d76c4de51202cac29b2f875d07bfffd35cc6fa53ae4e8d4baa3732a0d0c57e22
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,26 @@
|
|
1
1
|
# OpenStudio Extension Gem
|
2
2
|
|
3
|
+
## Version 0.2.1
|
4
|
+
|
5
|
+
* Changes from 0.1.5 (runner.conf bug)
|
6
|
+
* Changes from 0.1.6 (update core library)
|
7
|
+
* Update measure tester to 0.2.2 (with Rubocop 0.54)
|
8
|
+
|
3
9
|
## Version 0.2.0
|
4
10
|
|
5
11
|
* Upgrade Bundler to 2.1.x
|
6
12
|
* Restrict to Ruby ~> 2.5.0
|
7
13
|
* Remove json_pure gem
|
8
14
|
* Update measure tester to 0.2.0 (removes need for github checkout)
|
15
|
+
* Note that this version does not include the changes from Version 0.1.5
|
16
|
+
|
17
|
+
## Version 0.1.6
|
18
|
+
|
19
|
+
* Update core library methods with what was in OpenStudio-measures
|
20
|
+
|
21
|
+
## Version 0.1.5
|
22
|
+
|
23
|
+
* Fix bug to respect the runner.conf file when using Extension::Runner with no options
|
9
24
|
|
10
25
|
## Version 0.1.4
|
11
26
|
|
data/Gemfile
CHANGED
data/Jenkinsfile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
//Jenkins pipelines are stored in shared libaries. Please see: https://github.com/
|
1
|
+
//Jenkins pipelines are stored in shared libaries. Please see: https://github.com/NREL/cbci_jenkins_libs
|
2
2
|
|
3
3
|
@Library('cbci_shared_libs') _
|
4
4
|
|
5
5
|
// Build for PR to develop branch only.
|
6
6
|
if ((env.CHANGE_ID) && (env.CHANGE_TARGET) ) { // check if set
|
7
7
|
|
8
|
-
|
8
|
+
openstudio_extension_gems()
|
9
9
|
|
10
10
|
}
|
data/README.md
CHANGED
@@ -31,27 +31,27 @@ Each OpenStudio extension gem should define its own module name to ensure that t
|
|
31
31
|
|
32
32
|
## Installation
|
33
33
|
|
34
|
-
To use this and other extension gems, you will need Ruby 2.
|
34
|
+
To use this and other extension gems, you will need Ruby 2.5.x and OpenStudio 3.0.0 or greater.
|
35
35
|
|
36
36
|
### Windows Installation
|
37
|
-
Install Ruby using the [RubyInstaller](https://rubyinstaller.org/downloads/archives/) for [Ruby 2.
|
37
|
+
Install Ruby using the [RubyInstaller](https://rubyinstaller.org/downloads/archives/) for [Ruby 2.5.5 (x64)](https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.5.5-x64.exe).
|
38
38
|
|
39
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
|
-
Check the ruby installation returns the correct Ruby version (2.
|
41
|
+
Check the ruby installation returns the correct Ruby version (2.5.x):
|
42
42
|
```
|
43
43
|
ruby -v
|
44
44
|
```
|
45
45
|
|
46
46
|
Install bundler from the command line
|
47
47
|
```
|
48
|
-
gem install bundler -v 1
|
48
|
+
gem install bundler -v 2.1
|
49
49
|
```
|
50
50
|
|
51
|
-
Install OpenStudio. Create a file ```C:\ruby-2.
|
51
|
+
Install OpenStudio. Create a file ```C:\ruby-2.5.5-x64-mingw32\lib\ruby\site_ruby\openstudio.rb``` and point it to your OpenStudio installation by editing the contents. E.g.:
|
52
52
|
|
53
53
|
```ruby
|
54
|
-
require 'C:\openstudio-
|
54
|
+
require 'C:\openstudio-3.0.0\Ruby\openstudio.rb'
|
55
55
|
```
|
56
56
|
|
57
57
|
Verify your OpenStudio and Ruby configuration:
|
@@ -65,19 +65,20 @@ rbenv can be installed via [Homebrew](https://brew.sh/):
|
|
65
65
|
```
|
66
66
|
brew install rbenv
|
67
67
|
rbenv init
|
68
|
-
rbenv install 2.
|
68
|
+
rbenv install 2.5.5
|
69
69
|
```
|
70
70
|
|
71
71
|
Also install bundler
|
72
72
|
```
|
73
|
-
gem install bundler -v 1
|
73
|
+
gem install bundler -v 2.1
|
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` (or similar) file. It should point to the Ruby folder within
|
78
|
+
Add the RUBYLIB environment variable to your `bash_profile` (or similar) file. It should point to the Ruby folder within
|
79
|
+
the OpenStudio Application you just downloaded (replace 3.0.0 with the version you are using):
|
79
80
|
```
|
80
|
-
export RUBYLIB=/Applications/OpenStudio-
|
81
|
+
export RUBYLIB=/Applications/OpenStudio-3.0.0/Ruby
|
81
82
|
```
|
82
83
|
|
83
84
|
|
@@ -150,7 +151,7 @@ Common Rake Tasks that are available to derivative extension gems include:
|
|
150
151
|
| openstudio:measures:add_readme | Add README.md.erb file if it and the README markdown file do not already exist for a measure |
|
151
152
|
| openstudio:measures:copy_resources | Copy the resources files to individual measures in the calling gem |
|
152
153
|
| openstudio:measures:update_copyright | Update copyright on measure files in the calling gem |
|
153
|
-
| openstudio`:runner:`init
|
154
|
+
| openstudio`:runner:`init | Create a runner.conf file running simulations |
|
154
155
|
| openstudio:stage_bcl | Copy the measures to a location that can be uploaded to BCL |
|
155
156
|
| openstudio:push_bcl | Upload measures from the specified location to the BCL |
|
156
157
|
| openstudio:test_with_docker | Use openstudio docker image to run tests |
|
@@ -235,22 +236,10 @@ Or install it yourself as:
|
|
235
236
|
|
236
237
|
# TODO
|
237
238
|
|
238
|
-
- [X] Finalize documentation on naming conventions, etc
|
239
|
-
- [X] Add test measure
|
240
|
-
- [X] Rake task ```openstudio:update_measures```
|
241
|
-
- [X] Rake task ```openstudio:test_with_openstudio```
|
242
239
|
- [ ] Rake task ```stage_bcl``` _DLM: BCL gem should be a development dependency only until we can reduce its dependencies and remove native dependencies? should probably put it into a special group so we can bundle without it in openstudio-gems._
|
243
240
|
- [ ] Rake task ```push_bcl``` _DLM: how do we want to test this?
|
244
|
-
- [X] Get all rake tasks working on Travis
|
245
241
|
- [ ] Capture useful output from Travis (measure dashboard results, log files, zip of build products, etc) and put it somewhere (s3? naming convention?)
|
246
|
-
- [X] ```Extension::openstudio_extension_version``` _DLM: should we rename? should people overwrite this in their class?_
|
247
|
-
- [X] ```Extension::measures_dir``` _DLM: I think this can have a default implementation, right? If something does not need to be overridden should it be a module method rather than a class one? KAF: this is in rake task for now
|
248
|
-
- [X] ```Extension::list_measures``` _DLM: I think this can have a default implementation, right?_KAF: In Rake task for now
|
249
242
|
- [ ] ```Extension::files_dir``` _DLM: I think this can have a default implementation, right?_
|
250
243
|
- [ ] ```Extension::minimum_openstudio_version``` _DLM: should we rename? should people overwrite this in their class?_
|
251
|
-
- [X] ```Runner::initialize``` _DLM: should say that the path argument should be for a dir with a Gemfile right?_
|
252
|
-
- [X] ```Runner::configure_osw``` _DLM: should take in an OSW, add paths to all measure and file dirs for loaded OpenStudio Extensions, write out configured OSW_
|
253
|
-
- [ ] Run rubocop on all of the core files and remove exclusion from .rubocop.yml file.
|
254
244
|
- [ ] Cleanup task after running tests (may need to be in the OpenStudio Measure Tester)
|
255
|
-
- [X] Add a `rake init new_ext_gem` to Rakefile
|
256
245
|
- [ ] Add tests to the extension/core
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/lib/change_log.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'github_api'
|
4
5
|
require 'date'
|
@@ -14,9 +15,9 @@ require 'optparse/date'
|
|
14
15
|
|
15
16
|
options = {}
|
16
17
|
OptionParser.new do |opts|
|
17
|
-
opts.banner = "Usage: change_log.rb [options]\n"
|
18
|
-
|
19
|
-
opts.separator
|
18
|
+
opts.banner = "Usage: change_log.rb [options]\n" \
|
19
|
+
'Prints New, Open, Closed Issues, and number of accepted PRs'
|
20
|
+
opts.separator ''
|
20
21
|
|
21
22
|
# defaults, go back 90 days
|
22
23
|
options[:start_date] = Date.today - 90
|
data/lib/openstudio-extension.rb
CHANGED
data/lib/openstudio/extension.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# *******************************************************************************
|
2
4
|
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
3
5
|
# All rights reserved.
|
@@ -101,11 +103,9 @@ module OpenStudio
|
|
101
103
|
def self.all_measure_dirs
|
102
104
|
result = []
|
103
105
|
all_extensions.each do |obj|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
rescue StandardError
|
108
|
-
end
|
106
|
+
dir = obj.new.measures_dir
|
107
|
+
result << dir if dir
|
108
|
+
rescue StandardError
|
109
109
|
end
|
110
110
|
return result.uniq
|
111
111
|
end
|
@@ -117,11 +117,9 @@ module OpenStudio
|
|
117
117
|
def self.all_file_dirs
|
118
118
|
result = []
|
119
119
|
all_extensions.each do |obj|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
rescue StandardError
|
124
|
-
end
|
120
|
+
dir = obj.new.files_dir
|
121
|
+
result << dir if dir
|
122
|
+
rescue StandardError
|
125
123
|
end
|
126
124
|
return result.uniq
|
127
125
|
end
|
@@ -45,6 +45,23 @@ module OsLib_CreateResults
|
|
45
45
|
# @param end_mo [String] the end month for the peak demand window
|
46
46
|
# @param end_day [Integer] the end day for the peak demand window
|
47
47
|
# @param end_hr [Integer] the end hour for the peak demand window, using 24-hr clock
|
48
|
+
# @param electricity_consumption_tou_periods [Array<Hash>] optional array of hashes to add
|
49
|
+
# time-of-use electricity consumption values to the annual consumption information.
|
50
|
+
# Periods may overlap, but should be listed in the order in which they must be checked,
|
51
|
+
# where the value will be assigned to the first encountered period it falls into.
|
52
|
+
# An example hash looks like this:
|
53
|
+
# {
|
54
|
+
# 'tou_name' => 'system_peak',
|
55
|
+
# 'tou_id' => 1,
|
56
|
+
# 'skip_weekends' => true,
|
57
|
+
# 'skip_holidays' => true,
|
58
|
+
# 'start_mo' => 'July',
|
59
|
+
# 'start_day' => 1,
|
60
|
+
# 'start_hr' => 14,
|
61
|
+
# 'end_mo' => 'August',
|
62
|
+
# 'end_day' => 31,
|
63
|
+
# 'end_hr' => 18
|
64
|
+
# }
|
48
65
|
# @return [OpenStudio::AttributeVector] a vector of results needed by EDAPT
|
49
66
|
def create_results(skip_weekends = true,
|
50
67
|
skip_holidays = true,
|
@@ -53,7 +70,8 @@ module OsLib_CreateResults
|
|
53
70
|
start_hr = 14,
|
54
71
|
end_mo = 'September',
|
55
72
|
end_day = 30,
|
56
|
-
end_hr = 18
|
73
|
+
end_hr = 18,
|
74
|
+
electricity_consumption_tou_periods = [])
|
57
75
|
|
58
76
|
# get the current version of OS being used to determine if sql query
|
59
77
|
# changes are needed (for when E+ changes).
|
@@ -497,6 +515,83 @@ module OsLib_CreateResults
|
|
497
515
|
@runner.registerValue('annual_demand_electricity_peak_demand', 0.0, 'kW')
|
498
516
|
end
|
499
517
|
|
518
|
+
# Describe the TOU periods
|
519
|
+
electricity_consumption_tou_periods.each do |tou_pd|
|
520
|
+
@runner.registerInfo("TOU period #{tou_pd['tou_id']} represents #{tou_pd['tou_name']} and covers #{tou_pd['start_mo']}-#{tou_pd['start_day']} to #{tou_pd['end_mo']}-#{tou_pd['end_day']} from #{tou_pd['start_hr']} to #{tou_pd['end_hr']}, skip weekends = #{tou_pd['skip_weekends']}, skip holidays = #{tou_pd['skip_holidays']}")
|
521
|
+
end
|
522
|
+
|
523
|
+
# electricity time-of-use periods
|
524
|
+
elec = @sql.timeSeries(ann_env_pd, 'Zone Timestep', 'Electricity:Facility', '')
|
525
|
+
if elec.is_initialized && day_types
|
526
|
+
elec = elec.get
|
527
|
+
# Put timeseries into array
|
528
|
+
elec_vals = []
|
529
|
+
ann_elec_vals = elec.values
|
530
|
+
for i in 0..(ann_elec_vals.size - 1)
|
531
|
+
elec_vals << ann_elec_vals[i]
|
532
|
+
end
|
533
|
+
|
534
|
+
# Put values into array
|
535
|
+
elec_times = []
|
536
|
+
ann_elec_times = elec.dateTimes
|
537
|
+
for i in 0..(ann_elec_times.size - 1)
|
538
|
+
elec_times << ann_elec_times[i]
|
539
|
+
end
|
540
|
+
|
541
|
+
# Loop through the time/value pairs and find the peak
|
542
|
+
# excluding the times outside of the Xcel peak demand window
|
543
|
+
electricity_tou_vals = Hash.new(0)
|
544
|
+
elec_times.zip(elec_vals).each_with_index do |vs, ind|
|
545
|
+
date_time = vs[0]
|
546
|
+
joules = vs[1]
|
547
|
+
day_type = day_types[ind]
|
548
|
+
time = date_time.time
|
549
|
+
date = date_time.date
|
550
|
+
|
551
|
+
# puts("#{val_kW}kW; #{date}; #{time}; #{day_of_week.valueName}")
|
552
|
+
|
553
|
+
# Determine which TOU period this hour falls into
|
554
|
+
tou_period_assigned = false
|
555
|
+
electricity_consumption_tou_periods.each do |tou_pd|
|
556
|
+
pd_start_date = OpenStudio::DateTime.new(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(tou_pd['start_mo']), tou_pd['start_day'], timeseries_yr), OpenStudio::Time.new(0, 0, 0, 0))
|
557
|
+
pd_end_date = OpenStudio::DateTime.new(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(tou_pd['end_mo']), tou_pd['end_day'], timeseries_yr), OpenStudio::Time.new(0, 24, 0, 0))
|
558
|
+
pd_start_time = OpenStudio::Time.new(0, tou_pd['start_hr'], 0, 0)
|
559
|
+
pd_end_time = OpenStudio::Time.new(0, tou_pd['end_hr'], 0, 0)
|
560
|
+
# Skip times outside of the correct months
|
561
|
+
next if date_time < pd_start_date || date_time > pd_end_date
|
562
|
+
# Skip times before some time and after another time
|
563
|
+
next if time < pd_start_time || time > pd_end_time
|
564
|
+
# Skip weekends if asked
|
565
|
+
if tou_pd['skip_weekends']
|
566
|
+
# Sunday = 1, Saturday = 7
|
567
|
+
next if day_type == 1 || day_type == 7
|
568
|
+
end
|
569
|
+
# Skip holidays if asked
|
570
|
+
if tou_pd['skip_holidays']
|
571
|
+
# Holiday = 8
|
572
|
+
next if day_type == 8
|
573
|
+
end
|
574
|
+
# If here, this hour falls into the specified period
|
575
|
+
tou_period_assigned = true
|
576
|
+
electricity_tou_vals[tou_pd['tou_id']] += joules
|
577
|
+
break
|
578
|
+
end
|
579
|
+
# Ensure that the value fell into a period
|
580
|
+
unless tou_period_assigned
|
581
|
+
@runner.registerError("Did not find a TOU period covering #{time} on #{date}, kWh will not be included in any TOU period.")
|
582
|
+
end
|
583
|
+
end
|
584
|
+
# Register values for any time-of-use period with kWh
|
585
|
+
electricity_tou_vals.each do |tou_pd_id, joules_in_pd|
|
586
|
+
gj_in_pd = OpenStudio.convert(joules_in_pd, 'J', 'GJ').get
|
587
|
+
kwh_in_pd = OpenStudio.convert(joules_in_pd, 'J', 'kWh').get
|
588
|
+
@runner.registerValue("annual_consumption_electricity_tou_#{tou_pd_id}", gj_in_pd, 'GJ')
|
589
|
+
@runner.registerInfo("TOU period #{tou_pd_id} annual electricity consumption = #{kwh_in_pd} kWh.")
|
590
|
+
end
|
591
|
+
else
|
592
|
+
@runner.registerError('Electricity timeseries (Electricity:Facility at zone timestep) could not be found, cannot determine the information needed to calculate savings or incentives.')
|
593
|
+
end
|
594
|
+
|
500
595
|
# electricity_annual_avg_peak_demand
|
501
596
|
val = @sql.electricityTotalEndUses
|
502
597
|
if val.is_initialized
|
@@ -587,6 +682,88 @@ module OsLib_CreateResults
|
|
587
682
|
@runner.registerValue('annual_demand_district_cooling_peak_demand', 0.0, 'kW')
|
588
683
|
end
|
589
684
|
|
685
|
+
# district cooling time-of-use periods
|
686
|
+
dist_clg = @sql.timeSeries(ann_env_pd, 'Zone Timestep', 'DistrictCooling:Facility', '')
|
687
|
+
if dist_clg.is_initialized && day_types
|
688
|
+
dist_clg = dist_clg.get
|
689
|
+
# Put timeseries into array
|
690
|
+
dist_clg_vals = []
|
691
|
+
ann_dist_clg_vals = dist_clg.values
|
692
|
+
for i in 0..(ann_dist_clg_vals.size - 1)
|
693
|
+
dist_clg_vals << ann_dist_clg_vals[i]
|
694
|
+
end
|
695
|
+
|
696
|
+
# Put values into array
|
697
|
+
dist_clg_times = []
|
698
|
+
ann_dist_clg_times = dist_clg.dateTimes
|
699
|
+
for i in 0..(ann_dist_clg_times.size - 1)
|
700
|
+
dist_clg_times << ann_dist_clg_times[i]
|
701
|
+
end
|
702
|
+
|
703
|
+
# Loop through the time/value pairs and find the peak
|
704
|
+
# excluding the times outside of the Xcel peak demand window
|
705
|
+
dist_clg_tou_vals = Hash.new(0)
|
706
|
+
dist_clg_times.zip(dist_clg_vals).each_with_index do |vs, ind|
|
707
|
+
date_time = vs[0]
|
708
|
+
joules = vs[1]
|
709
|
+
day_type = day_types[ind]
|
710
|
+
time = date_time.time
|
711
|
+
date = date_time.date
|
712
|
+
|
713
|
+
# puts("#{val_kW}kW; #{date}; #{time}; #{day_of_week.valueName}")
|
714
|
+
|
715
|
+
# Determine which TOU period this hour falls into
|
716
|
+
tou_period_assigned = false
|
717
|
+
electricity_consumption_tou_periods.each do |tou_pd|
|
718
|
+
pd_start_date = OpenStudio::DateTime.new(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(tou_pd['start_mo']), tou_pd['start_day'], timeseries_yr), OpenStudio::Time.new(0, 0, 0, 0))
|
719
|
+
pd_end_date = OpenStudio::DateTime.new(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(tou_pd['end_mo']), tou_pd['end_day'], timeseries_yr), OpenStudio::Time.new(0, 24, 0, 0))
|
720
|
+
pd_start_time = OpenStudio::Time.new(0, tou_pd['start_hr'], 0, 0)
|
721
|
+
pd_end_time = OpenStudio::Time.new(0, tou_pd['end_hr'], 0, 0)
|
722
|
+
# Skip times outside of the correct months
|
723
|
+
next if date_time < pd_start_date || date_time > pd_end_date
|
724
|
+
# Skip times before some time and after another time
|
725
|
+
next if time < pd_start_time || time > pd_end_time
|
726
|
+
# Skip weekends if asked
|
727
|
+
if tou_pd['skip_weekends']
|
728
|
+
# Sunday = 1, Saturday = 7
|
729
|
+
next if day_type == 1 || day_type == 7
|
730
|
+
end
|
731
|
+
# Skip holidays if asked
|
732
|
+
if tou_pd['skip_holidays']
|
733
|
+
# Holiday = 8
|
734
|
+
next if day_type == 8
|
735
|
+
end
|
736
|
+
# If here, this hour falls into the specified period
|
737
|
+
tou_period_assigned = true
|
738
|
+
dist_clg_tou_vals[tou_pd['tou_id']] += joules
|
739
|
+
break
|
740
|
+
end
|
741
|
+
# Ensure that the value fell into a period
|
742
|
+
unless tou_period_assigned
|
743
|
+
@runner.registerError("Did not find a TOU period covering #{time} on #{date}, kWh will not be included in any TOU period.")
|
744
|
+
end
|
745
|
+
end
|
746
|
+
# Register values for any time-of-use period with kWh
|
747
|
+
dist_clg_tou_vals.each do |tou_pd_id, joules_in_pd|
|
748
|
+
gj_in_pd = OpenStudio.convert(joules_in_pd, 'J', 'GJ').get
|
749
|
+
kwh_in_pd = OpenStudio.convert(joules_in_pd, 'J', 'kWh').get
|
750
|
+
@runner.registerValue("annual_consumption_district_cooling_tou_#{tou_pd_id}", gj_in_pd, 'GJ')
|
751
|
+
@runner.registerInfo("TOU period #{tou_pd_id} annual district cooling consumption = #{kwh_in_pd} kWh.")
|
752
|
+
end
|
753
|
+
else
|
754
|
+
# If TOU periods were specified but this model has no district cooling, report zeroes
|
755
|
+
if electricity_consumption_tou_periods.size > 0
|
756
|
+
# Get the TOU ids
|
757
|
+
tou_ids = []
|
758
|
+
electricity_consumption_tou_periods.each do |tou_pd|
|
759
|
+
tou_ids << tou_pd['tou_id']
|
760
|
+
end
|
761
|
+
tou_ids.uniq.each do |tou_id|
|
762
|
+
@runner.registerValue("annual_consumption_district_cooling_tou_#{tou_id}", 0.0, 'GJ')
|
763
|
+
end
|
764
|
+
end
|
765
|
+
end
|
766
|
+
|
590
767
|
else
|
591
768
|
@runner.registerError('Could not find an annual run period')
|
592
769
|
return OpenStudio::Attribute.new('report', result_elems)
|
@@ -283,7 +283,12 @@ module OsLib_Constructions
|
|
283
283
|
# create info message
|
284
284
|
if !runner.nil? # todo - need to look for bad visible transmittance here
|
285
285
|
uFactorSiToIpConversion = OpenStudio.convert(material.uFactor, 'W/m^2*K', 'Btu/ft^2*h*R').get
|
286
|
-
|
286
|
+
# version check to support 2.x and 3.x
|
287
|
+
if Gem::Version.new(OpenStudio::openStudioVersion) > Gem::Version.new("2.9.1")
|
288
|
+
runner.registerInfo("Created #{construction.name} construction. U-factor: #{OpenStudio.toNeatString(uFactorSiToIpConversion, 2, true)}(Btu/ft^2*h*R), SHGC: #{material.solarHeatGainCoefficient}, VT: #{material.getVisibleTransmittance.get}.")
|
289
|
+
else
|
290
|
+
runner.registerInfo("Created #{construction.name} construction. U-factor: #{OpenStudio.toNeatString(uFactorSiToIpConversion, 2, true)}(Btu/ft^2*h*R), SHGC: #{material.getSolarHeatGainCoefficient}, VT: #{material.getVisibleTransmittance.get}.")
|
291
|
+
end
|
287
292
|
end
|
288
293
|
|
289
294
|
result = construction
|