Esempio n. 1
0
def get_wcc_pressure(edition, h_bldg, h_story, ctype, exposure, wind_speed,
                     pitch):
    # Step 1: Determine which "family" of building codes will be needed (if necessary):
    if edition == 'ASCE 7-02' or edition == 'ASCE 7-05':
        edition = 'ASCE 7-98'
    elif edition == 'ASCE 7-88':
        edition = 'ASCE 7-93'
    # Step 2: Access the appropriate reference building and determine the file path:
    pressures = PressureCalc()
    # Semantic translation for survey data:
    if pitch == 'flat':
        # Assign angle considering 2:12 slope
        pitch = math.degrees(math.atan(2 / 12))
    else:
        pitch = 11
    if h_story == 9 and pitch <= 10:  #[ft]
        ref_exposure, ref_hstory, ref_hbldg, ref_pitch, ref_speed, ref_cat, hpr, h_ocean, encl_class = pressures.ref_bldg(
        )
        file_path = 'D:/Users/Karen/Documents/Github/DPBWE/Similitude Parameters/Wall_CC/RBLDG1/'
    else:
        pass
    # Step 4: Extract the reference pressures for the component type
    pref = pd.read_csv(file_path + ctype + '/ref.csv',
                       index_col='Edition').loc[[edition], :]
    # Step 5: Extract similitude parameters for wind speed, height, and exposure
    # Similitude in wind speed:
    if wind_speed == ref_speed:
        vfactor = 0.0
    else:
        if edition == 'ASCE 7-93':
            vfactor = pd.read_csv(
                file_path + '/v93.csv',
                index_col='Edition')[str(wind_speed)][edition]
        else:
            vfactor = pd.read_csv(
                file_path + '/v.csv',
                index_col='Edition')[str(wind_speed)][edition]
    # Similitude in height:
    if h_bldg == ref_hbldg:
        hfactor = 0.0
    else:
        if edition == 'ASCE 7-93':
            hfactor = pd.read_csv(file_path + '/h93.csv')[str(h_bldg) +
                                                          ' ft'][0]
        else:
            hfactor = pd.read_csv(file_path + '/h.csv',
                                  index_col='Edition')[str(h_bldg) +
                                                       ' ft'][edition]
    # Similitude in exposure categories:
    if exposure == ref_exposure:
        efactor = 0.0
    else:
        efactor = pd.read_csv(file_path + '/e' + edition[-2:] + '.csv',
                              index_col='Height in ft')[exposure][h_bldg]
    # Step 6: Apply the similitude parameters to get the final pressures for each zone:
    factor_lst = [vfactor, hfactor, efactor]
    psim = pref.loc[edition]
    for factor in factor_lst:
        psim = factor * psim + psim
    return psim
