コード例 #1
0
def _get_limits(idf=None, polygons=None):
    """Get limits for the x, y and z axes so the plot is fitted to the axes."""
    if polygons:
        x = [pt[0] for color in polygons for p in polygons[color] for pt in p]
        y = [pt[1] for color in polygons for p in polygons[color] for pt in p]
        z = [pt[2] for color in polygons for p in polygons[color] for pt in p]

    elif idf:
        surfaces = _get_surfaces(idf)

        x = [pt[0] for s in surfaces for pt in getcoords(s)]
        y = [pt[1] for s in surfaces for pt in getcoords(s)]
        z = [pt[2] for s in surfaces for pt in getcoords(s)]
    if all([x, y, z]):
        max_delta = max((max(x) - min(x)), (max(y) - min(y)),
                        (max(z) - min(z)))
        limits = {
            "x": (min(x), min(x) + max_delta),
            "y": (min(y), min(y) + max_delta),
            "z": (min(z), min(y) + max_delta),
        }
    else:
        limits = {"x": (0, 0), "y": (0, 0), "z": (0, 0)}

    return limits
コード例 #2
0
def _get_collections(idf, opacity=1):
    """Set up 3D collections for each surface type.
    """
    surfaces = _get_surfaces(idf)
    # set up the collections
    walls = Poly3DCollection(
        [getcoords(s) for s in surfaces if s.Surface_Type.lower() == 'wall'],
        alpha=opacity,
        facecolor='wheat',
        edgecolors='black')
    floors = Poly3DCollection(
        [getcoords(s) for s in surfaces if s.Surface_Type.lower() == 'floor'],
        alpha=opacity,
        facecolor='dimgray',
        edgecolors='black')
    roofs = Poly3DCollection(
        [getcoords(s) for s in surfaces if s.Surface_Type.lower() == 'roof'],
        alpha=opacity,
        facecolor='firebrick',
        edgecolors='black')
    windows = Poly3DCollection(
        [getcoords(s) for s in surfaces if s.Surface_Type.lower() == 'window'],
        alpha=opacity,
        facecolor='cornflowerblue',
        edgecolors='black')
    shading_surfaces = _get_shading(idf)
    shading = Poly3DCollection([getcoords(s) for s in shading_surfaces],
                               alpha=opacity,
                               facecolor='darkolivegreen',
                               edgecolors='black')

    return walls, roofs, floors, windows, shading
コード例 #3
0
def _get_limits(idf=None, polygons=None):
    """
    Get limits for the x, y and z axes so the plot is 
    fitted to the axes.
    
    """
    if polygons:
        x = [pt[0] for color in polygons for p in polygons[color] for pt in p]
        y = [pt[1] for color in polygons for p in polygons[color] for pt in p]
        z = [pt[2] for color in polygons for p in polygons[color] for pt in p]

    elif idf:
        surfaces = _get_surfaces(idf)

        x = [pt[0] for s in surfaces for pt in getcoords(s)]
        y = [pt[1] for s in surfaces for pt in getcoords(s)]
        z = [pt[2] for s in surfaces for pt in getcoords(s)]

    max_delta = max((max(x) - min(x)), (max(y) - min(y)), (max(z) - min(z)))

    return {
        'x': (min(x), min(x) + max_delta),
        'y': (min(y), min(y) + max_delta),
        'z': (min(z), min(y) + max_delta)
    }
コード例 #4
0
def _get_collection(surface_type,
                    surfaces,
                    opacity,
                    facecolor,
                    edgecolors="black"):
    """Make collections from a list of EnergyPlus surfaces."""
    if surface_type == "shading":
        coords = [
            getcoords(s) for s in surfaces if not hasattr(s, "Surface_Type")
        ]
    else:
        coords = [
            getcoords(s) for s in surfaces if hasattr(s, "Surface_Type")
            and s.Surface_Type.lower() == surface_type.lower()
        ]
    trimmed_coords = [c for c in coords if c]  # dump any empty surfaces
    collection = Poly3DCollection(trimmed_coords,
                                  alpha=opacity,
                                  facecolor=facecolor,
                                  edgecolors=edgecolors)
    return collection
コード例 #5
0
def zone_height_min2max(idf, zonename, debug=False):
    """zone height = max-min"""
    zone = idf.getobject('ZONE', zonename)
    surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
    zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
    surf_xyzs = [function_helpers.getcoords(s) for s in zone_surfs]
    surf_xyzs = list(itertools.chain(*surf_xyzs))
    surf_zs = [z for x, y, z in surf_xyzs]
    topz = max(surf_zs)
    botz = min(surf_zs)
    height = topz - botz
    return height
コード例 #6
0
ファイル: modeleditor.py プロジェクト: jamiebull1/eppy
def zone_height_min2max(idf, zonename, debug=False):
    """zone height = max-min"""
    zone = idf.getobject('ZONE', zonename)
    surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
    zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
    surf_xyzs = [function_helpers.getcoords(s) for s in zone_surfs]
    surf_xyzs = list(itertools.chain(*surf_xyzs))
    surf_zs = [z for x, y, z in surf_xyzs]
    topz = max(surf_zs)
    botz = min(surf_zs)
    height = topz - botz
    return height
コード例 #7
0
def set_daylighting(idf, job):
    if job['daylighting'] < 0.5:
        return
    for zone in idf.idfobjects['ZONE']:
        floor = [f for f in idf.idfobjects['BUILDINGSURFACE:DETAILED'] if f.Surface_Type.lower() == 'floor' and f.Zone_Name == zone.Name][0]
        coords = getcoords(floor)
        xs = [v[0] for v in coords]
        ys = [v[1] for v in coords]
        z = [v[2] for v in coords][0]
        x = sum(xs) / len(xs)
        y = sum(ys) / len(ys)
        daylight = idf.newidfobject(
            'DAYLIGHTING:CONTROLS', 
            Zone_Name = zone.Name, 
            Total_Daylighting_Reference_Points = 1, 
            XCoordinate_of_First_Reference_Point = x, 
            YCoordinate_of_First_Reference_Point = y, 
            ZCoordinate_of_First_Reference_Point = z + 0.8, 
            Glare_Calculation_Azimuth_Angle_of_View_Direction_Clockwise_from_Zone_yAxis=90,
            Lighting_Control_Type = 2,
            Number_of_Stepped_Control_Steps = 1,
            )
コード例 #8
0
def vertices(surface):
    """Get vertices as (x,y,z) tuples.
    """
    return getcoords(surface)