urbanopt-core 0.11.0 → 1.0.0
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/.github/workflows/nightly_build.yml +7 -6
- data/.gitignore +1 -0
- data/CHANGELOG.md +41 -19
- data/Gemfile +0 -5
- data/LICENSE.md +1 -1
- data/README.md +8 -4
- data/doc_templates/LICENSE.md +1 -1
- data/doc_templates/copyright_erb.txt +1 -1
- data/lib/measures/urbanopt-core-test-measure/LICENSE.md +42 -0
- data/lib/measures/urbanopt-core-test-measure/README.md +40 -0
- data/lib/measures/urbanopt-core-test-measure/README.md.erb +42 -0
- data/lib/measures/urbanopt-core-test-measure/measure.rb +109 -0
- data/lib/measures/urbanopt-core-test-measure/measure.xml +117 -0
- data/lib/measures/urbanopt-core-test-measure/tests/urbanopt_core_test_measure_test.rb +83 -0
- data/lib/urbanopt/core/version.rb +1 -1
- data/urbanopt-core-gem.gemspec +7 -7
- metadata +21 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cd161e310c17d98c30e9dc46f2cec0f84f4f52d42f198e70187a141fe7302c7
|
4
|
+
data.tar.gz: 2e51a5becf77145b0f5da82a8af0258d2d4c8ea57c20c6db18a1db7dfcc5e6ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6d3ff0d274f36e4f70e749d05a826a655b8b99197c0cd3848e3c14180588d4a5837c095775e096c2d4998bd2b865f1d9423681d35b3025a0f6862a8455fc049
|
7
|
+
data.tar.gz: 11919cbdbf0f303672c574757a95dd76a52ce5187226f77838fbdad036e56f114d56adc8526d43b2774723caa78ff1d7a37258f7de32e2d572223ad3e4952a54
|
@@ -1,13 +1,12 @@
|
|
1
1
|
name: Core-gem CI
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
4
|
+
push:
|
5
|
+
workflow_dispatch:
|
5
6
|
schedule:
|
6
7
|
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
|
7
8
|
# 5 am UTC (11pm MDT the day before) every weekday night in MDT
|
8
|
-
- cron:
|
9
|
-
pull_request:
|
10
|
-
types: [review_requested]
|
9
|
+
- cron: "25 5 * * 2-6"
|
11
10
|
|
12
11
|
env:
|
13
12
|
# This env var should enforce develop branch of all dependencies
|
@@ -18,11 +17,13 @@ jobs:
|
|
18
17
|
weeknight-tests:
|
19
18
|
runs-on: ubuntu-latest
|
20
19
|
container:
|
21
|
-
image: docker://nrel/openstudio:3.
|
20
|
+
image: docker://nrel/openstudio:3.9.0
|
22
21
|
steps:
|
23
22
|
- uses: actions/checkout@v4
|
24
23
|
- name: Update gems
|
25
|
-
run:
|
24
|
+
run: |
|
25
|
+
bundle install
|
26
|
+
bundle update
|
26
27
|
- name: Run Rspec
|
27
28
|
run: bundle exec rspec
|
28
29
|
# coveralls action docs: https://github.com/marketplace/actions/coveralls-github-action
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,44 +1,66 @@
|
|
1
1
|
# URBANopt Core Gem
|
2
2
|
|
3
|
+
## Version 1.0.0
|
4
|
+
|
5
|
+
## Exciting New Features 🎉
|
6
|
+
|
7
|
+
* Use openstudio 3.9.0 by @vtnate in https://github.com/urbanopt/urbanopt-core-gem/pull/60
|
8
|
+
|
9
|
+
### Other Changes
|
10
|
+
|
11
|
+
* Used the pinned version of regex-parser in openstudio-extension. by @wenyikuang in https://github.com/urbanopt/urbanopt-core-gem/pull/61
|
12
|
+
|
13
|
+
## New Contributors
|
14
|
+
|
15
|
+
* @wenyikuang made their first contribution in https://github.com/urbanopt/urbanopt-core-gem/pull/61
|
16
|
+
|
17
|
+
**Full Changelog**: https://github.com/urbanopt/urbanopt-core-gem/compare/v0.11.0...v1.0.0
|
18
|
+
|
3
19
|
## Version 0.11.0
|
4
20
|
|
5
|
-
## What's Changed
|
6
21
|
### Exciting New Features 🎉
|
22
|
+
|
7
23
|
* More tests by @vtnate in https://github.com/urbanopt/urbanopt-core-gem/pull/55
|
8
24
|
* Os37 by @vtnate in https://github.com/urbanopt/urbanopt-core-gem/pull/56
|
25
|
+
|
9
26
|
### Other Changes
|
27
|
+
|
10
28
|
* remove Jenkinsfile by @vtnate in https://github.com/urbanopt/urbanopt-core-gem/pull/53
|
11
29
|
* also run CI when a PR gets a review request by @vtnate in https://github.com/urbanopt/urbanopt-core-gem/pull/54
|
12
30
|
|
13
|
-
|
14
31
|
**Full Changelog**: https://github.com/urbanopt/urbanopt-core-gem/compare/v0.10.0...v0.11.0
|
15
32
|
|
16
33
|
## Version 0.10.0
|
34
|
+
|
17
35
|
Date Range: 12/12/22 - 07/19/23
|
18
36
|
|
19
|
-
|
20
|
-
|
21
|
-
|
37
|
+
* Update dependencies for OpenStudio 3.6.0
|
38
|
+
* Update license and references to the license file
|
39
|
+
* Remove outdated Travis CI config file
|
22
40
|
|
23
41
|
## Version 0.9.0
|
42
|
+
|
24
43
|
Date Range: 04/22/22 - 12/12/22
|
25
44
|
|
26
|
-
|
45
|
+
* Update dependencies for OpenStudio 3.5.0
|
27
46
|
|
28
47
|
## Version 0.8.0
|
48
|
+
|
29
49
|
Date Range: 11/23/21 - 04/21/22
|
30
50
|
|
31
|
-
|
51
|
+
* Fixed [#41]( https://github.com/urbanopt/urbanopt-core-gem/pull/41 ), Update licenses
|
32
52
|
|
33
53
|
## Version 0.7.0
|
54
|
+
|
34
55
|
Date Range: 07/02/21 - 11/22/21
|
35
56
|
|
36
|
-
|
57
|
+
* Updated dependencies for OpenStudio 3.3.0
|
37
58
|
|
38
59
|
## Version 0.6.1
|
60
|
+
|
39
61
|
Date Range: 04/27/21 - 07/01/21
|
40
62
|
|
41
|
-
|
63
|
+
* Fixed [#37]( https://github.com/urbanopt/urbanopt-core-gem/pull/37 ), update rubocop configs to v4
|
42
64
|
|
43
65
|
## Version 0.6.0
|
44
66
|
|
@@ -50,8 +72,8 @@ Updated dependencies for OpenStudio 3.2.0 (Ruby 2.7)
|
|
50
72
|
|
51
73
|
Date Range: 11/26/20 - 12/08/20
|
52
74
|
|
53
|
-
|
54
|
-
|
75
|
+
* Fixed [#15]( https://github.com/urbanopt/urbanopt-core-gem/issues/15 ), Updated urbanopt-reopt-example-project to simulate and generate results for multiple PVs
|
76
|
+
* Fixed [#30]( https://github.com/urbanopt/urbanopt-core-gem/issues/30 ), Update extension-gem dependency
|
55
77
|
|
56
78
|
## Version 0.5.0
|
57
79
|
|
@@ -63,16 +85,15 @@ Updated dependencies for OpenStudio 3.1.0
|
|
63
85
|
|
64
86
|
Date Range: 06/05/20 - 09/17/20
|
65
87
|
|
66
|
-
|
67
|
-
|
68
|
-
|
88
|
+
* Fixed [#7]( https://github.com/urbanopt/urbanopt-core-gem/issues/7 ), Remove travis in favor of Jenkins
|
89
|
+
* Fixed [#24]( https://github.com/urbanopt/urbanopt-core-gem/issues/24 ), Chore: Add TM to first mention URBANopt on LICENSE file and LICENSE section
|
69
90
|
|
70
91
|
## Version 0.3.0
|
71
92
|
|
72
93
|
Date Range: 03/31/20 - 06/04/20
|
73
94
|
|
74
|
-
|
75
|
-
|
95
|
+
* Updated dependencies for ruby 2.5.x and OpenStudio 3.x
|
96
|
+
* Remove old changelog script functionality in favor of new extension-gem functionality (can be run via rake task)
|
76
97
|
|
77
98
|
## Version 0.2.0
|
78
99
|
|
@@ -81,9 +102,10 @@ URBANopt Core Gem version 0.2.0 include minor updates to dependencies and update
|
|
81
102
|
Date Range: 12/27/19 - 03/31/20
|
82
103
|
|
83
104
|
Closed Issues and Features
|
84
|
-
|
85
|
-
|
86
|
-
|
105
|
+
|
106
|
+
* Fixed [#11]( https://github.com/urbanopt/urbanopt-core-gem/pull/11 ), Use URBANopt standard contributing guidelines
|
107
|
+
* Fixed [#13]( https://github.com/urbanopt/urbanopt-core-gem/pull/13 ), updating copyrights
|
108
|
+
* Fixed [#14]( https://github.com/urbanopt/urbanopt-core-gem/pull/14 ), set ruby and extension gem versions
|
87
109
|
|
88
110
|
## Version 0.1.1 (unreleased)
|
89
111
|
|
data/Gemfile
CHANGED
@@ -11,11 +11,6 @@ gemspec
|
|
11
11
|
# checkout the latest version (develop) from github.
|
12
12
|
allow_local = ENV['FAVOR_LOCAL_GEMS']
|
13
13
|
|
14
|
-
# pin this dependency to avoid unicode_normalize error
|
15
|
-
gem 'addressable', '2.8.1'
|
16
|
-
# pin this dependency to avoid using racc dependency (which has native extensions)
|
17
|
-
gem 'parser', '3.2.2.2'
|
18
|
-
|
19
14
|
# if allow_local && File.exist?('../OpenStudio-extension-gem')
|
20
15
|
# gem 'openstudio-extension', path: '../OpenStudio-extension-gem'
|
21
16
|
# elsif allow_local
|
data/LICENSE.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
URBANopt (tm), Copyright (c) 2019-
|
1
|
+
URBANopt (tm), Copyright (c) 2019-2025, Alliance for Sustainable Energy, LLC, and other
|
2
2
|
contributors. All rights reserved.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification,
|
data/README.md
CHANGED
@@ -13,19 +13,23 @@ Add this line to your application's Gemfile:
|
|
13
13
|
gem 'urbanopt-core'
|
14
14
|
```
|
15
15
|
|
16
|
-
And then execute:
|
16
|
+
And then in the terminal, execute:
|
17
17
|
|
18
|
-
|
18
|
+
```terminal
|
19
|
+
bundle
|
20
|
+
```
|
19
21
|
|
20
22
|
Or install it yourself as:
|
21
23
|
|
22
|
-
|
24
|
+
```terminal
|
25
|
+
gem install 'urbanopt-core'
|
26
|
+
```
|
23
27
|
|
24
28
|
## Usage
|
25
29
|
|
26
30
|
This Extension Gem stores the base information needed for all derivative URBANopt extension gems.
|
27
31
|
|
28
|
-
|
32
|
+
## Releasing
|
29
33
|
|
30
34
|
* Update CHANGELOG.md
|
31
35
|
* Run `rake rubocop:auto_correct`
|
data/doc_templates/LICENSE.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
URBANopt (tm), Copyright (c) 2019-
|
1
|
+
URBANopt (tm), Copyright (c) 2019-2025, Alliance for Sustainable Energy, LLC, and other
|
2
2
|
contributors. All rights reserved.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%
|
2
2
|
# *********************************************************************************
|
3
|
-
# URBANopt (tm), Copyright (c) 2019-
|
3
|
+
# URBANopt (tm), Copyright (c) 2019-2025, Alliance for Sustainable Energy, LLC, and other
|
4
4
|
# contributors. All rights reserved.
|
5
5
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -0,0 +1,42 @@
|
|
1
|
+
URBANopt (tm), Copyright (c) 2019-2025, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
contributors. All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
Redistributions of source code must retain the above copyright notice, this list
|
8
|
+
of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
Redistributions in binary form must reproduce the above copyright notice, this
|
11
|
+
list of conditions and the following disclaimer in the documentation and/or other
|
12
|
+
materials provided with the distribution.
|
13
|
+
|
14
|
+
Neither the name of the copyright holder nor the names of its contributors may be
|
15
|
+
used to endorse or promote products derived from this software without specific
|
16
|
+
prior written permission.
|
17
|
+
|
18
|
+
Redistribution of this software, without modification, must refer to the software
|
19
|
+
by the same designation. Redistribution of a modified version of this software
|
20
|
+
(i) may not refer to the modified version by the same designation, or by any
|
21
|
+
confusingly similar designation, and (ii) must refer to the underlying software
|
22
|
+
originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
|
23
|
+
the term “URBANopt”, or any confusingly similar designation may not be used to
|
24
|
+
refer to any modified version of this software or any modified version of the
|
25
|
+
underlying software originally provided by Alliance without the prior written
|
26
|
+
consent of Alliance.
|
27
|
+
|
28
|
+
The name of the copyright holder(s), any contributors, the United States Government,
|
29
|
+
the United States Department of Energy, or any of their employees may not be used to
|
30
|
+
endorse or promote products derived from this software without specific prior written
|
31
|
+
permission from the respective party.
|
32
|
+
|
33
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND
|
34
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
35
|
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
36
|
+
THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED STATES
|
37
|
+
DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT,
|
38
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
39
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
40
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
41
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
42
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
###### (Automatically generated documentation)
|
4
|
+
|
5
|
+
# URBANopt Core Test Measure
|
6
|
+
|
7
|
+
## Description
|
8
|
+
This measure is just a test of Urbanopt Core measure. it adds a meter at the requested reporting frequency.
|
9
|
+
|
10
|
+
## Modeler Description
|
11
|
+
The measure just passes in the string and does not validate that it is a proper meter name. It is up to the user to know this or to look at the .mdd file from a previous simulation run.
|
12
|
+
|
13
|
+
## Measure Type
|
14
|
+
ModelMeasure
|
15
|
+
|
16
|
+
## Taxonomy
|
17
|
+
|
18
|
+
|
19
|
+
## Arguments
|
20
|
+
|
21
|
+
|
22
|
+
### Enter Meter Name
|
23
|
+
|
24
|
+
**Name:** meter_name,
|
25
|
+
**Type:** String,
|
26
|
+
**Units:** ,
|
27
|
+
**Required:** true,
|
28
|
+
**Model Dependent:** false
|
29
|
+
|
30
|
+
### Reporting Frequency
|
31
|
+
|
32
|
+
**Name:** reporting_frequency,
|
33
|
+
**Type:** Choice,
|
34
|
+
**Units:** ,
|
35
|
+
**Required:** true,
|
36
|
+
**Model Dependent:** false
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<%#= README.md.erb is used to auto-generate README.md. %>
|
2
|
+
<%#= To manually maintain README.md throw away README.md.erb and manually edit README.md %>
|
3
|
+
###### (Automatically generated documentation)
|
4
|
+
|
5
|
+
# <%= name %>
|
6
|
+
|
7
|
+
## Description
|
8
|
+
<%= description %>
|
9
|
+
|
10
|
+
## Modeler Description
|
11
|
+
<%= modelerDescription %>
|
12
|
+
|
13
|
+
## Measure Type
|
14
|
+
<%= measureType %>
|
15
|
+
|
16
|
+
## Taxonomy
|
17
|
+
<%= taxonomy %>
|
18
|
+
|
19
|
+
## Arguments
|
20
|
+
|
21
|
+
<% arguments.each do |argument| %>
|
22
|
+
### <%= argument[:display_name] %>
|
23
|
+
<%= argument[:description] %>
|
24
|
+
**Name:** <%= argument[:name] %>,
|
25
|
+
**Type:** <%= argument[:type] %>,
|
26
|
+
**Units:** <%= argument[:units] %>,
|
27
|
+
**Required:** <%= argument[:required] %>,
|
28
|
+
**Model Dependent:** <%= argument[:model_dependent] %>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<% if arguments.size == 0 %>
|
32
|
+
<%= "This measure does not have any user arguments" %>
|
33
|
+
<% end %>
|
34
|
+
|
35
|
+
<% if outputs.size > 0 %>
|
36
|
+
## Outputs
|
37
|
+
<% output_names = [] %>
|
38
|
+
<% outputs.each do |output| %>
|
39
|
+
<% output_names << output[:display_name] %>
|
40
|
+
<% end %>
|
41
|
+
<%= output_names.join(", ") %>
|
42
|
+
<% end %>
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# *********************************************************************************
|
2
|
+
# URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC.
|
3
|
+
# See also https://github.com/urbanopt/urbanopt-core-gem/blob/develop/LICENSE.md
|
4
|
+
# *********************************************************************************
|
5
|
+
|
6
|
+
# see the URL below for information on how to write OpenStudio measures
|
7
|
+
# http://openstudio.nrel.gov/openstudio-measure-writing-guide
|
8
|
+
|
9
|
+
# see the URL below for access to C++ documentation on mondel objects (click on "model" in the main window to view model objects)
|
10
|
+
# http://openstudio.nrel.gov/sites/openstudio.nrel.gov/files/nv_data/cpp_documentation_it/model/html/namespaces.html
|
11
|
+
|
12
|
+
# start the measure
|
13
|
+
class UrbanoptCoreTestMeasure < OpenStudio::Measure::ModelMeasure
|
14
|
+
# define the name that a user will see, this method may be deprecated as
|
15
|
+
# the display name in PAT comes from the name field in measure.xml
|
16
|
+
def name
|
17
|
+
return 'URBANopt Core Test Measure'
|
18
|
+
end
|
19
|
+
|
20
|
+
# human readable description
|
21
|
+
def description
|
22
|
+
return 'This measure is just a test of Urbanopt Core measure. it adds a meter at the requested reporting frequency.'
|
23
|
+
end
|
24
|
+
|
25
|
+
# human readable description of modeling approach
|
26
|
+
def modeler_description
|
27
|
+
return 'The measure just passes in the string and does not validate that it is a proper meter name. It is up to the user to know this or to look at the .mdd file from a previous simulation run.'
|
28
|
+
end
|
29
|
+
|
30
|
+
# define the arguments that the user will input
|
31
|
+
def arguments(model)
|
32
|
+
args = OpenStudio::Measure::OSArgumentVector.new
|
33
|
+
|
34
|
+
# make an argument for the meter name
|
35
|
+
meter_name = OpenStudio::Measure::OSArgument.makeStringArgument('meter_name', true)
|
36
|
+
meter_name.setDisplayName('Enter Meter Name')
|
37
|
+
meter_name.setDefaultValue('Electricity:Facility')
|
38
|
+
args << meter_name
|
39
|
+
|
40
|
+
# make an argument for the electric tariff
|
41
|
+
reporting_frequency_chs = OpenStudio::StringVector.new
|
42
|
+
reporting_frequency_chs << 'detailed'
|
43
|
+
reporting_frequency_chs << 'timestep'
|
44
|
+
reporting_frequency_chs << 'hourly'
|
45
|
+
reporting_frequency_chs << 'daily'
|
46
|
+
reporting_frequency_chs << 'monthly'
|
47
|
+
reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)
|
48
|
+
reporting_frequency.setDisplayName('Reporting Frequency')
|
49
|
+
reporting_frequency.setDefaultValue('hourly')
|
50
|
+
args << reporting_frequency
|
51
|
+
|
52
|
+
return args
|
53
|
+
end
|
54
|
+
|
55
|
+
# define what happens when the measure is run
|
56
|
+
def run(model, runner, user_arguments)
|
57
|
+
super(model, runner, user_arguments)
|
58
|
+
|
59
|
+
# use the built-in error checking
|
60
|
+
if !runner.validateUserArguments(arguments(model), user_arguments)
|
61
|
+
return false
|
62
|
+
end
|
63
|
+
|
64
|
+
# assign the user inputs to variables
|
65
|
+
meter_name = runner.getStringArgumentValue('meter_name', user_arguments)
|
66
|
+
reporting_frequency = runner.getStringArgumentValue('reporting_frequency', user_arguments)
|
67
|
+
|
68
|
+
# check the user_name for reasonableness
|
69
|
+
if meter_name == ''
|
70
|
+
runner.registerError('No meter name was entered.')
|
71
|
+
return false
|
72
|
+
end
|
73
|
+
|
74
|
+
meters = model.getOutputMeters
|
75
|
+
# reporting initial condition of model
|
76
|
+
runner.registerInitialCondition("The model started with #{meters.size} meter objects.")
|
77
|
+
|
78
|
+
# flag to add meter
|
79
|
+
add_flag = true
|
80
|
+
|
81
|
+
# OpenStudio doesn't seemt to like two meters of the same name, even if they have different reporting frequencies.
|
82
|
+
meters.each do |meter|
|
83
|
+
if meter.name == meter_name
|
84
|
+
runner.registerWarning("A meter named #{meter_name} already exists. One will not be added to the model.")
|
85
|
+
if meter.reportingFrequency != reporting_frequency
|
86
|
+
meter.setReportingFrequency(reporting_frequency)
|
87
|
+
runner.registerInfo("Changing reporting frequency of existing meter to #{reporting_frequency}.")
|
88
|
+
end
|
89
|
+
add_flag = false
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
if add_flag
|
94
|
+
meter = OpenStudio::Model::OutputMeter.new(model)
|
95
|
+
meter.setName(meter_name)
|
96
|
+
meter.setReportingFrequency(reporting_frequency)
|
97
|
+
runner.registerInfo("Adding meter for #{meter.name} reporting #{reporting_frequency}")
|
98
|
+
end
|
99
|
+
|
100
|
+
meters = model.getOutputMeters
|
101
|
+
# reporting final condition of model
|
102
|
+
runner.registerFinalCondition("The model finished with #{meters.size} meter objects.")
|
103
|
+
|
104
|
+
return true
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# this allows the measure to be use by the application
|
109
|
+
UrbanoptCoreTestMeasure.new.registerWithApplication
|
@@ -0,0 +1,117 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<measure>
|
3
|
+
<schema_version>3.1</schema_version>
|
4
|
+
<name>urbanopt_core_test_measure</name>
|
5
|
+
<uid>3e11f20d-88a8-44eb-a951-4f8cf8a09ccd</uid>
|
6
|
+
<version_id>a8297a21-bb02-432c-910e-69222d8fa0f6</version_id>
|
7
|
+
<version_modified>2024-11-08T17:31:22Z</version_modified>
|
8
|
+
<xml_checksum>0CA4D54C</xml_checksum>
|
9
|
+
<class_name>UrbanoptCoreTestMeasure</class_name>
|
10
|
+
<display_name>URBANopt Core Test Measure</display_name>
|
11
|
+
<description>This measure is just a test of Urbanopt Core measure. it adds a meter at the requested reporting frequency.</description>
|
12
|
+
<modeler_description>The measure just passes in the string and does not validate that it is a proper meter name. It is up to the user to know this or to look at the .mdd file from a previous simulation run.</modeler_description>
|
13
|
+
<arguments>
|
14
|
+
<argument>
|
15
|
+
<name>meter_name</name>
|
16
|
+
<display_name>Enter Meter Name</display_name>
|
17
|
+
<type>String</type>
|
18
|
+
<required>true</required>
|
19
|
+
<model_dependent>false</model_dependent>
|
20
|
+
<default_value>Electricity:Facility</default_value>
|
21
|
+
</argument>
|
22
|
+
<argument>
|
23
|
+
<name>reporting_frequency</name>
|
24
|
+
<display_name>Reporting Frequency</display_name>
|
25
|
+
<type>Choice</type>
|
26
|
+
<required>true</required>
|
27
|
+
<model_dependent>false</model_dependent>
|
28
|
+
<default_value>hourly</default_value>
|
29
|
+
<choices>
|
30
|
+
<choice>
|
31
|
+
<value>detailed</value>
|
32
|
+
<display_name>detailed</display_name>
|
33
|
+
</choice>
|
34
|
+
<choice>
|
35
|
+
<value>timestep</value>
|
36
|
+
<display_name>timestep</display_name>
|
37
|
+
</choice>
|
38
|
+
<choice>
|
39
|
+
<value>hourly</value>
|
40
|
+
<display_name>hourly</display_name>
|
41
|
+
</choice>
|
42
|
+
<choice>
|
43
|
+
<value>daily</value>
|
44
|
+
<display_name>daily</display_name>
|
45
|
+
</choice>
|
46
|
+
<choice>
|
47
|
+
<value>monthly</value>
|
48
|
+
<display_name>monthly</display_name>
|
49
|
+
</choice>
|
50
|
+
</choices>
|
51
|
+
</argument>
|
52
|
+
</arguments>
|
53
|
+
<outputs />
|
54
|
+
<provenances />
|
55
|
+
<tags>
|
56
|
+
<tag>Reporting.QAQC</tag>
|
57
|
+
</tags>
|
58
|
+
<attributes>
|
59
|
+
<attribute>
|
60
|
+
<name>Measure Type</name>
|
61
|
+
<value>ModelMeasure</value>
|
62
|
+
<datatype>string</datatype>
|
63
|
+
</attribute>
|
64
|
+
<attribute>
|
65
|
+
<name>Measure Function</name>
|
66
|
+
<value>Measure</value>
|
67
|
+
<datatype>string</datatype>
|
68
|
+
</attribute>
|
69
|
+
<attribute>
|
70
|
+
<name>Requires EnergyPlus Results</name>
|
71
|
+
<value>false</value>
|
72
|
+
<datatype>boolean</datatype>
|
73
|
+
</attribute>
|
74
|
+
<attribute>
|
75
|
+
<name>Uses SketchUp API</name>
|
76
|
+
<value>false</value>
|
77
|
+
<datatype>boolean</datatype>
|
78
|
+
</attribute>
|
79
|
+
</attributes>
|
80
|
+
<files>
|
81
|
+
<file>
|
82
|
+
<filename>LICENSE.md</filename>
|
83
|
+
<filetype>md</filetype>
|
84
|
+
<usage_type>license</usage_type>
|
85
|
+
<checksum>D2F2365A</checksum>
|
86
|
+
</file>
|
87
|
+
<file>
|
88
|
+
<filename>README.md</filename>
|
89
|
+
<filetype>md</filetype>
|
90
|
+
<usage_type>readme</usage_type>
|
91
|
+
<checksum>0EA09A41</checksum>
|
92
|
+
</file>
|
93
|
+
<file>
|
94
|
+
<filename>README.md.erb</filename>
|
95
|
+
<filetype>erb</filetype>
|
96
|
+
<usage_type>readmeerb</usage_type>
|
97
|
+
<checksum>703C9964</checksum>
|
98
|
+
</file>
|
99
|
+
<file>
|
100
|
+
<version>
|
101
|
+
<software_program>OpenStudio</software_program>
|
102
|
+
<identifier>2.0.0</identifier>
|
103
|
+
<min_compatible>2.0.0</min_compatible>
|
104
|
+
</version>
|
105
|
+
<filename>measure.rb</filename>
|
106
|
+
<filetype>rb</filetype>
|
107
|
+
<usage_type>script</usage_type>
|
108
|
+
<checksum>7C4E6482</checksum>
|
109
|
+
</file>
|
110
|
+
<file>
|
111
|
+
<filename>urbanopt_core_test_measure_test.rb</filename>
|
112
|
+
<filetype>rb</filetype>
|
113
|
+
<usage_type>test</usage_type>
|
114
|
+
<checksum>FC45981D</checksum>
|
115
|
+
</file>
|
116
|
+
</files>
|
117
|
+
</measure>
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# *********************************************************************************
|
2
|
+
# URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC.
|
3
|
+
# See also https://github.com/urbanopt/urbanopt-core-gem/blob/develop/LICENSE.md
|
4
|
+
# *********************************************************************************
|
5
|
+
|
6
|
+
require 'openstudio'
|
7
|
+
require 'openstudio/measure/ShowRunnerOutput'
|
8
|
+
require 'fileutils'
|
9
|
+
|
10
|
+
require_relative '../measure'
|
11
|
+
require 'minitest/autorun'
|
12
|
+
|
13
|
+
class UrbanoptCoreTestMeasureTest < Minitest::Test
|
14
|
+
def test_urbanopt_core_test_measure_bad_input
|
15
|
+
# create an instance of the measure
|
16
|
+
measure = UrbanoptCoreTestMeasure.new
|
17
|
+
|
18
|
+
# create an instance of a runner
|
19
|
+
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
|
20
|
+
|
21
|
+
# make an empty model
|
22
|
+
model = OpenStudio::Model::Model.new
|
23
|
+
|
24
|
+
# get arguments and test that they are what we are expecting
|
25
|
+
arguments = measure.arguments(model)
|
26
|
+
assert_equal(2, arguments.size)
|
27
|
+
assert_equal('meter_name', arguments[0].name)
|
28
|
+
assert_equal('reporting_frequency', arguments[1].name)
|
29
|
+
|
30
|
+
# set argument values to bad values and run the measure
|
31
|
+
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
|
32
|
+
meter_name = arguments[0].clone
|
33
|
+
assert(meter_name.setValue(''))
|
34
|
+
argument_map['meter_name'] = meter_name
|
35
|
+
measure.run(model, runner, argument_map)
|
36
|
+
result = runner.result
|
37
|
+
assert(result.value.valueName == 'Fail')
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_urbanopt_core_test_measure_good_input
|
41
|
+
# create an instance of the measure
|
42
|
+
measure = UrbanoptCoreTestMeasure.new
|
43
|
+
|
44
|
+
# create an instance of a runner
|
45
|
+
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
|
46
|
+
|
47
|
+
# make an empty model
|
48
|
+
model = OpenStudio::Model::Model.new
|
49
|
+
|
50
|
+
# get arguments and test that they are what we are expecting
|
51
|
+
arguments = measure.arguments(model)
|
52
|
+
|
53
|
+
# set argument values to good values and run the measure on model with spaces
|
54
|
+
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
|
55
|
+
meter_name = arguments[0].clone
|
56
|
+
assert(meter_name.setValue('JustATest'))
|
57
|
+
argument_map['meter_name'] = meter_name
|
58
|
+
reporting_frequency = arguments[1].clone
|
59
|
+
assert(reporting_frequency.setValue('hourly'))
|
60
|
+
argument_map['reporting_frequency'] = reporting_frequency
|
61
|
+
measure.run(model, runner, argument_map)
|
62
|
+
result = runner.result
|
63
|
+
show_output(result)
|
64
|
+
assert(result.value.valueName == 'Success')
|
65
|
+
assert(result.warnings.empty?)
|
66
|
+
assert(result.info.size == 1)
|
67
|
+
|
68
|
+
# attempt to add a second meter
|
69
|
+
# create an instance of the measure
|
70
|
+
measure = UrbanoptCoreTestMeasure.new
|
71
|
+
|
72
|
+
# create an instance of a runner
|
73
|
+
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
|
74
|
+
|
75
|
+
measure.run(model, runner, argument_map)
|
76
|
+
|
77
|
+
result = runner.result
|
78
|
+
show_output(result)
|
79
|
+
assert(result.value.valueName == 'Success')
|
80
|
+
assert(result.warnings.size == 1)
|
81
|
+
assert(result.info.empty?)
|
82
|
+
end
|
83
|
+
end
|
data/urbanopt-core-gem.gemspec
CHANGED
@@ -19,13 +19,13 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.bindir = 'exe'
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
|
-
|
22
|
+
# We support exactly Ruby v3.2.2 because os-extension requires bundler==2.4.10 and that requires Ruby 3.2.2: https://stdgems.org/bundler/
|
23
|
+
# It would be nice to be able to use newer patches of Ruby 3.2, which would require os-extension to relax its dependency on bundler.
|
24
|
+
spec.required_ruby_version = '3.2.2'
|
23
25
|
|
24
|
-
spec.add_development_dependency '
|
25
|
-
spec.add_development_dependency '
|
26
|
-
spec.add_development_dependency '
|
27
|
-
spec.add_development_dependency 'simplecov', '~> 0.18.2'
|
28
|
-
spec.add_development_dependency 'simplecov-lcov', '~> 0.8.0'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.13'
|
27
|
+
spec.add_development_dependency 'simplecov', '0.22.0'
|
28
|
+
spec.add_development_dependency 'simplecov-lcov', '0.8.0'
|
29
29
|
|
30
|
-
spec.add_dependency 'openstudio-extension', '~> 0.
|
30
|
+
spec.add_dependency 'openstudio-extension', '~> 0.8.3'
|
31
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: urbanopt-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Macumber
|
@@ -9,76 +9,48 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-01-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: bundler
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '2.1'
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - "~>"
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '2.1'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: rake
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - "~>"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '13.0'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '13.0'
|
42
14
|
- !ruby/object:Gem::Dependency
|
43
15
|
name: rspec
|
44
16
|
requirement: !ruby/object:Gem::Requirement
|
45
17
|
requirements:
|
46
18
|
- - "~>"
|
47
19
|
- !ruby/object:Gem::Version
|
48
|
-
version: '3.
|
20
|
+
version: '3.13'
|
49
21
|
type: :development
|
50
22
|
prerelease: false
|
51
23
|
version_requirements: !ruby/object:Gem::Requirement
|
52
24
|
requirements:
|
53
25
|
- - "~>"
|
54
26
|
- !ruby/object:Gem::Version
|
55
|
-
version: '3.
|
27
|
+
version: '3.13'
|
56
28
|
- !ruby/object:Gem::Dependency
|
57
29
|
name: simplecov
|
58
30
|
requirement: !ruby/object:Gem::Requirement
|
59
31
|
requirements:
|
60
|
-
- -
|
32
|
+
- - '='
|
61
33
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.
|
34
|
+
version: 0.22.0
|
63
35
|
type: :development
|
64
36
|
prerelease: false
|
65
37
|
version_requirements: !ruby/object:Gem::Requirement
|
66
38
|
requirements:
|
67
|
-
- -
|
39
|
+
- - '='
|
68
40
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
41
|
+
version: 0.22.0
|
70
42
|
- !ruby/object:Gem::Dependency
|
71
43
|
name: simplecov-lcov
|
72
44
|
requirement: !ruby/object:Gem::Requirement
|
73
45
|
requirements:
|
74
|
-
- -
|
46
|
+
- - '='
|
75
47
|
- !ruby/object:Gem::Version
|
76
48
|
version: 0.8.0
|
77
49
|
type: :development
|
78
50
|
prerelease: false
|
79
51
|
version_requirements: !ruby/object:Gem::Requirement
|
80
52
|
requirements:
|
81
|
-
- -
|
53
|
+
- - '='
|
82
54
|
- !ruby/object:Gem::Version
|
83
55
|
version: 0.8.0
|
84
56
|
- !ruby/object:Gem::Dependency
|
@@ -87,14 +59,14 @@ dependencies:
|
|
87
59
|
requirements:
|
88
60
|
- - "~>"
|
89
61
|
- !ruby/object:Gem::Version
|
90
|
-
version: 0.
|
62
|
+
version: 0.8.3
|
91
63
|
type: :runtime
|
92
64
|
prerelease: false
|
93
65
|
version_requirements: !ruby/object:Gem::Requirement
|
94
66
|
requirements:
|
95
67
|
- - "~>"
|
96
68
|
- !ruby/object:Gem::Version
|
97
|
-
version: 0.
|
69
|
+
version: 0.8.3
|
98
70
|
description: URBANopt core library and measures
|
99
71
|
email:
|
100
72
|
- nicholas.long@nrel.gov
|
@@ -120,6 +92,12 @@ files:
|
|
120
92
|
- doc_templates/copyright_ruby.txt
|
121
93
|
- lib/measures/.gitkeep
|
122
94
|
- lib/measures/.rubocop.yml
|
95
|
+
- lib/measures/urbanopt-core-test-measure/LICENSE.md
|
96
|
+
- lib/measures/urbanopt-core-test-measure/README.md
|
97
|
+
- lib/measures/urbanopt-core-test-measure/README.md.erb
|
98
|
+
- lib/measures/urbanopt-core-test-measure/measure.rb
|
99
|
+
- lib/measures/urbanopt-core-test-measure/measure.xml
|
100
|
+
- lib/measures/urbanopt-core-test-measure/tests/urbanopt_core_test_measure_test.rb
|
123
101
|
- lib/urbanopt/core.rb
|
124
102
|
- lib/urbanopt/core/extension.rb
|
125
103
|
- lib/urbanopt/core/feature.rb
|
@@ -135,16 +113,16 @@ require_paths:
|
|
135
113
|
- lib
|
136
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
137
115
|
requirements:
|
138
|
-
- -
|
116
|
+
- - '='
|
139
117
|
- !ruby/object:Gem::Version
|
140
|
-
version: 2.
|
118
|
+
version: 3.2.2
|
141
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
120
|
requirements:
|
143
121
|
- - ">="
|
144
122
|
- !ruby/object:Gem::Version
|
145
123
|
version: '0'
|
146
124
|
requirements: []
|
147
|
-
rubygems_version: 3.
|
125
|
+
rubygems_version: 3.4.10
|
148
126
|
signing_key:
|
149
127
|
specification_version: 4
|
150
128
|
summary: URBANopt core library and measures
|