honeybee-openstudio 2.34.8 → 2.35.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: badea0be05124c62097e7732560433b8a1d8941aecc21af3e9ab8f2e7b19b837
4
- data.tar.gz: 53ddac62aaffe8a76f01ac3f8bf02f0b167dca4fc0aa3b509c6b11e3d6181fec
3
+ metadata.gz: 8253cfd61ddf3f1e838d50f9c72d650e4373b3b19347f9975f2efe48c1ed81b9
4
+ data.tar.gz: 9d862528a0f8dd57a82964aa50e897096e03dbbc7d3d0ccadcde6bc7e3d4a7c8
5
5
  SHA512:
6
- metadata.gz: 98558f65b918299e64548cb37ff75d2a9042970ccf64cb9ece29a7b772645e06d59a1e3ba212948ef312873c72d7a721d9066212d0947248905285e9bf5cb34d
7
- data.tar.gz: 901a6c78784757090e5873f282bdfc870de96c4cbe96d061ac8c80831431f51432fb79f3c8f5ae8e258b5c0904b878312e443a0a8d28eb41e2bd290dc09fbf02
6
+ metadata.gz: ee63cd76ff125f23eada0492a8fe65ddfa6e07a550fdb8683b9595ff3024f48a9526a891be463d0ae4ad1fd96f3385ff00b748deda58041340783f469553a186
7
+ data.tar.gz: ac10d61f84602af26558f4a2091cee8200ba1c2be0330cf0ac114035439dc8b6729eee52c9457afed7af2de1102eff23571dfbf3b82558dc214f567e313e2e57
@@ -15,8 +15,8 @@ jobs:
15
15
  run: |
16
16
  echo $(pwd)
17
17
  echo $(ls)
18
- docker pull nrel/openstudio:3.5.0
19
- docker run --name test --rm -d -t -v $(pwd):/work -w /work nrel/openstudio:3.5.0
18
+ docker pull nrel/openstudio:3.6.1
19
+ docker run --name test --rm -d -t -v $(pwd):/work -w /work nrel/openstudio:3.6.1
20
20
  docker exec -t test pwd
21
21
  docker exec -t test ls
22
22
  docker exec -t test bundle update
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'honeybee-openstudio'
7
- spec.version = '2.34.8'
7
+ spec.version = '2.35.0'
8
8
  spec.authors = ['Tanushree Charan', 'Dan Macumber', 'Chris Mackey', 'Mostapha Sadeghipour Roudsari']
9
9
  spec.email = ['tanushree.charan@nrel.gov', 'chris@ladybug.tools']
10
10
 
@@ -25,14 +25,14 @@ Gem::Specification.new do |spec|
25
25
  spec.required_ruby_version = "~> 2.7.0"
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 2.1"
28
- spec.add_development_dependency "public_suffix", "~> 3.1.1"
29
- spec.add_development_dependency "json-schema", "~> 2.8.1"
30
- spec.add_development_dependency "rake", "~> 13.0"
28
+ spec.add_development_dependency "public_suffix", "~> 5.0.3"
29
+ spec.add_development_dependency "json-schema", "~> 2.7.0"
30
+ spec.add_development_dependency "rake", "~> 13.0.6"
31
31
  spec.add_development_dependency "rspec", "~> 3.9"
32
32
  spec.add_development_dependency "rubocop", "~> 1.15.0"
33
33
  end
34
34
 
35
35
  spec.add_dependency 'json_pure'
36
36
  spec.add_dependency 'openstudio-extension', '0.6.1'
37
- spec.add_dependency 'openstudio-standards', '~> 0.3.0'
37
+ spec.add_dependency 'openstudio-standards', '~> 0.4.0'
38
38
  end
@@ -11,30 +11,30 @@ gem 'builder', '3.2.4'
11
11
  gem 'docile', '1.4.0'
12
12
  gem 'faraday', '1.0.1'
13
13
  gem 'git', '1.12.0'
14
- gem 'json-schema', '2.8.1'
14
+ gem 'json-schema', '2.7.0'
15
15
  gem 'json_pure', '2.6.3'
16
16
  gem 'macaddr', '1.7.2'
17
17
  gem 'minitar', '0.9'
18
+ gem 'minitest', '5.14.4'
19
+ gem 'minitest-reporters', '1.4.3'
18
20
  gem 'multipart-post', '2.3.0'
19
21
  gem 'octokit', '4.18.0'
20
- gem 'openstudio-calibration', '0.7.0'
21
- gem 'openstudio-common-measures', '0.7.0'
22
- gem 'openstudio-ee', '0.7.0'
23
- gem 'openstudio-extension', '0.6.0'
24
- gem 'openstudio-geb', '0.2.1'
25
- gem 'openstudio-load-flexibility-measures', '0.6.1'
22
+ gem 'openstudio-calibration', '0.8.0'
23
+ gem 'openstudio-common-measures', '0.8.0'
24
+ gem 'openstudio-ee', '0.8.0'
25
+ gem 'openstudio-extension', '0.6.1'
26
+ gem 'openstudio-geb', '0.3.2'
27
+ gem 'openstudio-load-flexibility-measures', '0.7.0'
26
28
  gem 'openstudio_measure_tester', '0.3.2'
27
- gem 'openstudio-model-articulation', '0.7.0'
28
- gem 'openstudio-standards', '0.3.0'
29
+ gem 'openstudio-model-articulation', '0.8.0'
30
+ gem 'openstudio-standards', '0.4.0'
29
31
  gem 'openstudio-workflow', '2.3.1'
30
32
  gem 'parallel', '1.19.2'