Esempio n. 2
0
def wind_pressure_ftree(bldg, wind_speed, facade_flag, parcel_flag, rng):
    """
    A function to conduct the wind pressure fault tree analysis of a building.
    :param bldg: (Building object) with hasDemand attribute populated with external wind pressures. Wall and Roof
                objects in Building.adjacentElement
    :param wind_speed: The wind speed that will be used to quantify the pressure demand. This should be the wind speed
                        in Exposure C, 10 m reference height at the building location
    :param facade_flag: (Boolean) True if the fault tree analysis includes assessment of facade component performance
    :param parcel_flag: (Boolean) True if the Building object is populated with minimum descriptions (i.e., has no
                        information regarding component sizing)
    :param rng: (From np.random.default_rng(seed)) Random number generator object
    :return: df_fail: (Pandas DataFrame) with columns = failure elements (Wall/Roof objects), failure regions
            (Shapely polygon), and whether element is a roof element (True/False)
    """
    # For each building:
    # 1) Sample pressure coefficients and calculate wind pressure loading demand:
    df_bldg_cps = bldg.hasDemand['wind pressure']['external']

    def get_sample_cp(mean_cp, cp_std_dev):
        return norm.rvs(mean_cp, cp_std_dev, random_state=rng)

    # Sample from gaussian distribution with mean = mean cp and std dev = 0.3
    df_bldg_cps['Sample Cp'] = get_sample_cp(df_bldg_cps['Mean Cp'],
                                             df_bldg_cps['Cp Std Dev'])
    # Quantify pressures:
    pressure_calc = PressureCalc()
    df_bldg_cps['Pressure'] = df_bldg_cps['Sample Cp'].apply(
        lambda j: pressure_calc.get_tpu_pressure(wind_speed, j, 'B', bldg.
                                                 hasGeometry['Height'], 'mph'))
    # Apply correction for pressure taps at the bottom: pressure = 0
    idx_col = np.where(df_bldg_cps.columns == 'Sample Cp')[0][0]
    for idx in df_bldg_cps.index.to_list():
        if df_bldg_cps['Real Life Location'][idx].z == 0:
            df_bldg_cps.iat[idx, idx_col] = 0
        else:
            pass
    # 2) Loop through building envelope components, sample capacities, and check for breach:
    fail_elements = []
    fail_regions = []
    for key in bldg.adjacentElement:
        if key == 'Floor':
            pass
        elif key == 'Roof':
            if len(bldg.adjacentElement[key][0].hasSubElement['cover']) > 0:
                for elem in bldg.adjacentElement[key][0].hasSubElement[
                        'cover']:
                    # Query tap numbers, pressures, and intersecting areas:
                    tap_nums = elem.hasDemand['wind pressure']['external'][
                        'tap number']
                    tap_pressures = df_bldg_cps['Pressure'][tap_nums]
                    tap_areas = elem.hasDemand['wind pressure']['external'][
                        'intersecting area']
                    if type(tap_areas) == list:
                        tap_areas = np.array(tap_areas)
                    else:
                        pass
                    # Sample component capacity:
                    idx = 0
                    for p in tap_pressures.index.to_list():
                        fail_flag = False
                        if tap_pressures.loc[p] < 0:
                            elem_capacity = elem.hasCapacity['wind pressure'][
                                'external']['negative']
                            if elem_capacity > tap_pressures.loc[p]:
                                fail_flag = True
                            else:
                                pass
                        else:
                            elem_capacity = elem.hasCapacity['wind pressure'][
                                'external']['positive']
                            if elem_capacity < tap_pressures.loc[p]:
                                fail_flag = True
                            else:
                                pass
                        # Add failure data:
                        if fail_flag:
                            fail_regions.append(tap_areas[idx])
                            elem.hasFailure['wind pressure'] = True
                            fail_elements.append(elem)
                        else:
                            pass
                        idx += 1
            else:
                pass
        elif key == 'Walls':
            if facade_flag:
                for elem in bldg.adjacentElement[key]:
                    # Query tap numbers, pressures, and intersecting areas:
                    tap_nums = elem.hasDemand['wind pressure']['external'][
                        'tap number']
                    tap_pressures = df_bldg_cps['Pressure'][tap_nums]
                    tap_areas = elem.hasDemand['wind pressure']['external'][
                        'intersecting area']
                    if type(tap_areas) == list:
                        tap_areas = np.array(tap_areas)
                    else:
                        pass
                    # Capacity versus demand checks:
                    area_idx = 0
                    for p in tap_pressures.index.to_list():
                        fail_flag = False
                        if tap_pressures.loc[p] == 0:  # If no pressure, skip
                            pass
                        elif tap_pressures.loc[p] < 0:
                            elem_capacity = elem.hasCapacity['wind pressure'][
                                'external']['negative']
                            if elem_capacity > tap_pressures.loc[p]:
                                fail_flag = True
                            else:
                                pass
                        else:
                            elem_capacity = elem.hasCapacity['wind pressure'][
                                'external']['positive']
                            if elem_capacity < tap_pressures.loc[p]:
                                fail_flag = True
                            else:
                                pass
                        # Add failure data:
                        if fail_flag:
                            if parcel_flag:  # Failure region is the tap area:
                                fail_regions.append(
                                    df_bldg_cps['Tap Polygon'][p])
                                elem.hasFailure['wind pressure'] = True
                                fail_elements.append(elem)
                            else:
                                if 'GLASS' in elem.hasType.upper():
                                    fail_regions.append(
                                        elem.hasGeometry['3D Geometry']
                                        ['local'])
                                    elem.hasFailure['wind pressure'] = True
                                    fail_elements.append(elem)
                                else:
                                    print('Glass check not working')
                                    fail_regions.append(tap_areas[area_idx])
                                    elem.hasFailure['wind pressure'] = True
                                    fail_elements.append(elem)
                        else:
                            pass
                        idx += 1
            else:
                pass
    # Return a DataFrame with all failed elements and regions:
    df_fail = pd.DataFrame({
        'fail elements': fail_elements,
        'fail regions': fail_regions
    })
    df_fail['roof element'] = df_fail['fail elements'].apply(
        lambda x: isinstance(x, Roof))
    return df_fail
