-
Notifications
You must be signed in to change notification settings - Fork 145
/
Honeybee_Export To OpenStudio.py
5675 lines (4947 loc) · 310 KB
/
Honeybee_Export To OpenStudio.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# Honeybee: A Plugin for Environmental Analysis (GPL) started by Mostapha Sadeghipour Roudsari
#
# This file is part of Honeybee.
#
# Copyright (c) 2013-2018, Mostapha Sadeghipour Roudsari <mostapha@ladybug.tools>, Chris Mackey <chris@ladybug.tools>, and Chien Si Harriman <charriman@terabuild.com>
# Honeybee is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
#
# Honeybee is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
#
# @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
"""
Use this component to export HBZones into an OpenStudio file, and run them through EnergyPlus.
_
The component outputs the report from the simulation, the file path of the IDF file, and the CSV result file from the EnergyPlus run, and two other result files that record outputs in different formats.
-
Provided by Honeybee 0.0.64
Args:
north_: Input a vector to be used as a true North direction for the energy simulation or a number between 0 and 360 that represents the degrees off from the y-axis to make North. The default North direction is set to the Y-axis (0 degrees).
_epwWeatherFile: An .epw file path on your system as a text string.
_analysisPeriod_: An optional analysis period from the Ladybug_Analysis Period component. If no Analysis period is given, the energy simulation will be run for the enitre year.
_energySimPar_: Optional Energy Simulation Parameters from the "Honeybee_Energy Simulation Par" component. If no value is connected here, the simulation will run with the following parameters:
1 - 6 timeSteps per hour
2 - A shadow calculation that averages over multiple days (as opposed to running it for each timeStep)
3 - A shadow calculation frequency of 30 (meaning that the shadow calulation is averaged over every 30 days)
4 - A maximum of 3000 points used in the shadow calculation. (This may need to be higher if you have a lot of detailed context geometry)
5 - A solar energy calculation that includes both interior and exterior light reflections.
6 - A simulation including a zone sizing calculation, a system sizing calculation, a plat sizing calculation, and a full run of the energy use ofver the analysis period. The simulation is not run for the sizing period by default.
7 - A system sizing period that runs from the extreme periods of the weather file and not a ddy file.
8 - City terrian.
::::::::::::::::::::::::::::::::::::::: ...
_HBZones: The HBZones that you wish to write into an OSM file and/or run through EnergyPlus. These can be from any of the components that output HBZones.
HBContext_: Optional HBContext geometry from the "Honeybee_EP Context Surfaces." component.
simulationOutputs_: A list of the outputs that you would like EnergyPlus to write into the result CSV file. This can be any set of any outputs that you would like from EnergyPlus, writen as a list of text that will be written into the IDF. It is recommended that, if you are not expereinced with writing EnergyPlus outputs, you should use the "Honeybee_Write EP Result Parameters" component to request certain types of common outputs.
_OSMeasures: Any number of OpenStudio measures that you want to apply to your OpenStudio model. Use the "Honeybee_Load OpenStudio Measure" component to load a measure into Grasshopper. OpenStudio measures can be downloaded from the NREL Building Components Library (BCL) at this link: https://bcl.nrel.gov/
additionalStrings_: THIS OPTION IS JUST FOR ADVANCED USERS OF ENERGYPLUS. You can input additional text strings here that you would like written into the IDF. The strings input here should be complete EnergyPlus objects that are correctly formatted. You can input as many objects as you like in a list. This input can be used to write objects into the IDF that are not currently supported by Honeybee.
::::::::::::::::::::::::::::::::::::::: ...
_writeOSM: Set to "True" to have the component take your HBZones and other inputs and write them into an OSM file. Note that only setting this to "True" and not setting the output below to "True" will not automatically run the file through EnergyPlus for you.
runSimulation_: Set to "True" to have the component generate an IDF file from the OSM file and run the IDF through through EnergyPlus. Set to "False" to not run the file (this is the default). You can also connect an integer for the following options:
0 = Do Not Run OSM and IDF thrrough EnergyPlus
1 = Run the OSM and IDF through EnergyPlus with a command prompt window that displays the progress of the simulation
2 = Run the OSM and IDF through EnergyPlus in the background (without the command line popup window).
3 = Generate an IDF from the OSM file but do not run it through EnergyPlus
openOpenStudio_: Set to "True" to open the OSM file in the OpenStudio interface. This is useful if you want to visualize the HVAC system in OpenStudio, you want to edit the HVAC further in OpenStudio, or just want to run the simulation from OpenStudio instead of Rhino/GH. Note that, for this to work, you must have .osm files associated with the OpenStudio application.
fileName_: Optional text which will be used to name your OSM, IDF and result files. Change this to aviod over-writing results of previous energy simulations.
workingDir_: An optional working directory to a folder on your system, into which your OSM, IDF and result files will be written. NOTE THAT DIRECTORIES INPUT HERE SHOULD NOT HAVE ANY SPACES OR UNDERSCORES IN THE FILE PATH.
Returns:
readMe!: Check here to see a report of the EnergyPlus run, including errors.
osmFileAddress: The file path of the OSM file that has been generated on your machine.
idfFileAddress: The file path of the IDF file that has been generated on your machine. This file is only generated when you set "runSimulation_" to "True."
resultFileAddress: The file path of the CSV result file that has been generated on your machine. This file is only generated when you set "runSimulation_" to "True."
sqlFileAddress: The file path to the SQL result file that has been generated on your machine. This file contains all results from the energy model run. This file is only generated when you set "runSimulation_" to "True."
eioFileAddress: The file path of the EIO file that has been generated on your machine. This file contains information about the sizes of all HVAC equipment from the simulation. This file is only generated when you set "runSimulation_" to "True."
rddFileAddress: The file path of the Result Data Dictionary (.rdd) file that is generated after running the file through EnergyPlus. This file contains all possible outputs that can be requested from the EnergyPlus model. Use the "Honeybee_Read Result Dictionary" to see what outputs can be requested.
htmlReport: The file path to the HTML report that was generated after running the file through EnergyPlus. Open this in a web browser for an overview of the energy model results.
studyFolder: The directory in which the simulation has been run. Connect this to the 'Honeybee_Lookup EnergyPlus' folder to bring many of the files in this directory into Grasshopper.
model: The openStudio model ojbect. Use this output to generate gbXML files from your OpwnStudio models.
"""
ghenv.Component.Name = "Honeybee_Export To OpenStudio"
ghenv.Component.NickName = 'exportToOpenStudio'
ghenv.Component.Message = 'VER 0.0.64\nFEB_20_2019'
ghenv.Component.IconDisplayMode = ghenv.Component.IconDisplayMode.application
ghenv.Component.Category = "Honeybee"
ghenv.Component.SubCategory = "10 | Energy | Energy"
#compatibleHBVersion = VER 0.0.56\nMAY_18_2018
#compatibleLBVersion = VER 0.0.59\nJUL_24_2015
ghenv.Component.AdditionalHelpFromDocStrings = "1"
import os
import sys
import System
import scriptcontext as sc
import Rhino as rc
import Grasshopper.Kernel as gh
import time
from pprint import pprint
import shutil
import copy
import math
import subprocess
import operator
import collections
import platform
rc.Runtime.HostUtils.DisplayOleAlerts(False)
assert platform.architecture()[0] == '64bit', \
'You must use Rhino 64-bit to run OpenStudio not {}.'.format(platform.architecture()[0])
osVersion = ''
if sc.sticky.has_key('honeybee_release'):
if sc.sticky["honeybee_folders"]["OSLibPath"] != None:
# openstudio is there
openStudioLibFolder = sc.sticky["honeybee_folders"]["OSLibPath"]
openStudioIsReady = True
# check the version of OpenStudio.
try:
osVersion = openStudioLibFolder.split('-')[-1].split('/')[0]
except:
pass
try:
vernum1, vernum2 = int(osVersion.split('.')[0]), int(osVersion.split('.')[1])
except:
vernum1 = 1
vernum2 = 0
import clr
clr.AddReferenceToFileAndPath(openStudioLibFolder+"\\openStudio.dll")
import sys
if openStudioLibFolder not in sys.path:
sys.path.append(openStudioLibFolder)
import OpenStudio as ops
else:
openStudioIsReady = False
# let the user know that they need to download OpenStudio libraries
msg1 = "You do not have OpenStudio installed on Your System.\n" + \
"You wont be able to use this component until you install it.\n" + \
"Download the latest OpenStudio for Windows from:\n"
msg2 = "https://www.openstudio.net/downloads"
print msg1
print msg2
ghenv.Component.AddRuntimeMessage(gh.GH_RuntimeMessageLevel.Warning, msg1)
ghenv.Component.AddRuntimeMessage(gh.GH_RuntimeMessageLevel.Warning, msg2)
else:
openStudioIsReady = False
class WriteOPS(object):
def __init__(self, EPParameters, weatherFilePath):
self.weatherFile = weatherFilePath # just for batch file as an alternate solution
self.lb_preparation = sc.sticky["ladybug_Preparation"]()
self.hb_EPObjectsAux = sc.sticky["honeybee_EPObjectsAUX"]()
self.hb_EPMaterialAUX = sc.sticky["honeybee_EPMaterialAUX"]()
self.hb_EPScheduleAUX = sc.sticky["honeybee_EPScheduleAUX"]()
self.hb_EPPar = sc.sticky["honeybee_EPParameters"]()
self.simParameters = self.hb_EPPar.readEPParams(EPParameters)
if self.simParameters[4] != None:
self.ddyFile = self.simParameters[4]
self.customddy = True
else:
self.ddyFile = weatherFilePath.replace(".epw", ".ddy", 1)
self.customddy = False
self.constructionList = {}
self.materialList = {}
self.scheduleList = {}
self.scheduleSetList = {}
self.peopleList = {}
self.lightingList = {}
self.equipList = {}
self.ventList = {}
self.internalMassList = {}
self.shdCntrlList = {}
self.frameObjList = {}
self.levels = {}
self.HVACSystemDict = {}
self.adjacentSurfacesDict = {}
self.adjacentFenSrfsDict = {}
self.thermalZonesDict = {}
self.spaceTypeDict = {}
self.infiltList = []
self.schSetList = []
self.pplList = []
self.lightList = []
self.eqList = []
self.csvSchedules = []
self.csvScheduleCount = 0
self.shadeCntrlToReplace = []
self.replaceShdCntrl = False
self.windowSpectralDatasets = {}
self.waterSourceVRFs = {}
self.generatorCosts = []
def setSimulationControls(self, model):
solarDist = self.simParameters[2]
simulationControls = self.simParameters[3]
simControl = ops.Model.getSimulationControl(model);
simControl.setDoZoneSizingCalculation(simulationControls[0])
simControl.setDoSystemSizingCalculation(simulationControls[1])
simControl.setDoPlantSizingCalculation(simulationControls[2])
simControl.setRunSimulationforSizingPeriods(simulationControls[3])
simControl.setRunSimulationforWeatherFileRunPeriods(simulationControls[4])
simControl.setSolarDistribution(solarDist)
def setShadowCalculation(self, model):
calcMethod, freq, maxFigure = self.simParameters[1]
shadowCalculation = ops.Model.getShadowCalculation(model)
shadowCalculation.setMaximumFiguresInShadowOverlapCalculations(int(maxFigure))
shadowCalculation.setSkyDiffuseModelingAlgorithm(calcMethod)
shadowCalculation.setCalculationFrequency(int(freq))
def setTimestep(self, model):
timestepInput = self.simParameters[0]
timestep = ops.Model.getTimestep(model)
timestep.setNumberOfTimestepsPerHour(int(timestepInput))
def setSite(self, epwFilePath, model):
# Read the site from the EPW file.
epwfile = open(epwFilePath,"r")
headline = epwfile.readline()
csheadline = headline.split(',')
locName = csheadline[1]+'\t'+csheadline[3]
lat = float(csheadline[6])
lngt = float(csheadline[7])
timeZone = float(csheadline[8])
try:
elev = float(csheadline[9][:-1])
except:
elev = float(csheadline[9])
epwfile.close()
# Get the OpenStudio Model Site.
site = ops.Model.getSite(model)
# Set the properties of the site.
site.setName(locName)
site.setLatitude(lat)
site.setLongitude(lngt)
site.setTimeZone(timeZone)
site.setElevation(elev)
# Set weather file for OSM
ops.WeatherFile.setWeatherFile(model,ops.EpwFile(tryGetOSPath(epwFilePath)))
def setStartDayOfWeek(self, model):
# The ability to set the start day of week currently breaks OpenStudio's way of assigning schedules.
# As a result, this feature of OpenStudio SDK is not being used now.
# Instead, any specified start day of the year is assigned in the IDF after export.
startDOW = self.simParameters[8]
if startDOW == None:
startDOW = "UseWeatherFile"
yearDesc = ops.OpenStudioModelSimulation.getYearDescription(model)
yds = model.getObjectsByType(ops.IddObjectType("OS:YearDescription"))
yds[0].setString(2, startDOW)
def setHolidays(self, model):
# Even though holidays are built into OpenStudio SDK and written into the OSM,
# it seems like they are not yet written into the IDF.
# as a result, there is an additional function to add the holidays into the IDF later in this component.
if self.simParameters[7] != []:
for count, hol in enumerate(self.simParameters[7]):
holiday = ops.RunPeriodControlSpecialDays(hol, model)
holiday.setDuration(1)
holiday.setSpecialDayType("Holiday")
def setTerrain(self, model):
terrain = self.simParameters[5]
site = ops.Model.getSite(model)
site.setTerrain(terrain)
def setGroundTemps(self, model):
grndTemps = self.simParameters[6]
if grndTemps != []:
opsGrndTemps = model.getSiteGroundTemperatureBuildingSurface()
opsGrndTemps.setJanuaryGroundTemperature(grndTemps[0])
opsGrndTemps.setFebruaryGroundTemperature(grndTemps[1])
opsGrndTemps.setMarchGroundTemperature(grndTemps[2])
opsGrndTemps.setAprilGroundTemperature(grndTemps[3])
opsGrndTemps.setMayGroundTemperature(grndTemps[4])
opsGrndTemps.setJuneGroundTemperature(grndTemps[5])
opsGrndTemps.setJulyGroundTemperature(grndTemps[6])
opsGrndTemps.setAugustGroundTemperature(grndTemps[7])
opsGrndTemps.setSeptemberGroundTemperature(grndTemps[8])
opsGrndTemps.setOctoberGroundTemperature(grndTemps[9])
opsGrndTemps.setNovemberGroundTemperature(grndTemps[10])
opsGrndTemps.setDecemberGroundTemperature(grndTemps[11])
def setRunningPeriod(self, runningPeriod, model):
# get the days from numbers
stMonth, stDay, stHour, endMonth, endDay, endHour = self.lb_preparation.readRunPeriod(runningPeriod, True)
runPeriod = ops.Model.getRunPeriod(model)
runPeriod.setBeginDayOfMonth(stDay)
runPeriod.setBeginMonth(stMonth)
runPeriod.setEndDayOfMonth(endDay)
runPeriod.setEndMonth(endMonth)
def setNorth(self, north, model):
northAngle, northVector = self.lb_preparation.angle2north(north)
building = ops.Model.getBuilding(model)
building.setNorthAxis(math.degrees(northAngle))
def generateStories(self, HBZones, model):
levels = []
for HBZone in HBZones:
floorH = "%.2f"%HBZone.getFloorZLevel()
if float(floorH) not in levels:
levels.append(float(floorH))
levels.sort()
for floorH in levels:
story = ops.BuildingStory(model)
story.setNominalZCoordinate(float(floorH))
key = "%.2f"%floorH
if str(key) == '-0.00':
key = '0.00'
self.levels[key] = story
def setupLevels(self, zone, space):
floorH = "%.2f"%zone.getFloorZLevel()
if str(floorH) == '-0.00':
floorH = '0.00'
space.setBuildingStory(self.levels[floorH])
return space
def setSizingFactors(self, model):
heatSizFac = self.simParameters[9]
coolSizFac = self.simParameters[10]
sizParams = ops.Model.getSizingParameters(model)
try:
sizParams.setHeatingSizingFactor(heatSizFac)
except:
pass
try:
sizParams.setCoolingSizingFactor(coolSizFac)
except:
pass
def addDesignDays(self, model):
# check ddy file to be available
ddyFile = self.ddyFile
ddFound = False
if not os.path.isfile(ddyFile):
print "Can't find ddy file next to the EPW."
print "Extreme values from the weather file design will be used instead."
else:
ddyPath = tryGetOSPath(ddyFile)
ddyIdf = ops.IdfFile.load(ddyPath, ops.IddFileType("EnergyPlus"))
ddyWorkSpcae = ops.Workspace(ddyIdf.get())
reverseTranslator = ops.EnergyPlusReverseTranslator()
ddyModel = reverseTranslator.translateWorkspace(ddyWorkSpcae)
designDayVector = ddyModel.getDesignDays()
selectedDesignDays = ops.WorkspaceObjectVector()
for dday in designDayVector:
if self.customddy == True:
selectedDesignDays.Add(dday)
ddFound = True
if dday.name().get().find(".4%")> -1 or dday.name().get().find("99.6%") > -1:
selectedDesignDays.Add(dday)
ddFound = True
model.addObjects(selectedDesignDays)
return ddFound
def writeDDObjStr(self, ddName, designType, month, day, dbTemp, dbTempRange, wbTemp, enth, humidConditType, pressure, windSpeed, windDir, ashraeSkyClearness):
ddStr = '! ' + ddName + '\n' + \
'SizingPeriod:DesignDay,\n' + \
'\t' + ddName + ', !- Name\n' + \
'\t' + str(month) + ', !- Month\n' + \
'\t' + str(day) + ', !- Day of Month\n' + \
'\t' + designType + ',!- Day Type\n' + \
'\t' + str(dbTemp) + ', !- Maximum Dry-Bulb Temperature {C}\n' + \
'\t' + str(dbTempRange) + ', !- Daily Dry-Bulb Temperature Range {C}\n' + \
'\t' + 'DefaultMultipliers, !- Dry-Bulb Temperature Range Modifier Type\n' + \
'\t' + ', !- Dry-Bulb Temperature Range Modifier Schedule Name\n' + \
'\t' + humidConditType + ', !- Humidity Condition Type\n' + \
'\t' + str(wbTemp) + ', !- Wetbulb or Dewpoint at Maximum Dry-Bulb {C}\n' + \
'\t' + ', !- Humidity Indicating Day Schedule Name\n' + \
'\t' + ', !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}\n' + \
'\t' + str(enth) + ', !- Enthalpy at Maximum Dry-Bulb {J/kg}\n' + \
'\t' + ', !- Daily Wet-Bulb Temperature Range {deltaC}\n' + \
'\t' + str(pressure) + ', !- Barometric Pressure {Pa}\n' + \
'\t' + str(windSpeed) + ', !- Wind Speed {m/s} design conditions vs. traditional 6.71 m/s (15 mph)\n' + \
'\t' + str(windDir) + ', !- Wind Direction {Degrees; N=0, S=180}\n' + \
'\t' + 'No, !- Rain {Yes/No}\n' + \
'\t' + 'No, !- Snow on ground {Yes/No}\n' + \
'\t' + 'No, !- Daylight Savings Time Indicator\n' + \
'\t' + 'ASHRAEClearSky' + ', !- Solar Model Indicator\n' + \
'\t' + ', !- Beam Solar Day Schedule Name\n' + \
'\t' + ', !- Diffuse Solar Day Schedule Name\n' + \
'\t' + ', !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub)\n' + \
'\t' + ', !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud)\n' + \
'\t' + str(ashraeSkyClearness) + '; !- Clearness {0.0 to 1.1}\n' + '\n'
return ddStr
def createDdyFromEPW(self, epwWeatherFile, workingDir, lb_preparation, lb_comfortModels):
# Extract the relevant data from the EPW.
# We need the following: dbTemp, dewPoint, rH, windSpeed, windDir, windDir, wetBulb, enthalpy
dbTemp = []
dewPoint = []
rH = []
windSpeed = []
windDir = []
barPress = []
wetBulb = []
epwfile = open(epwWeatherFile,"r")
for count, line in enumerate(epwfile):
if count > 7:
dbTemp.append(float(line.split(',')[6]))
dewPoint.append(float(line.split(',')[7]))
rH.append(float(line.split(',')[8]))
barPress.append(float(line.split(',')[9]))
windSpeed.append(float(line.split(',')[21]))
windDir.append(float(line.split(',')[20]))
epwfile.close()
hR, enthalpy, pP, sP = lb_comfortModels.calcHumidRatio(dbTemp, rH, barPress)
for i, tem in enumerate(dbTemp):
wetBulb.append(lb_comfortModels.findWetBulb(tem, rH[i], barPress[i]))
# Find the conditions for the most extreme hours in the epw. These are the 7 extreme conditions we need:
# 1 - Winnter Design Day - Min Dry Bulb (Sensible Heating)
# 2 - Winter Design Day - Min Dew Point (Humidification)
# 3 - Winter Design Day = Max Wind Speed when temperature is less than 1 standard deviation of annual mean.
# 4 - Summer Design Day - Max Dry Bulb (Sensible Cooling)
# 5 - Summer Design Day - Max Wet Bulb (Dehumidification)
# 6 - Summer Design Day - Max Dew Point (Dehumidification)
# 7 - Summer Design Day - Max Enthalpy (Dehumidification)
sortedDB, corrWB = zip(*sorted(zip(dbTemp, wetBulb)))
minDB = sortedDB[34] # Design Condition 1
WBforMinDB = corrWB[34]
maxDB = sortedDB[-35] # Design Condition 4
WBforMaxDB = corrWB[-35]
sortedDP, corrDB = zip(*sorted(zip(dewPoint, dbTemp)))
minDP = sortedDP[34] # Design Condition 2
DBforMinDP = corrDB[34]
maxDP = sortedDP[-35] # Design Condition 6
DBforMaxDP = corrDB[-35]
sortedWB, corresDB = zip(*sorted(zip(wetBulb, dbTemp)))
maxWB = sortedWB[-35] # Design Condition 5
DBforMaxWB = corresDB[-35]
sortedEnth, correspondDB = zip(*sorted(zip(enthalpy, dbTemp)))
maxEnth = int(sortedEnth[-35] * 1000) # Design Condition 7
DBforMaxEnth = correspondDB[-35]
coldStdDevTemp = sortedDB[1384]
hotStdDevTemp = sortedDB[-1385]
winSpBelowTemp = []
windDirBelowTemp = []
winSpAboveTemp = []
windDirAboveTemp = []
for i, tem in enumerate(dbTemp):
if tem < coldStdDevTemp:
winSpBelowTemp.append(windSpeed[i])
windDirBelowTemp.append(windDir[i])
elif tem > hotStdDevTemp:
winSpAboveTemp.append(windSpeed[i])
windDirAboveTemp.append(windDir[i])
winSpBelowTemp.sort()
coldMonWind = winSpBelowTemp[922]
coldMonWinDir = int(sum(windDirBelowTemp)/len(windDirBelowTemp))
maxWind = winSpBelowTemp[-5] # Design Condition 3
winSpAboveTemp.sort()
hotMonWind = winSpAboveTemp[922]
hotMonWinDir = int(sum(windDirAboveTemp)/len(windDirAboveTemp))
# Calculate a few other required values from the epw data.
# Like average annual pressure and coldest/hottest month.
# and average wind speed/direction during these months.
avgEpwParPress = int(sum(barPress)/len(barPress))
def binAndAvgByMonth(dataSet):
avgMonthData = []
binnedMonthData = []
for mon in range(12):
binnedMonthData.append([])
for i, x in enumerate(dataSet):
d, m, t = lb_preparation.hour2Date(i, True)
binnedMonthData[m].append(x)
for dataList in binnedMonthData:
avgMonthData.append(sum(dataList)/len(dataList))
return avgMonthData, binnedMonthData
def partitionList(l, n):
for i in range(0, len(l), n):
yield l[i:i+n]
avgMonTemps, binMonTemps = binAndAvgByMonth(dbTemp)
monNums = range(12)
avgMonTempsSort, monNumsSort = zip(*sorted(zip(avgMonTemps, monNums)))
coldMonth = monNumsSort[0]
hotMonth = monNumsSort[-1]
allHotMonthTemps = binMonTemps[hotMonth]
dayHotMonTemps = partitionList(allHotMonthTemps, 24)
dailyTempDiff = []
for day in dayHotMonTemps:
day.sort()
dailyTempDiff.append(day[-1]-day[0])
hotDayDBTempRange = (int((sum(dailyTempDiff)/len(dailyTempDiff))*100))/100
# Assemble a list of design condition strings to write into the ddy file.
ddStrs = []
ddStrs.append(self.writeDDObjStr('Ann Htg 99.6% Condns DB', 'WinterDesignDay', coldMonth+1, 21, minDB, 0, minDB, '', 'Wetbulb', avgEpwParPress, coldMonWind, coldMonWinDir, 0))
ddStrs.append(self.writeDDObjStr('Ann Hum_n 99.6% Condns DP=>MCDB', 'WinterDesignDay', coldMonth+1, 21, DBforMinDP, 0, minDP, '', 'Dewpoint', avgEpwParPress, coldMonWind, coldMonWinDir, 0))
ddStrs.append(self.writeDDObjStr('Ann Htg Wind 99.6% Condns WS=>MCDB', 'WinterDesignDay', coldMonth+1, 21, coldStdDevTemp, 0, coldStdDevTemp, '', 'Wetbulb', avgEpwParPress, maxWind, coldMonWinDir, 0))
ddStrs.append(self.writeDDObjStr('Ann Clg .4% Condns DB=>MWB', 'SummerDesignDay', hotMonth+1, 21, maxDB, hotDayDBTempRange, WBforMaxDB, '', 'Wetbulb', avgEpwParPress, hotMonWind, hotMonWinDir, 1.2))
ddStrs.append(self.writeDDObjStr('Ann Clg .4% Condns WB=>MDB', 'SummerDesignDay', hotMonth+1, 21, DBforMaxWB, hotDayDBTempRange, maxWB, '', 'Wetbulb', avgEpwParPress, hotMonWind, hotMonWinDir, 1.2))
ddStrs.append(self.writeDDObjStr('Ann Clg .4% Condns DP=>MDB', 'SummerDesignDay', hotMonth+1, 21, DBforMaxDP, hotDayDBTempRange, maxDP, '', 'Dewpoint', avgEpwParPress, hotMonWind, hotMonWinDir, 1.2))
ddStrs.append(self.writeDDObjStr('Ann Clg .4% Condns Enth=>MDB', 'SummerDesignDay', hotMonth+1, 21, DBforMaxEnth, hotDayDBTempRange, '', maxEnth, 'Enthalpy', avgEpwParPress, hotMonWind, hotMonWinDir, 1.2))
# Write the design day objects into a .ddy file.
epwFileName = epwWeatherFile.split('\\')[-1].split('.')[0]
self.ddyFile = workingDir + '\\' + epwFileName + '.ddy'
ddyFile = open(self.ddyFile, "w")
for sizingObj in ddStrs:
ddyFile.write(sizingObj)
ddyFile.close()
def isConstructionInLib(self, constructionName):
return constructionName in self.constructionList
def addConstructionToLib(self, constructionName, construction):
self.constructionList[constructionName] = construction
def getConstructionFromLib(self, constructionName):
return self.constructionList[constructionName]
def isMaterialInLib(self, materialName):
return materialName in self.materialList.keys()
def addMaterialToLib(self, materialName, material):
self.materialList[materialName] = material
def getMaterialFromLib(self, materialName):
return self.materialList[materialName]
def isScheduleInLib(self, scheduleName):
return scheduleName in self.scheduleList.keys()
def addScheduleToLib(self, scheduleName, schedule):
self.scheduleList[scheduleName] = schedule
def getScheduleFromLib(self, scheduleName):
return self.scheduleList[scheduleName]
def isShdCntrlInLib(self, shdCntrlName):
return shdCntrlName in self.shdCntrlList.keys()
def addShdCntrlToLib(self, shdCntrlName, shdCntrl):
self.shdCntrlList[shdCntrlName] = shdCntrl
def getShdCntrlFromLib(self, shdCntrlName):
return self.shdCntrlList[shdCntrlName]
def isFrameObjInLib(self, frameObjName):
return frameObjName in self.frameObjList.keys()
def addFrameObjToLib(self, frameObjName, frameObj):
self.frameObjList[frameObjName] = frameObj
def getFrameObjFromLib(self, frameObjName):
return self.frameObjList[frameObjName]
def createOSScheduleTypeLimitsFromValues(self, model, lowerLimit, upperLimit, numericType, unitType):
typeLimit = ops.ScheduleTypeLimits(model)
try: typeLimit.setLowerLimitValue(float(lowerLimit))
except: pass
try: typeLimit.setUpperLimitValue(float(upperLimit))
except: pass
typeLimit.setNumericType(numericType)
try: typeLimit.setUnitType(unitType)
except: pass
return typeLimit
def createOSScheduleTypeLimits(self, schdTypeLimitsName, model):
"""
['ScheduleTypeLimits', '0', '1', 'Continuous']
['Schedule Type', 'Lower Limit Value {BasedOnField A3}', 'Upper Limit Value {BasedOnField A3}', 'Numeric Type']
"""
values, comments = self.hb_EPScheduleAUX.getScheduleTypeLimitsDataByName(schdTypeLimitsName, ghenv.Component)
typeLimit = ops.ScheduleTypeLimits(model)
try: typeLimit.setLowerLimitValue(float(values[1]))
except: pass
try: typeLimit.setUpperLimitValue(float(values[2]))
except: pass
typeLimit.setNumericType(values[3])
try: typeLimit.setUnitType(values[4])
except: pass
return typeLimit
def createConstantScheduleRuleset(self, ruleSetName, schName, typeLimitName, value, model):
scheduleRuleset = ops.ScheduleRuleset(model)
scheduleRuleset.setName(ruleSetName)
scheduleDay = scheduleRuleset.defaultDaySchedule()
scheduleDay.setName(schName)
scheduleDay.setScheduleTypeLimits(self.createOSScheduleTypeLimits(typeLimitName, model))
osUntilTime = ops.Time(1)
scheduleDay.removeValue(osUntilTime)
scheduleDay.addValue(osUntilTime, float(value))
return scheduleRuleset
def createConstantOSSchedule(self, schName, values, model):
"""
'Schedule:Constant'
['Schedule Type', 'Schedule Type Limits Name', 'Hourly Value']
"""
scheduleConstant = ops.ScheduleConstant(model)
scheduleConstant.setName(schName)
scheduleConstant.setValue(float(values[2]))
if values[1] != None:
typeLimitName = values[1]
try: scheduleConstant.setScheduleTypeLimits(self.getScheduleFromLib(typeLimitName))
except: scheduleConstant.setScheduleTypeLimits(typeLimitName)
return scheduleConstant
def createDayOSSchedule(self, schName, values, model):
"""
Schedule:Day:Interval
['Schedule Type', 'Schedule Type Limits Name', 'Interpolate to Timestep', 'Time 1 {hh:mm}', 'Value Until Time 1']
"""
scheduleDay = ops.ScheduleDay(model)
scheduleDay.setName(schName)
typeLimitName = values[1]
scheduleDay.setScheduleTypeLimits(self.getScheduleFromLib(typeLimitName))
numberOfDaySch = int((len(values) - 3) /2)
for i in range(numberOfDaySch):
untilTime = map(int, values[2 * i + 3].split(":"))
fractionalTime = untilTime[0] + untilTime[1]/60
osUntilTime = ops.Time(fractionalTime/24)
scheduleDay.addValue(osUntilTime, float(values[2 * i + 4]))
return scheduleDay
def createWeeklyOSSchedule(self, schName, values, model):
"""
Schedule:Week:Daily
['Schedule Type', 'Sunday Schedule:Day Name', 'Monday Schedule:Day Name',
'Tuesday Schedule:Day Name', 'Wednesday Schedule:Day Name', 'Thursday Schedule:Day Name',
'Friday Schedule:Day Name', 'Saturday Schedule:Day Name', 'Holiday Schedule:Day Name',
'SummerDesignDay Schedule:Day Name', 'WinterDesignDay Schedule:Day Name',
'CustomDay1 Schedule:Day Name', 'CustomDay2 Schedule:Day Name']
"""
weeklySchd = ops.ScheduleWeek(model)
weeklySchd.setName(schName)
sundaySchedule = self.getOSSchedule(values[1], model)
weeklySchd.setSundaySchedule(sundaySchedule)
mondaySchedule = self.getOSSchedule(values[2], model)
weeklySchd.setMondaySchedule(mondaySchedule)
tuesdaySchedule = self.getOSSchedule(values[3], model)
weeklySchd.setTuesdaySchedule(tuesdaySchedule)
wednesdaySchedule = self.getOSSchedule(values[4], model)
weeklySchd.setWednesdaySchedule(wednesdaySchedule)
thursdaySchedule = self.getOSSchedule(values[5], model)
weeklySchd.setThursdaySchedule(thursdaySchedule)
fridaySchedule = self.getOSSchedule(values[6], model)
weeklySchd.setFridaySchedule(fridaySchedule)
saturdaySchedule = self.getOSSchedule(values[7], model)
weeklySchd.setSaturdaySchedule(saturdaySchedule)
holidaySchedule = self.getOSSchedule(values[8], model)
weeklySchd.setHolidaySchedule(holidaySchedule)
summerDesignDaySchedule = self.getOSSchedule(values[9], model)
weeklySchd.setSummerDesignDaySchedule(summerDesignDaySchedule)
winterDesignDaySchedule = self.getOSSchedule(values[10], model)
weeklySchd.setWinterDesignDaySchedule(winterDesignDaySchedule)
customDay1Schedule = self.getOSSchedule(values[11], model)
weeklySchd.setCustomDay1Schedule(customDay1Schedule)
customDay2Schedule = self.getOSSchedule(values[12], model)
weeklySchd.setCustomDay2Schedule(customDay2Schedule)
return weeklySchd
def createYearlyOSSchedule(self, schName, values, model):
"""
"Schedule:Year"
"""
name = schName
typeLimitName = values[1]
schedule = ops.ScheduleYear(model)
schedule.setName(name)
schedule.setScheduleTypeLimits(self.getScheduleFromLib(typeLimitName))
# generate weekly schedules
numOfWeeklySchedules = int((len(values)-2)/5)
for i in range(numOfWeeklySchedules):
weekDayScheduleName = values[5 * i + 2]
startDate = ops.Date(ops.MonthOfYear(int(values[5 * i + 3])), int(values[5 * i + 4]))
endDate = ops.Date(ops.MonthOfYear(int(values[5 * i + 5])), int(values[5 * i + 6]))
ScheduleWeek = self.getOSSchedule(weekDayScheduleName, model)
schedule.addScheduleWeek(endDate, ScheduleWeek)
return schedule
def getOSSchedule(self, schName, model):
csvSched = False
if schName.lower().endswith(".csv"):
msg = "Currently OpenStudio component des not support .csv file as a schedule.\n" + \
"The schedule: " + schName + " will be written into IDF after it is translated from an OSM."
print msg
self.csvSchedules.append(schName)
self.csvScheduleCount += 1
csvSched = True
if csvSched == True:
values, comments = self.hb_EPScheduleAUX.getScheduleDataByName('DEFAULTCSVPLACEHOLDER', ghenv.Component)
# Check the type limits.
with open(schName, "r") as schFile:
for lineCount, line in enumerate(schFile):
if lineCount == 0:
typeLims = line.split(',')[-1]
if 'dimensionless' not in typeLims.lower():
if typeLims.strip().lower() == 'temperature':
values[1] = typeLims.strip() + ' 1'
elif 'daysim schedule file' in typeLims.lower():
values[1] = 'fractional'
else:
values[1] = typeLims.strip()
else:
values, comments = self.hb_EPScheduleAUX.getScheduleDataByName(schName, ghenv.Component)
if values[0].lower() != "schedule:week:daily":
scheduleTypeLimitsName = values[1]
if not self.isScheduleInLib(scheduleTypeLimitsName):
OSScheduleTypeLimits = self.createOSScheduleTypeLimits(values[1], model)
self.addScheduleToLib(scheduleTypeLimitsName, OSScheduleTypeLimits)
if not self.isScheduleInLib(schName):
if values[0].lower() == "schedule:year":
OSSchedule = self.createYearlyOSSchedule(schName, values, model)
elif values[0].lower() == "schedule:day:interval":
OSSchedule = self.createDayOSSchedule(schName, values, model)
elif values[0].lower() == "schedule:week:daily":
OSSchedule = self.createWeeklyOSSchedule(schName, values, model)
elif values[0].lower() == "schedule:constant":
OSSchedule = self.createConstantOSSchedule(schName, values, model)
else:
OSSchedule = None
if OSSchedule!=None:
# add to library
self.addScheduleToLib(schName, OSSchedule)
return OSSchedule
else:
return self.getScheduleFromLib(schName)
def getOSFrameObj(self, frameObjName, model):
if not self.isFrameObjInLib(frameObjName):
values = sc.sticky["honeybee_WindowPropLib"][frameObjName]
OSFrameObj = ops.WindowPropertyFrameAndDivider(model)
OSFrameObj.setFrameWidth(float(values[1][0]))
OSFrameObj.setFrameConductance(float(values[4][0]))
OSFrameObj.setRatioOfFrameEdgeGlassConductanceToCenterOfGlassConductance(float(values[5][0]))
OSFrameObj.setFrameSolarAbsorptance(float(values[6][0]))
OSFrameObj.setFrameVisibleAbsorptance(float(values[7][0]))
OSFrameObj.setFrameThermalHemisphericalEmissivity(float(values[8][0]))
self.addFrameObjToLib(frameObjName, OSFrameObj)
return OSFrameObj
else:
return self.getFrameObjFromLib(frameObjName)
def getOSShdCntrl(self, shdCntrlName, model):
if not self.isShdCntrlInLib(shdCntrlName):
# Make the shade control obect.
values = self.hb_EPObjectsAux.getEPObjectDataByName(shdCntrlName)
if values[2][0] != '':
# Iniitalize for construction (for switchable glazing).
constrName = values[2][0]
if not self.isConstructionInLib(constrName):
OSConstruction = self.getOSConstruction(constrName, model)
self.addConstructionToLib(constrName, OSConstruction)
else:
OSConstruction = self.getConstructionFromLib(constrName)
OSShdCntrl = ops.ShadingControl(OSConstruction)
else:
# Iniitalize for material (for blinds and shades).
materialName = values[8][0]
if not self.isMaterialInLib(materialName):
OSMaterial = self.getOSMaterial(materialName, model)
self.addMaterialToLib(materialName, OSMaterial)
else:
OSMaterial = self.getMaterialFromLib(materialName)
OSShdCntrl = ops.ShadingControl(OSMaterial)
# Shading Type
if values[1][0] != '':
OSShdCntrl.setShadingType(values[1][0])
# Shading Control Type.
if values[3][0] != '':
### Openstudio currently does not support any shading control other than OnIfHighSolarOnWindow.
# As such, there is a workaround above for now.
if values[3][0] == 'OnIfHighSolarOnWindow':
OSShdCntrl.setShadingControlType(str(values[3][0]))
else:
self.replaceShdCntrl = True
self.shadeCntrlToReplace.append([shdCntrlName, OSShdCntrl.name()])
# Shading Schedule.
if values[4][0] != '':
osSched = self.getOSSchedule(values[4][0], model)
OSShdCntrl.setSchedule(osSched)
# Shading setpoint.
if values[5][0] != '':
OSShdCntrl.setSetpoint(float(values[5][0]))
# Openstudio also does not support a second setpoint. This code really doen't do anything for now.
try:
setP2 = float(values[11][0])
OSShdCntrl.setDouble(12, setP2)
except:
pass
self.addShdCntrlToLib(shdCntrlName, OSShdCntrl)
return OSShdCntrl
else:
return self.getShdCntrlFromLib(shdCntrlName)
def assignThermalZone(self, zone, space, model):
thermalZone = ops.ThermalZone(model)
ops.OpenStudioModelHVAC.setThermalZone(space, thermalZone)
thermalZone.setName(zone.name)
if zone.isPlenum or not zone.partOfArea:
space.partofTotalFloorArea = False
if zone.multiplier and zone.multiplier != 1:
thermalZone.setMultiplier(zone.multiplier)
if zone.ceilingHeight:
thermalZone.setCeilingHeight(zone.ceilingHeight)
if zone.volume:
thermalZone.setVolume(zone.volume)
if zone.insideConvectionAlgorithm:
thermalZone.setZoneInsideConvectionAlgorithm(zone.insideConvectionAlgorithm)
if zone.outsideConvectionAlgorithm:
thermalZone.setZoneOutsideConvectionAlgorithm(zone.outsideConvectionAlgorithm)
return space, thermalZone
### START OF FUNCTIONS FOR CREATING HVAC SYSTEMS FROM SCRATCH ###
"""
These functions are a python adaptation of several functions from the OsLib_HVAC.rb.
These ruby versions of these functions are used for many of the
Advanced Energy Design Guideline (AEDG) measures that have been released by NREL.
"""
def createDefaultAEDGPump(self, model, pEfficiency, pressRise=119563):
pump = ops.PumpVariableSpeed(model)
pump.setRatedPumpHead(pressRise) #Pa
pump.setMotorEfficiency(pEfficiency)
pump.setCoefficient1ofthePartLoadPerformanceCurve(0)
pump.setCoefficient2ofthePartLoadPerformanceCurve(0.0216)
pump.setCoefficient3ofthePartLoadPerformanceCurve(-0.0325)
pump.setCoefficient4ofthePartLoadPerformanceCurve(1.0095)
return pump
def createDefaultAEDGFan(self, fanType, model, airDetails):
if fanType == 'CV':
fan = ops.FanConstantVolume(model, model.alwaysOnDiscreteSchedule())
elif fanType == 'VV':
fan = ops.FanVariableVolume(model, model.alwaysOnDiscreteSchedule())
if airDetails != None and airDetails.fanTotalEfficiency != 'Default':
fan.setFanEfficiency(airDetails.fanTotalEfficiency)
else:
if fanType == 'CV':
fan.setFanEfficiency(0.6)
else:
fan.setFanEfficiency(0.69)
if airDetails != None and airDetails.fanPressureRise != 'Default':
fan.setPressureRise(airDetails.fanPressureRise)
else:
if fanType == 'CV':
fan.setPressureRise(500) #Pa
else:
fan.setPressureRise(1125) #Pa
if airDetails != None and airDetails.airSysHardSize != 'Default':
fan.setMaximumFlowRate(float(airDetails.airSysHardSize))
else:
fan.autosizeMaximumFlowRate()
if airDetails != None and airDetails.fanMotorEfficiency != 'Default':
fan.setMotorEfficiency(airDetails.fanMotorEfficiency)
else:
fan.setMotorEfficiency(0.9)
fan.setMotorInAirstreamFraction(1.0)
return fan
def createDefaultGroundSourceChiller(self, model, coolingDetails, HVACCount, heatingDetails):
# cooling
# create clgCapFuncTempCurve
clgCapFuncTempCurve = ops.CurveBiquadratic(model)
clgCapFuncTempCurve.setName('ChillerHeaterClgCapFT' +str(HVACCount))
clgCapFuncTempCurve.setCoefficient1Constant(0.950829)
clgCapFuncTempCurve.setCoefficient2x(0.03419327)
clgCapFuncTempCurve.setCoefficient3xPOW2(0.000266642)
clgCapFuncTempCurve.setCoefficient4y(-0.001733397)
clgCapFuncTempCurve.setCoefficient5yPOW2(-0.0001762417)
clgCapFuncTempCurve.setCoefficient6xTIMESY(-0.0000369198)
clgCapFuncTempCurve.setMinimumValueofx(4.44)
clgCapFuncTempCurve.setMaximumValueofx(12.78)
clgCapFuncTempCurve.setMinimumValueofy(12.78)
clgCapFuncTempCurve.setMaximumValueofy(29.44)
clgCapFuncTempCurve.setInputUnitTypeforX('Temperature')
clgCapFuncTempCurve.setInputUnitTypeforY('Temperature')
clgCapFuncTempCurve.setOutputUnitType('Dimensionless')
# create eirFuncTempCurve
eirFuncTempCurve = ops.CurveBiquadratic(model)
eirFuncTempCurve.setName('ChillerHeaterClgEIRFT' +str(HVACCount))
eirFuncTempCurve.setCoefficient1Constant(0.7362431)
eirFuncTempCurve.setCoefficient2x(0.02136491)
eirFuncTempCurve.setCoefficient3xPOW2(0.0003638909)
eirFuncTempCurve.setCoefficient4y(-0.004284947)
eirFuncTempCurve.setCoefficient5yPOW2(0.0003389817)
eirFuncTempCurve.setCoefficient6xTIMESY(-0.0003632396)
eirFuncTempCurve.setMinimumValueofx(4.44)
eirFuncTempCurve.setMaximumValueofx(12.78)
eirFuncTempCurve.setMinimumValueofy(12.78)
eirFuncTempCurve.setMaximumValueofy(29.44)
eirFuncTempCurve.setInputUnitTypeforX('Temperature')
eirFuncTempCurve.setInputUnitTypeforY('Temperature')
eirFuncTempCurve.setOutputUnitType('Dimensionless')
# create eirFuncPlrCurve
eirFuncPlrCurve = ops.CurveBicubic(model)
eirFuncPlrCurve.setName('ChillerHeaterClgEIRFPLR' +str(HVACCount))
eirFuncPlrCurve.setCoefficient1Constant(0)
eirFuncPlrCurve.setCoefficient2x(1.22895)
eirFuncPlrCurve.setCoefficient3xPOW2(-0.751383)
eirFuncPlrCurve.setCoefficient7xPOW3(0.517396)
eirFuncPlrCurve.setMinimumValueofx(0.2)
eirFuncPlrCurve.setMaximumValueofx(1)
# heating
# create htgCapFuncTempCurve
htgCapFuncTempCurve = ops.CurveBiquadratic(model)
htgCapFuncTempCurve.setName('ChillerHeaterHtgCapFT' +str(HVACCount))
htgCapFuncTempCurve.setCoefficient1Constant(0.9415266)
htgCapFuncTempCurve.setCoefficient2x(0.05527431)
htgCapFuncTempCurve.setCoefficient3xPOW2(0.0003573558)
htgCapFuncTempCurve.setCoefficient4y(0.001258391)
htgCapFuncTempCurve.setCoefficient5yPOW2(-0.00006420546)
htgCapFuncTempCurve.setCoefficient6xTIMESY(-0.0005350989)
htgCapFuncTempCurve.setMinimumValueofx(4.44)
htgCapFuncTempCurve.setMaximumValueofx(15.56)
htgCapFuncTempCurve.setMinimumValueofy(35)
htgCapFuncTempCurve.setMaximumValueofy(57.22)
htgCapFuncTempCurve.setInputUnitTypeforX('Temperature')
htgCapFuncTempCurve.setInputUnitTypeforY('Temperature')
htgCapFuncTempCurve.setOutputUnitType('Dimensionless')
# create eirFuncTempCurve
chillerHeaterHtgEIRFT = ops.CurveBiquadratic(model)
chillerHeaterHtgEIRFT.setName('ChillerHeaterHtgEIRFT' +str(HVACCount))
chillerHeaterHtgEIRFT.setCoefficient1Constant(0.2286246)
chillerHeaterHtgEIRFT.setCoefficient2x(0.02498714)
chillerHeaterHtgEIRFT.setCoefficient3xPOW2(-0.00001267106)
chillerHeaterHtgEIRFT.setCoefficient4y(0.009327184)
chillerHeaterHtgEIRFT.setCoefficient5yPOW2(0.00005892037)
chillerHeaterHtgEIRFT.setCoefficient6xTIMESY(-0.0003268512)
chillerHeaterHtgEIRFT.setMinimumValueofx(4.44)
chillerHeaterHtgEIRFT.setMaximumValueofx(15.56)
chillerHeaterHtgEIRFT.setMinimumValueofy(35)
chillerHeaterHtgEIRFT.setMaximumValueofy(57.22)
chillerHeaterHtgEIRFT.setInputUnitTypeforX('Temperature')
chillerHeaterHtgEIRFT.setInputUnitTypeforY('Temperature')
chillerHeaterHtgEIRFT.setOutputUnitType('Dimensionless')