31
33
  gem 'parser', '3.2.2.2'
32
- gem 'public_suffix', '5.0.1'
33
- gem 'minitest', '5.14.4'
34
- gem 'minitest-reporters', '1.4.3'
35
- gem 'rchardet', '1.8.0'
36
- gem 'rake', '13.0.6'
34
+ gem 'public_suffix', '5.0.3'
37
35
  gem 'rainbow', '3.1.1'
36
+ gem 'rake', '13.0.6'
37
+ gem 'rchardet', '1.8.0'
38
38
  gem 'regexp_parser', '2.8.1'
39
39
  gem 'rexml', '3.2.5'
40
40
  gem 'rubocop', '1.15.0'
@@ -50,12 +50,12 @@ gem 'simplecov-html', '0.12.3'
50
50
  gem 'spreadsheet', '1.2.9'
51
51
  gem 'systemu', '2.6.5'
52
52
  gem 'unicode-display_width', '2.4.2'
53
- gem 'urbanopt-core', '0.9.0'
54
- gem 'urbanopt-geojson', '0.9.0'
55
- gem 'urbanopt-reporting', '0.7.0'
53
+ gem 'urbanopt-core', '0.10.0'
54
+ gem 'urbanopt-geojson', '0.10.0'
55
+ gem 'urbanopt-reporting', '0.8.0'
56
56
  gem 'uuid', '2.3.9'
57
57
  gem 'yamler', '0.1.0'
58
58
  gem 'zliby', '0.0.5'
59
59
 
60
60
  # include the honeybee-openstudio-gem
61
- gem 'honeybee-openstudio', '2.33.4'
61
+ gem 'honeybee-openstudio', '2.34.9'
@@ -36,7 +36,7 @@ require 'openstudio'
36
36
  module Honeybee
37
37
  class Model
38
38
 
39
- # Create Ladybug Energy Model JSON from OpenStudio Model
39
+ # Create Honeybee Model JSON from OpenStudio Model
40
40
  def self.translate_from_openstudio(openstudio_model)
41
41
  hash = {}
42
42
  hash[:type] = 'Model'
@@ -79,7 +79,7 @@ module Honeybee
79
79
  Model.new(hash)
80
80
  end
81
81
 
82
- # Create Ladybug Energy Model JSON from OSM file
82
+ # Create Honeybee Model JSON from OSM file
83
83
  def self.translate_from_osm_file(file)
84
84
  vt = OpenStudio::OSVersion::VersionTranslator.new
85
85
  openstudio_model = vt.loadModel(file)
@@ -87,7 +87,7 @@ module Honeybee
87
87
  self.translate_from_openstudio(openstudio_model.get)
88
88
  end
89
89
 
90
- # Create Ladybug Energy Model JSON from gbXML file
90
+ # Create Honeybee Model JSON from gbXML file
91
91
  def self.translate_from_gbxml_file(file)
92
92
  translator = OpenStudio::GbXML::GbXMLReverseTranslator.new
93
93
  openstudio_model = translator.loadModel(file)
@@ -103,7 +103,7 @@ module Honeybee
103
103
  self.translate_from_openstudio(os_model)
104
104
  end
105
105
 
106
- # Create Ladybug Energy Model JSON from IDF file
106
+ # Create Honeybee Model JSON from IDF file
107
107
  def self.translate_from_idf_file(file)
108
108
  translator = OpenStudio::EnergyPlus::ReverseTranslator.new
109
109
  openstudio_model = translator.loadModel(file)
@@ -111,6 +111,14 @@ module Honeybee
111
111
  self.translate_from_openstudio(openstudio_model.get)
112
112
  end
113
113
 
114
+ # Create Honeybee Model JSON from SDD file
115
+ def translate_from_sdd_file(file)
116
+ translator = OpenStudio::SDD::ReverseTranslator.new
117
+ openstudio_model = translator.loadModel(file)
118
+ raise "Cannot load SDD file at '#{}'" if openstudio_model.empty?
119
+ self.translate_from_openstudio(openstudio_model.get)
120
+ end
121
+
114
122
  def self.properties_from_model(openstudio_model)
115
123
  hash = {}
116
124
  hash[:type] = 'ModelProperties'