Esempio n. 3
0
def assign_rcc_pressures(bldg, zone_pts, int_poly, edition, exposure,
                         wind_speed):
    # Create an instance of PressureCalc:
    pressures = PressureCalc()
    # Assign C&C pressures given the component type and its location (zone):
    roof_elem = bldg.hasStorey[-1].hasElement['Roof'][0]
    # Create a list of all C&C types within the roof:
    rcc_lst = pd.DataFrame(columns=['Element', 'Type'])
    # Figure out what ctype the main roof component is:
    ctype = pressures.get_ctype(roof_elem)
    rcc_lst = rcc_lst.append({
        'Element': roof_elem,
        'Type': ctype
    },
                             ignore_index=True)
    # Figure out what the ctype is for any additional roof components:
    if roof_elem.hasSubElement is None:
        bldg.hasStorey[-1].hasElement['Roof'][0].hasCapacity['type'].append(
            'C&C Pressure')
        # Figure out what ctype the roof cover is:
        ctype = pressures.get_ctype(roof_elem)
        rcc_lst = rcc_lst.append({
            'Element': roof_elem,
            'Type': ctype
        },
                                 ignore_index=True)
    else:
        for elem in roof_elem.hasSubElement:
            # Figure out what ctype the roof component is:
            ctype = pressures.get_ctype(elem)
            rcc_lst = rcc_lst.append({
                'Element': elem,
                'Type': ctype
            },
                                     ignore_index=True)
    # Find all unique C&C types and calculate (+)/(-) pressures at each zone:
    zone_pressures = pd.DataFrame(columns=['Type', 'Pressures'])
    for ctype in rcc_lst['Type'].unique():
        # (+)/(-) pressures:
        psim = get_rcc_pressure(edition, bldg.hasGeometry['Height'], ctype,
                                exposure, wind_speed, roof_elem.hasPitch)
        # Incorporate pressure minimums:
        if bldg.hasYearBuilt > 2010 and (abs(psim) < 16):  # [lb]/[ft^2]
            if psim < 0:
                psim = -16
            else:
                psim = 16
        else:
            pass
        zone_pressures = zone_pressures.append(
            {
                'Type': ctype,
                'Pressures': psim
            }, ignore_index=True)
    # Assign zone pressures to each Roof C&C Element:
    for elem in rcc_lst['Element']:
        zone2_flag = False
        zone1_flag = False
        # Use Zone 4 points and element coordinates to assign pressure
        for seg in zone_pts['NewZoneStart']:
            if not zone2_flag and not zone1_flag:
                # Create a line segment using zone 4 points
                zline = LineString([
                    zone_pts['NewZoneStart'][seg], zone_pts['NewZoneEnd'][seg]
                ])
                # Check if element falls within the zone or is exactly at zone points or is outsidezone 4:
                if elem.hasGeometry['1D Geometry'][0].within(
                        zline) and elem.hasGeometry['1D Geometry'][1].within(
                            zline):
                    zone2_flag = True
                elif elem.hasGeometry['1D Geometry'][0] == zone_pts[
                        'NewZoneStart'][seg] and elem.hasGeometry[
                            '1D Geometry'][1] == zone_pts['NewZoneEnd'][seg]:
                    zone2_flag = True
                elif elem.hasGeometry['1D Geometry'][0].within(int_poly):
                    zone1_flag = True
                else:
                    pass
            else:
                break
        # Find the index where zone_pressures['Type'] matches the element's C&C type:
        etype_ind = rcc_lst.loc[rcc_lst['Element'] == elem]
        type_ind = zone_pressures.loc[zone_pressures['Type'] == rcc_lst['Type']
                                      [etype_ind]]
        if zone2_flag:
            rp_dict = {
                'Positive': zone_pressures['Pressures'][type_ind]['Zone2+'],
                'Negative': zone_pressures['Pressures'][type_ind]['Zone2-']
            }
            elem.hasCapacity['value'] = rp_dict
        elif zone1_flag:
            rp_dict = {
                'Positive': zone_pressures['Pressures'][type_ind]['Zone1+'],
                'Negative': zone_pressures['Pressures'][type_ind]['Zone1-']
            }
            elem.hasCapacity['value'] = rp_dict
        else:
            rp_dict = {
                'Positive': zone_pressures['Pressures'][type_ind]['Zone3+'],
                'Negative': zone_pressures['Pressures'][type_ind]['Zone3-']
            }
            elem.hasCapacity['value'] = rp_dict
