openstudio-analysis 1.3.2 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -4
- data/LICENSE.md +7 -22
- data/README.md +4 -5
- data/Rakefile +2 -32
- data/lib/openstudio/analysis/algorithm_attributes.rb +2 -32
- data/lib/openstudio/analysis/formulation.rb +163 -55
- data/lib/openstudio/analysis/server_api.rb +2 -32
- data/lib/openstudio/analysis/server_scripts.rb +2 -32
- data/lib/openstudio/analysis/support_files.rb +2 -32
- data/lib/openstudio/analysis/translator/datapoints.rb +2 -32
- data/lib/openstudio/analysis/translator/excel.rb +2 -32
- data/lib/openstudio/analysis/translator/workflow.rb +2 -32
- data/lib/openstudio/analysis/version.rb +3 -33
- data/lib/openstudio/analysis/workflow.rb +2 -32
- data/lib/openstudio/analysis/workflow_step.rb +12 -35
- data/lib/openstudio/analysis.rb +2 -32
- data/lib/openstudio/helpers/hash.rb +2 -32
- data/lib/openstudio/helpers/string.rb +2 -32
- data/lib/openstudio/helpers/utils.rb +2 -32
- data/lib/openstudio/weather/epw.rb +2 -32
- data/lib/openstudio-analysis.rb +2 -32
- data/update_license.rb +7 -67
- 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: 910d9bf7e03884f0d18b769fbcf5bb348438fffa4de56590540679f5b193c848
|
4
|
+
data.tar.gz: 702c4692f6ce7c4297965d6b60854657341e92f3efcf5b8ebbe312ae8cb73646
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac4e0cd24adb96e06a35fc463b5588ac2f40c28e6b39e652c74351b63def71549e5f4a7859060d2f403c31c54a2d3275046f1353cc0f3d256d44aa9d5ec5f62e
|
7
|
+
data.tar.gz: 7bdeefad3522338a73d725d10bc853b7e7a114657a3bd237a061e77eecb299b1b59d09fbbbe92eff76f507fd07bbde4bd7e6701f070ee6dd8ea2115d5ccb3d5a
|
data/CHANGELOG.md
CHANGED
@@ -1,17 +1,40 @@
|
|
1
|
-
OpenStudio Analysis Gem Change Log
|
1
|
+
OpenStudio(R) Analysis Gem Change Log
|
2
2
|
==================================
|
3
3
|
|
4
|
+
Version 1.3.4
|
5
|
+
-------------
|
6
|
+
* Update licenses
|
7
|
+
* Add download_zip, download_osm, download_osw, download_reports attributes to OSA
|
8
|
+
* Add cli_verbose, cli_debug, initialize_worker_timeout, run_workflow_timeout, upload_results_timeout attributes to OSA
|
9
|
+
|
10
|
+
Version 1.3.3
|
11
|
+
-------------
|
12
|
+
* Add arguments to .save_osa_zip() to add all files in weather and/or seed directories to zip file. defaults to false.
|
13
|
+
|
4
14
|
Version 1.3.2
|
5
15
|
-------------
|
6
|
-
* Add
|
16
|
+
* Add array of search paths to .convert_osw() to find measures in various directories.
|
17
|
+
* warn if :weather_file and :seed_model are not defined.
|
18
|
+
* use :file_paths in the OSW to search for :seed_model and :weather_file.
|
19
|
+
* add .stat and .ddy files to analysis.zip if in same directory as .epw defined in :weather_file.
|
20
|
+
* use :measure_paths in OSW to search for measures.
|
7
21
|
|
8
22
|
Version 1.3.1
|
9
23
|
-------------
|
10
|
-
* Add method to delete a Variable
|
24
|
+
* Add method to delete a Variable: **analysis.remove_variable()**
|
25
|
+
* fix bug related to multiple calls to analysis.to_hash deleting variables
|
26
|
+
* Add PSO and Optim to allowed algorithms
|
11
27
|
|
12
28
|
Version 1.3.0
|
13
29
|
-------------
|
14
|
-
* Create an OSA from an OSW
|
30
|
+
* Create an OSA from an OSW: **analysis.convert_osw()**
|
31
|
+
* Add output variables and objective functions: **analysis.add_output()**
|
32
|
+
* Add server initialization and finalization scripts: **analysis.server_scripts.add()**
|
33
|
+
* Set algorithm attributes: **analysis.algorithm.set_attribute()**
|
34
|
+
* Set algorithm type: **analysis.analysis_type()**
|
35
|
+
* Add additional library/data files: **analysis.libraries.add()**
|
36
|
+
* create analysis.json: **File.write('analysis.json',JSON.pretty_generate(analysis.to_hash))**
|
37
|
+
* create analysis.zip: **analysis.save_osa_zip('analysis.zip')**
|
15
38
|
|
16
39
|
Version 1.2.0
|
17
40
|
-------------
|
data/LICENSE.md
CHANGED
@@ -1,28 +1,13 @@
|
|
1
|
-
OpenStudio(R), Copyright (c) 2008
|
1
|
+
OpenStudio(R), Copyright (c) 2008, 2023 Alliance for Sustainable Energy, LLC.
|
2
2
|
|
3
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
4
|
-
that the following conditions are met:
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
5
4
|
|
6
|
-
|
7
|
-
the following disclaimer.
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
8
6
|
|
9
|
-
|
10
|
-
the following disclaimer in the documentation and/or other materials provided with the distribution.
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
11
8
|
|
12
|
-
|
13
|
-
promote products derived from this software without specific prior written permission from the respective
|
14
|
-
party.
|
9
|
+
3. Redistribution of this software, without modification, must refer to the software by the same designation. Redistribution of a modified version of this software (i) may not refer to the modified version by the same designation, or by any confusingly similar designation, and (ii) must refer to the underlying software originally provided by Alliance as “OpenStudio®”. Except to comply with the foregoing, the term “OpenStudio®”, or any confusingly similar designation may not be used to refer to any modified version of this software or any modified version of the underlying software originally provided by Alliance without the prior written consent of Alliance.
|
15
10
|
|
16
|
-
|
17
|
-
derivative works may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar
|
18
|
-
designation without specific prior written permission from Alliance for Sustainable Energy, LLC.
|
11
|
+
4. The name of the copyright holder(s), any contributors, the United States Government, the United States Department of Energy, or any of their employees may not be used to endorse or promote products derived from this software without specific prior written permission from the respective party.
|
19
12
|
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
21
|
-
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
22
|
-
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED
|
23
|
-
STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY
|
24
|
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
25
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
26
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
27
|
-
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
28
|
-
DAMAGE.
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
CHANGED
@@ -1,16 +1,15 @@
|
|
1
|
-
# OpenStudio Analysis Gem
|
1
|
+
# OpenStudio(R) Analysis Gem
|
2
2
|
|
3
3
|
[![Build Status](https://github.com/NREL/OpenStudio-analysis-gem/actions/workflows/openstudio-analysis.yml/badge.svg?branch=develop)](https://github.com/NREL/OpenStudio-analysis-gem/actions/workflows/openstudio-analysis.yml)
|
4
4
|
[![Coverage Status](https://coveralls.io/repos/NREL/OpenStudio-analysis-gem/badge.svg?branch=develop)](https://coveralls.io/r/NREL/OpenStudio-analysis-gem?branch=develop)
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/openstudio-analysis.svg)](https://badge.fury.io/rb/openstudio-analysis)
|
6
6
|
|
7
|
-
The OpenStudio Analysis Gem is used to communicate files to the OpenStudio
|
7
|
+
The OpenStudio Analysis Gem is used to communicate files to the [OpenStudio Analysis Framework](https://www.tandfonline.com/doi/full/10.1080/19401493.2020.1778788).
|
8
8
|
|
9
|
-
The purpose of this gem is to generate the analysis.json file, analysis.zip, and communicate with the server to upload
|
9
|
+
The purpose of this gem is to generate the analysis.json file, analysis.zip, convert an OSW to an OSA, and communicate with the server to upload
|
10
10
|
the simulations.
|
11
11
|
|
12
|
-
This gem does not create the cluster.
|
13
|
-
Amazon AWS using either [OpenStudio's PAT](https://openstudio.nrel.gov) the [openstudio-aws gem](https://rubygems.org/gems/openstudio-aws) or using [vagrant](http://www.vagrantup.com/).
|
12
|
+
This gem does not create the cluster. To manage cloud resources use the [OpenStudio Analysis Framework Helm Charts](https://github.com/NREL/openstudio-server-helm).
|
14
13
|
|
15
14
|
## Instructions
|
16
15
|
|
data/Rakefile
CHANGED
@@ -1,36 +1,6 @@
|
|
1
1
|
# *******************************************************************************
|
2
|
-
# OpenStudio(R), Copyright (c)
|
3
|
-
#
|
4
|
-
# Redistribution and use in source and binary forms, with or without
|
5
|
-
# modification, are permitted provided that the following conditions are met:
|
6
|
-
#
|
7
|
-
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
-
# this list of conditions and the following disclaimer.
|
9
|
-
#
|
10
|
-
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
-
# this list of conditions and the following disclaimer in the documentation
|
12
|
-
# and/or other materials provided with the distribution.
|
13
|
-
#
|
14
|
-
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
-
# may be used to endorse or promote products derived from this software without
|
16
|
-
# specific prior written permission from the respective party.
|
17
|
-
#
|
18
|
-
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
-
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
-
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
-
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
-
#
|
23
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
27
|
-
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
28
|
-
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
29
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
30
|
-
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
31
|
-
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
32
|
-
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
33
|
-
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2
|
+
# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
|
3
|
+
# See also https://openstudio.net/license
|
34
4
|
# *******************************************************************************
|
35
5
|
|
36
6
|
require 'bundler'
|
@@ -1,36 +1,6 @@
|
|
1
1
|
# *******************************************************************************
|
2
|
-
# OpenStudio(R), Copyright (c)
|
3
|
-
#
|
4
|
-
# Redistribution and use in source and binary forms, with or without
|
5
|
-
# modification, are permitted provided that the following conditions are met:
|
6
|
-
#
|
7
|
-
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
-
# this list of conditions and the following disclaimer.
|
9
|
-
#
|
10
|
-
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
-
# this list of conditions and the following disclaimer in the documentation
|
12
|
-
# and/or other materials provided with the distribution.
|
13
|
-
#
|
14
|
-
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
-
# may be used to endorse or promote products derived from this software without
|
16
|
-
# specific prior written permission from the respective party.
|
17
|
-
#
|
18
|
-
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
-
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
-
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
-
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
-
#
|
23
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
27
|
-
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
28
|
-
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
29
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
30
|
-
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
31
|
-
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
32
|
-
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
33
|
-
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2
|
+
# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
|
3
|
+
# See also https://openstudio.net/license
|
34
4
|
# *******************************************************************************
|
35
5
|
|
36
6
|
# OpenStudio::Analysis::Algorithm define the algorithm parameters. The module and class names start to conflict
|
@@ -1,36 +1,6 @@
|
|
1
1
|
# *******************************************************************************
|
2
|
-
# OpenStudio(R), Copyright (c)
|
3
|
-
#
|
4
|
-
# Redistribution and use in source and binary forms, with or without
|
5
|
-
# modification, are permitted provided that the following conditions are met:
|
6
|
-
#
|
7
|
-
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
-
# this list of conditions and the following disclaimer.
|
9
|
-
#
|
10
|
-
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
-
# this list of conditions and the following disclaimer in the documentation
|
12
|
-
# and/or other materials provided with the distribution.
|
13
|
-
#
|
14
|
-
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
-
# may be used to endorse or promote products derived from this software without
|
16
|
-
# specific prior written permission from the respective party.
|
17
|
-
#
|
18
|
-
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
-
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
-
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
-
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
-
#
|
23
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
27
|
-
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
28
|
-
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
29
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
30
|
-
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
31
|
-
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
32
|
-
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
33
|
-
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2
|
+
# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
|
3
|
+
# See also https://openstudio.net/license
|
34
4
|
# *******************************************************************************
|
35
5
|
|
36
6
|
# OpenStudio formulation class handles the generation of the OpenStudio Analysis format.
|
@@ -59,6 +29,15 @@ module OpenStudio
|
|
59
29
|
attr_accessor :workflow
|
60
30
|
attr_accessor :algorithm
|
61
31
|
attr_accessor :osw_path
|
32
|
+
attr_accessor :download_zip
|
33
|
+
attr_accessor :download_reports
|
34
|
+
attr_accessor :download_osw
|
35
|
+
attr_accessor :download_osm
|
36
|
+
attr_accessor :cli_debug
|
37
|
+
attr_accessor :cli_verbose
|
38
|
+
attr_accessor :initialize_worker_timeout
|
39
|
+
attr_accessor :run_workflow_timeout
|
40
|
+
attr_accessor :upload_results_timeout
|
62
41
|
|
63
42
|
# the attributes below are used for packaging data into the analysis zip file
|
64
43
|
attr_reader :weather_files
|
@@ -81,6 +60,15 @@ module OpenStudio
|
|
81
60
|
@weather_file = WeatherFile.new
|
82
61
|
@seed_model = SeedModel.new
|
83
62
|
@algorithm = OpenStudio::Analysis::AlgorithmAttributes.new
|
63
|
+
@download_zip = true
|
64
|
+
@download_reports = true
|
65
|
+
@download_osw = true
|
66
|
+
@download_osm = true
|
67
|
+
@cli_debug = "--debug"
|
68
|
+
@cli_verbose = "--verbose"
|
69
|
+
@initialize_worker_timeout = 28800
|
70
|
+
@run_workflow_timeout = 28800
|
71
|
+
@upload_results_timeout = 28800
|
84
72
|
|
85
73
|
# Analysis Zip attributes
|
86
74
|
@weather_files = SupportFiles.new
|
@@ -120,6 +108,97 @@ module OpenStudio
|
|
120
108
|
@weather_file[:file] = file
|
121
109
|
end
|
122
110
|
|
111
|
+
# Set the value for 'download_zip'
|
112
|
+
#
|
113
|
+
# @param value [Boolean] The value for 'download_zip'
|
114
|
+
def download_zip=(value)
|
115
|
+
if [true, false].include?(value)
|
116
|
+
@download_zip = value
|
117
|
+
else
|
118
|
+
raise ArgumentError, "Invalid value for 'download_zip'. Only true or false allowed."
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Set the value for 'download_reports'
|
123
|
+
#
|
124
|
+
# @param value [Boolean] The value for 'download_reports'
|
125
|
+
def download_reports=(value)
|
126
|
+
if [true, false].include?(value)
|
127
|
+
@download_reports = value
|
128
|
+
else
|
129
|
+
raise ArgumentError, "Invalid value for 'download_reports'. Only true or false allowed."
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# Set the value for 'download_osw'
|
134
|
+
#
|
135
|
+
# @param value [Boolean] The value for 'download_osw'
|
136
|
+
def download_osw=(value)
|
137
|
+
if [true, false].include?(value)
|
138
|
+
@download_osw = value
|
139
|
+
else
|
140
|
+
raise ArgumentError, "Invalid value for 'download_osw'. Only true or false allowed."
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# Set the value for 'download_osm'
|
145
|
+
#
|
146
|
+
# @param value [Boolean] The value for 'download_osm'
|
147
|
+
def download_osm=(value)
|
148
|
+
if [true, false].include?(value)
|
149
|
+
@download_osm = value
|
150
|
+
else
|
151
|
+
raise ArgumentError, "Invalid value for 'download_osm'. Only true or false allowed."
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# Set the value for 'cli_debug'
|
156
|
+
#
|
157
|
+
# @param value [Boolean] The value for 'cli_debug'
|
158
|
+
def cli_debug=(value)
|
159
|
+
@cli_debug = value
|
160
|
+
end
|
161
|
+
|
162
|
+
# Set the value for 'cli_verbose'
|
163
|
+
#
|
164
|
+
# @param value [Boolean] The value for 'cli_verbose'
|
165
|
+
def cli_verbose=(value)
|
166
|
+
@cli_verbose = value
|
167
|
+
end
|
168
|
+
|
169
|
+
# Set the value for 'run_workflow_timeout'
|
170
|
+
#
|
171
|
+
# @param value [Integer] The value for 'run_workflow_timeout'
|
172
|
+
def run_workflow_timeout=(value)
|
173
|
+
if value.is_a?(Integer)
|
174
|
+
@run_workflow_timeout = value
|
175
|
+
else
|
176
|
+
raise ArgumentError, "Invalid value for 'run_workflow_timeout'. Only integer values allowed."
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Set the value for 'initialize_worker_timeout'
|
181
|
+
#
|
182
|
+
# @param value [Integer] The value for 'initialize_worker_timeout'
|
183
|
+
def initialize_worker_timeout=(value)
|
184
|
+
if value.is_a?(Integer)
|
185
|
+
@initialize_worker_timeout = value
|
186
|
+
else
|
187
|
+
raise ArgumentError, "Invalid value for 'initialize_worker_timeout'. Only integer values allowed."
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Set the value for 'upload_results_timeout'
|
192
|
+
#
|
193
|
+
# @param value [Integer] The value for 'upload_results_timeout'
|
194
|
+
def upload_results_timeout=(value)
|
195
|
+
if value.is_a?(Integer)
|
196
|
+
@upload_results_timeout = value
|
197
|
+
else
|
198
|
+
raise ArgumentError, "Invalid value for 'upload_results_timeout'. Only integer values allowed."
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
123
202
|
# Add an output of interest to the problem formulation
|
124
203
|
#
|
125
204
|
# @param output_hash [Hash] Hash of the output variable in the legacy format
|
@@ -233,11 +312,16 @@ module OpenStudio
|
|
233
312
|
end
|
234
313
|
|
235
314
|
h[:analysis][:file_format_version] = version
|
236
|
-
h[:analysis][:cli_debug] =
|
237
|
-
h[:analysis][:cli_verbose] =
|
238
|
-
h[:analysis][:run_workflow_timeout] =
|
239
|
-
h[:analysis][:upload_results_timeout] =
|
240
|
-
h[:analysis][:initialize_worker_timeout] =
|
315
|
+
h[:analysis][:cli_debug] = @cli_debug
|
316
|
+
h[:analysis][:cli_verbose] = @cli_verbose
|
317
|
+
h[:analysis][:run_workflow_timeout] = @run_workflow_timeout
|
318
|
+
h[:analysis][:upload_results_timeout] = @upload_results_timeout
|
319
|
+
h[:analysis][:initialize_worker_timeout] = @initialize_worker_timeout
|
320
|
+
h[:analysis][:download_zip] = @download_zip
|
321
|
+
h[:analysis][:download_reports] = @download_reports
|
322
|
+
h[:analysis][:download_osw] = @download_osw
|
323
|
+
h[:analysis][:download_osm] = @download_osm
|
324
|
+
|
241
325
|
#-BLB I dont think this does anything. server_scripts are run if they are in
|
242
326
|
#the /scripts/analysis or /scripts/data_point directories
|
243
327
|
#but nothing is ever checked in the OSA.
|
@@ -351,12 +435,12 @@ module OpenStudio
|
|
351
435
|
end
|
352
436
|
|
353
437
|
|
354
|
-
def save_osa_zip(filename)
|
438
|
+
def save_osa_zip(filename, all_weather_files = false, all_seed_files = false)
|
355
439
|
filename += '.zip' if File.extname(filename) == ''
|
356
440
|
|
357
441
|
FileUtils.mkdir_p File.dirname(filename) unless Dir.exist? File.dirname(filename)
|
358
442
|
|
359
|
-
save_analysis_zip_osa(filename)
|
443
|
+
save_analysis_zip_osa(filename, all_weather_files, all_seed_files)
|
360
444
|
end
|
361
445
|
|
362
446
|
# convert an OSW to an OSA
|
@@ -487,12 +571,11 @@ module OpenStudio
|
|
487
571
|
# New format for OSAs. Package up the seed, weather files, and measures
|
488
572
|
# filename is the name of the file to be saved. ex: analysis.zip
|
489
573
|
# it will parse the OSA and zip up all the files defined in the workflow
|
490
|
-
def save_analysis_zip_osa(filename)
|
574
|
+
def save_analysis_zip_osa(filename, all_weather_files = false, all_seed_files = false)
|
491
575
|
def add_directory_to_zip_osa(zipfile, local_directory, relative_zip_directory)
|
492
576
|
puts "Add Directory #{local_directory}"
|
493
577
|
Dir[File.join(local_directory.to_s, '**', '**')].each do |file|
|
494
578
|
puts "Adding File #{file}"
|
495
|
-
|
496
579
|
zipfile.add(file.sub(local_directory, relative_zip_directory), file)
|
497
580
|
end
|
498
581
|
zipfile
|
@@ -503,27 +586,30 @@ module OpenStudio
|
|
503
586
|
puts "osw_path: #{@osw_path}"
|
504
587
|
osw_full_path = File.dirname(File.expand_path(@osw_path))
|
505
588
|
puts "osw_full_path: #{osw_full_path}"
|
506
|
-
|
589
|
+
|
507
590
|
Zip::File.open(filename, create: true) do |zf|
|
508
|
-
|
591
|
+
## Weather files
|
509
592
|
puts 'Adding Support Files: Weather'
|
510
|
-
#check if weather file exists. use abs path. remove leading ./ from @weather_file path if there.
|
511
|
-
#check if path is already absolute
|
593
|
+
# check if weather file exists. use abs path. remove leading ./ from @weather_file path if there.
|
594
|
+
# check if path is already absolute
|
512
595
|
if @weather_file[:file]
|
513
596
|
if File.exists?(@weather_file[:file])
|
514
597
|
puts " Adding #{@weather_file[:file]}"
|
515
598
|
#zf.add("weather/#{File.basename(@weather_file[:file])}", @weather_file[:file])
|
516
599
|
base_name = File.basename(@weather_file[:file], ".*")
|
517
600
|
puts "base_name: #{base_name}"
|
518
|
-
#convert backslash on windows to forward slash so Dir.glob will work (in case user uses \)
|
601
|
+
# convert backslash on windows to forward slash so Dir.glob will work (in case user uses \)
|
519
602
|
weather_dirname = File.dirname(@weather_file[:file]).gsub("\\", "/")
|
520
603
|
puts "weather_dirname: #{weather_dirname}"
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
604
|
+
# If all_weather_files is true, add all files in the directory to the zip.
|
605
|
+
# Otherwise, add only files that match the base name.
|
606
|
+
file_pattern = all_weather_files ? "*" : "#{base_name}.*"
|
607
|
+
Dir.glob(File.join(weather_dirname, file_pattern)) do |file_path|
|
608
|
+
puts "file_path: #{file_path}"
|
609
|
+
puts "zip path: weather/#{File.basename(file_path)}"
|
610
|
+
zf.add("weather/#{File.basename(file_path)}", file_path)
|
611
|
+
end
|
612
|
+
# make absolute path and check for file
|
527
613
|
elsif File.exists?(File.join(osw_full_path,@weather_file[:file].sub(/^\.\//, '')))
|
528
614
|
puts " Adding: #{File.join(osw_full_path,@weather_file[:file].sub(/^\.\//, ''))}"
|
529
615
|
#zf.add("weather/#{File.basename(@weather_file[:file])}", File.join(osw_full_path,@weather_file[:file].sub(/^\.\//, '')))
|
@@ -531,7 +617,8 @@ module OpenStudio
|
|
531
617
|
puts "base_name2: #{base_name}"
|
532
618
|
weather_dirname = File.dirname(File.join(osw_full_path,@weather_file[:file].sub(/^\.\//, ''))).gsub("\\", "/")
|
533
619
|
puts "weather_dirname: #{weather_dirname}"
|
534
|
-
|
620
|
+
file_pattern = all_weather_files ? "*" : "#{base_name}.*"
|
621
|
+
Dir.glob(File.join(weather_dirname, file_pattern)) do |file_path|
|
535
622
|
puts "file_path2: #{file_path}"
|
536
623
|
puts "zip path2: weather/#{File.basename(file_path)}"
|
537
624
|
zf.add("weather/#{File.basename(file_path)}", file_path)
|
@@ -541,7 +628,7 @@ module OpenStudio
|
|
541
628
|
end
|
542
629
|
else
|
543
630
|
warn "weather_file[:file] is not defined"
|
544
|
-
end
|
631
|
+
end
|
545
632
|
|
546
633
|
## Seed files
|
547
634
|
puts 'Adding Support Files: Seed Models'
|
@@ -551,16 +638,37 @@ module OpenStudio
|
|
551
638
|
if File.exists?(@seed_model[:file])
|
552
639
|
puts " Adding #{@seed_model[:file]}"
|
553
640
|
zf.add("seeds/#{File.basename(@seed_model[:file])}", @seed_model[:file])
|
641
|
+
if all_seed_files
|
642
|
+
seed_dirname = File.dirname(@seed_model[:file]).gsub("\\", "/")
|
643
|
+
puts "seed_dirname: #{seed_dirname}"
|
644
|
+
Dir.glob(File.join(seed_dirname, '*')) do |file_path|
|
645
|
+
next if file_path == @seed_model[:file] # Skip if the file is the same as @seed_model[:file] so not added twice
|
646
|
+
puts "file_path: #{file_path}"
|
647
|
+
puts "zip path: seeds/#{File.basename(file_path)}"
|
648
|
+
zf.add("seeds/#{File.basename(file_path)}", file_path)
|
649
|
+
end
|
650
|
+
end
|
554
651
|
#make absolute path and check for file
|
555
652
|
elsif File.exists?(File.join(osw_full_path,@seed_model[:file].sub(/^\.\//, '')))
|
556
653
|
puts " Adding #{File.join(osw_full_path,@seed_model[:file].sub(/^\.\//, ''))}"
|
557
654
|
zf.add("seeds/#{File.basename(@seed_model[:file])}", File.join(osw_full_path,@seed_model[:file].sub(/^\.\//, '')))
|
655
|
+
if all_seed_files
|
656
|
+
seed_dirname = File.dirname(File.join(osw_full_path,@seed_model[:file].sub(/^\.\//, ''))).gsub("\\", "/")
|
657
|
+
puts "seed_dirname: #{seed_dirname}"
|
658
|
+
Dir.glob(File.join(seed_dirname, '*')) do |file_path|
|
659
|
+
next if file_path == File.join(osw_full_path,@seed_model[:file].sub(/^\.\//, '')) # Skip if the file is the same as @seed_model[:file] so not added twice
|
660
|
+
puts "file_path: #{file_path}"
|
661
|
+
puts "zip path: seeds/#{File.basename(file_path)}"
|
662
|
+
zf.add("seeds/#{File.basename(file_path)}", file_path)
|
663
|
+
end
|
664
|
+
end
|
558
665
|
else
|
559
666
|
raise "seed_file[:file] does not exist at: #{File.join(osw_full_path,@seed_model[:file].sub(/^\.\//, ''))}"
|
560
667
|
end
|
561
668
|
else
|
562
669
|
warn "seed_file[:file] is not defined"
|
563
|
-
end
|
670
|
+
end
|
671
|
+
|
564
672
|
puts 'Adding Support Files: Libraries'
|
565
673
|
@libraries.each do |lib|
|
566
674
|
raise "Libraries must specify their 'library_name' as metadata which becomes the directory upon zip" unless lib[:metadata][:library_name]
|
@@ -1,36 +1,6 @@
|
|
1
1
|
# *******************************************************************************
|
2
|
-
# OpenStudio(R), Copyright (c)
|
3
|
-
#
|
4
|
-
# Redistribution and use in source and binary forms, with or without
|
5
|
-
# modification, are permitted provided that the following conditions are met:
|
6
|
-
#
|
7
|
-
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
-
# this list of conditions and the following disclaimer.
|
9
|
-
#
|
10
|
-
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
-
# this list of conditions and the following disclaimer in the documentation
|
12
|
-
# and/or other materials provided with the distribution.
|
13
|
-
#
|
14
|
-
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
-
# may be used to endorse or promote products derived from this software without
|
16
|
-
# specific prior written permission from the respective party.
|
17
|
-
#
|
18
|
-
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
-
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
-
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
-
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
-
#
|
23
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
27
|
-
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
28
|
-
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
29
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
30
|
-
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
31
|
-
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
32
|
-
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
33
|
-
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2
|
+
# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
|
3
|
+
# See also https://openstudio.net/license
|
34
4
|
# *******************************************************************************
|
35
5
|
|
36
6
|
# Class manages the communication with the server.
|
@@ -1,36 +1,6 @@
|
|
1
1
|
# *******************************************************************************
|
2
|
-
# OpenStudio(R), Copyright (c)
|
3
|
-
#
|
4
|
-
# Redistribution and use in source and binary forms, with or without
|
5
|
-
# modification, are permitted provided that the following conditions are met:
|
6
|
-
#
|
7
|
-
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
-
# this list of conditions and the following disclaimer.
|
9
|
-
#
|
10
|
-
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
-
# this list of conditions and the following disclaimer in the documentation
|
12
|
-
# and/or other materials provided with the distribution.
|
13
|
-
#
|
14
|
-
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
-
# may be used to endorse or promote products derived from this software without
|
16
|
-
# specific prior written permission from the respective party.
|
17
|
-
#
|
18
|
-
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
-
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
-
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
-
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
-
#
|
23
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
27
|
-
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
28
|
-
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
29
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
30
|
-
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
31
|
-
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
32
|
-
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
33
|
-
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2
|
+
# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
|
3
|
+
# See also https://openstudio.net/license
|
34
4
|
# *******************************************************************************
|
35
5
|
|
36
6
|
# OpenStudio::Analysis::ServerScripts is a container to hold the analysis and data_point server scripts.
|
@@ -1,36 +1,6 @@
|
|
1
1
|
# *******************************************************************************
|
2
|
-
# OpenStudio(R), Copyright (c)
|
3
|
-
#
|
4
|
-
# Redistribution and use in source and binary forms, with or without
|
5
|
-
# modification, are permitted provided that the following conditions are met:
|
6
|
-
#
|
7
|
-
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
-
# this list of conditions and the following disclaimer.
|
9
|
-
#
|
10
|
-
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
-
# this list of conditions and the following disclaimer in the documentation
|
12
|
-
# and/or other materials provided with the distribution.
|
13
|
-
#
|
14
|
-
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
-
# may be used to endorse or promote products derived from this software without
|
16
|
-
# specific prior written permission from the respective party.
|
17
|
-
#
|
18
|
-
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
-
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
-
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
-
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
-
#
|
23
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
27
|
-
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
28
|
-
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
29
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
30
|
-
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
31
|
-
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
32
|
-
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
33
|
-
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2
|
+
# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
|
3
|
+
# See also https://openstudio.net/license
|
34
4
|
# *******************************************************************************
|
35
5
|
|
36
6
|
# OpenStudio::Analysis::SupportFiles is a container to hold other analysis files that may need to be packaged.
|