honeybee-openstudio 2.0.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -5
- data/README.md +1 -1
- data/honeybee-openstudio.gemspec +1 -1
- data/lib/files/urbanopt_Gemfile +4 -12
- data/lib/from_honeybee.rb +1 -0
- data/lib/from_honeybee/_openapi/model.json +2119 -1313
- data/lib/from_honeybee/_openapi/simulation-parameter.json +202 -61
- data/lib/from_honeybee/construction/window.rb +0 -1
- data/lib/from_honeybee/construction/windowshade.rb +207 -0
- data/lib/from_honeybee/model.rb +73 -36
- data/lib/from_honeybee/schedule/ruleset.rb +13 -9
- data/lib/from_honeybee/simulation/parameter.rb +32 -19
- metadata +3 -2
@@ -3,7 +3,7 @@
|
|
3
3
|
"servers": [],
|
4
4
|
"info": {
|
5
5
|
"description": "This is the documentation for Honeybee energy simulation parameter schema.",
|
6
|
-
"version": "
|
6
|
+
"version": "0.0.1",
|
7
7
|
"title": "Honeybee Energy Simulation Parameter Schema",
|
8
8
|
"contact": {
|
9
9
|
"name": "Ladybug Tools",
|
@@ -44,6 +44,11 @@
|
|
44
44
|
"x-displayName": "DesignDay",
|
45
45
|
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/DesignDay\" />\n"
|
46
46
|
},
|
47
|
+
{
|
48
|
+
"name": "designdaytypes_model",
|
49
|
+
"x-displayName": "DesignDayTypes",
|
50
|
+
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/DesignDayTypes\" />\n"
|
51
|
+
},
|
47
52
|
{
|
48
53
|
"name": "drybulbcondition_model",
|
49
54
|
"x-displayName": "DryBulbCondition",
|
@@ -54,16 +59,41 @@
|
|
54
59
|
"x-displayName": "HumidityCondition",
|
55
60
|
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/HumidityCondition\" />\n"
|
56
61
|
},
|
62
|
+
{
|
63
|
+
"name": "humiditytypes_model",
|
64
|
+
"x-displayName": "HumidityTypes",
|
65
|
+
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/HumidityTypes\" />\n"
|
66
|
+
},
|
57
67
|
{
|
58
68
|
"name": "runperiod_model",
|
59
69
|
"x-displayName": "RunPeriod",
|
60
70
|
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/RunPeriod\" />\n"
|
61
71
|
},
|
72
|
+
{
|
73
|
+
"name": "daysofweek_model",
|
74
|
+
"x-displayName": "DaysOfWeek",
|
75
|
+
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/DaysOfWeek\" />\n"
|
76
|
+
},
|
62
77
|
{
|
63
78
|
"name": "shadowcalculation_model",
|
64
79
|
"x-displayName": "ShadowCalculation",
|
65
80
|
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ShadowCalculation\" />\n"
|
66
81
|
},
|
82
|
+
{
|
83
|
+
"name": "solardistribution_model",
|
84
|
+
"x-displayName": "SolarDistribution",
|
85
|
+
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/SolarDistribution\" />\n"
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"name": "calculationmethod_model",
|
89
|
+
"x-displayName": "CalculationMethod",
|
90
|
+
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/CalculationMethod\" />\n"
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"name": "calculationupdatemethod_model",
|
94
|
+
"x-displayName": "CalculationUpdateMethod",
|
95
|
+
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/CalculationUpdateMethod\" />\n"
|
96
|
+
},
|
67
97
|
{
|
68
98
|
"name": "simulationcontrol_model",
|
69
99
|
"x-displayName": "SimulationControl",
|
@@ -74,11 +104,21 @@
|
|
74
104
|
"x-displayName": "SimulationOutput",
|
75
105
|
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/SimulationOutput\" />\n"
|
76
106
|
},
|
107
|
+
{
|
108
|
+
"name": "reportingfrequency_model",
|
109
|
+
"x-displayName": "ReportingFrequency",
|
110
|
+
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ReportingFrequency\" />\n"
|
111
|
+
},
|
77
112
|
{
|
78
113
|
"name": "simulationparameter_model",
|
79
114
|
"x-displayName": "SimulationParameter",
|
80
115
|
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/SimulationParameter\" />\n"
|
81
116
|
},
|
117
|
+
{
|
118
|
+
"name": "terriantypes_model",
|
119
|
+
"x-displayName": "TerrianTypes",
|
120
|
+
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/TerrianTypes\" />\n"
|
121
|
+
},
|
82
122
|
{
|
83
123
|
"name": "sizingparameter_model",
|
84
124
|
"x-displayName": "SizingParameter",
|
@@ -96,16 +136,24 @@
|
|
96
136
|
"tags": [
|
97
137
|
"ashraeclearsky_model",
|
98
138
|
"ashraetau_model",
|
139
|
+
"calculationmethod_model",
|
140
|
+
"calculationupdatemethod_model",
|
99
141
|
"daylightsavingtime_model",
|
142
|
+
"daysofweek_model",
|
100
143
|
"designday_model",
|
144
|
+
"designdaytypes_model",
|
101
145
|
"drybulbcondition_model",
|
102
146
|
"humiditycondition_model",
|
147
|
+
"humiditytypes_model",
|
148
|
+
"reportingfrequency_model",
|
103
149
|
"runperiod_model",
|
104
150
|
"shadowcalculation_model",
|
105
151
|
"simulationcontrol_model",
|
106
152
|
"simulationoutput_model",
|
107
153
|
"simulationparameter_model",
|
108
154
|
"sizingparameter_model",
|
155
|
+
"solardistribution_model",
|
156
|
+
"terriantypes_model",
|
109
157
|
"windcondition_model"
|
110
158
|
]
|
111
159
|
}
|
@@ -126,15 +174,13 @@
|
|
126
174
|
"readOnly": true
|
127
175
|
},
|
128
176
|
"reporting_frequency": {
|
177
|
+
"allOf": [
|
178
|
+
{
|
179
|
+
"$ref": "#/components/schemas/ReportingFrequency"
|
180
|
+
}
|
181
|
+
],
|
129
182
|
"title": "Reporting Frequency",
|
130
183
|
"default": "Hourly",
|
131
|
-
"enum": [
|
132
|
-
"Timestep",
|
133
|
-
"Hourly",
|
134
|
-
"Daily",
|
135
|
-
"Monthly",
|
136
|
-
"Annual"
|
137
|
-
],
|
138
184
|
"type": "string"
|
139
185
|
},
|
140
186
|
"include_sqlite": {
|
@@ -146,7 +192,7 @@
|
|
146
192
|
"include_html": {
|
147
193
|
"title": "Include Html",
|
148
194
|
"description": "Boolean to note whether an HTML report should be requested from the simulation.",
|
149
|
-
"default":
|
195
|
+
"default": true,
|
150
196
|
"type": "boolean"
|
151
197
|
},
|
152
198
|
"outputs": {
|
@@ -256,18 +302,14 @@
|
|
256
302
|
"maxItems": 2
|
257
303
|
},
|
258
304
|
"start_day_of_week": {
|
305
|
+
"allOf": [
|
306
|
+
{
|
307
|
+
"$ref": "#/components/schemas/DaysOfWeek"
|
308
|
+
}
|
309
|
+
],
|
259
310
|
"title": "Start Day Of Week",
|
260
311
|
"description": "Text for the day of the week on which the simulation starts.",
|
261
312
|
"default": "Sunday",
|
262
|
-
"enum": [
|
263
|
-
"Sunday",
|
264
|
-
"Monday",
|
265
|
-
"Tuesday",
|
266
|
-
"Wednesday",
|
267
|
-
"Thursday",
|
268
|
-
"Friday",
|
269
|
-
"Saturday"
|
270
|
-
],
|
271
313
|
"type": "string"
|
272
314
|
},
|
273
315
|
"holidays": {
|
@@ -362,34 +404,45 @@
|
|
362
404
|
"readOnly": true
|
363
405
|
},
|
364
406
|
"solar_distribution": {
|
407
|
+
"allOf": [
|
408
|
+
{
|
409
|
+
"$ref": "#/components/schemas/SolarDistribution"
|
410
|
+
}
|
411
|
+
],
|
365
412
|
"title": "Solar Distribution",
|
366
413
|
"default": "FullExteriorWithReflections",
|
367
|
-
"
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
414
|
+
"type": "string"
|
415
|
+
},
|
416
|
+
"calculation_method": {
|
417
|
+
"allOf": [
|
418
|
+
{
|
419
|
+
"$ref": "#/components/schemas/CalculationMethod"
|
420
|
+
}
|
373
421
|
],
|
422
|
+
"title": "Calculation Method",
|
423
|
+
"description": "Text noting whether CPU-based polygon clipping method orGPU-based pixel counting method should be used. For low numbers of shadingsurfaces (less than ~200), PolygonClipping requires less runtime thanPixelCounting. However, PixelCounting runtime scales significantlybetter at higher numbers of shading surfaces. PixelCounting also hasno limitations related to zone concavity when used with any\u201cFullInterior\u201d solar distribution options.",
|
424
|
+
"default": "PolygonClipping",
|
425
|
+
"type": "string"
|
426
|
+
},
|
427
|
+
"calculation_update_method": {
|
428
|
+
"allOf": [
|
429
|
+
{
|
430
|
+
"$ref": "#/components/schemas/CalculationUpdateMethod"
|
431
|
+
}
|
432
|
+
],
|
433
|
+
"title": "Calculation Update Method",
|
434
|
+
"description": "Text describing how often the solar and shading calculations are updated with respect to the flow of time in the simulation.",
|
435
|
+
"default": "Periodic",
|
374
436
|
"type": "string"
|
375
437
|
},
|
376
438
|
"calculation_frequency": {
|
377
439
|
"title": "Calculation Frequency",
|
378
|
-
"description": "Integer for the number of days in each period for which a unique shadow calculation will be performed. This field is only used if the
|
440
|
+
"description": "Integer for the number of days in each period for which a unique shadow calculation will be performed. This field is only used if the Periodic calculation_method is used.",
|
379
441
|
"default": 30,
|
380
442
|
"minimum": 1,
|
381
443
|
"type": "integer",
|
382
444
|
"format": "int32"
|
383
445
|
},
|
384
|
-
"calculation_method": {
|
385
|
-
"title": "Calculation Method",
|
386
|
-
"default": "AverageOverDaysInFrequency",
|
387
|
-
"enum": [
|
388
|
-
"AverageOverDaysInFrequency",
|
389
|
-
"TimestepFrequency"
|
390
|
-
],
|
391
|
-
"type": "string"
|
392
|
-
},
|
393
446
|
"maximum_figures": {
|
394
447
|
"title": "Maximum Figures",
|
395
448
|
"description": "Number of allowable figures in shadow overlap calculations.",
|
@@ -441,13 +494,12 @@
|
|
441
494
|
"type": "object",
|
442
495
|
"properties": {
|
443
496
|
"humidity_type": {
|
444
|
-
"
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
"HumidityRatio",
|
449
|
-
"Enthalpy"
|
497
|
+
"allOf": [
|
498
|
+
{
|
499
|
+
"$ref": "#/components/schemas/HumidityTypes"
|
500
|
+
}
|
450
501
|
],
|
502
|
+
"title": "Humidity Type",
|
451
503
|
"type": "string"
|
452
504
|
},
|
453
505
|
"humidity_value": {
|
@@ -544,7 +596,7 @@
|
|
544
596
|
},
|
545
597
|
"clearness": {
|
546
598
|
"title": "Clearness",
|
547
|
-
"description": "Value between 0 and 1.2 that will get multiplied by the
|
599
|
+
"description": "Value between 0 and 1.2 that will get multiplied by the irradiance to correct for factors like elevation above sea level.",
|
548
600
|
"minimum": 0,
|
549
601
|
"maximum": 1.2,
|
550
602
|
"type": "number",
|
@@ -636,20 +688,12 @@
|
|
636
688
|
"type": "string"
|
637
689
|
},
|
638
690
|
"day_type": {
|
639
|
-
"
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
"Sunday",
|
644
|
-
"Monday",
|
645
|
-
"Tuesday",
|
646
|
-
"Wednesday",
|
647
|
-
"Thursday",
|
648
|
-
"Friday",
|
649
|
-
"Holiday",
|
650
|
-
"CustomDay1",
|
651
|
-
"CustomDay2"
|
691
|
+
"allOf": [
|
692
|
+
{
|
693
|
+
"$ref": "#/components/schemas/DesignDayTypes"
|
694
|
+
}
|
652
695
|
],
|
696
|
+
"title": "Day Type",
|
653
697
|
"type": "string"
|
654
698
|
},
|
655
699
|
"dry_bulb_condition": {
|
@@ -823,20 +867,117 @@
|
|
823
867
|
"format": "double"
|
824
868
|
},
|
825
869
|
"terrain_type": {
|
870
|
+
"allOf": [
|
871
|
+
{
|
872
|
+
"$ref": "#/components/schemas/TerrianTypes"
|
873
|
+
}
|
874
|
+
],
|
826
875
|
"title": "Terrain Type",
|
827
876
|
"description": "Text for the terrain in which the model sits. This is used to determine the wind profile over the height of the rooms.",
|
828
877
|
"default": "City",
|
829
|
-
"enum": [
|
830
|
-
"Ocean",
|
831
|
-
"Country",
|
832
|
-
"Suburbs",
|
833
|
-
"Urban",
|
834
|
-
"City"
|
835
|
-
],
|
836
878
|
"type": "string"
|
837
879
|
}
|
838
880
|
},
|
839
881
|
"additionalProperties": false
|
882
|
+
},
|
883
|
+
"DesignDayTypes": {
|
884
|
+
"title": "Day Type",
|
885
|
+
"enum": [
|
886
|
+
"SummerDesignDay",
|
887
|
+
"WinterDesignDay",
|
888
|
+
"Sunday",
|
889
|
+
"Monday",
|
890
|
+
"Tuesday",
|
891
|
+
"Wednesday",
|
892
|
+
"Thursday",
|
893
|
+
"Friday",
|
894
|
+
"Holiday",
|
895
|
+
"CustomDay1",
|
896
|
+
"CustomDay2"
|
897
|
+
],
|
898
|
+
"type": "string"
|
899
|
+
},
|
900
|
+
"HumidityTypes": {
|
901
|
+
"title": "Humidity Type",
|
902
|
+
"enum": [
|
903
|
+
"Wetbulb",
|
904
|
+
"Dewpoint",
|
905
|
+
"HumidityRatio",
|
906
|
+
"Enthalpy"
|
907
|
+
],
|
908
|
+
"type": "string"
|
909
|
+
},
|
910
|
+
"DaysOfWeek": {
|
911
|
+
"title": "Start Day Of Week",
|
912
|
+
"description": "Text for the day of the week on which the simulation starts.",
|
913
|
+
"default": "Sunday",
|
914
|
+
"enum": [
|
915
|
+
"Sunday",
|
916
|
+
"Monday",
|
917
|
+
"Tuesday",
|
918
|
+
"Wednesday",
|
919
|
+
"Thursday",
|
920
|
+
"Friday",
|
921
|
+
"Saturday"
|
922
|
+
],
|
923
|
+
"type": "string"
|
924
|
+
},
|
925
|
+
"SolarDistribution": {
|
926
|
+
"title": "Solar Distribution",
|
927
|
+
"default": "FullExteriorWithReflections",
|
928
|
+
"enum": [
|
929
|
+
"MinimalShadowing",
|
930
|
+
"FullExterior",
|
931
|
+
"FullInteriorAndExterior",
|
932
|
+
"FullExteriorWithReflections",
|
933
|
+
"FullInteriorAndExteriorWithReflections"
|
934
|
+
],
|
935
|
+
"type": "string"
|
936
|
+
},
|
937
|
+
"CalculationMethod": {
|
938
|
+
"title": "Calculation Method",
|
939
|
+
"description": "Text noting whether CPU-based polygon clipping method orGPU-based pixel counting method should be used. For low numbers of shadingsurfaces (less than ~200), PolygonClipping requires less runtime thanPixelCounting. However, PixelCounting runtime scales significantlybetter at higher numbers of shading surfaces. PixelCounting also hasno limitations related to zone concavity when used with any\u201cFullInterior\u201d solar distribution options.",
|
940
|
+
"default": "PolygonClipping",
|
941
|
+
"enum": [
|
942
|
+
"PolygonClipping",
|
943
|
+
"PixelCounting"
|
944
|
+
],
|
945
|
+
"type": "string"
|
946
|
+
},
|
947
|
+
"CalculationUpdateMethod": {
|
948
|
+
"title": "Calculation Update Method",
|
949
|
+
"description": "Text describing how often the solar and shading calculations are updated with respect to the flow of time in the simulation.",
|
950
|
+
"default": "Periodic",
|
951
|
+
"enum": [
|
952
|
+
"Periodic",
|
953
|
+
"Timestep"
|
954
|
+
],
|
955
|
+
"type": "string"
|
956
|
+
},
|
957
|
+
"ReportingFrequency": {
|
958
|
+
"title": "Reporting Frequency",
|
959
|
+
"default": "Hourly",
|
960
|
+
"enum": [
|
961
|
+
"Timestep",
|
962
|
+
"Hourly",
|
963
|
+
"Daily",
|
964
|
+
"Monthly",
|
965
|
+
"Annual"
|
966
|
+
],
|
967
|
+
"type": "string"
|
968
|
+
},
|
969
|
+
"TerrianTypes": {
|
970
|
+
"title": "Terrain Type",
|
971
|
+
"description": "Text for the terrain in which the model sits. This is used to determine the wind profile over the height of the rooms.",
|
972
|
+
"default": "City",
|
973
|
+
"enum": [
|
974
|
+
"Ocean",
|
975
|
+
"Country",
|
976
|
+
"Suburbs",
|
977
|
+
"Urban",
|
978
|
+
"City"
|
979
|
+
],
|
980
|
+
"type": "string"
|
840
981
|
}
|
841
982
|
}
|
842
983
|
}
|
@@ -0,0 +1,207 @@
|
|
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 'from_honeybee/model_object'
|
33
|
+
require 'from_honeybee/construction/window'
|
34
|
+
|
35
|
+
require 'openstudio'
|
36
|
+
|
37
|
+
module FromHoneybee
|
38
|
+
class WindowConstructionShadeAbridged < ModelObject
|
39
|
+
attr_reader :errors, :warnings
|
40
|
+
|
41
|
+
def initialize(hash = {})
|
42
|
+
super(hash)
|
43
|
+
@construction = nil
|
44
|
+
@shade_construction = nil
|
45
|
+
@shade_location = nil
|
46
|
+
@shade_material = nil
|
47
|
+
@control_type = nil
|
48
|
+
@setpoint = nil
|
49
|
+
@schedule = nil
|
50
|
+
end
|
51
|
+
|
52
|
+
def defaults
|
53
|
+
@@schema[:components][:schemas][:WindowConstructionShadeAbridged][:properties]
|
54
|
+
end
|
55
|
+
|
56
|
+
def find_existing_openstudio_object(openstudio_model)
|
57
|
+
object = openstudio_model.getConstructionByName(@hash[:identifier])
|
58
|
+
return object.get if object.is_initialized
|
59
|
+
nil
|
60
|
+
end
|
61
|
+
|
62
|
+
def to_openstudio(openstudio_model)
|
63
|
+
# write the shaded and unsaded versions of the construciton into the model
|
64
|
+
# reverse the shaded and unshaded identifiers so unshaded one is assigned to apertures
|
65
|
+
unshd_id = @hash[:identifier]
|
66
|
+
shd_id = @hash[:window_construction][:identifier]
|
67
|
+
@hash[:window_construction][:identifier] = unshd_id
|
68
|
+
@hash[:identifier] = shd_id
|
69
|
+
|
70
|
+
# create the unshaded construction
|
71
|
+
unshd_constr_obj = WindowConstructionAbridged.new(@hash[:window_construction])
|
72
|
+
@construction = unshd_constr_obj.to_openstudio(openstudio_model)
|
73
|
+
|
74
|
+
# create the shaded construction
|
75
|
+
@shade_construction = OpenStudio::Model::Construction.new(openstudio_model)
|
76
|
+
@shade_construction.setName(shd_id)
|
77
|
+
|
78
|
+
# create the layers of the unshaded construction into which we will insert the shade
|
79
|
+
os_materials = []
|
80
|
+
@hash[:window_construction][:layers].each do |layer|
|
81
|
+
material_identifier = layer
|
82
|
+
material = openstudio_model.getMaterialByName(material_identifier)
|
83
|
+
unless material.empty?
|
84
|
+
os_material = material.get
|
85
|
+
os_materials << os_material
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# figure out where to insert the shade material and insert it
|
90
|
+
if @hash[:shade_location]
|
91
|
+
@shade_location = @hash[:shade_location]
|
92
|
+
else
|
93
|
+
@shade_location = defaults[:shade_location][:default]
|
94
|
+
end
|
95
|
+
|
96
|
+
# insert the shade material
|
97
|
+
shd_mat_name = openstudio_model.getMaterialByName(@hash[:shade_material])
|
98
|
+
unless shd_mat_name.empty?
|
99
|
+
@shade_material = shd_mat_name.get
|
100
|
+
end
|
101
|
+
unless @shade_material.nil?
|
102
|
+
if @shade_material.is_a? OpenStudio::Model::StandardGlazing
|
103
|
+
if @shade_location == 'Interior'
|
104
|
+
os_materials[-1] = @shade_material
|
105
|
+
elsif @shade_location == 'Exterior' | os_materials.length < 2
|
106
|
+
os_materials[0] = @shade_material
|
107
|
+
else # middle glass pane
|
108
|
+
os_materials[-3] = @shade_material
|
109
|
+
end
|
110
|
+
else
|
111
|
+
if @shade_location == 'Interior'
|
112
|
+
os_materials << @shade_material
|
113
|
+
elsif @shade_location == 'Exterior'
|
114
|
+
os_materials.unshift(@shade_material)
|
115
|
+
else # between glass shade/blind
|
116
|
+
split_gap = split_gas_gap(openstudio_model, os_materials[-2], @shade_material)
|
117
|
+
os_materials[-2] = split_gap
|
118
|
+
os_materials.insert(-2, @shade_material)
|
119
|
+
os_materials.insert(-2, split_gap)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# assign the layers to the shaded construction
|
125
|
+
os_materials_vec = OpenStudio::Model::MaterialVector.new
|
126
|
+
os_materials.each do |mat|
|
127
|
+
os_materials_vec << mat
|
128
|
+
end
|
129
|
+
@shade_construction.setLayers(os_materials)
|
130
|
+
|
131
|
+
# set defaults for control type, setpoint, and schedule
|
132
|
+
if @hash[:control_type]
|
133
|
+
@control_type = @hash[:control_type]
|
134
|
+
else
|
135
|
+
@control_type = defaults[:control_type][:default]
|
136
|
+
end
|
137
|
+
|
138
|
+
if @hash[:setpoint]
|
139
|
+
@setpoint = @hash[:setpoint]
|
140
|
+
else
|
141
|
+
@setpoint = defaults[:setpoint][:default]
|
142
|
+
end
|
143
|
+
|
144
|
+
unless @hash[:schedule].nil?
|
145
|
+
schedule_ref = openstudio_model.getScheduleByName(@hash[:schedule])
|
146
|
+
unless schedule_ref.empty?
|
147
|
+
@schedule = schedule_ref.get
|
148
|
+
if @control_type == 'AlwaysOn'
|
149
|
+
@control_type = 'OnIfScheduleAllows'
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
@shade_construction
|
155
|
+
end
|
156
|
+
|
157
|
+
def to_openstudio_shading_control(openstudio_model)
|
158
|
+
# add a WindowShadingControl object to a model for a given aperture and room
|
159
|
+
os_shade_control = OpenStudio::Model::ShadingControl.new(@shade_construction)
|
160
|
+
|
161
|
+
# figure out the shading type
|
162
|
+
if @shade_material.is_a? OpenStudio::Model::StandardGlazing
|
163
|
+
shd_type = 'SwitchableGlazing'
|
164
|
+
elsif @shade_material.is_a? OpenStudio::Model::Blind
|
165
|
+
if @shade_location == 'Between'
|
166
|
+
shd_type = 'BetweenGlassBlind'
|
167
|
+
else
|
168
|
+
shd_type = @shade_location + 'Blind'
|
169
|
+
end
|
170
|
+
else
|
171
|
+
if @shade_location == 'Between'
|
172
|
+
shd_type = 'BetweenGlassShade'
|
173
|
+
else
|
174
|
+
shd_type = @shade_location + 'Shade'
|
175
|
+
end
|
176
|
+
end
|
177
|
+
os_shade_control.setShadingType(shd_type)
|
178
|
+
|
179
|
+
# set the shade control type and schedule
|
180
|
+
os_shade_control.setShadingControlType(@control_type)
|
181
|
+
unless @setpoint.nil?
|
182
|
+
os_shade_control.setSetpoint(@setpoint)
|
183
|
+
end
|
184
|
+
unless @schedule.nil?
|
185
|
+
os_shade_control.setSchedule(@schedule)
|
186
|
+
end
|
187
|
+
|
188
|
+
os_shade_control
|
189
|
+
end
|
190
|
+
|
191
|
+
def split_gas_gap(openstudio_model, original_gap, shade_material)
|
192
|
+
# split a gas gap material in two when it is interrupeted by a shade/blind
|
193
|
+
if shade_material.is_a? OpenStudio::Model::Blind
|
194
|
+
shd_thick = 0
|
195
|
+
else
|
196
|
+
shd_thick = shade_material.thickness
|
197
|
+
end
|
198
|
+
gap_thick = (original_gap.thickness - shd_thick) / 2
|
199
|
+
gap_obj = $gas_gap_hash[original_gap.name.get]
|
200
|
+
new_gap = gap_obj.to_openstudio(openstudio_model)
|
201
|
+
new_gap.setName(original_gap.name.get + gap_thick.to_s)
|
202
|
+
new_gap.setThickness(gap_thick)
|
203
|
+
new_gap
|
204
|
+
end
|
205
|
+
|
206
|
+
end #WindowConstructionShadeAbridged
|
207
|
+
end #FromHoneybee
|