Esempio n. 4
0
def assign_wcc_pressures(bldg, zone_pts, edition, exposure, wind_speed):
    # Create an instance of PressureCalc:
    pressures = PressureCalc()
    # Assign C&C pressures given the component type and its location (zone):
    for storey in bldg.hasStorey:
        # Create a list of all Wall C&C types within this story
        wcc_lst = pd.DataFrame(columns=['Element', 'Type'])
        for elem in storey.adjacentElement['Walls']:
            if elem.isExterior and elem.inLoadPath:
                # Figure out what ctype the wall component is:
                ctype = pressures.get_ctype(elem)
                wcc_lst = wcc_lst.append({
                    'Element': elem,
                    'Type': ctype
                },
                                         ignore_index=True)
                elem.hasCapacity['type'].append('C&C Pressure')
            else:
                pass
        # Find all unique C&C types and calculate (+)/(-) pressures at each zone:
        zone_pressures = pd.DataFrame(columns=['Type', 'Pressures'])
        for ctype in wcc_lst['Type'].unique():
            # (+)/(-) pressures:
            psim = get_wcc_pressure(
                edition, bldg.hasGeometry['Height'],
                storey.hasGeometry['Height'], ctype, exposure, wind_speed,
                bldg.hasStorey[-1].hasElement['Roof'][0].hasPitch)
            # Incorporate pressure minimums:
            if bldg.hasYearBuilt > 2010 and (abs(psim) < 16):  # [lb]/[ft^2]
                if psim < 0:
                    psim = -16
                else:
                    psim = 16
            else:
                pass
            zone_pressures = zone_pressures.append(
                {
                    'Type': ctype,
                    'Pressures': psim
                }, ignore_index=True)
        # Assign zone pressures to each Wall C&C Element
        for elem in wcc_lst['Element']:
            zone4_flag = False
            # Use Zone 4 points and element coordinates to assign pressure
            for seg in range(0, len(zone_pts['NewZoneStart'])):
                if not zone4_flag:
                    # Create a line segment using zone 4 points
                    zline = LineString([
                        zone_pts['NewZoneStart'][seg],
                        zone_pts['NewZoneEnd'][seg]
                    ])
                    # Check if element falls within the zone or is exactly at zone points or is outsidezone 4:
                    if Point(elem.hasGeometry['1D Geometry'].coords[0]).within(
                            zline) and Point(elem.hasGeometry['1D Geometry'].
                                             coords[1]).within(zline):
                        zone4_flag = True
                    elif Point(elem.hasGeometry['1D Geometry'].coords[0]
                               ) == zone_pts['NewZoneStart'][seg] and Point(
                                   elem.hasGeometry['1D Geometry'].coords[1]
                               ) == zone_pts['NewZoneEnd'][seg]:
                        zone4_flag = True
                    else:
                        pass
                else:
                    break
            # Find the element's C&C type:
            ectype = wcc_lst.loc[wcc_lst['Element'] == elem, 'Type'].iloc[0]
            # Find the index where the element C&C type matches with unique types in zone_pressures:
            utype_ind = zone_pressures[zone_pressures['Type'] ==
                                       ectype].index.values
            if zone4_flag:
                wp_dict = {
                    'Positive':
                    zone_pressures.iloc[utype_ind]['Pressures'][0]['Zone 4+'],
                    'Negative':
                    zone_pressures.iloc[utype_ind]['Pressures'][0]['Zone 4-']
                }
                elem.hasCapacity['value'].append(wp_dict)
            else:
                wp_dict = {
                    'Positive':
                    zone_pressures.iloc[utype_ind]['Pressures'][0]['Zone 5+'],
                    'Negative':
                    zone_pressures.iloc[utype_ind]['Pressures'][0]['Zone 5-']
                }
                elem.hasCapacity['value'].append(wp_dict)