@@ -0,0 +1,23 @@
1
+ Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable Energy, LLC,
2
+ Ladybug Tools LLC and other contributors. All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
5
+ following conditions are met:
6
+
7
+ (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
8
+ disclaimer.
9
+
10
+ (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
11
+ disclaimer in the documentation and/or other materials provided with the distribution.
12
+
13
+ (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
14
+ derived from this software without specific prior written permission from the respective party.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
19
+ STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,32 @@
1
+
2
+
3
+ ###### (Automatically generated documentation)
4
+
5
+ # From Honeybee Model To SDD
6
+
7
+ ## Description
8
+ Translate a JSON file of a Honeybee Model into a SDD Model.
9
+
10
+ ## Modeler Description
11
+ Translate a JSON file of a Honeybee Model into a SDD Model.
12
+
13
+ ## Measure Type
14
+ ModelMeasure
15
+
16
+ ## Taxonomy
17
+
18
+
19
+ ## Arguments
20
+
21
+
22
+ ### Path to the Honeybee Model JSON file
23
+
24
+ **Name:** model_json,
25
+ **Type:** String,
26
+ **Units:** ,
27
+ **Required:** true,
28
+ **Model Dependent:** false
29
+
30
+
31
+
32
+
@@ -0,0 +1,115 @@
1
+ # *******************************************************************************
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
+ # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # (1) Redistributions of source code must retain the above copyright notice,
9
+ # this list of conditions and the following disclaimer.
10
+ #
11
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # (3) Neither the name of the copyright holder nor the names of any contributors
16
+ # may be used to endorse or promote products derived from this software without
17
+ # specific prior written permission from the respective party.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
20
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
23
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
24
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ # *******************************************************************************
31
+
32
+ # see the URL below for information on how to write OpenStudio measures
33
+ # http://nrel.github.io/OpenStudio-user-documentation/reference/measure_writing_guide/
34
+
35
+ require 'to_openstudio'
36
+ require 'openstudio'
37
+
38
+ # start the measure
39
+ class FromHoneybeeModelToSDD < OpenStudio::Measure::ModelMeasure
40
+ # human readable name
41
+ def name
42
+ return 'From Honeybee Model to SDD'
43
+ end
44
+
45
+ # human readable description
46
+ def description
47
+ return 'Translate a JSON file of a Honeybee Model into a SDD Model.'
48
+ end
49
+
50
+ # human readable description of modeling approach
51
+ def modeler_description
52
+ return 'Translate a JSON file of a Honeybee Model into a SDD Model.'
53
+ end
54
+
55
+ # define the arguments that the user will input
56
+ def arguments(model)
57
+ args = OpenStudio::Measure::OSArgumentVector.new
58
+
59
+ # Make an argument for the honyebee model json
60
+ model_json = OpenStudio::Measure::OSArgument.makeStringArgument('model_json', true)
61
+ model_json.setDisplayName('Path to the Honeybee Model JSON file')
62
+ args << model_json
63
+
64
+ # Make an argument for the output file path
65
+ output_file_path = OpenStudio::Measure::OSArgument.makeStringArgument('output_file_path', false)
66
+ output_file_path.setDisplayName('Output file path')
67
+ output_file_path.setDescription('If set, the output SDD file will be exported to this path. Othervise The file will be exported to the same path as the input model.')
68
+ output_file_path.setDefaultValue('')
69
+ args << output_file_path
70
+
71
+ return args
72
+ end
73
+
74
+ # define what happens when the measure is run
75
+ def run(model, runner, user_arguments)
76
+ super(model, runner, user_arguments)
77
+ STDOUT.flush
78
+ if !runner.validateUserArguments(arguments(model), user_arguments)
79
+ return false
80
+ end
81
+
82
+ # convert the Honeybee model into an OpenStudio Model
83
+ model_json = runner.getStringArgumentValue('model_json', user_arguments)
84
+ if !File.exist?(model_json)
85
+ runner.registerError("Cannot find file '#{model_json}'")
86
+ return false
87
+ end
88
+ honeybee_model = Honeybee::Model.read_from_disk(model_json)
89
+ $simple_window_cons = true
90
+ $orphan_groups = false
91
+ STDOUT.flush
92
+ os_model = honeybee_model.to_openstudio_model(model)
93
+ STDOUT.flush
94
+
95
+ # convert the OpenStudio model into a SDD Model
96
+ output_file_path = runner.getStringArgumentValue('output_file_path', user_arguments)
97
+ if output_file_path && !output_file_path.empty?
98
+ unless File.exist?(output_file_path)
99
+ output_folder = File.split(output_file_path)[0]
100
+ FileUtils.mkdir_p(output_folder)
101
+ end
102
+ else
103
+ model_path, model_name = File.split(model_json)
104
+ sdd_model_name = model_name.split('.')[0] + '.sdd'
105
+ output_file_path = File.join(model_path, sdd_model_name)
106
+ end
107
+ translator = OpenStudio::SDD::SddForwardTranslator.new
108
+ translator.modelToSDD(os_model, output_file_path)
109
+
110
+ return true
111
+ end
112
+ end
113
+
114
+ # register the measure to be used by the application
115
+ FromHoneybeeModelToSDD.new.registerWithApplication
@@ -0,0 +1,88 @@
1
+ <?xml version="1.0"?>
2
+ <measure>
3
+ <schema_version>3.0</schema_version>
4
+ <name>from_honeybee_model</name>
5
+ <uid>a5f500d5-97ff-4048-a6f4-6b0b0a92d0f0</uid>
6
+ <version_id>1171d409-32be-4b94-baae-56d59a7e3b1d</version_id>
7
+ <version_modified>20201124T031956Z</version_modified>
8
+ <xml_checksum>D8922A73</xml_checksum>
9
+ <class_name>FromHoneybeeModelToSDD</class_name>
10
+ <display_name>From Honeybee Model to SDD</display_name>
11
+ <description>Translate a JSON file of a Honeybee Model into a SDD Model.</description>
12
+ <modeler_description>Translate a JSON file of a Honeybee Model into a SDD Model.</modeler_description>
13
+ <arguments>
14
+ <argument>
15
+ <name>model_json</name>
16
+ <display_name>Path to the Honeybee Model JSON file</display_name>
17
+ <type>String</type>
18
+ <required>true</required>
19
+ <model_dependent>false</model_dependent>
20
+ </argument>
21
+ <argument>
22
+ <name>output_file_path</name>
23
+ <display_name>Output file path</display_name>
24
+ <type>String</type>
25
+ <required>false</required>
26
+ <model_dependent>false</model_dependent>
27
+ <default_value></default_value>
28
+ </argument>
29
+ </arguments>
30
+ <outputs />
31
+ <provenances />
32
+ <tags>
33
+ <tag>Whole Building.Space Types</tag>
34
+ </tags>
35
+ <attributes>
36
+ <attribute>
37
+ <name>Measure Type</name>
38
+ <value>ModelMeasure</value>
39
+ <datatype>string</datatype>
40
+ </attribute>
41
+ <attribute>
42
+ <name>Intended Software Tool</name>
43
+ <value>Apply Measure Now</value>
44
+ <datatype>string</datatype>
45
+ </attribute>
46
+ <attribute>
47
+ <name>Intended Software Tool</name>
48
+ <value>OpenStudio Application</value>
49
+ <datatype>string</datatype>
50
+ </attribute>
51
+ <attribute>
52
+ <name>Intended Software Tool</name>
53
+ <value>Parametric Analysis Tool</value>
54
+ <datatype>string</datatype>
55
+ </attribute>
56
+ </attributes>
57
+ <files>
58
+ <file>
59
+ <filename>LICENSE.md</filename>
60
+ <filetype>md</filetype>
61
+ <usage_type>license</usage_type>
62
+ <checksum>1E0EDDB0</checksum>
63
+ </file>
64
+ <file>
65
+ <filename>README.md</filename>
66
+ <filetype>md</filetype>
67
+ <usage_type>readme</usage_type>
68
+ <checksum>782C496D</checksum>
69
+ </file>
70
+ <file>
71
+ <version>
72
+ <software_program>OpenStudio</software_program>
73
+ <identifier>2.0.0</identifier>
74
+ <min_compatible>2.0.0</min_compatible>
75
+ </version>
76
+ <filename>measure.rb</filename>
77
+ <filetype>rb</filetype>
78
+ <usage_type>script</usage_type>
79
+ <checksum>8B48C43C</checksum>
80
+ </file>
81
+ <file>
82
+ <filename>from_honeybee_model_to_sdd_test.rb</filename>
83
+ <filetype>rb</filetype>
84
+ <usage_type>test</usage_type>
85
+ <checksum>A800695A</checksum>
86
+ </file>
87
+ </files>
88
+ </measure>
@@ -0,0 +1,105 @@
1
+ # *******************************************************************************
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
+ # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # (1) Redistributions of source code must retain the above copyright notice,
9
+ # this list of conditions and the following disclaimer.
10
+ #
11
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # (3) Neither the name of the copyright holder nor the names of any contributors
16
+ # may be used to endorse or promote products derived from this software without
17
+ # specific prior written permission from the respective party.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
20
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
23
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
24
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ # *******************************************************************************
31
+
32
+ require 'openstudio'
33
+ require 'openstudio/ruleset/ShowRunnerOutput'
34
+ require 'minitest/autorun'
35
+ require_relative '../measure.rb'
36
+ require 'fileutils'
37
+
38
+ class FromHoneybeeModelToSDD_Test < Minitest::Test
39
+ # method to apply arguments, run measure, and assert results (only populate args hash with non-default argument values)
40
+ def apply_measure_to_model(test_name, args, model_name = nil, result_value = 'Success', warnings_count = 0, info_count = nil)
41
+ # create an instance of the measure
42
+ measure = FromHoneybeeModelToSDD.new
43
+
44
+ # create an instance of a runner
45
+ runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
46
+
47
+ if model_name.nil?
48
+ # make an empty model
49
+ model = OpenStudio::Model::Model.new
50
+ else
51
+ # load the test model
52
+ translator = OpenStudio::OSVersion::VersionTranslator.new
53
+ path = OpenStudio::Path.new(File.dirname(__FILE__) + '/' + model_name)
54
+ model = translator.loadModel(path)
55
+ assert(!model.empty?)
56
+ model = model.get
57
+ end
58
+
59
+ # get arguments
60
+ arguments = measure.arguments(model)
61
+ argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
62
+
63
+ # populate argument with specified hash value if specified
64
+ arguments.each do |arg|
65
+ temp_arg_var = arg.clone
66
+ if args.key?(arg.name)
67
+ assert(temp_arg_var.setValue(args[arg.name]), "could not set #{arg.name} to #{args[arg.name]}.")
68
+ end
69
+ argument_map[arg.name] = temp_arg_var
70
+ end
71
+
72
+ # run the measure
73
+ measure.run(model, runner, argument_map)
74
+ result = runner.result
75
+
76
+ # show the output
77
+ puts "measure results for #{test_name}"
78
+ show_output(result)
79
+
80
+ # assert that it ran correctly
81
+ if result_value.nil? then result_value = 'Success' end
82
+ assert_equal(result_value, result.value.valueName)
83
+
84
+ # check count of warning and info messages
85
+ unless info_count.nil? then assert(result.info.size == info_count) end
86
+ unless warnings_count.nil? then assert(result.warnings.size == warnings_count, "warning count (#{result.warnings.size}) did not match expectation (#{warnings_count})") end
87
+
88
+ # if 'Fail' passed in make sure at least one error message (while not typical there may be more than one message)
89
+ if result_value == 'Fail' then assert(result.errors.size >= 1) end
90
+
91
+ end
92
+
93
+ def test_shoe_box
94
+ args = {}
95
+ args['model_json'] = File.join(File.dirname(__FILE__) + "/../../../../spec/samples/model/model_energy_shoe_box.json")
96
+ apply_measure_to_model(__method__.to_s.gsub('test_',''),args, nil)
97
+ end
98
+
99
+ def test_office_floor
100
+ args = {}
101
+ args['model_json'] = File.join(File.dirname(__FILE__) + "/../../../../spec/samples/model/model_complete_office_floor.json")
102
+ apply_measure_to_model(__method__.to_s.gsub('test_',''),args, nil)
103
+ end
104
+
105
+ end
@@ -0,0 +1,23 @@
1
+ Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable Energy, LLC,
2
+ Ladybug Tools LLC and other contributors. All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
5
+ following conditions are met:
6
+
7
+ (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
8
+ disclaimer.
9
+
10
+ (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
11
+ disclaimer in the documentation and/or other materials provided with the distribution.
12
+
13
+ (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
14
+ derived from this software without specific prior written permission from the respective party.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
19
+ STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,32 @@
1
+
2
+
3
+ ###### (Automatically generated documentation)
4
+
5
+ # From SDD Model
6
+
7
+ ## Description
8
+ Translate a SDD model into a JSON file of a Honeybee Model.
9
+
10
+ ## Modeler Description
11
+ Translate a SDD model into a JSON file of a Honeybee Model.
12
+
13
+ ## Measure Type
14
+ ModelMeasure
15
+
16
+ ## Taxonomy
17
+
18
+
19
+ ## Arguments
20
+
21
+
22
+ ### Path to the SDD Model file
23
+
24
+ **Name:** sdd_model,
25
+ **Type:** String,
26
+ **Units:** ,
27
+ **Required:** true,
28
+ **Model Dependent:** false
29
+
30
+
31
+
32
+
@@ -0,0 +1,114 @@
1
+ # *******************************************************************************
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
+ # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # (1) Redistributions of source code must retain the above copyright notice,
9
+ # this list of conditions and the following disclaimer.
10
+ #
11
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # (3) Neither the name of the copyright holder nor the names of any contributors
16
+ # may be used to endorse or promote products derived from this software without
17
+ # specific prior written permission from the respective party.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
20
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
23
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
24
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ # *******************************************************************************
31
+
32
+ # see the URL below for information on how to write OpenStudio measures
33
+ # http://nrel.github.io/OpenStudio-user-documentation/reference/measure_writing_guide/
34
+
35
+ require 'from_openstudio'
36
+
37
+ # start the measure
38
+ class FromSDDModel < OpenStudio::Measure::ModelMeasure
39
+ # human readable name
40
+ def name
41
+ return "From SDD Model"
42
+ end
43
+
44
+ # human readable description
45
+ def description
46
+ return "Translate a SDD into a JSON file of a Honeybee Model."
47
+ end
48
+
49
+ # human readable description of modeling approach
50
+ def modeler_description
51
+ return "Translate a SDD into a JSON file of a Honeybee Model."
52
+ end
53
+
54
+ # define the arguments that the user will input
55
+ def arguments(model)
56
+ args = OpenStudio::Measure::OSArgumentVector.new
57
+
58
+ # Make an argument for the OpenStudio model
59
+ sdd_model = OpenStudio::Measure::OSArgument.makeStringArgument('sdd_model', true)
60
+ sdd_model.setDisplayName('Path to the SDD Model')
61
+ args << sdd_model
62
+
63
+ # Make an argument for the output file path
64
+ output_file_path = OpenStudio::Measure::OSArgument.makeStringArgument('output_file_path', false)
65
+ output_file_path.setDisplayName('Output file path')
66
+ output_file_path.setDescription('If set, the output Honeybee JSON file will be exported to this path. Othervise The file will be exported to the same path as the SDD model.')
67
+ output_file_path.setDefaultValue('')
68
+ args << output_file_path
69
+
70
+ return args
71
+ end
72
+
73
+ # define what happens when the measure is run
74
+ def run(model, runner, user_arguments)
75
+ super(model, runner, user_arguments)
76
+ STDOUT.flush
77
+ if !runner.validateUserArguments(arguments(model), user_arguments)
78
+ return false
79
+ end
80
+
81
+ sdd_model = runner.getStringArgumentValue('sdd_model', user_arguments)
82
+
83
+ sdd_model_path, sdd_model_name = File.split(sdd_model)
84
+ honeybee_model_name = sdd_model_name.split('.')[0] + '.hbjson'
85
+
86
+ if !File.exist?(sdd_model)
87
+ runner.registerError("Cannot find file '#{sdd_model}'")
88
+ return false
89
+ end
90
+
91
+ honeybee_model = Honeybee::Model.translate_from_sdd_file(sdd_model)
92
+ honeybee_hash = honeybee_model.hash
93
+
94
+ output_file_path = runner.getStringArgumentValue('output_file_path', user_arguments)
95
+
96
+ if output_file_path && !output_file_path.empty?
97
+ unless File.exist?(output_file_path)
98
+ output_folder = File.split(output_file_path)[0]
99
+ FileUtils.mkdir_p(output_folder)
100
+ end
101
+ else
102
+ output_file_path = File.join(sdd_model_path, honeybee_model_name)
103
+ end
104
+
105
+ File.open(output_file_path, 'w') do |f|
106
+ f.puts JSON::pretty_generate(honeybee_hash)
107
+ end
108
+
109
+ return true
110
+ end
111
+ end
112
+
113
+ # register the measure to be used by the application
114
+ FromSDDModel.new.registerWithApplication
@@ -0,0 +1,131 @@
1
+ <?xml version="1.0"?>
2
+ <measure>
3
+ <schema_version>3.0</schema_version>
4
+ <name>from_sdd_model</name>
5
+ <uid>e4b3a388-3468-4962-a12e-e2e02bacb0a2</uid>
6
+ <version_id>0261fa70-1322-43ce-ae24-e6e65eb98f03</version_id>
7
+ <version_modified>20210428T160059Z</version_modified>
8
+ <xml_checksum>6BA95EF6</xml_checksum>
9
+ <class_name>FromSDDModel</class_name>
10
+ <display_name>From SDD Model</display_name>
11
+ <description>Translate a SDD into a JSON file of a Honeybee Model.</description>
12
+ <modeler_description>Translate a SDD into a JSON file of a Honeybee Model.</modeler_description>
13
+ <arguments>
14
+ <argument>
15
+ <name>model_json</name>
16
+ <display_name>Path to the Honeybee Model JSON file</display_name>
17
+ <description></description>
18
+ <type>String</type>
19
+ <units></units>
20
+ <required>true</required>
21
+ <model_dependent>false</model_dependent>
22
+ <default_value></default_value>
23
+ <min_value></min_value>
24
+ <max_value></max_value>
25
+ </argument>
26
+ </arguments>
27
+ <outputs />
28
+ <provenances />
29
+ <tags>
30
+ <tag>Whole Building.Space Types</tag>
31
+ </tags>
32
+ <attributes>
33
+ <attribute>
34
+ <name>Intended Software Tool</name>
35
+ <value>Apply Measure Now</value>
36
+ <datatype>string</datatype>
37
+ </attribute>
38
+ <attribute>
39
+ <name>Intended Software Tool</name>
40
+ <value>OpenStudio Application</value>
41
+ <datatype>string</datatype>
42
+ </attribute>
43
+ <attribute>
44
+ <name>Intended Software Tool</name>
45
+ <value>Parametric Analysis Tool</value>
46
+ <datatype>string</datatype>
47
+ </attribute>
48
+ <attribute>
49
+ <name>Intended Software Tool</name>
50
+ <value>Apply Measure Now</value>
51
+ <datatype>string</datatype>
52
+ </attribute>
53
+ <attribute>
54
+ <name>Intended Software Tool</name>
55
+ <value>OpenStudio Application</value>
56
+ <datatype>string</datatype>
57
+ </attribute>
58
+ <attribute>
59
+ <name>Intended Software Tool</name>
60
+ <value>Parametric Analysis Tool</value>
61
+ <datatype>string</datatype>
62
+ </attribute>
63
+ <attribute>
64
+ <name>Intended Software Tool</name>
65
+ <value>Apply Measure Now</value>
66
+ <datatype>string</datatype>
67
+ </attribute>
68
+ <attribute>
69
+ <name>Intended Software Tool</name>
70
+ <value>OpenStudio Application</value>
71
+ <datatype>string</datatype>
72
+ </attribute>
73
+ <attribute>
74
+ <name>Intended Software Tool</name>
75
+ <value>Parametric Analysis Tool</value>
76
+ <datatype>string</datatype>
77
+ </attribute>
78
+ <attribute>
79
+ <name>Measure Type</name>
80
+ <value>ModelMeasure</value>
81
+ <datatype>string</datatype>
82
+ </attribute>
83
+ <attribute>
84
+ <name>Intended Software Tool</name>
85
+ <value>Apply Measure Now</value>
86
+ <datatype>string</datatype>
87
+ </attribute>
88
+ <attribute>
89
+ <name>Intended Software Tool</name>
90
+ <value>OpenStudio Application</value>
91
+ <datatype>string</datatype>
92
+ </attribute>
93
+ <attribute>
94
+ <name>Intended Software Tool</name>
95
+ <value>Parametric Analysis Tool</value>
96
+ <datatype>string</datatype>
97
+ </attribute>
98
+ </attributes>
99
+ <files>
100
+ <file>
101
+ <filename>LICENSE.md</filename>
102
+ <filetype>md</filetype>
103
+ <usage_type>license</usage_type>
104
+ <checksum>1E0EDDB0</checksum>
105
+ </file>
106
+ <file>
107
+ <filename>README.md</filename>
108
+ <filetype>md</filetype>
109
+ <usage_type>readme</usage_type>
110
+ <checksum>782C496D</checksum>
111
+ </file>
112
+ <file>
113
+ <version>
114
+ <software_program>OpenStudio</software_program>
115
+ <identifier>2.0.0</identifier>
116
+ <min_compatible>2.0.0</min_compatible>
117
+ </version>
118
+ <filename>measure.rb</filename>
119
+ <filetype>rb</filetype>
120
+ <usage_type>script</usage_type>
121
+ <checksum>D5D8CB66</checksum>
122
+ </file>
123
+ <file>
124
+ <filename>from_sdd_model_test.rb</filename>
125
+ <filetype>rb</filetype>
126
+ <usage_type>test</usage_type>
127
+ <checksum>AE86B654</checksum>
128
+ </file>
129
+ </files>
130
+ </measure>
131
+ <error>cannot load such file -- from_openstudio</error>
@@ -0,0 +1,107 @@
1
+ # *******************************************************************************
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
+ # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # (1) Redistributions of source code must retain the above copyright notice,
9
+ # this list of conditions and the following disclaimer.
10
+ #
11
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # (3) Neither the name of the copyright holder nor the names of any contributors
16
+ # may be used to endorse or promote products derived from this software without
17
+ # specific prior written permission from the respective party.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
20
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
23
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
24
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ # *******************************************************************************
31
+
32
+ require 'openstudio'
33
+ require 'openstudio/ruleset/ShowRunnerOutput'
34
+ require 'minitest/autorun'
35
+ require_relative '../measure.rb'
36
+ require 'fileutils'
37
+
38
+ class FromSDDModel_Test < Minitest::Test
39
+ # method to apply arguments, run measure, and assert results (only populate args hash with non-default argument values)
40
+ def apply_measure_to_model(test_name, args, model_name = nil, result_value = 'Success', warnings_count = 0, info_count = nil)
41
+ # create an instance of the measure
42
+ measure = FromSDDModel.new
43
+
44
+ # create an instance of a runner
45
+ runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
46
+
47
+ if model_name.nil?
48
+ # make an empty model
49
+ model = OpenStudio::Model::Model.new
50
+ else
51
+ # load the test model
52
+ translator = OpenStudio::OSVersion::VersionTranslator.new
53
+ path = OpenStudio::Path.new(File.dirname(__FILE__) + '/' + model_name)
54
+ model = translator.loadModel(path)
55
+ assert(!model.empty?)
56
+ model = model.get
57
+ end
58
+
59
+ # get arguments
60
+ arguments = measure.arguments(model)
61
+ argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
62
+
63
+ # populate argument with specified hash value if specified
64
+ arguments.each do |arg|
65
+ temp_arg_var = arg.clone
66
+ if args.key?(arg.name)
67
+ assert(temp_arg_var.setValue(args[arg.name]), "could not set #{arg.name} to #{args[arg.name]}.")
68
+ end
69
+ argument_map[arg.name] = temp_arg_var
70
+ end
71
+
72
+ # run the measure
73
+ measure.run(model, runner, argument_map)
74
+ result = runner.result
75
+
76
+ puts "this is measure #{measure.run(model, runner, argument_map)}"
77
+ # show the output
78
+ puts "measure results for #{test_name}"
79
+ show_output(result)
80
+
81
+ # assert that it ran correctly
82
+ if result_value.nil? then result_value = 'Success' end
83
+ assert_equal(result_value, result.value.valueName)
84
+
85
+ # check count of warning and info messages
86
+ unless info_count.nil? then assert(result.info.size == info_count) end
87
+ unless warnings_count.nil? then assert(result.warnings.size == warnings_count, "warning count (#{result.warnings.size}) did not match expectation (#{warnings_count})") end
88
+
89
+ # if 'Fail' passed in make sure at least one error message (while not typical there may be more than one message)
90
+ if result_value == 'Fail' then assert(result.errors.size >= 1) end
91
+
92
+ end
93
+
94
+ def test_example_model_with_output_path
95
+ args = {}
96
+ args['sdd_model'] = File.join(File.dirname(__FILE__) + '/../../../../spec/samples/sdd/sdd_TRK.xml')
97
+ args['output_file_path'] = File.join(File.dirname(__FILE__) + '/output/sdd_TRK.hbjson')
98
+ apply_measure_to_model(__method__.to_s.gsub('test_',''),args, nil)
99
+ end
100
+
101
+ def test_example_model_without_output_path
102
+ args = {}
103
+ args['sdd_model'] = File.join(File.dirname(__FILE__) + '/../../../../spec/samples/sdd/sdd_TRK.xml')
104
+ apply_measure_to_model(__method__.to_s.gsub('test_',''),args, nil)
105
+ end
106
+
107
+ end
@@ -85,6 +85,55 @@ module Honeybee
85
85
  defaults[:placeholder_value][:default]
86
86
  end
87
87
 
88
+ def full_annual_values(openstudio_model)
89
+ # get start and end date times
90
+ yd = openstudio_model.getYearDescription
91
+ date_time = OpenStudio::DateTime.new(yd.makeDate(1, 1), OpenStudio::Time.new(0,0,0))
92
+ start_date_time = OpenStudio::DateTime.new(yd.makeDate(start_month, start_day), OpenStudio::Time.new(0,0,0))
93
+ end_date_time = OpenStudio::DateTime.new(yd.makeDate(12, 31), OpenStudio::Time.new(1,0,0))
94
+
95
+ # get timestep
96
+ interval_length = 60 / timestep
97
+ dt = OpenStudio::Time.new(0, 0, interval_length, 0)
98
+
99
+ # get values and date times
100
+ values = @hash[:values]
101
+ num_values = values.size
102
+ i_values = 0
103
+ padded_values = []
104
+ date_times = []
105
+ pv = placeholder_value
106
+
107
+ while date_time < end_date_time
108
+ date = date_time.date
109
+ time = date_time.time
110
+ date_times << "#{date.dayOfMonth} #{date.monthOfYear.valueName} #{time.hours.to_s.rjust(2,'0')}:#{time.minutes.to_s.rjust(2,'0')}"
111
+
112
+ if date_time < start_date_time
113
+ padded_values << pv
114
+ elsif i_values < num_values
115
+ padded_values << values[i_values]
116
+ i_values += 1
117
+ else
118
+ padded_values << pv
119
+ end
120
+
121
+ date_time += dt
122
+ end
123
+
124
+ # if there are still more values to add, this indicates a reversed period
125
+ if i_values + 1 < num_values
126
+ overwrite_index = 0
127
+ while i_values != num_values
128
+ padded_values[overwrite_index] = values[i_values]
129
+ i_values += 1
130
+ overwrite_index += 1
131
+ end
132
+ end
133
+
134
+ return padded_values, date_times
135
+ end
136
+
88
137
  def to_schedule_fixed_interval(openstudio_model)
89
138
  # create the new schedule
90
139
  os_fi_schedule = OpenStudio::Model::ScheduleFixedInterval.new(openstudio_model)
@@ -92,9 +141,11 @@ module Honeybee
92
141
  unless @hash[:display_name].nil?
93
142
  os_fi_schedule.setDisplayName(@hash[:display_name])
94
143
  end
95
- # assign start date
96
- os_fi_schedule.setStartMonth(start_month)
97
- os_fi_schedule.setStartDay(start_day)
144
+
145
+ # assign start date and the out of range value
146
+ os_fi_schedule.setStartMonth(1)
147
+ os_fi_schedule.setStartDay(1)
148
+ os_fi_schedule.setOutOfRangeValue(placeholder_value)
98
149
 
99
150
  # assign the interpolate value
100
151
  os_fi_schedule.setInterpolatetoTimestep(interpolate)
@@ -115,8 +166,9 @@ module Honeybee
115
166
 
116
167
  # assign the values as a timeseries
117
168
  year_description = openstudio_model.getYearDescription
118
- start_date = year_description.makeDate(start_month, start_day)
119
- timeseries = OpenStudio::TimeSeries.new(start_date, openstudio_interval_length, OpenStudio.createVector(@hash[:values]), '')
169
+ start_date = year_description.makeDate(1, 1)
170
+ all_values, date_times = full_annual_values(openstudio_model)
171
+ timeseries = OpenStudio::TimeSeries.new(start_date, openstudio_interval_length, OpenStudio.createVector(all_values), '')
120
172
  os_fi_schedule.setTimeSeries(timeseries)
121
173
 
122
174
  os_fi_schedule
@@ -127,41 +179,9 @@ module Honeybee
127
179
  # in order to combine schedules in the same csv file they must have the same key
128
180
  schedule_key = "#{@hash[:identifier]}_#{start_month}_#{start_day}_#{timestep}"
129
181
 
130
- # get start and end date times
131
- yd = openstudio_model.getYearDescription
132
- date_time = OpenStudio::DateTime.new(yd.makeDate(1, 1), OpenStudio::Time.new(0,0,0))
133
- start_date_time = OpenStudio::DateTime.new(yd.makeDate(start_month, start_day), OpenStudio::Time.new(0,0,0))
134
- end_date_time = OpenStudio::DateTime.new(yd.makeDate(12, 31), OpenStudio::Time.new(1,0,0))
135
-
136
- # get timestep
182
+ # get the list of values for the whole year
137
183
  interval_length = 60 / timestep
138
- dt = OpenStudio::Time.new(0, 0, interval_length, 0)
139
-
140
- # get values and date times
141
- values = @hash[:values]
142
- num_values = values.size
143
- i_values = 0
144
- padded_values = []
145
- date_times = []
146
- pv = placeholder_value
147
-
148
- while date_time < end_date_time
149
- date = date_time.date
150
- time = date_time.time
151
- date_times << "#{date.dayOfMonth} #{date.monthOfYear.valueName} #{time.hours.to_s.rjust(2,'0')}:#{time.minutes.to_s.rjust(2,'0')}"
152
-
153
- if date_time < start_date_time
154
- padded_values << pv
155
- elsif i_values < num_values
156
- padded_values << values[i_values]
157
- i_values += 1
158
- else
159
- padded_values << pv
160
- end
161
-
162
- date_time += dt
163
- end
164
-
184
+ padded_values, date_times = full_annual_values(openstudio_model)
165
185
 
166
186
  # find or create the schedule csv object which will hold the filename and columns
167
187
  filename = nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeybee-openstudio
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.34.8
4
+ version: 2.35.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanushree Charan
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2023-07-12 00:00:00.000000000 Z
14
+ date: 2023-08-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json_pure
@@ -47,14 +47,14 @@ dependencies:
47
47
  requirements:
48
48
  - - "~>"
49
49
  - !ruby/object:Gem::Version
50
- version: 0.3.0
50
+ version: 0.4.0
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - "~>"
56
56
  - !ruby/object:Gem::Version
57
- version: 0.3.0
57
+ version: 0.4.0
58
58
  description: Library and measures for translating between Honeybee JSON schema and
59
59
  OpenStudio Model schema (OSM).
60
60
  email:
@@ -191,6 +191,11 @@ files:
191
191
  - lib/measures/from_honeybee_model_to_gbxml/measure.rb
192
192
  - lib/measures/from_honeybee_model_to_gbxml/measure.xml
193
193
  - lib/measures/from_honeybee_model_to_gbxml/tests/from_honeybee_model_to_gbxml_test.rb
194
+ - lib/measures/from_honeybee_model_to_sdd/LICENSE.md
195
+ - lib/measures/from_honeybee_model_to_sdd/README.md
196
+ - lib/measures/from_honeybee_model_to_sdd/measure.rb
197
+ - lib/measures/from_honeybee_model_to_sdd/measure.xml
198
+ - lib/measures/from_honeybee_model_to_sdd/tests/from_honeybee_model_to_sdd_test.rb
194
199
  - lib/measures/from_honeybee_simulation_parameter/LICENSE.md
195
200
  - lib/measures/from_honeybee_simulation_parameter/README.md
196
201
  - lib/measures/from_honeybee_simulation_parameter/measure.rb
@@ -206,6 +211,11 @@ files:
206
211
  - lib/measures/from_openstudio_model/measure.rb
207
212
  - lib/measures/from_openstudio_model/measure.xml
208
213
  - lib/measures/from_openstudio_model/tests/from_openstudio_model_test.rb
214
+ - lib/measures/from_sdd_model/LICENSE.md
215
+ - lib/measures/from_sdd_model/README.md
216
+ - lib/measures/from_sdd_model/measure.rb
217
+ - lib/measures/from_sdd_model/measure.xml
218
+ - lib/measures/from_sdd_model/tests/from_sdd_model_test.rb
209
219
  - lib/to_openstudio.rb
210
220
  - lib/to_openstudio/construction/air.rb
211
221
  - lib/to_openstudio/construction/dynamic.rb