Source code for viiapackage.strengthening.l5.l5p

### ===================================================================================================================
###   L5-P strengthening measure
### ===================================================================================================================
# Copyright ©VIIA 2024

### ===================================================================================================================
###   1. Import modules
### ===================================================================================================================

# General imports
from __future__ import annotations
import warnings
from typing import TYPE_CHECKING, Union, List

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.fem_shape_geometries import fem_copy_polyline
from rhdhv_fem.shapes import Wall, MainSurfaceReinforcement

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject
from viiapackage.strengthening.helper_functions import viia_check_shape_argument, viia_check_measure_in_gmc


### ===================================================================================================================
###   2. Function to create L5-P strengthening measures
### ===================================================================================================================

[docs]def viia_l5p( project: ViiaProject, variant: int, wall: Wall, application_type: str = 'both', eccentricity: bool = True) -> List[Union[Wall, MainSurfaceReinforcement]]: """ This function creates an L5-P-measure (Quakeshield mesh with shotcrete) for a selected wall. It adds a concrete wall of 20mm on both sides of the wall, C35/45 and applies a grid reinforcement of Quakeshield. Optional is to apply the measure only on one side and the inclusion of eccentricity. .. note:: When applying on one side, eccentricity is always taken into account. .. warning:: The tyings are not modelled, these need to be added manually. It will model the strengthening measure around openings and can be applied on walls in all directions. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - variant (int): The variant number of the measure that is in the GMC. - wall (obj): Object reference of the wall that has to be strengthened. - application_type (str): Select the side to apply the measure on. Default value is 'both', applying the measure on both sides of the wall. If 'positive' or 'negative' is provided as argument, the measure will be applied on that side of the wall only. Positive is in the direction of the local z-axis of the strengthened wall. - eccentricity (bool): The eccentricity of the strengthening is applied by default when applying the measure on both sides. Default value is True. This input is ignored when application-type is 'positive' or 'negative', eccentricity is always applied in these cases. Output: - The strengthening measure is added to the wall. Newly created walls and reinforcements are returned in a list. """ # Check if measure is in GMC measure_type = 'L5-P' measure_sub_type = f"{measure_type}-{int(variant)}" viia_check_measure_in_gmc(project=project, measure_sub_type=measure_sub_type) # Argument handling wall: Wall = viia_check_shape_argument(project, wall, 'viia_l5p') if application_type.lower() not in ['both', 'positive', 'negative']: raise ValueError( f"ERROR: Input for viia_l5p function for 'application_type' has to be 'both', 'positive' " f"or 'negative'. Check your input ({application_type}).") application_type = application_type.lower() if application_type in ['positive', 'negative'] and not eccentricity: warnings.warn( f"WARNING: When selecting 'application_type' to be 'positive' or 'negative', the eccentricity is always " f"applied. User input for eccentricity=False is ignored.") # Materials and geometry to be used for strengthening measure material_name = project.project_specific['strengthening_measures']['L5-P']['material'] reinforcement_material_name = project.project_specific['strengthening_measures']['L5-P']['reinforcement_material'] thickness = project.project_specific['strengthening_measures']['L5-P']['thickness'] # Initialize new_walls_lst = [] new_reinforcements_lst = [] eccentricity_value = 0 if application_type == 'both' and not eccentricity: new_wall = project.viia_create_wall( name=wall.layer, points=[wall.contour.get_points()], material=material_name, geometry=str(int(thickness * 2000))) new_wall.name = new_wall.name.replace('WANDEN', 'WANDEN_L5P') new_wall.openings = wall.openings new_walls_lst.append(new_wall) new_reinforcement = project.viia_create_main_surface_reinforcement( name=wall.layer, points=[wall.contour.get_points()], material=reinforcement_material_name, geometry='WANDEN-L5P-CFRPMESH-2x', discretisation='element', host_members=[new_wall], element_x_axis=[0, 0, 1]) new_reinforcement.name = \ new_reinforcement.name.replace('WAPENING', 'WAPENING_L5P').replace('WANDEN-L5P-CFRPMESH-2x', '2x') new_reinforcement.openings = wall.openings new_reinforcements_lst.append(new_reinforcement) elif application_type == 'both' and eccentricity: eccentricity_value = round(wall.geometry.geometry_model.thickness / 2 + thickness / 2, 3) # Application of wall with positive eccentricity new_wall_positive = project.viia_create_wall( name=wall.layer, points=[wall.contour.get_points()], material=material_name, geometry=str(int(thickness * 1000))) new_wall_positive.name = new_wall_positive.name.replace('WANDEN', 'WANDEN_L5P_POS') new_wall_positive.openings = wall.openings new_wall_positive.add_geometry_eccentricity(z=eccentricity_value) new_walls_lst.append(new_wall_positive) new_reinforcement_positive = project.viia_create_main_surface_reinforcement( name=wall.layer, points=[fem_copy_polyline(wall.contour, dx=wall.normal_vector()[0] * eccentricity_value, dy=wall.normal_vector()[1] * eccentricity_value).get_points()], material=reinforcement_material_name, geometry='WANDEN-L5P-CFRPMESH', discretisation='element', host_members=[new_wall_positive], element_x_axis=[0, 0, 1]) new_reinforcement_positive.name = \ new_reinforcement_positive.name.replace('WAPENING', 'WAPENING_L5P_POS').replace('WANDEN-L5P-CFRPMESH', '1x') openings_input = None if wall.openings is not None: openings_input = [fem_copy_polyline( opening, dx=wall.normal_vector()[0] * eccentricity_value, dy=wall.normal_vector()[1] * eccentricity_value) for opening in wall.openings] new_reinforcement_positive.openings = openings_input new_reinforcements_lst.append(new_reinforcement_positive) # Application of wall with negative eccentricity new_wall_negative = project.viia_create_wall( name=wall.layer, points=[wall.contour.get_points()], material=material_name, geometry=str(int(thickness * 1000))) new_wall_negative.name = new_wall_negative.name.replace('WANDEN', 'WANDEN_L5P_NEG') new_wall_negative.openings = wall.openings new_wall_negative.add_geometry_eccentricity(z=-eccentricity_value) new_walls_lst.append(new_wall_negative) normal_vector_negative = [-1 * i for i in wall.normal_vector()] new_reinforcement_negative = project.viia_create_main_surface_reinforcement( name=wall.layer, points=[fem_copy_polyline(wall.contour, dx=normal_vector_negative[0] * eccentricity_value, dy=normal_vector_negative[1] * eccentricity_value).get_points()], material=reinforcement_material_name, geometry='WANDEN-L5P-CFRPMESH', discretisation='element', host_members=[new_wall_negative], element_x_axis=[0, 0, 1]) new_reinforcement_negative.name = \ new_reinforcement_negative.name.replace('WAPENING', 'WAPENING_L5P_NEG').replace('WANDEN-L5P-CFRPMESH', '1x') openings_input = None if wall.openings is not None: openings_input = [fem_copy_polyline( opening, dx=normal_vector_negative[0] * eccentricity_value, dy=normal_vector_negative[1] * eccentricity_value) for opening in wall.openings] new_reinforcement_negative.openings = openings_input new_reinforcements_lst.append(new_reinforcement_negative) else: if application_type == 'positive': eccentricity_value = round(wall.geometry.geometry_model.thickness / 2 + thickness / 2, 3) elif application_type == 'negative': eccentricity_value = -round(wall.geometry.geometry_model.thickness / 2 + thickness / 2, 3) new_wall = project.viia_create_wall( name=wall.layer, points=[wall.contour.get_points()], material=material_name, geometry=str(int(thickness * 1000))) new_wall.name = new_wall.name.replace('WANDEN', 'WANDEN_L5P') new_wall.openings = wall.openings new_wall.add_geometry_eccentricity(z=eccentricity_value) new_walls_lst.append(new_wall) new_reinforcement = project.viia_create_main_surface_reinforcement( name=wall.layer, points=[fem_copy_polyline(wall.contour, dx=wall.normal_vector()[0] * eccentricity_value, dy=wall.normal_vector()[1] * eccentricity_value).get_points()], material=reinforcement_material_name, geometry='WANDEN-L5P-CFRPMESH', discretisation='element', host_members=[new_wall], element_x_axis=[0, 0, 1]) new_reinforcement.name = \ new_reinforcement.name.replace('WAPENING', 'WAPENING_L5P').replace('WANDEN-L5P-CFRPMESH', '1x') openings_input = None if wall.openings is not None: openings_input = [fem_copy_polyline( opening, dx=wall.normal_vector()[0] * eccentricity_value, dy=wall.normal_vector()[1] * eccentricity_value) for opening in wall.openings] new_reinforcement.openings = openings_input new_reinforcements_lst.append(new_reinforcement) # Notifications for user project.write_log( f"L5-P measure applied on wall {wall.name}.\n Concrete walls ('spuitbeton') created: " f"{', '.join([new_wall.name for new_wall in new_walls_lst])}\n Reinforcement CFRP-mesh created: " f"{', '.join([new_reinforcement.name for new_reinforcement in new_reinforcements_lst])}.") # Set the data for strengthening in attribute of wall wall.add_meta_data({'strengthening': measure_sub_type}) return [*new_walls_lst, *new_reinforcements_lst]
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================