Esempio n. 5
0
def assign_rmwfrs_pressures(bldg, edition, exposure, wind_speed):
    # Create an instance of PressureCalc:
    pressures = PressureCalc()
    # Assign MWFRS pressures for the roof:
    bldg.hasElement['Roof'][0].hasCapacity['type'].append('MWFRS Pressure')
    # Set up parameters to access pressures:
    # (1) Roof pitch
    roof_elem = bldg.hasStorey[-1].hasElement['Roof'][0]
    if isinstance(roof_elem.hasPitch, str):
        if roof_elem.hasPitch == 'flat':
            # Assign angle based on 2:12 slope
            pitch = math.degrees(math.atan2(2, 12))
        else:
            print('Roof (str) pitch currently not supported')
    else:
        pass
    # (2) Direction and aspect ratios
    # Roof MWFRS pressure assignments require knowledge of the building aspect ratio for a given "wind direction"
    # (2a) Find the orientation of the building footprint using minimum rotated rectangle:
    rect = bldg.hasGeometry['Footprint']['local'].minimum_rotated_rectangle
    xrect, yrect = rect.exterior.xy
    xfpt, yfpt = bldg.hasGeometry['Footprint']['local'].exterior.xy
    theta = bldg.hasOrientation
    # (2b) Find the length of the rectangle's line segments:
    # Set up placeholders for Roof MWFRS pressures:
    info_rmwfrs = {
        'side length': [],
        'wind direction': [],
        'possible wind directions': [],
        'direction length': [],
        'pressures': []
    }
    # Set up placeholders for LineString objects of each line segment in rectangle:
    rlines1 = []  # for wind directions N-S and E-W
    rlines2 = []  # for wind directions S-N and W-E
    for coord in range(0, 4):
        if coord == 0 or coord == 3:
            new_line1 = LineString([(xrect[coord], yrect[coord]),
                                    (xrect[coord + 1], yrect[coord + 1])])
            new_line2 = LineString([(xrect[coord + 1], yrect[coord + 1]),
                                    (xrect[coord], yrect[coord])])
        else:
            # Reverse order the points in remaining line segments (useful for zone assignments later):
            new_line1 = LineString([(xrect[coord + 1], yrect[coord + 1]),
                                    (xrect[coord], yrect[coord])])
            new_line2 = LineString([(xrect[coord], yrect[coord]),
                                    (xrect[coord + 1], yrect[coord + 1])])
        rlines1.append(new_line1)
        rlines2.append(new_line2)
        info_rmwfrs['side length'].append(new_line1.length)
    # (3) Access roof uplift pressures:
    # To get correct pressures, need to know: wind blowing parallel or normal to ridge? AND length of opposite side
    # Store the RMWFRS pressures in dictionary:
    uplift_pressures = dict.fromkeys(['normal', 'parallel'])
    for j in range(0, 2):
        # Assume that the ridge runs along the longer dimension of the building:
        if info_rmwfrs['side length'][j] == max(info_rmwfrs['side length']):
            direction = 'parallel'
            dlength = min(info_rmwfrs['side length'])
            # Given the orientation of the building, find a set of parallel wind directions:
            real_directions = [180 - theta, 360 - theta]
        else:
            direction = 'normal'
            dlength = max(info_rmwfrs['side length'])
            # Given the orientation of the building, find a set of normal wind directions:
            real_directions = [theta, 180 + theta]
        # Save values for this "side" of the building:
        info_rmwfrs['wind direction'].append(direction)
        info_rmwfrs['direction length'].append(dlength)
        info_rmwfrs['possible wind directions'].append(real_directions)
        # Access pressures:
        psim = get_roof_uplift_pressure(edition, bldg, dlength, exposure,
                                        wind_speed, direction, pitch)
        info_rmwfrs['pressures'].append(psim)
        # (4) Assign zone pressures to the corresponding building geometry:
        prmwfrs = pd.DataFrame()
        prmwfrs['Uplift Pressure'] = psim
        # Need to create polygons to define zone locations:
        # Given wind directions according to station data conventions, pair zone geometries with pressures:
        for wdir in range(0, len(real_directions)):
            # Store the wind direction we are considering:
            dir_name = 'Direction' + str(wdir)
            dir_list = []
            for i in range(0, len(psim)):
                dir_list.append(real_directions[wdir])
            prmwfrs[dir_name] = dir_list
            # Set up tag for 'ZonePolys' columns:
            zonepoly_name = 'ZonePolys' + str(wdir)
            if edition != 'ASCE 7-88' and edition != 'ASCE 7-93':
                hdist = [
                    bldg.hasGeometry['Height'] / 2, bldg.hasGeometry['Height'],
                    bldg.hasGeometry['Height'] * 2
                ]
                if real_directions[wdir] == min(real_directions):
                    ref_lines = rlines1
                else:
                    ref_lines = rlines2
                # Zone Polygons can be defined by creating points along two parallel sides:
                lst_points1 = [Point(ref_lines[j].coords[:][0])]
                lst_points2 = [Point(ref_lines[j + 2].coords[:][0])]
                for zone in range(0, len(psim)):
                    if zone == 3:  # Case when there are four zones:
                        pass
                    else:
                        # Create a new point along each line segment:
                        new_point1 = ref_lines[j].interpolate(hdist[zone])
                        new_point2 = ref_lines[j + 2].interpolate(hdist[zone])
                        # Add to the corresponding lists:
                        lst_points1.append(new_point1)
                        lst_points2.append(new_point2)
                # Finish off with the last point in the line segment:
                lst_points1.append(Point(ref_lines[j].coords[:][1]))
                lst_points2.append(Point(ref_lines[j + 2].coords[:][1]))
                # Create zone geometries:
                poly_list = []
                for pt in range(0, len(lst_points1) - 1):
                    rpoly = Polygon([
                        lst_points1[pt], lst_points1[pt + 1],
                        lst_points2[pt + 1], lst_points2[pt]
                    ])  # order ccw like min_rect
                    xpoly, ypoly = rpoly.exterior.xy
                    plt.plot(xpoly,
                             ypoly,
                             label='Zone ' + str(pt + 1),
                             color='0.50',
                             linewidth=1,
                             linestyle='dashed')
                    # Add to DataFrame object:
                    poly_list.append(rpoly)
                prmwfrs[zonepoly_name] = poly_list
                #plt.legend()
                plt.plot(xfpt, yfpt, 'k')
                plt.xlabel('x [m]')
                plt.ylabel('y [m]')
                plt.axis('off')
                plt.show()
            else:
                if direction == 'parallel':
                    pass
                else:
                    pass
            # Once zone geometries have been defined and pressures mapped, store the Dataframe:
            uplift_pressures[direction] = prmwfrs
    bldg.hasElement['Roof'][0].hasCapacity['value'].append(uplift_pressures)
