if msg != str.Empty:
        w = gh.GH_RuntimeMessageLevel.Warning
        ghenv.Component.AddRuntimeMessage(w, msg)

    else:
        iIllumLevelsNoDynamicSHD = DataTree[Object]()
        iIllumLevelsDynamicSHDGroupI = DataTree[Object]()
        iIllumLevelsDynamicSHDGroupII = DataTree[Object]()
        iIlluminanceBasedOnOccupancy = DataTree[Object]()
        shadingGroupInEffect = DataTree[Object]()

        # for each space
        for spaceCount in range(len(numOfPtsInEachSpace)):
            for HOY in range(8760):
                p = GH_Path(spaceCount, HOY)
                stateInEffect = 0
                blindsGroupInEffect = 0
                shadingGroupInEffectForTheHour = "No blind"
                iIllumLevelsNoDynamicSHD.AddRange(
                    illuminanceValues[0][HOY][0]
                    [sum(numOfPtsInEachSpace[:spaceCount]
                         ):sum(numOfPtsInEachSpace[:spaceCount + 1])], p)

                if illuminanceValues[1] != [] and len(
                        illuminanceValues[1]
                    [HOY]) != 0 and shadingProfiles[spaceCount] != []:
                    numberOfStates = len(illuminanceValues[1][HOY])
                    if shadingProfiles[spaceCount][0][HOY] > 0:
                        stateInEffect = int(
                            round(numberOfStates *
示例#2
0
                                                   _testPoints, _HOY,
                                                   annualProfiles_)

    if msg != str.Empty:
        w = gh.GH_RuntimeMessageLevel.Warning
        ghenv.Component.AddRuntimeMessage(w, msg)

    else:
        iIllumLevelsNoDynamicSHD = DataTree[Object]()
        iIllumLevelsDynamicSHDGroupI = DataTree[Object]()
        iIllumLevelsDynamicSHDGroupII = DataTree[Object]()
        iIlluminanceBasedOnOccupancy = DataTree[Object]()

        # for each space
        for spaceCount in range(len(numOfPtsInEachSpace)):
            p = GH_Path(spaceCount)

            stateInEffect = 0
            blindsGroupInEffect = 0
            shadingGroupInEffect = "No blind"
            iIllumLevelsNoDynamicSHD.AddRange(
                illuminanceValues[0][0]
                [sum(numOfPtsInEachSpace[:spaceCount]
                     ):sum(numOfPtsInEachSpace[:spaceCount + 1])], p)

            if len(illuminanceValues[1]
                   ) != 0 and shadingProfiles[spaceCount] != []:
                numberOfStates = len(illuminanceValues[1])
                if shadingProfiles[spaceCount][0][_HOY - 1] > 0:
                    stateInEffect = int(
                        round(numberOfStates *
示例#3
0
import Rhino

# for accesssing GH classes
import clr
clr.AddReference("Grasshopper")
from Grasshopper.Kernel.Data import GH_Path
from Grasshopper import DataTree

# read geometry out of 3dm files and filter by layernames
if DoImport and FilePaths and LayerNames:

    layerTree = DataTree[Rhino.Geometry.GeometryBase]() # make a DataTree

    for filepath in FilePaths:
        model = Rhino.FileIO.File3dm.Read(filepath)
        if not model: continue
        for i, layer in enumerate(LayerNames):
            path = GH_Path(i)
            geometry = []
            objs = model.Objects.FindByLayer(layer)
            for obj in objs:
                geom = obj.Geometry
                geom.EnsurePrivateCopy()
                geometry.append(geom)
            layerTree.AddRange(geometry, path)
        # models can take up a considerable amount of
        # memory that we don't need, so get rid of it
        # after copying the geometry we want out of it
        model.Dispose()
示例#4
0
def graft_tree(t):
    r = {}
    for k, v in t.items():
        for i in range(len(v)):
            r[GH_Path(k).AppendElement(i)] = [v[i]]
    return r
示例#5
0
        print "You should first let the Ladybug fly..."
        w = gh.GH_RuntimeMessageLevel.Warning
        ghenv.Component.AddRuntimeMessage(w, "You should first let the Ladybug fly...")
        return -1


if _runIt:
    result = main(north_, _selectedSkyMtx, context_, _numOfArrows_, _surfaceTiltAngle_, _centerPoint_,
                   _scale_, _arrowHeadScale_, legendPar_, showTotalOnly_, bakeIt_)
    
    if result!= -1:
        legend = DataTree[Object]()
        radiationArrowsMesh = DataTree[Object]()
        radRoseBaseCrvs = DataTree[Object]()
        legendBasePts = DataTree[Object]()
        radRoseEndPts = DataTree[Object]()
        radRoseValues = DataTree[Object]()
        for i, leg in enumerate(result[1]):
            p = GH_Path(i)
            radiationArrowsMesh.Add(result[0][i], p)
            radRoseBaseCrvs.AddRange(result[2][i], p)
            legend.Add(leg[0], p)
            legend.AddRange(leg[1], p)
            legendBasePts.Add(result[3][i], p)
            radRoseEndPts.AddRange(result[4][i], p)
            radRoseValues.AddRange(result[5][i], p)
        ghenv.Component.Params.Output[4].Hidden = True       
        ghenv.Component.Params.Output[5].Hidden = True
else: print "Set _runIt to True!"

示例#6
0
def getData(pyZoneData, zoneFlrAreas, annualData, simStep, zoneNormalizable,
            zoneHeaders, headerUnits, normByFlr, analysisPeriod,
            stepOfSimulation, total):
    # import the classes
    if sc.sticky.has_key('ladybug_release'):
        lb_preparation = sc.sticky["ladybug_Preparation"]()
        lb_visualization = sc.sticky["ladybug_ResultVisualization"]()
        #Make a list to contain the data for coloring and labeling.
        dataForColoring = []
        normedZoneData = []
        coloredTitle = []
        coloredUnits = None

        #Add basic stuff to the title.
        if normByFlr == True and zoneNormalizable == True and zoneHeaders != []:
            coloredTitle.append("Floor Normalized " +
                                str(zoneHeaders[0][2].split("for")[0]) +
                                " - " + headerUnits + "/" +
                                str(sc.doc.ModelUnitSystem) + "2")
            coloredUnits = headerUnits + "/" + str(
                sc.doc.ModelUnitSystem) + "2"
        elif normByFlr == False and zoneNormalizable == True and zoneHeaders != []:
            coloredTitle.append(
                str(zoneHeaders[0][2].split("for")[0]) + " - " + headerUnits)
            coloredUnits = headerUnits
        elif total == True:
            coloredTitle.append(
                str(zoneHeaders[0][2].split("for")[0]) + " - " + headerUnits)
            coloredUnits = headerUnits
        elif zoneNormalizable == False and zoneHeaders != []:
            coloredTitle.append("Average " +
                                str(zoneHeaders[0][2].split("for")[0] + " - " +
                                    headerUnits))
            coloredUnits = headerUnits
        else:
            coloredTitle.append("Unknown Data")
            coloredUnits = "Unknown Units"

        #Make lists that assist with the labaeling of the rest of the title.
        monthNames = [
            "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
            "Oct", "Nov", "Dec"
        ]
        timeNames = [
            "1:00", "2:00", "3:00", "4:00", "5:00", "6:00", "7:00", "8:00",
            "9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00",
            "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00",
            "23:00", "24:00"
        ]

        #If it is possible to normalize the data and the value is set to True (either by user request or default), norm the data.
        if zoneNormalizable == True and normByFlr == True:
            for zone, list in enumerate(pyZoneData):
                zoneNormData = []
                for item in list:
                    zoneNormData.append(item / (zoneFlrAreas[zone]))
                normedZoneData.append(zoneNormData)

        #If none of the analysisperiod or stepOfSim are connected, just total or average all the data.
        def getColorData1():
            if normByFlr == True and zoneNormalizable == True:
                for list in normedZoneData:
                    dataForColoring.append(round(sum(list), 4))
            elif normByFlr == False and zoneNormalizable == True:
                for list in pyZoneData:
                    dataForColoring.append(round(sum(list), 4))
            elif total == True:
                for list in pyZoneData:
                    dataForColoring.append(round(sum(list), 4))
            else:
                for list in pyZoneData:
                    dataForColoring.append(round(sum(list), 4) / len(list))

        if analysisPeriod == [0, 0] and stepOfSimulation == None:
            getColorData1()
            if zoneHeaders != []:
                coloredTitle.append(
                    str(monthNames[zoneHeaders[0][5][0] - 1]) + " " +
                    str(zoneHeaders[0][5][1]) + " " +
                    str(timeNames[zoneHeaders[0][5][2] - 1]) + " - " +
                    str(monthNames[zoneHeaders[0][6][0] - 1]) + " " +
                    str(zoneHeaders[0][6][1]) + " " +
                    str(timeNames[zoneHeaders[0][6][2] - 1]))
            else:
                coloredTitle.append("Complete Time Period That Is Connected")
        if analysisPeriod == [] and stepOfSimulation == None:
            getColorData1()
            if zoneHeaders != []:
                coloredTitle.append(
                    str(monthNames[zoneHeaders[0][5][0] - 1]) + " " +
                    str(zoneHeaders[0][5][1]) + " " +
                    str(timeNames[zoneHeaders[0][5][2] - 1]) + " - " +
                    str(monthNames[zoneHeaders[0][6][0] - 1]) + " " +
                    str(zoneHeaders[0][6][1]) + " " +
                    str(timeNames[zoneHeaders[0][6][2] - 1]))
            else:
                coloredTitle.append("Complete Time Period That Is Connected")
        elif simStep == "Annually" or simStep == "unknown timestep":
            getColorData1()
            if zoneHeaders != []:
                coloredTitle.append(
                    str(monthNames[zoneHeaders[0][5][0] - 1]) + " " +
                    str(zoneHeaders[0][5][1]) + " " +
                    str(timeNames[zoneHeaders[0][5][2] - 1]) + " - " +
                    str(monthNames[zoneHeaders[0][6][0] - 1]) + " " +
                    str(zoneHeaders[0][6][1]) + " " +
                    str(timeNames[zoneHeaders[0][6][2] - 1]))
            else:
                coloredTitle.append("Complete Time Period That Is Connected")

        # If the user has connected a stepOfSim, make the step of sim the thing used to color zones.
        if stepOfSimulation != None:
            if stepOfSimulation < len(pyZoneData[0]):
                if normByFlr == True and zoneNormalizable == True:
                    for list in normedZoneData:
                        dataForColoring.append(round(list[stepOfSimulation],
                                                     4))
                elif normByFlr == False and zoneNormalizable == True:
                    for list in pyZoneData:
                        dataForColoring.append(round(list[stepOfSimulation],
                                                     4))
                elif total == True:
                    for list in pyZoneData:
                        dataForColoring.append(round(list[stepOfSimulation],
                                                     4))
                else:
                    for list in pyZoneData:
                        dataForColoring.append(round(list[stepOfSimulation],
                                                     4))

                if simStep == "Monthly" and annualData == True:
                    coloredTitle.append(monthNames[stepOfSimulation])
                elif simStep == "Monthly":
                    coloredTitle.append("Month " + str(stepOfSimulation + 1) +
                                        " of Simulation")
                elif simStep == "Daily":
                    coloredTitle.append("Day " + str(stepOfSimulation + 1) +
                                        " of Simulation")
                elif simStep == "Hourly":
                    coloredTitle.append("Hour " + str(stepOfSimulation + 1) +
                                        " of Simulation")
                else:
                    coloredTitle.append("Step " + str(stepOfSimulation + 1) +
                                        " of Simulation")
            else:
                warning = "The input step of the simulation is beyond the length of the simulation."
                print warning
                ghenv.Component.AddRuntimeMessage(w, warning)

        # If the user has connected annual data, has not hooked up a step of simulation, and has hooked up an analysis period, take data from just the analysis period.
        if annualData == True and analysisPeriod != [
                0, 0
        ] and analysisPeriod != [] and stepOfSimulation == None and simStep != "Annually" and simStep != "unknown timestep":
            #If the data is monthly, just take the months from the analysis period.
            if simStep == "Monthly":
                startMonth = analysisPeriod[0][0]
                endMonth = analysisPeriod[1][0]
                if normByFlr == True and zoneNormalizable == True:
                    for list in normedZoneData:
                        dataForColoring.append(
                            round(sum(list[startMonth:endMonth + 1]), 4))
                elif normByFlr == False and zoneNormalizable == True:
                    for list in pyZoneData:
                        dataForColoring.append(
                            round(sum(list[startMonth:endMonth + 1]), 4))
                elif total == True:
                    for list in pyZoneData:
                        dataForColoring.append(
                            round(sum(list[startMonth:endMonth + 1]), 4))
                else:
                    for list in pyZoneData:
                        dataForColoring.append(
                            round(
                                sum(list[startMonth:endMonth + 1]) /
                                len(list[startMonth:endMonth + 1]), 4))
                coloredTitle.append(
                    str(monthNames[startMonth - 1]) + " - " +
                    str(monthNames[endMonth - 1]))
            #If the data is daily, just take the days and months from the analysis period.
            elif simStep == "Daily":
                startMonth = analysisPeriod[0][0]
                endMonth = analysisPeriod[1][0]
                startDay = analysisPeriod[0][1]
                endDay = analysisPeriod[1][1]

                #Make a function that returns the days for a given list of months
                def getDays(monthsList, startDay, endDay):
                    daysList = []
                    daysPerMonth = [
                        31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
                    ]
                    for count, month in enumerate(monthsList):
                        if count == 0 and startMonth == endMonth:
                            daysList.append(daysPerMonth[month - 1] + 1 -
                                            startDay +
                                            (endDay - daysPerMonth[month - 1]))
                        elif count == 0:
                            daysList.append(daysPerMonth[month - 1] + 1 -
                                            startDay)
                        elif count == len(
                                monthsList) - 1 and endDay != daysPerMonth[
                                    month - 1]:
                            daysList.append(endDay)
                        else:
                            daysList.append(daysPerMonth[month - 1])
                    return daysList

                #Make a list of months leading up to the first day.
                initMonths = []
                for month in range(1, startMonth + 1, 1):
                    initMonths.append(month)
                initDays = getDays(initMonths, 1, startDay)
                startIndex = sum(initDays)

                # Make a list of days in each month of the analysis period.
                monthsList = []
                for month in range(startMonth, endMonth + 1, 1):
                    monthsList.append(month)
                simDays = getDays(monthsList, startDay, endDay)
                endIndex = startIndex + sum(simDays)

                #Get the data from the lists.
                if normByFlr == True and zoneNormalizable == True:
                    for list in normedZoneData:
                        dataForColoring.append(
                            round(sum(list[startIndex:endIndex + 1]), 4))
                elif normByFlr == False and zoneNormalizable == True:
                    for list in pyZoneData:
                        dataForColoring.append(
                            round(sum(list[startIndex:endIndex + 1]), 4))
                elif total == True:
                    for list in pyZoneData:
                        dataForColoring.append(
                            round(sum(list[startIndex:endIndex + 1]), 4))
                else:
                    for list in pyZoneData:
                        dataForColoring.append(
                            round(
                                sum(list[startIndex:endIndex + 1]) /
                                len(list[startIndex:endIndex + 1]), 4))

                #Add the analysis period to the title.
                coloredTitle.append(
                    str(monthNames[startMonth - 1]) + " " + str(startDay) +
                    " - " + str(monthNames[endMonth - 1]) + " " + str(endDay))

            #If the data is hourly, use the ladybug preparation functions to extract the hours from the analysis period.
            elif simStep == "Hourly":
                startMonth = analysisPeriod[0][0]
                endMonth = analysisPeriod[1][0]
                startDay = analysisPeriod[0][1]
                endDay = analysisPeriod[1][1]
                startHour = analysisPeriod[0][2]
                endHour = analysisPeriod[1][2]
                HOYS, months, days = lb_preparation.getHOYsBasedOnPeriod(
                    analysisPeriod, 1)
                startIndex = HOYS[0]
                endIndex = HOYS[-1]

                #select out the data.
                theHourlyData = []
                if normByFlr == True and zoneNormalizable == True:
                    for list in normedZoneData:
                        lstData = []
                        for hour in HOYS:
                            lstData.append(list[hour - 1])
                        theHourlyData.append(lstData)
                else:
                    for list in pyZoneData:
                        lstData = []
                        for hour in HOYS:
                            lstData.append(list[hour - 1])
                        theHourlyData.append(lstData)

                #Get the data from the lists.
                if normByFlr == True and zoneNormalizable == True:
                    for list in theHourlyData:
                        dataForColoring.append(round(sum(list), 4))
                elif normByFlr == False and zoneNormalizable == True:
                    for list in theHourlyData:
                        dataForColoring.append(round(sum(list), 4))
                elif total == True:
                    for list in theHourlyData:
                        dataForColoring.append(round(sum(list), 4))
                else:
                    for list in theHourlyData:
                        dataForColoring.append(round(sum(list) / len(list), 4))
                #Add the analysis period to the title.
                coloredTitle.append(
                    str(monthNames[startMonth - 1]) + " " + str(startDay) +
                    " " + str(timeNames[startHour - 1]) + " - " +
                    str(monthNames[endMonth - 1]) + " " + str(endDay) + " " +
                    str(timeNames[endHour - 1]))

        #If there is floor normalized zone data, turn it into a data tree object.
        if normedZoneData != []:
            floorNormData = DataTree[Object]()
            for listCount, list in enumerate(normedZoneData):
                floorNormData.Add(
                    "key:location/dataType/units/frequency/startsAt/endsAt",
                    GH_Path(listCount))
                floorNormData.Add(str(zoneHeaders[listCount][1]),
                                  GH_Path(listCount))
                floorNormData.Add(
                    "Floor Normalized " + str(zoneHeaders[listCount][1]),
                    GH_Path(listCount))
                floorNormData.Add(
                    headerUnits + "/" + str(sc.doc.ModelUnitSystem) + "2",
                    GH_Path(listCount))
                floorNormData.Add(str(zoneHeaders[listCount][4]),
                                  GH_Path(listCount))
                floorNormData.Add(str(zoneHeaders[listCount][5]),
                                  GH_Path(listCount))
                floorNormData.Add(str(zoneHeaders[listCount][6]),
                                  GH_Path(listCount))
                for num in list:
                    floorNormData.Add((num), GH_Path(listCount))
        else:
            floorNormData = normedZoneData

        #Return all of the data
        return dataForColoring, floorNormData, coloredTitle, coloredUnits, lb_preparation, lb_visualization
    else:
        print "You should first let the Ladybug fly..."
        ghenv.Component.AddRuntimeMessage(
            w, "You should first let the Ladybug fly...")
        return [], [], [], None, None, None
示例#7
0
# AR3B011 EARTHY (2019/20 Q1)
# Zaatari refugee camp Hammam project: "Janat Al-Tohr
#Group Members: Nikoleta Sidiropoulou,  Hans Gamerschlag, Noah van den Berg, Rick van Dijk, Maximilian Mandat, Hamidreza Shahriari
#This is script is drived from the work of  Sung, Woojae; 'COMPONENT ORIENTED SCRIPTING IN GRASSHOPPER VBRHINO GRASSHOPPER VISUAL BASIC WORKSHOP, 2011.11.18' ,www.woojsung.com

import Rhino.Geometry as rg
import math
from Grasshopper.Kernel.Data import GH_Path
from Grasshopper import DataTree

pathCount = 0
newPath = GH_Path(pathCount)
pts = []
tree = DataTree[rg.Point3d]()

for point in pointss:
    pathCount += 1
    newPath = GH_Path(pathCount)
    # Finding the normal normal vector of the point at mesh
    po = surface.ClosestMeshPoint(point, 0.1)
    normal_vector = surface.NormalAt(po)
    # Geting the cross product vector
    drainVector = rg.Vector3d.CrossProduct(normal_vector, rg.Vector3d.ZAxis)
    drainVector.Unitize()
    # Rotating the cross product vector by 90 degree clock wise to find the drain slope vector
    drainVector.Transform(
        rg.Transform.Rotation(math.pi * 0.5, normal_vector, point))
    # Moving the initial point by the drain vector to find the position of the new vector
    movedPoint = point + distance * drainVector
    # Finding the position of the movedPoint on the mesh
    try:
        heading = [
            "key:location/dataType/units/frequency/startsAt/endsAt", " ",
            "Annual illuminance values", "lux", "Hourly", (1, 1, 1),
            (12, 31, 24)
        ]

        for shadingGroup in illuminanceValues.keys():
            # results with no blind
            if shadingGroup == 0:
                annualIllumNoDynamicSHD.extend(heading +
                                               illuminanceValues[0][0])

            elif shadingGroup == 1 and len(illuminanceValues[1]) != 0:
                for shadingState, illumValues in enumerate(
                        illuminanceValues[1]):
                    p = GH_Path(shadingState)
                    annualIllumDynamicSHDGroupI.AddRange(heading, p)
                    annualIllumDynamicSHDGroupI.AddRange(illumValues, p)

            elif shadingGroup == 2 and len(illuminanceValues[2]) != 0:
                for shadingState, illumValues in enumerate(
                        illuminanceValues[2]):
                    p = GH_Path(shadingState)
                    annualIllumDynamicSHDGroupII.AddRange(heading, p)
                    annualIllumDynamicSHDGroupII.AddRange(illumValues, p)

        # create the mixed result with the shadings
        if len(shadingProfile) != 0 and len(illuminanceValues[1]) != 0:
            mixResults = heading

            # for now Honeybee only supports single shading group so the number of
示例#9
0
print(data)     #检查每个路径下的项值

DA = DataTree[Rhino.Geometry.GeometryBase]()    #定义空的树形数据
print(DA)

Glst = []   #建立空的列表,用于分别放置各个路径下的所有项值,每个路径下的项值被放置于一个列表中
for i in range(data.BranchCount):   #BranchCount路径数,通过循环树形数据下每一个路径下的所有项值
    branchlst = data.Branch(i)  #Branch()路径下的项,逐一提取树形数据下每一个路径下的所有项值
    lst = []    #建立空列表,提取路径下的各个项值
    for k in range(len(branchlst)):     #在各路径下所有项值循环
        lst.append(branchlst[k])    #把项值加入列表
    Glst.append(lst)     #再总结数据
print(Glst)

branchname = 1
DBPath = GH_Path(branchname)    #将1转换为{1}
DB = DataTree[Rhino.Geometry.GeometryBase](Glst[0],DBPath) #(路径,{1})提取树形数据
print(DB)

DC = DataTree[Rhino.Geometry.GeometryBase](DB)  #复制
print(DC)

OTreeData = Glst

#############################################################################
#接上文程序print(DC)后
#提取列表中列表的项值
addpoint = Glst[0][1]   #提取Glst列表索引值为0的子列表,继而提取列表索引值为1的项值
print(addpoint)     #检查
#追加项值,默认最后
DC.Add(addpoint)    #使用方法在最后一个路径上追加项(点)
示例#10
0
strPath = 0
numPath = 0

numbers = DataTree[Object]()
strings = DataTree[Object]()

for count, item in enumerate(_inputList):
    try:
        item = float(item)
        if count == 0: numfirst = True
        if lastOne == None: lastOne = "float"
        if lastOne!= "float":
            lastOne = "float"
            numPath += 1
        if numfirst == False:
            p = GH_Path(numPath-1)
            numbers.Add(item, p)
        else:
            p = GH_Path(numPath)
            numbers.Add(item, p)
    except:
        if count == 0: numfirst = False
        if lastOne == None: lastOne = "str"
        if lastOne!= "str":
            lastOne = "str"
            strPath += 1
        if numfirst == True:
            p = GH_Path(strPath-1)
            strings.Add(item, p)
        else:
            p = GH_Path(strPath)
示例#11
0
    # Organize the date into Class blocks (break at each 'header')

    tempTree = DataTree[Object]()

    p = 0

    # Go through the imported Data and create a new branch for each item

    for i in range(len(lines_clean)):

        if len(lines_clean[i]) == 1:

            p += 1

        tempTree.Add(lines_clean[i], GH_Path(p))

    # Create all the IDF Class object blocks

    IDF_Objs_List = []

    for each in tempTree.Branches:

        tempDict = {}

        Name = ''

        for eachListItem in each:

            if len(eachListItem) == 1:
            lightingHeading = [
                "key:location/dataType/units/frequency/startsAt/endsAt", " ",
                "Lighting Switch Profile", "0 = Off, 1 = On", "Hourly",
                (1, 1, 1), (12, 31, 24)
            ]
            shadingHeading = [
                "key:location/dataType/units/frequency/startsAt/endsAt", " ",
                "Shading Profile", "0 = Up, 1 = Down", "Hourly", (1, 1, 1),
                (12, 31, 24)
            ]
            occCounter = 0
            shadingCounter = 0
            lightingCounter = 0
            for headingCount, heading in enumerate(headings):
                if heading.strip().startswith("occ"):
                    p = GH_Path(branchCount, occCounter)
                    occupancyProfile.AddRange(
                        occupancyHeading + resultDict[headingCount], p)
                    occCounter += 1
                if heading.strip().startswith("light"):
                    p = GH_Path(branchCount, lightingCounter)
                    lightingControlProfiles.AddRange(
                        lightingHeading + resultDict[headingCount], p)
                    lightingCounter += 1
                if heading.strip().startswith("blind"):
                    p = GH_Path(branchCount, shadingCounter)
                    shadingProfiles.AddRange(
                        shadingHeading + resultDict[headingCount], p)
                    shadingCounter += 1
            dgpProfile = "[place holder]"
             surfaceAirGain[int(path[-1])].append(column.split('(')[-1].split(')')[0])
         
         elif 'Zone Air Heat Balance System Air Transfer Rate' in column:
             key.append(20)
             zoneName = checkZone(" " + ":".join(column.split(":")[:-1]))
             systemAirGain[int(path[-1])].append(zoneName)
             systemAirGain[int(path[-1])].append(column.split('(')[-1].split(')')[0])
         
         else:
             key.append(-1)
             path.append(-1)
 
 else:
     for columnCount, column in enumerate(line.split(',')):
         if key[columnCount] != 14:
             try: p = GH_Path(int(path[columnCount]))
             except: p = GH_Path(int(path[columnCount][0]), int(path[columnCount][1]))
         else:
             p = GH_Path(int(path[columnCount][0]), int(path[columnCount][1]))
         
         if key[columnCount] == 0:
             try: cooling.Add((float(column)/3600000), p)
             except: dataTypeList[2] = False
         elif key[columnCount] == 1:
             try: heating.Add((float(column)/3600000), p)
             except: dataTypeList[3] = False
         elif key[columnCount] == 2:
             try: electricLight.Add((float(column)/3600000), p)
             except: dataTypeList[4] = False
         elif key[columnCount] == 3:
             try: electricEquip.Add((float(column)/3600000), p)
            sunVisibility = result[-1]

        elif result != -1 and len(result) == 5:
            contextMesh, analysisMesh, testPts_flatten, testVec_flatten, originalTestPoints = result

        testPts = DataTree[System.Object]()
        testVec = DataTree[System.Object]()
        sunIsVisible = DataTree[System.Object]()

        if result != -1:
            sunlightHoursResult = DataTree[System.Object]()

            # graft test points
            ptCount = 0
            for i, ptList in enumerate(originalTestPoints):
                p = GH_Path(i)
                for pCount, pt in enumerate(ptList):
                    testPts.Add(pt, p)
                    testVec.Add(testVec_flatten[ptCount], p)
                    if result != -1 and len(result) != 5:
                        #try:
                        q = GH_Path(i, pCount)
                        sunlightHoursResult.Add(
                            sunlightHoursResult_flatten[ptCount], p)
                        sunIsVisible.AddRange(sunVisibility[ptCount], q)
                        #except: pass
                    ptCount += 1

        ghenv.Component.Params.Output[1].Hidden = True
        ghenv.Component.Params.Output[2].Hidden = True
        ghenv.Component.Params.Output[3].Hidden = True
                0)[0] != None and _testShades.Branch(
                    0)[0] != None and _testWindow.Branch(0)[0] != None:
        checkData, gridSize, allDataDict, skyResolution, analysisPeriod, locationData, latitude, longitude, timeZone, north = checkTheInputs(
        )

#If everything passes above, prepare the geometry for analysis.
if checkLB == True and checkData == True:
    windowTestPtsInit, shadeMeshInit, geoAllDataDict = prepareGeometry(
        gridSize, allDataDict)

    #Unpack the data trees of test pts and shade mesh breps so that the user can see them and get a sense of what to expect from the evaluation.
    windowTestPts = DataTree[Object]()
    shadeMesh = DataTree[Object]()
    for brCount, branch in enumerate(windowTestPtsInit):
        for item in branch:
            windowTestPts.Add(item, GH_Path(brCount))
    for brCount, branch in enumerate(shadeMeshInit):
        for item in branch:
            shadeMesh.Add(item, GH_Path(brCount))

#If all of the data is good and the user has set "_runIt" to "True", run the shade benefit calculation to generate all results.
if checkLB == True and checkData == True and _runIt == True:
    finalAllDataDict, sunVectors = checkSkyResolution(
        skyResolution, geoAllDataDict, analysisPeriod, latitude, longitude,
        timeZone, north, lb_sunpath, lb_preparation)
    result = main(finalAllDataDict, sunVectors, skyResolution, legendPar_,
                  lb_preparation, lb_visualization)

    if result != -1:
        shadeHelpfulnessList, shadeHarmfulnessList, shadeNetEffectList, shadeMeshList, legend, legendBasePt = result
        shadeMesh = DataTree[Object]()
#Check the inputs.
checkData = False
if _coolingLoad.BranchCount > 0 and _heatingLoad.BranchCount > 0 and _beamGain.BranchCount > 0 and _testShades.BranchCount > 0 and _testWindow.BranchCount > 0 and _location != None:
    if _coolingLoad.Branch(0)[0] != None and _heatingLoad.Branch(0)[0] != None and _beamGain.Branch(0)[0] != None and _testShades.Branch(0)[0] != None and _testWindow.Branch(0)[0] != None:
        checkData, gridSize, allDataDict, skyResolution, analysisPeriod, locationData, latitude, longitude, timeZone, north = checkTheInputs()

#If everything passes above, prepare the geometry for analysis.
if checkLB == True and checkData == True:
    windowTestPtsInit, shadeMeshInit, geoAllDataDict = prepareGeometry(gridSize, allDataDict)
    
    #Unpack the data trees of test pts and shade mesh breps so that the user can see them and get a sense of what to expect from the evaluation.
    windowTestPts = DataTree[Object]()
    shadeMesh = DataTree[Object]()
    for brCount, branch in enumerate(windowTestPtsInit):
        for item in branch:
            windowTestPts.Add(item, GH_Path(brCount))
    for brCount, branch in enumerate(shadeMeshInit):
        for item in branch:
            shadeMesh.Add(item, GH_Path(brCount))


#If all of the data is good and the user has set "_runIt" to "True", run the shade benefit calculation to generate all results.
if checkLB == True and checkData == True and _runIt == True:
    finalAllDataDict, sunVectors = checkSkyResolution(skyResolution, geoAllDataDict, analysisPeriod, latitude, longitude, timeZone, north, lb_sunpath, lb_preparation)
    result = main(finalAllDataDict, sunVectors, legendPar_, lb_preparation, lb_visualization)
    
    if result != -1:
        shadeHelpfulnessList, shadeHarmfulnessList, shadeNetEffectList, shadeMeshList, legend, legendBasePt = result
        shadeMesh = DataTree[Object]()
        shadeHelpfulness = DataTree[Object]()
        shadeHarmfulness = DataTree[Object]()
示例#17
0
    fileSeparated = []
    nfile = fileAllJoined.split(",")
    for seg in nfile:
        if seg != "": fileSeparated.append(seg)
    #print fileSeparated
    surfaces = {}
    for segCount, seg in enumerate(fileSeparated):
        # I should fix this code later! This is really poor written.
        if seg.upper() == "polygon".upper():
            material = fileSeparated[segCount - 1]
            numPt = int(fileSeparated[segCount + 4])
            ptCrd = fileSeparated[segCount + 5:segCount + 5 + numPt]
            ptCrd = [float(pt) for pt in ptCrd]
            srf = radLine2Srf(ptCrd)
            if not surfaces.has_key(material): surfaces[material] = []
            surfaces[material].append(srf)

    RADMaterials = DataTree[System.Object]()
    RADSurfaces = DataTree[System.Object]()
    if len(surfaces) > 0:
        # removeOutputs()
        outputNum = 0
        for mat, srfs in surfaces.items():
            RADMaterials.Add(mat, GH_Path(outputNum))
            RADSurfaces.AddRange(srfs, GH_Path(outputNum))
            outputNum += 1

#outputCount = ghenv.Component.Params.Output.Count
# if not radFile and  outputCount > 1:
#    removeOutputs()
示例#18
0
            sumVentACH_night = float(str(summerVent_[1]))
        except:
            sumVentACH_night = '=L31'

        sumVent.append(
            PHPP_XL_Obj('SummVent', 'L31',
                        sumVentACH_day))  # Daytime window Ventilation Default
        sumVent.append(PHPP_XL_Obj(
            'SummVent', 'P59',
            sumVentACH_night))  # Nightime window Ventilation Default
        sumVent.append(PHPP_XL_Obj('SummVent', 'R21',
                                   ''))  # HRV Summer Bypass - Clear
        sumVent.append(PHPP_XL_Obj(
            'SummVent', 'R22',
            'x'))  # HRV Summer Bypass Set Temp difference (default)
        sumVent.append(PHPP_XL_Obj('SummVent', 'R23',
                                   ''))  # HRV Summer Bypass - Clear
        sumVent.append(PHPP_XL_Obj('SummVent', 'R24',
                                   ''))  # HRV Summer Bypass - Clear

#-------------------------------------------------------------------------------
# Add it all to a master Tree
toPHPP_Setup_ = DataTree[Object]()  # Master tree to hold all the results
toPHPP_Setup_.AddRange(verification, GH_Path(0))
toPHPP_Setup_.AddRange(climate, GH_Path(1))
toPHPP_Setup_.AddRange(airtightness, GH_Path(2))
toPHPP_Setup_.AddRange(vent, GH_Path(3))
toPHPP_Setup_.AddRange(per, GH_Path(4))
toPHPP_Setup_.AddRange(mech, GH_Path(5))
toPHPP_Setup_.AddRange(sumVent, GH_Path(6))
toPHPP_Setup_.AddRange(dhwSystem, GH_Path(7))
示例#19
0
        if not sc.sticky['honeybee_release'].isCompatible(ghenv.Component):
            initCheck = False
    except:
        initCheck = False
        warning = "You need a newer version of Honeybee to use this compoent." + \
        "Use updateHoneybee component to update userObjects.\n" + \
        "If you have already updated userObjects drag Honeybee_Honeybee component " + \
        "into canvas and try again."
        ghenv.Component.AddRuntimeMessage(w, warning)

if _HBZones != [] and initCheck == True:
    if _HBZones[0] != None:
        copyHBZoneData()
        hb_zoneData = sc.sticky["Honeybee_LabelZoneData"]

        labelCentPts, textSize, font, attribute = setDefaults()
        zoneTxtLabels, zoneTextLabels, wireFrames, labelBasePts = main(
            hb_zoneData, labelCentPts, textSize, font, attribute)

        #Unpack the data trees of curves and label text.
        brepTxtLabels = DataTree[Object]()
        zoneWireFrames = DataTree[Object]()
        for listCount, lists in enumerate(zoneTextLabels):
            for item in lists:
                brepTxtLabels.Add(item, GH_Path(listCount))
        for listCount, lists in enumerate(wireFrames):
            for item in lists:
                zoneWireFrames.Add(item, GH_Path(listCount))

#Hide unwanted outputs
ghenv.Component.Params.Output[1].Hidden = True
checkData = False
check = checkTheInputs()

if check != -1:
    checkData, heightsAboveGround, analysisPeriod, d, a, averageData, \
    windSpeed, windDir, epwData, epwStr, lb_preparation, lb_visualization, \
    lb_wind, windVectorScale, scaleFactor = check

#Get the wind profile curve if everything looks good.
if checkData == True:
    windProfileCurve, windVectorMesh, speeds, vectors, anchorPts, legend, legendBasePt = main(
        heightsAboveGround, analysisPeriod, d, a, averageData, windSpeed,
        windDir, epwData, epwStr, lb_preparation, lb_visualization, lb_wind,
        windVectorScale, scaleFactor)

    #Unpack the lists of lists in Python.
    for count, list in enumerate(speeds):
        for item in list:
            windSpeeds.Add(item, GH_Path(count))

    for count, list in enumerate(vectors):
        for item in list:
            windVectors.Add(item, GH_Path(count))

    for count, list in enumerate(anchorPts):
        for item in list:
            vectorAnchorPts.Add(item, GH_Path(count))

#Hide the anchor points.
ghenv.Component.Params.Output[4].Hidden = True
ghenv.Component.Params.Output[9].Hidden = True
                    zoneName = checkZone(" " + column.split(':')[0])
                    makeHeader(earthTubeHeating, int(path[columnCount]),
                               zoneName,
                               column.split('(')[-1].split(')')[0],
                               "Earth Tube Heating Energy", "kWh", True)
                    dataTypeList[8] = True

                else:
                    key.append(-1)
                    path.append(-1)

            #print key
            #print path
        else:
            for columnCount, column in enumerate(line.split(',')):
                p = GH_Path(int(path[columnCount]))
                if normByFlr == True:
                    flrArea = floorAreaList[int(path[columnCount])]
                else:
                    flrArea = 1

                if key[columnCount] == 0:
                    sensibleCooling.Add((float(column) / 3600000) / flrArea, p)
                elif key[columnCount] == 1:
                    latentCooling.Add((float(column) / 3600000) / flrArea, p)
                elif key[columnCount] == 2:
                    sensibleHeating.Add((float(column) / 3600000) / flrArea, p)
                elif key[columnCount] == 3:
                    latentHeating.Add((float(column) / 3600000) / flrArea, p)
                elif key[columnCount] == 4:
                    supplyVolFlow.Add((float(column)) / flrArea, p)
示例#22
0
## PER Items

PER_ = PER(cleanHeatGenInput(primaryHeatGeneration_, '5-Direct electricity'),
           cleanHeatGenInput(secondaryHeatGeneration_, '-'),
           cleanFractionInput(heatingFracPrimary_),
           cleanFractionInput(dhwFracPrimary_))

## Heating / Cooling Equipment

Equipment_ = HeatingCoolingEquip(boiler_, hp_, hpGround_, compact_,
                                 distictHeating_, supplyAirCooling_,
                                 recircAirCooling_, addnlDehumid_,
                                 panelCooling_)

# Add both PER and Equipment to a master tree

Heating_Cooling_ = DataTree[Object]()

Heating_Cooling_.Add(PER_, GH_Path(0))

Heating_Cooling_.Add(Equipment_, GH_Path(01))

print('----\nPER:')

preview(PER_)

print('----\nEquipment:')

preview(Equipment_)
def main():
    earth_radius = 6378137
    equator_circumference = 2 * pi * earth_radius
    initial_resolution = equator_circumference / 256.0
    origin_shift = equator_circumference / 2.0

    mapsType = {
        '0': 'satellite',
        '1': 'roadmap',
        '2': 'terrain',
        '3': 'hybrid'
    }

    if _basePoint_ == None:
        basePoint = Rhino.Geometry.Point3d.Origin
    else:
        basePoint = _basePoint_
    if _imgResolution_ == None:
        imgResolution = 18
    else:
        imgResolution = int(
            _imgResolution_)  # make sure that it is an integer number
    if _numDivision_ == None:
        numDivision = 15
    else:
        numDivision = int(_numDivision_)
    if _radius_ == None:
        radius = 100
    else:
        radius = _radius_
    if _numOfTiles_ == None:
        numOfTiles = 3
    else:
        numOfTiles = int(_numOfTiles_)
    if mapType_ == None:
        mapType = mapsType['0']
    else:
        mapType = mapsType[mapType_]
    if type_ == None: type = 0
    else: type = type_

    # location or point3d
    try:
        latitude, longitude, elevation = eval(_location)
        location = Rhino.Geometry.Point3d(latitude, longitude, elevation)

    except:
        locationName, latitude, longitude, timeZone, elevation = lb_preparation.decomposeLocation(
            _location)
        location = Rhino.Geometry.Point3d(latitude, longitude, elevation)

    xf = earthPoint(location, basePoint)

    # make sure that basePoint is on the terrain
    if elevation >= 0: factor = 1
    else: factor = -1

    tilesTree = DataTree[System.Object]()
    tiles = createTiles(basePoint, radius, numOfTiles)
    for i, tile in enumerate(tiles):
        path = GH_Path(0, i)
        tilesTree.Add(tile, path)

    points_for_srf = []
    elevations_for_srf = []
    URLs = []
    imagePath = DataTree[System.Object]()
    if _runIt:
        pointsGeo, pointsZ, pointsXY, imagePath = DataTree[
            System.Object](), DataTree[System.Object](), DataTree[
                System.Object](), DataTree[System.Object]()

        for i in range(len(tiles)):
            points_srf = divideSrf(tiles[i], numDivision)
            try:
                points, elevations = terrainGen(points_srf, xf, _runIt)
                ptCenter = centerPtsGeo(tiles[i])
                pointGeo = xf * ptCenter
                points_for_srf.extend(points_srf)
                elevations_for_srf.extend(elevations)

                URL = textureGen(_runIt, pointGeo, points, origin_shift,
                                 initial_resolution, imgResolution, mapType)
                URLs.append(URL)

                path = GH_Path(0, i)
                pointsGeo.AddRange(points, path)
                pointsZ.AddRange(elevations, path)
                pointsXY.AddRange(points_srf, path)

            except TypeError:
                return None, None, None, None, None, None, None, None

        # make 3D points
        # thanks to djordje for this advice
        cull_pts = cullAndSortPoints(points_for_srf, elevations_for_srf)
        num = (numDivision + 1) * numOfTiles - (numOfTiles - 1)
        if type == 0:
            lb_meshpreparation = sc.sticky["ladybug_Mesh"]()
            terrain = lb_meshpreparation.meshFromPoints(num, num, cull_pts)
            origin = Rhino.Geometry.Intersect.Intersection.ProjectPointsToMeshes(
                [terrain], [basePoint], Rhino.Geometry.Vector3d.ZAxis * factor,
                sc.doc.ModelAbsoluteTolerance)
        elif type == 1:
            uDegree = min(3, num - 1)
            vDegree = min(3, num - 1)
            terrain = Rhino.Geometry.NurbsSurface.CreateThroughPoints(
                cull_pts, num, num, uDegree, vDegree, False, False)
            origin = Rhino.Geometry.Intersect.Intersection.ProjectPointsToBreps(
                [terrain.ToBrep()], [basePoint],
                Rhino.Geometry.Vector3d.ZAxis * factor,
                sc.doc.ModelAbsoluteTolerance)

        # make a folder for the images
        directory = mdPath(folder_)

        try:
            for i, u in enumerate(URLs):
                path = GH_Path(0, i)
                name = directory + str(i) + "elevation.png"
                client = System.Net.WebClient()
                written_file = client.DownloadFile(u, name)
                imagePath.Add(name, path)
        except:
            pass
            print(
                "Something went wrong during the request of images. Please, try again."
            )

    else:
        # check the grid size
        dimension = round(((radius * 2) / numOfTiles) / numDivision, 3)
        print("Size of the grid = {0} x {0}".format(dimension))
        return None, None, None, None, None, tilesTree, None, None

    return pointsGeo, pointsZ, pointsXY, imagePath, terrain, tilesTree, origin, elevation
示例#24
0
try:
    latitude = float(getattr(location, 'Latitude {deg}', 51.30))
    longitude = float(getattr(location, 'Longitude {deg}', 9.44))
    climate = findNearestPHPPclimateZone(latitude, longitude, phpp_ClimateData)
except:
    print 'Error finding the nearest PHPP Climate Zone?'
    climate = []

#-------------------------------------------------------------------------------
#########       Package up all the output objects    #########
#########       into a single tree for passing       #########

PHPPObjs_ = DataTree[Object]()
# Materials and Constructions
PHPPObjs_.AddRange(opaqueMaterials, GH_Path(0))  # Opaque Material Objects
PHPPObjs_.AddRange(opaqueConstructions,
                   GH_Path(1))  # Opaque IDF_Obj_Construction Objects
PHPPObjs_.AddRange(windowMaterialsSimple,
                   GH_Path(2))  # EP Style Window Material Objects
PHPPObjs_.AddRange(windowConstructionsSimple,
                   GH_Path(3))  # EP Style Window IDF_Obj_Construction Objects
# Surfaces
PHPPObjs_.AddRange(opaqueSurfaces_Exposed,
                   GH_Path(4))  # Opaque Surface Objects
PHPPObjs_.AddRange(
    windowObjects,
    GH_Path(5))  # PHPP Style Window IDF_Obj_Construction Objects
PHPPObjs_.AddRange(HBZonePHPPRooms,
                   GH_Path(6))  # List of all the HB Zone PHPP Rooms
PHPPObjs_.AddRange(
        lb_preparation = sc.sticky["ladybug_Preparation"]()
    except:
        initCheck = False
        warning = "You need a newer version of Ladybug to use this compoent." + \
        "Use updateLadybug component to update userObjects.\n" + \
        "If you have already updated userObjects drag Ladybug_Ladybug component " + \
        "into canvas and try again."
        ghenv.Component.AddRuntimeMessage(w, warning)

if initCheck == True:
    checkData, viewRes, viewMethod, viewPoints, viewPtNormals, parallel = checkInputs(
    )
    if checkData == True and _runIt == True:
        viewPatchBasePt = viewPoints[0]
        viewVectors, viewPatches, patchAreaFacs = checkViewResolution(
            viewRes, viewPatchBasePt, lb_preparation)
        srfViewFactorsInit, viewVecSrfIndexInit = main(
            _testSrfs, context_, viewVectors, patchAreaFacs, viewPoints,
            viewPtNormals, viewMethod, parallel)

        srfViewFactors = DataTree[Object]()
        viewVecSrfIndex = DataTree[Object]()
        for count, dataList in enumerate(srfViewFactorsInit):
            for item in dataList:
                srfViewFactors.Add(item, GH_Path(count))
        for count, dataList in enumerate(viewVecSrfIndexInit):
            for item in dataList:
                viewVecSrfIndex.Add(item, GH_Path(count))

ghenv.Component.Params.Output[4].Hidden = True
ghenv.Component.Params.Output[5].Hidden = True
        "If you have already updated userObjects drag Honeybee_Honeybee component " + \
        "into canvas and try again."
        ghenv.Component.AddRuntimeMessage(w, warning)

if initCheck == True and _HBZones != []:
    if heating_.BranchCount > 0 or totalSolarGain_.BranchCount > 0 or electricLight_.BranchCount > 0 or electricEquip_.BranchCount > 0 or peopleGains_.BranchCount > 0 or surfaceEnergyFlow_.BranchCount > 0 or infiltrationEnergy_.BranchCount > 0 or mechVentilationEnergy_.BranchCount > 0 or natVentEnergy_.BranchCount > 0 or cooling_.BranchCount > 0 or fanElectric_.BranchCount > 0:
        result = main(_HBZones, heating_, totalSolarGain_, electricLight_,
                      electricEquip_, fanElectric_, peopleGains_,
                      surfaceEnergyFlow_, infiltrationEnergy_,
                      mechVentilationEnergy_, natVentEnergy_, cooling_)

        if result != -1:
            modelEnergyBalanceInit, energyBalWithStorageInit, flrNormEBalInit, flrNormEBalWStorageInit = result

            modelEnergyBalance = DataTree[Object]()
            energyBalWithStorage = DataTree[Object]()
            flrNormEnergyBal = DataTree[Object]()
            flrNormBalWStorage = DataTree[Object]()

            for dataCount, dataList in enumerate(modelEnergyBalanceInit):
                for item in dataList:
                    modelEnergyBalance.Add(item, GH_Path(dataCount))
            for dataCount, dataList in enumerate(energyBalWithStorageInit):
                for item in dataList:
                    energyBalWithStorage.Add(item, GH_Path(dataCount))
            for dataCount, dataList in enumerate(flrNormEBalInit):
                for item in dataList:
                    flrNormEnergyBal.Add(item, GH_Path(dataCount))
            for dataCount, dataList in enumerate(flrNormEBalWStorageInit):
                for item in dataList:
                    flrNormBalWStorage.Add(item, GH_Path(dataCount))
            def readDSStandardResults(filePath):
                results = []
                with open(filePath, "r") as inf:
                    for line in inf:
                        if not line.startswith("#"):
                            results.append(float(line.split("\t")[-1]))
                return results

            def getsDA(DLARes, threshold=50):
                moreThan = 0
                for res in DLARes:
                    if res >= threshold:
                        moreThan += 1
                return "%.2f" % ((moreThan / len(DLARes)) * 100)

            for branchNum in range(_testPoints.BranchCount):
                p = GH_Path(branchNum)
                DLARes = readDSStandardResults(DLALists[branchNum])
                DLA.AddRange(DLARes, p)
                UDLI_Less_100.AddRange(
                    readDSStandardResults(underUDLILists[branchNum]), p)
                UDLI_100_2000.AddRange(
                    readDSStandardResults(inRangeUDLILists[branchNum]), p)
                UDLI_More_2000.AddRange(
                    readDSStandardResults(overUDLILists[branchNum]), p)
                CDA.AddRange(readDSStandardResults(CDALists[branchNum]), p)
                annualProfiles.Add(EPLSchLists[branchNum], p)
                sDA.Add(getsDA(DLARes), p)
                htmReport.Add(htmLists[branchNum], p)
initCheck = True
#Honeybee check.
if not sc.sticky.has_key('honeybee_release') == True:
    initCheck = False
    print "You should first let Honeybee fly..."
    ghenv.Component.AddRuntimeMessage(w,
                                      "You should first let Honeybee fly...")
else:
    try:
        if not sc.sticky['honeybee_release'].isCompatible(ghenv.Component):
            initCheck = False
        if sc.sticky['honeybee_release'].isInputMissing(ghenv.Component):
            initCheck = False
    except:
        initCheck = False
        warning = "You need a newer version of Honeybee to use this compoent." + \
        "Use updateHoneybee component to update userObjects.\n" + \
        "If you have already updated userObjects drag Honeybee_Honeybee component " + \
        "into canvas and try again."
        ghenv.Component.AddRuntimeMessage(w, warning)

if initCheck == True and _simData.BranchCount > 0 and str(
        _simData) != "tree {0}" and len(_HBZones) > 0 and _HBZones[0] != None:
    result = main(_HBZones, _simData)
    if result != -1:
        totNormData, zoneNormDataInit = result
        zoneNormData = DataTree[Object]()
        for brCount, branch in enumerate(zoneNormDataInit):
            for item in branch:
                zoneNormData.Add(item, GH_Path(brCount))
        if key not in HBZones.keys():
            HBZones[key] = [orientationVectors, []]

        HBZones[key][1].append(HBZone)

    return HBZones


if _HBZones and _HBZones != None:

    orderedHBZones = main(_HBZones, onlyWGlz_)

    if orderedHBZones != -1:
        keys = orderedHBZones.keys()
        keys.sort()

        hb_hive = sc.sticky["honeybee_Hive"]()

        HBZones = DataTree[Object]()
        orientations = DataTree[Object]()

        for count, key in enumerate(keys):
            p = GH_Path(count)
            orientations.AddRange(orderedHBZones[key][0], p)

            zones = hb_hive.addToHoneybeeHive(
                orderedHBZones[key][1],
                ghenv.Component.InstanceGuid.ToString() + str(uuid.uuid4()))
            HBZones.AddRange(zones, p)
ghenv.Component.IconDisplayMode = ghenv.Component.IconDisplayMode.application
ghenv.Component.Category = "HB-Legacy"
ghenv.Component.SubCategory = "10 | Energy | Energy"
ghenv.Component.AdditionalHelpFromDocStrings = "6"

from System import Object
import Grasshopper.Kernel as gh
from Grasshopper import DataTree
from Grasshopper.Kernel.Data import GH_Path

comfResultsTree = DataTree[Object]()
cullLast = False

if _comfResultsMtx != [] and _comfResultsMtx[0] != None:
    try:
        for bCount, dataList in enumerate(_comfResultsMtx):
            p = GH_Path(bCount - 1)
            if bCount == 0:
                if "Over-Heated Percent" in dataList or "Under-Heated Percent" in dataList or "Occupied Thermal Comfort Percent" in dataList or "Thermal Autonomy" in dataList:
                    cullLast = True
            elif cullLast == True and bCount == len(_comfResultsMtx) - 1:
                pass
            else:
                for item in dataList:
                    comfResultsTree.Add(item, p)
    except:
        warn = 'Failed to convert the matrix.  Make sure that you are connecting up the Mtx and not another type of input.'
        print warn
        ghenv.Component.AddRuntimeMessage(gh.GH_RuntimeMessageLevel.Warning,
                                          warn)