Esempio n. 6
0
def get_roof_uplift_pressure(edition, bldg, length, exposure, wind_speed,
                             direction, pitch):
    # Step 1: Determine which reference building is needed and the file path:
    pressures = PressureCalc(
    )  # Create an instance of PressureCalc to pull reference building parameters
    if direction == 'parallel' or (direction == 'normal' and pitch < 10):
        ref_exposure, ref_hstory, ref_hbldg, ref_pitch, ref_speed, ref_cat, hpr, h_ocean, encl_class = pressures.ref_bldg(
        )
        file_path = 'D:/Users/Karen/Documents/Github/DPBWE/Similitude Parameters/Roof_MWFRS/RBLDG1/'
    elif direction == 'normal' and (edition == 'ASCE 7-88'
                                    or edition == 'ASCE 7-93'):
        pass
    # Step 2: Determine the use case:
    ratio = bldg.hasGeometry['Height'] / length
    if edition == 'ASCE 7-88' or edition == 'ASCE 7-93':
        if direction == 'parallel':
            if ratio <= 2.5:
                use_case = 3
            elif ratio > 2.5:
                use_case = 4
        elif direction == 'normal':
            pass
    else:
        if direction == 'parallel' or (direction == 'normal' and pitch < 10):
            if ratio <= 0.5:
                use_case = 1
            elif ratio >= 1.0:
                use_case = 2
        elif direction == 'normal' and pitch >= 10:
            pass
    # Step 3: Determine which "family" of building codes will be needed (if necessary):
    if edition == 'ASCE 7-02' or edition == 'ASCE 7-05':
        edition = 'ASCE 7-98'
    elif edition == 'ASCE 7-88':
        edition = 'ASCE 7-93'
    # Step 4: Extract the respective reference pressure for the use case:
    pref = pd.read_csv(file_path + 'ref' + str(use_case) + '.csv',
                       index_col='Edition').loc[[edition], :]
    # Step 5: Filter out any zones that are not needed for use cases 1 and 2:
    if use_case == 1 and ratio == 0.5:
        pref = pref[pref.columns[0:3]]  # Case with only 3 zones
    elif use_case == 2 and ratio == 2.0:
        pref = pref[pref.columns[0:1]]  # Case with only 1 zone
    # Step 5: Extract similitude parameters for wind speed, height, and exposure
    # Similitude in wind speed:
    if wind_speed == ref_speed:
        vfactor = 0.0
    else:
        if edition == 'ASCE 7-93':
            vfactor = pd.read_csv(
                file_path + 'v93.csv',
                index_col='Edition')[str(wind_speed)][edition]
        else:
            vfactor = pd.read_csv(
                file_path + 'v.csv', index_col='Edition'
            )[str(
                wind_speed
            )][edition]  # Leave here for now, for regional simulation will probably want to load everything somewhere outside
    # Similitude in height:
    if bldg.hasGeometry['Height'] == ref_hbldg:
        hfactor = 0.0
    else:
        if edition == 'ASCE 7-93':
            hfactor = pd.read_csv(file_path +
                                  'h93.csv')[str(bldg.hasGeometry['Height']) +
                                             ' ft'][0]
        else:
            hfactor = pd.read_csv(file_path +
                                  'h.csv')[str(bldg.hasGeometry['Height']) +
                                           ' ft'][0]
    # Similitude in exposure categories:
    if exposure == ref_exposure:
        efactor = 0.0
    else:
        efactor = pd.read_csv(
            file_path + 'e' + edition[-2:] + '.csv',
            index_col='Height in ft')[exposure][bldg.hasGeometry['Height']]
    # Step 6: Apply the similitude parameters to get the final pressures for each zone:
    factor_lst = [vfactor, hfactor, efactor]
    psim = pref.loc[edition]
    for factor in factor_lst:
        psim = factor * psim + psim
    return psim
Esempio n. 7
0
def get_rcc_pressure(edition, h_bldg, ctype, exposure, wind_speed, pitch):
    # Step 1: Semantic translation of roof pitch:
    if pitch == 'flat':
        # Code editions ASCE 7-98 and earlier use 10 degrees for first use case
        # Code editions ASCE 7-02 and later use 7 degrees for first use case
        # Assign angle < 7 degrees:
        pitch = 6
    # Step 2: Determine which "family" of building codes will be needed (if necessary):
    if pitch < 7:
        if edition == 'ASCE 7-02' or edition == 'ASCE 7-05':
            edition = 'ASCE 7-98'
    else:
        pass
    if edition == 'ASCE 7-88':
        edition = 'ASCE 7-93'
    # Step 2: Access the appropriate reference building and determine the file path:
    pressures = PressureCalc()
    # NOTE: Might need to modify logic here once we add more reference buildings
    if edition == 'ASCE 7-98' or edition == 'ASCE 7-93':
        if pitch <= 10:
            use_case = 1
            ref_exposure, ref_hstory, ref_hbldg, ref_pitch, ref_speed, ref_cat, hpr, h_ocean, encl_class = pressures.ref_bldg(
            )
            file_path = 'D:/Users/Karen/Documents/Github/DPBWE/Similitude Parameters/Roof_CC/RBLDG1/'
    else:
        if (
                edition == 'ASCE 7-02' or edition == 'ASCE 7-05'
                or edition == 'ASCE 7-10'
        ) and pitch <= 7:  # Still including this logic for non-Parcel models
            use_case = 1
            ref_exposure, ref_hstory, ref_hbldg, ref_pitch, ref_speed, ref_cat, hpr, h_ocean, encl_class = pressures.ref_bldg(
            )
            file_path = 'D:/Users/Karen/Documents/Github/DPBWE/Similitude Parameters/Roof_CC/RBLDG1/'
        elif (edition == 'ASCE 7-02' or edition == 'ASCE 7-05'
              or edition == 'ASCE 7-10') and 7 < pitch <= 27:
            use_case = 2
            print('Roof use case currently not supported')
    # Step 4: Extract the reference pressures for the component type -- COME BACK AND CHECK FOR WHEN WE EXPAND TO OTHER USE CASES
    pref = pd.read_csv(file_path + ctype + '/ref' + str(use_case) + '.csv',
                       index_col='Edition').loc[[edition], :]
    # Step 5: Extract similitude parameters for wind speed, height, and exposure
    # Similitude in wind speed:
    if wind_speed == ref_speed:
        vfactor = 0.0
    else:
        if edition == 'ASCE 7-93':
            vfactor = pd.read_csv(
                file_path + '/v93.csv',
                index_col='Edition')[str(wind_speed)][edition]
        else:
            vfactor = pd.read_csv(
                file_path + '/v.csv',
                index_col='Edition')[str(wind_speed)][edition]
    # Similitude in height:
    if h_bldg == ref_hbldg:
        hfactor = 0.0
    else:
        if edition == 'ASCE 7-93':
            hfactor = pd.read_csv(file_path + '/h93.csv')[str(h_bldg) +
                                                          ' ft'][0]
        else:
            hfactor = pd.read_csv(file_path + '/h.csv',
                                  index_col='Edition')[str(h_bldg) +
                                                       ' ft'][edition]
    # Similitude in exposure categories:
    if exposure == ref_exposure:
        efactor = 0.0
    else:
        efactor = pd.read_csv(file_path + '/e' + edition[-2:] + '.csv',
                              index_col='Height in ft')[exposure][h_bldg]
    # Step 6: Apply the similitude parameters to get the final pressures for each zone:
    factor_lst = [vfactor, hfactor, efactor]
    psim = pref.loc[edition]
    for factor in factor_lst:
        psim = factor * psim + psim
    return psim