Source code for viiapackage.geometry.viia_create_foundation

### ===================================================================================================================
###   Functionality to create foundation strips
### ===================================================================================================================
# Copyright ©VIIA 2024

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

# General imports
from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Tuple, Union
from copy import deepcopy

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.fem_math import fem_compare_coordinates, fem_vector_2_points, fem_unit_vector, \
    fem_cross_product_vector, fem_distance_coordinates, fem_compare_values, fem_parallel_vectors, \
    fem_closest_point, fem_longest_distance, fem_distance_point_to_plane, fem_greater, fem_smaller, fem_point_on_line, \
    fem_intersection_of_two_lines, fem_distance_point_to_line, fem_scalar_vector_multiplication, fem_translate_point
from rhdhv_fem.materials import Material, Masonry
from rhdhv_fem.shapes import Wall, Column, Fstrip
from rhdhv_fem.shape_geometries import Line
from rhdhv_fem.fem_tools import fem_find_object

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject
from viiapackage.viiaMaterials import viia_convert_material_to_linear
from viiapackage.geometry.viia_fstrips import identify_surface_common_nodes
from viiapackage.geometry.geometry_models import ViiaSteppedFoundationWall


### ====================================================================================================================
###    2. Create foundation walls/columns and strips
### ====================================================================================================================

[docs]def _check_fstrips_connectivity(project: ViiaProject): """ Function to check if all foundation strips are properly connected to each other. This check is needed to avoid gaps between two foundation strips. The gap case may arise when the length of one of the fstrip is smaller than the width of adjacent foundation strips.""" for i, fstrip in enumerate(project.collections.fstrips): connected_strips = [] connecting_fstrips = identify_surface_common_nodes(fstrip, project.collections.fstrips) # Checking number of points where fstrip and connecting_fstrip have in common. Two adjacent foundation strips # with only one common node will be an issue since adjacent foundation strips should have two common nodes. for connecting_fstrip in connecting_fstrips: common_nodes = [] for node in fstrip.contour.get_points(): if node in connecting_fstrip.contour.get_points(): common_nodes.append(node) if len(fstrip.contour.get_points()) == 3: connected_strips.append([fstrip, connecting_fstrip]) elif len(connecting_fstrip.contour.get_points()) == 3: connected_strips.append([connecting_fstrip, fstrip]) else: continue if len(common_nodes) == 1: project.write_log( f"Two foundation strips - {connected_strips[0][0].name} and {connected_strips[0][1].name} are " f"connected at a single point. This issue could arise if one of the two foundation strips have " f"length shorter than the width of the other foundation strip. Attempting to fix this. If not " f"fixed, please make manual adjustments.") # Find closest node nodes_to_compare = [ node.coordinates for node in connected_strips[0][1].contour.get_nodes() if node.coordinates != common_nodes[0]] closest_node, _ = fem_closest_point(point=common_nodes[0], point_list=nodes_to_compare) # Modifying fstrip by adding the closest node to polyline contour points_to_keep = deepcopy(connected_strips[0][0].contour.get_points()) connected_strips[0][0].contour = project.create_polyline(points_to_keep + [closest_node])
[docs]def _viia_create_foundation_wall_and_strip( project: ViiaProject, line_point_1: List[float], line_point_2: List[float], foundation_depth: float, foundation_wall_thickness: float, wall_material: Material, strip_width: float, strip_thickness: float, strip_material: Material) -> Tuple[Optional[Wall], Fstrip]: """ Function creates the wall and strip foundation.""" # Check points if not fem_compare_values(line_point_1[2], line_point_2[2]): raise ValueError( "ERROR: The function viia_create_foundation_wall_and_strip expects two points with the " "same z-coordinate. Please check.") if fem_compare_coordinates(line_point_1, line_point_2): raise ValueError( "ERROR: The two points for the function viia_create_foundation_wall_and_strip are equal. Please check.") if line_point_1[2] < foundation_depth: raise ValueError( f"ERROR: The viia_create_foundation_wall_and_strip function received lower z-coordinates of the wall " f"than the foundation_depth. Please check.") # Check the height and determine if 1 or 2 walls are created total_height = (line_point_1[2] - foundation_depth) * 1E3 if fem_smaller(total_height - strip_thickness / 2, 100): level = line_point_1[2] foundation_wall = None else: level = round(foundation_depth + strip_thickness / 2E3, 3) foundation_wall = project.viia_create_wall( name='F', material=wall_material, geometry=int(foundation_wall_thickness), points=[[ [line_point_1[0], line_point_1[1], line_point_1[2]], [line_point_2[0], line_point_2[1], line_point_1[2]], [line_point_2[0], line_point_2[1], level], [line_point_1[0], line_point_1[1], level]]]) foundation_strip = _viia_create_foundation_strip( project=project, thickness=strip_thickness, width=strip_width, level=level, material=strip_material, line_point_1=line_point_1, line_point_2=line_point_2) return foundation_wall, foundation_strip
def _viia_create_foundation_wall_and_strip_cavity_wall( project: ViiaProject, inner_leaf_point1: List[float], inner_leaf_point2: List[float], outer_leaf_point1: List[float], outer_leaf_point2: List[float], foundation_depth: float, foundation_wall_inner_leaf_thickness: float, foundation_wall_outer_leaf_thickness: float, wall_material_inner_leaf: Material, wall_material_outer_leaf: Material, strip_width: float, strip_thickness: float, strip_material: Material) -> Tuple[Optional[Wall], Optional[Wall], Fstrip, float]: """ Function creates the wall and strip foundation for cavity walls.""" # Check points if not all([fem_compare_values(value1=inner_leaf_point1[2], value2=point[2], precision=project.check_precision) for point in [inner_leaf_point2, outer_leaf_point1, outer_leaf_point2]]): raise ValueError( "ERROR: The function viia_create_foundation_wall_and_strip_cavity_wall expects all points with the " "same z-coordinate. Please check.") if fem_compare_coordinates( coordinate1=inner_leaf_point1, coordinate2=inner_leaf_point2, precision=project.check_precision): raise ValueError( "ERROR: The two points for the function inner leaf of the viia_create_foundation_wall_and_strip_cavity_wall" " are equal. Please check.") if fem_compare_coordinates( coordinate1=outer_leaf_point1, coordinate2=outer_leaf_point2, precision=project.check_precision): raise ValueError( "ERROR: The two points for the function outer leaf of the viia_create_foundation_wall_and_strip_cavity_wall" " are equal. Please check.") if inner_leaf_point1[2] < foundation_depth: # TODO Use fem_smaller and check for zero height walls raise ValueError( f"ERROR: The viia_create_foundation_wall_and_strip_cavity_wall function received lower z-coordinates of the" f"walls than the foundation_depth. Please check.") if not fem_parallel_vectors( vector_1=fem_vector_2_points(point1=inner_leaf_point1, point2=inner_leaf_point2), vector_2=fem_vector_2_points(point1=outer_leaf_point1, point2=outer_leaf_point2), anti_parallel_vectors=False, precision=project.check_precision): if fem_parallel_vectors( vector_1=fem_vector_2_points(point1=inner_leaf_point1, point2=inner_leaf_point2), vector_2=fem_vector_2_points(point1=outer_leaf_point2, point2=outer_leaf_point1), anti_parallel_vectors=True, precision=project.check_precision): # Inner and outer lead points are in opposite direction, the outer leaf points are flipped temp = outer_leaf_point1 outer_leaf_point1 = outer_leaf_point2 outer_leaf_point2 = temp else: raise ValueError( f"ERROR: The viia_create_foundation_wall_and_strip_cavity_wall function expects the inner and outer " f"leaf to be parallel. Please check.") # Check the height and determine if walls are created total_height = (inner_leaf_point1[2] - foundation_depth) * 1E3 if fem_smaller(total_height - strip_thickness / 2, 100): level = inner_leaf_point1[2] inner_leaf_foundation = None outer_leaf_foundation = None else: level = round(foundation_depth + strip_thickness / 2E3, project.rounding_precision) # Foundation inner leaf inner_leaf_foundation = project.viia_create_wall( name='F', material=wall_material_inner_leaf, geometry=int(foundation_wall_inner_leaf_thickness), points=[[ [inner_leaf_point1[0], inner_leaf_point1[1], inner_leaf_point1[2]], [inner_leaf_point2[0], inner_leaf_point2[1], inner_leaf_point1[2]], [inner_leaf_point2[0], inner_leaf_point2[1], level], [inner_leaf_point1[0], inner_leaf_point1[1], level]]]) # Foundation inner leaf outer_leaf_foundation = project.viia_create_wall( name='F', material=wall_material_outer_leaf, geometry=int(foundation_wall_outer_leaf_thickness), points=[[ [outer_leaf_point1[0], outer_leaf_point1[1], outer_leaf_point1[2]], [outer_leaf_point2[0], outer_leaf_point2[1], outer_leaf_point1[2]], [outer_leaf_point2[0], outer_leaf_point2[1], level], [outer_leaf_point1[0], outer_leaf_point1[1], level]]]) # Calculate the distance for the center point of the foundation strip cavity = 1e3 * fem_distance_point_to_line( point=inner_leaf_point1, line=[outer_leaf_point1, outer_leaf_point2])[0] - \ (foundation_wall_inner_leaf_thickness + foundation_wall_outer_leaf_thickness) / 2 width = foundation_wall_inner_leaf_thickness + foundation_wall_outer_leaf_thickness + cavity d1 = width / 2 - foundation_wall_inner_leaf_thickness / 2 d2 = width / 2 - foundation_wall_outer_leaf_thickness / 2 # Check if the input from user for the strip width complies to the minimum requirement if not fem_compare_values(value1=strip_width, value2=width, precision=project.check_precision) and \ strip_width < width: raise ValueError("ERROR: The width of the strip is smaller than the total thickness of the cavity wall.") # Determine the weighted mid-points vector = fem_vector_2_points(point1=inner_leaf_point1, point2=outer_leaf_point1) translation = fem_scalar_vector_multiplication(vector=vector, scalar=d1 / (d1 + d2)) line_point_1 = fem_translate_point(point=inner_leaf_point1, translations=translation) vector = fem_vector_2_points(point1=inner_leaf_point2, point2=outer_leaf_point2) translation = fem_scalar_vector_multiplication(vector=vector, scalar=d1 / (d1 + d2)) line_point_2 = fem_translate_point(point=inner_leaf_point2, translations=translation) # Create the foundation strip foundation_strip = _viia_create_foundation_strip( project=project, thickness=strip_thickness, width=strip_width, level=level, material=strip_material, line_point_1=line_point_1, line_point_2=line_point_2) return inner_leaf_foundation, outer_leaf_foundation, foundation_strip, cavity
[docs]def _viia_create_foundation_wall_and_strip_stepped_foundation( project: ViiaProject, line_point_1: List[float], line_point_2: List[float], foundation_depth: float, foundation_wall_thickness: float, strip_extensions: List[float], strip_heights: List[float], material: Material, cavity_extension_wall_bottom: Optional[float] = 0, cavity_extension_wall_thickness: Optional[float] = None, strip_material: Optional[Material] = None) -> Tuple[Optional[Wall], Wall, Fstrip, Optional[Wall]]: """ Function creates the stepped foundation.""" # Check points if not fem_compare_values(line_point_1[2], line_point_2[2]): raise ValueError( "ERROR: The function _viia_create_foundation_wall_and_strip_stepped_foundation expects two points with the " "same z-coordinate. Please check.") if fem_compare_coordinates(line_point_1, line_point_2): raise ValueError( "ERROR: The two points for the function _viia_create_foundation_wall_and_strip_stepped_foundation " "are equal. Please check.") # Check the height and determine if 1 or 2 walls are created total_height = (line_point_1[2] - foundation_depth) * 1000 steps_height = 0 for step in strip_heights: steps_height += step if not fem_smaller(steps_height, total_height): raise ValueError( "ERROR: The step heights are higher than the distance between the foundation depth and the bottom side of " "the wall. Please check the input.") # Set material for the strip, unless specified if not strip_material: strip_material = material # Create the strip strip_width = foundation_wall_thickness for step in strip_extensions: strip_width += 2 * step z_strip = foundation_depth + strip_heights[-1] / 2E3 lin_material = viia_convert_material_to_linear(project=project, material=strip_material) foundation_strip = _viia_create_foundation_strip( project=project, thickness=strip_heights[-1], width=strip_width, material=lin_material, level=z_strip, line_point_1=line_point_1, line_point_2=line_point_2) # Check if cavity extension wall exist height_normal_wall = 0 cavity_extension_wall_exist = False if not fem_greater(cavity_extension_wall_bottom, line_point_1[2]): cavity_extension_wall_exist = True height_normal_wall = total_height - steps_height - (line_point_1[2] - cavity_extension_wall_bottom) * 1E3 if height_normal_wall < 0: project.write_log( f"WARNING: The requested cavity extension " f"({int((line_point_1[2] - cavity_extension_wall_bottom) * 1E3)}mm) does " f"not fit the cross-section, please check your input. Maximum cavity extension allowed is " f"{int((line_point_1[2] - cavity_extension_wall_bottom) * 1E3) + height_normal_wall}mm. The model will " f"be created for a cavity extension equal to the maximum allowed.") cavity_extension_wall_bottom = cavity_extension_wall_bottom - height_normal_wall / 1E3 height_normal_wall = 0 elif fem_compare_values( value1=cavity_extension_wall_bottom, value2=line_point_2[2], precision=project.rounding_precision): height_normal_wall = total_height - steps_height # Create cavity extension wall cavity_extension_wall = None if cavity_extension_wall_exist: cavity_extension_wall = project.viia_create_wall( name='F', material=material, geometry=cavity_extension_wall_thickness, points=[[ [line_point_1[0], line_point_1[1], line_point_1[2]], [line_point_2[0], line_point_2[1], line_point_1[2]], [line_point_2[0], line_point_2[1], cavity_extension_wall_bottom], [line_point_1[0], line_point_1[1], cavity_extension_wall_bottom]]]) # create normal_wall normal_wall = None if fem_smaller(height_normal_wall, 250): # Wall is not split if cavity_extension_wall_exist: equivalent_top_level = cavity_extension_wall_bottom else: equivalent_top_level = line_point_1[2] else: # Two walls are created equivalent_top_level = foundation_depth + steps_height / 1E3 # Create the normal wall normal_wall = project.viia_create_wall( name='F', material=material, geometry=foundation_wall_thickness, points=[[ [line_point_1[0], line_point_1[1], cavity_extension_wall_bottom], [line_point_2[0], line_point_2[1], cavity_extension_wall_bottom], [line_point_2[0], line_point_2[1], equivalent_top_level], [line_point_1[0], line_point_1[1], equivalent_top_level]]]) # Calculate the properties eq_wall_width, _, modified_density = viia_get_equivalent_properties_masonry_wall_foundation( wall_thickness=foundation_wall_thickness, bottom_of_strip=foundation_depth, heights_levels_strip=strip_heights, strip_extensions=strip_extensions, original_density=strip_material.mass_density, top_level=equivalent_top_level) # Create the equivalent foundation wall equiv_wall = project.viia_create_wall( name='F', material=project.viia_materials(material_name=f'{lin_material.name}-DENSIT{int(modified_density)}'), geometry=eq_wall_width, points=[[ [line_point_1[0], line_point_1[1], equivalent_top_level], [line_point_2[0], line_point_2[1], equivalent_top_level], [line_point_2[0], line_point_2[1], z_strip], [line_point_1[0], line_point_1[1], z_strip]]]) # Return the created shapes return normal_wall, equiv_wall, foundation_strip, cavity_extension_wall
[docs]def viia_create_foundation_walls_and_strips( project: ViiaProject, walls: List[Union[Wall, str, Tuple[Wall, Line]]], foundation_depth: float, strip_material: Optional[str] = None, strip_width: Optional[float] = None, strip_thickness: Optional[int] = None, stepped_foundation_strip_extensions: Optional[List[float]] = None, stepped_foundation_strip_heights: Optional[List[float]] = None, adjust_strips: bool = True, allow_outer_leafs: bool = False, adjust_for_cavity: bool = True, foundation_wall_material: Optional[str] = None, cavity_extension: Optional[float] = 0) -> Tuple[Optional[List[Wall]], Optional[List[Fstrip]]]: """ Function creates the foundation underneath all walls in the list. The foundation strips are generated centered underneath the wall. In case of cavity walls, the foundation strip is generated underneath both leaves. The remaining strip width is equally distributed on both sides of the real wall including the cavity. .. note:: The input cavity_extension should only be used when the cavity wall extends below the ground floor level, therefore, the default value is set to 0. When given value to cavity_extension, it should be the height (dimension in vertical direction) of the extension part in [mm]. In reality, it means the cavity was filled and foundation wall becomes solid below certain height of cavity extension. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - walls (list): List with all the walls underneath which the foundation has to be made. The walls may be provided as string or as object reference of Wall. If provided as tuple with a line shape-geometry, the foundation is applied only underneath that part of the wall. This last feature is not available for cavity walls. - foundation_depth (float): Depth of the foundation strip, in [m]. - strip_material (str): Name of the strip material. - strip_width (int): Width of the strip, in [mm]. In case of stepped foundation this input parameter should not be provided. Default value None. - strip_thickness (int): Thickness of the strip, in [mm]. In case of stepped foundation this input parameter should not be provided. Default value None. - stepped_foundation_strip_extensions (list of float): List of extensions for stepped foundations, in [mm]. Input parameter should only be provided for stepped foundations. Default value None. The extensions are provided at each level of the stepped foundation going from top to bottom 60 | | 60 ---- ---- 75 | | 75 ---- ---- 40 | | 40 ---- ---- | | ----------------------- strip_extensions = [60, 75, 40] - stepped_foundation_strip_heights (list of float): List of extensions for stepped foundations, values in [mm]. Input parameter should only be provided for stepped foundations. Default value None. Height of the various levels of the stepped foundation going from top to bottom, in [mm]. | | ---- ---- 120 | | ---- ---- 50 | | ---- ---- 60 | | ----------------------- height_levels = [120, 50, 60] - adjust_strips (boolean): Switch to automatically adjust the fstrips so that they connect properly at intersections. This will remove overlapping parts, and add the missing area to connect the outer corners. Default value is True, performing the adjustment. - allow_outer_leafs (boolean): When set to true, foundations can be created below the outer leafs of cavity walls as well. Default value is False. - adjust_for_cavity (boolean): Toggle to place the foundation wall in the middle of the cavity. Default value is True. This input is not used and will be removed in future releases. - foundation_wall_material (str): Optional input to specify the material of the foundation wall. Default value is None, in which case the material of the wall is the same as that of the ground floor wall. - cavity_extension (float): The height of the ground floor cavity wall's extension below ground floor level, in [mm]. Default is 0, which means ground floor cavity walls doesn't extend into foundation Output: - Returns lists of object references of newly created foundation walls (Wall) and foundation strips (Fstrip). """ # Input for walls should be list # In case input for walls is not provided as list but as single wall, proceed with function if isinstance(walls, Wall): walls = [walls] if not isinstance(walls, list): raise ValueError(f'ERROR: Input for viia_create_foundation_walls_and_strips requires a list of walls.') for i, wall in enumerate(walls): if isinstance(wall, str): if 'wall_' in wall: walls[i] = fem_find_object( reference=int(wall.replace('wall_', '')), collection=project.collections.walls) else: walls[i] = fem_find_object(reference=wall, collection=project.collections.walls) if not isinstance(walls[i], Wall): raise ValueError(f'ERROR: The wall to create foundation under could not be found.') # Check if supplied strip material is present if strip_material and isinstance(strip_material, str): strip_material = project.viia_materials(strip_material) # Check if stepped foundation is applied stepped_foundation = False if stepped_foundation_strip_extensions or stepped_foundation_strip_heights: if not stepped_foundation_strip_extensions and stepped_foundation_strip_heights: raise ValueError("ERROR: Input for stepped foundation received, but incomplete.") if not len(stepped_foundation_strip_extensions) == len(stepped_foundation_strip_heights): raise ValueError("ERROR: Input for stepped foundation is not complying, lists should have same length.") stepped_foundation = True # Create the foundations per wall f_walls = [] f_strips = [] f_strips_directions = [] warning_given = False for wall in walls: # Check for user input of shape-geometries shape_line = None if isinstance(wall, tuple): shape_line = wall[1] wall = wall[0] if wall.id > 9000 and not allow_outer_leafs: if not warning_given: project.write_log( "WARNING: Foundations cannot be created underneath the outer leafs of the cavity wall. " "Please use the inner wall for this. This wall is skipped.") warning_given = True continue # Check if this is wall has an outer leaf outer_leaf = None is_cavity_wall = False cavity_distance = None for other_wall in project.collections.walls: if other_wall.id == wall.id + 9000: outer_leaf = other_wall is_cavity_wall = True break # Check input for line shape-geometries to create foundation on part only bottom_edges = wall.get_bottom_edges(include_openings=True) if shape_line and shape_line not in bottom_edges: raise ValueError( "ERROR: The line shape-geometry provided for the function to create a foundation is not part of the " f"bottom edge of the wall {wall.name}.") if shape_line: bottom_edges = [shape_line] # Determine the points for creation of the foundation if is_cavity_wall: if shape_line: raise NotImplementedError( "ERROR: Applying a foundation on part of a cavity wall is not yet implemented.") points = _determine_foundation_points_for_cavity_wall(inner_leaf=wall, outer_leaf=outer_leaf) cavity_distance = fem_distance_point_to_plane(point=points[0], plane=wall.contour.get_points()) * 2 - \ (wall.geometry.geometry_model.thickness + outer_leaf.geometry.geometry_model.thickness) / 2 else: points = fem_longest_distance([point for line in bottom_edges for point in line.get_points()]) # Determine the width of the foundation wall, in mm cavity_extension_wall_bottom = None cavity_extension_wall_thickness = None if is_cavity_wall: foundation_wall_thickness = wall.geometry.geometry_model.thickness * 1e3 + \ outer_leaf.geometry.geometry_model.thickness * 1e3 + cavity_distance * 1e3 # Calculate the cavity extension thickness cavity_extension_wall_thickness = \ wall.geometry.geometry_model.thickness * 1e3 + outer_leaf.geometry.geometry_model.thickness * 1e3 # Calculate the cavity extension bottom level and thickness cavity_extension_wall_bottom = points[0][2] - cavity_extension / 1e3 else: foundation_wall_thickness = wall.geometry.geometry_model.thickness * 1e3 # Check the material for the foundation wall if foundation_wall_material: if isinstance(foundation_wall_material, Material): wall_material = foundation_wall_material else: wall_material = project.viia_create_material(material_name=foundation_wall_material) else: wall_material = wall.material if stepped_foundation: # Check material if not isinstance(wall.material, Masonry): raise ValueError("ERROR: The stepped foundation is only available for masonry walls.") if strip_material: if strip_material is not wall.material: project.write_log( "WARNING: The strip for the stepped foundation has been requested with another material then " "the wall on top. This is not a common situation, please check before continuing. In normal " "situations you do not need to provide the strip-material.") if not isinstance(strip_material, Masonry): raise ValueError("ERROR: The stepped foundation is only available for masonry walls and strips.") # Create the stepped foundation if is_cavity_wall: normal_wall, equiv_wall, foundation_strip, cavity_extension_wall = \ _viia_create_foundation_wall_and_strip_stepped_foundation( project=project, line_point_1=points[0], line_point_2=points[1], foundation_depth=foundation_depth, foundation_wall_thickness=foundation_wall_thickness, strip_extensions=stepped_foundation_strip_extensions, strip_heights=stepped_foundation_strip_heights, material=wall_material, strip_material=strip_material, cavity_extension_wall_bottom=cavity_extension_wall_bottom, cavity_extension_wall_thickness=cavity_extension_wall_thickness) else: normal_wall, equiv_wall, foundation_strip, cavity_extension_wall = \ _viia_create_foundation_wall_and_strip_stepped_foundation( project=project, line_point_1=points[0], line_point_2=points[1], foundation_depth=foundation_depth, foundation_wall_thickness=foundation_wall_thickness, strip_extensions=stepped_foundation_strip_extensions, strip_heights=stepped_foundation_strip_heights, material=wall_material, strip_material=strip_material) f_walls.append(equiv_wall) if normal_wall: f_walls.append(normal_wall) if cavity_extension_wall: f_walls.append(cavity_extension_wall) f_strips.append(foundation_strip) direction = fem_vector_2_points(points[0], points[1]) f_strips_directions.append(direction) # X-axis of the foundation wall should be the same as the wall on top walls_created = [w for w in [normal_wall, equiv_wall, cavity_extension_wall] if w is not None] for wall_created in walls_created: if wall_created.element_x_axis != wall.element_x_axis: wall.flip() wall_created.element_x_axis = wall.element_x_axis # Store foundation dimensions to meta-data for C3 pictures # Note in case normal wall is None, the equivalent wall continues to the bottom edge of the supported wall equiv_dict = { 'equiv_wall': equiv_wall, 'normal_wall': normal_wall} if is_cavity_wall: if cavity_extension_wall: equiv_dict['cavity_extension_wall'] = cavity_extension_wall equiv_dict['cavity_distance'] = cavity_distance equiv_dict['outer_leaf_thickness'] = outer_leaf.geometry.geometry_model.thickness foundation_strip.add_meta_data({ 'stepped_foundation': True, 'supported_wall': wall, 'real_dimensions': [stepped_foundation_strip_extensions, stepped_foundation_strip_heights], 'equiv_dimensions': equiv_dict}) else: # Check if strip-material is provided (is only optional for stepped foundation) if not isinstance(strip_material, Material): raise ValueError("ERROR: The strip-material was not provided correctly.") if is_cavity_wall: # Inner leaf points inner_leaf_points = fem_longest_distance( [point for line in bottom_edges for point in line.get_points()]) # Outer leaf points outer_leaf_bottom_edges = outer_leaf.get_bottom_edges(include_openings=True) outer_leaf_points = fem_longest_distance( [point for line in outer_leaf_bottom_edges for point in line.get_points()]) # Create foundation wall, cavity wall and strip foundation_inner_leaf, foundation_outer_leaf, foundation_strip, cavity = \ _viia_create_foundation_wall_and_strip_cavity_wall( project=project, inner_leaf_point1=inner_leaf_points[0], inner_leaf_point2=inner_leaf_points[1], outer_leaf_point1=outer_leaf_points[0], outer_leaf_point2=outer_leaf_points[1], foundation_wall_inner_leaf_thickness=wall.geometry.geometry_model.thickness * 1e3, foundation_wall_outer_leaf_thickness=outer_leaf.geometry.geometry_model.thickness * 1e3, wall_material_inner_leaf=wall_material, wall_material_outer_leaf=outer_leaf.material, foundation_depth=foundation_depth, strip_width=strip_width, strip_thickness=strip_thickness, strip_material=strip_material) direction = fem_vector_2_points(points[0], points[1]) if foundation_inner_leaf: f_walls.append(foundation_inner_leaf) if foundation_outer_leaf: f_walls.append(foundation_outer_leaf) f_strips.append(foundation_strip) f_strips_directions.append(direction) # Align the X-axis of the foundation walls with the walls on top for foundation_wall, top_wall in zip([foundation_inner_leaf, foundation_outer_leaf], [wall, outer_leaf]): if foundation_wall.element_x_axis != top_wall.element_x_axis: foundation_wall.flip() foundation_wall.element_x_axis = top_wall.element_x_axis # Store foundation dimensions to meta-data for model pictures foundation details foundation_strip.add_meta_data({ 'strip_foundation': True, 'supported_wall': wall, 'foundation_wall': foundation_inner_leaf, 'foundation_cavity_wall': foundation_outer_leaf, 'cavity': int(round(cavity, 0))}) else: # Create foundation wall and strip foundation_wall, foundation_strip = _viia_create_foundation_wall_and_strip( project=project, line_point_1=points[0], line_point_2=points[1], foundation_depth=foundation_depth, foundation_wall_thickness=foundation_wall_thickness, wall_material=wall_material, strip_width=strip_width, strip_thickness=strip_thickness, strip_material=strip_material) direction = fem_vector_2_points(points[0], points[1]) f_walls.append(foundation_wall) f_strips.append(foundation_strip) f_strips_directions.append(direction) # X-axis of the foundation wall should be the same as the wall on top if wall and foundation_wall.element_x_axis != wall.element_x_axis: foundation_wall.flip() foundation_wall.element_x_axis = wall.element_x_axis # Store foundation dimensions to meta data for C1 pictures foundation_strip.add_meta_data({ 'strip_foundation': True, 'supported_wall': wall, 'foundation_wall': foundation_wall}) if adjust_strips: project.viia_adjust_fstrips(fstrips=f_strips, fstrip_directions=f_strips_directions, fwalls=f_walls) _check_fstrips_connectivity(project=project) return f_walls, f_strips
[docs]def _viia_create_foundation_strip( project: ViiaProject, thickness: float, width: float, level: float, material: Material, line_point_1: List[float], line_point_2: List[float], cut_off_line_1: Optional[List[List[float]]] = None, cut_off_line_2: Optional[List[List[float]]] = None) -> Fstrip: """ This function creates the foundation strip. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - thickness (float): Thickness of foundation strip, in [m]. - width (float): Width of foundation strip, in [m]. - level (float): Depth of the foundation, in [m] (level of the foundation strip). - material (obj): Object reference for material of the strip. - line_point_1 (list of float): First corner point of the wall underneath which the foundation is made. - line_point_2 (list of float): Second corner point of the wall underneath which the foundation is made. - cut_off_line_1 (list of lists of float): List with two points that define a cut-off line for the foundation strip, defining the side of the strip. Line point 1 should be on this line. - cut_off_line_2 (list of lists of float): List with two points that define a cut-off line for the foundation strip, defining the side of the strip. Line point 2 should be on this line. Output: - Creates and adds to project the newly created instance of Fstrip class. """ # Mid-points of strip line_point_3 = [line_point_2[0], line_point_2[1], level] line_point_4 = [line_point_1[0], line_point_1[1], level] strip_mid_line_points = [line_point_3, line_point_4] # Directions of strip strip_line_direction = fem_vector_2_points(point1=line_point_3, point2=line_point_4) extrude_direction = fem_unit_vector(fem_cross_product_vector(strip_line_direction, [0, 0, 1])) displacement_vector = [width / 2000 * i for i in extrude_direction] # Point of contour of strip strip_points = [ [strip_mid_line_points[0][i] + displacement_vector[i] for i in range(3)], [strip_mid_line_points[1][i] + displacement_vector[i] for i in range(3)], [strip_mid_line_points[1][i] - displacement_vector[i] for i in range(3)], [strip_mid_line_points[0][i] - displacement_vector[i] for i in range(3)]] if cut_off_line_1: if not fem_point_on_line(point=line_point_1, line_points=cut_off_line_1, precision=project.check_precision): raise ValueError( f"ERROR: The cut-off line for the foundation strip {cut_off_line_1} is not intersecting with the base " f"point of the foundation strip {line_point_1}.") strip_points[1] = fem_intersection_of_two_lines( coordinate1=strip_points[1], vector1=strip_line_direction, coordinate2=cut_off_line_1[0][:2] + [level], vector2=fem_vector_2_points(point1=cut_off_line_1[0], point2=cut_off_line_1[1])) strip_points[2] = fem_intersection_of_two_lines( coordinate1=strip_points[2], vector1=strip_line_direction, coordinate2=cut_off_line_1[0][:2] + [level], vector2=fem_vector_2_points(point1=cut_off_line_1[0], point2=cut_off_line_1[1])) if cut_off_line_2: if not fem_point_on_line(point=line_point_2, line_points=cut_off_line_2, precision=project.check_precision): raise ValueError( f"ERROR: The cut-off line for the foundation strip {cut_off_line_2} is not intersecting with the base " f"point of the foundation strip {line_point_2}.") strip_points[0] = fem_intersection_of_two_lines( coordinate1=strip_points[0], vector1=strip_line_direction, coordinate2=cut_off_line_2[0][:2] + [level], vector2=fem_vector_2_points(point1=cut_off_line_2[0], point2=cut_off_line_2[1])) strip_points[3] = fem_intersection_of_two_lines( coordinate1=strip_points[3], vector1=strip_line_direction, coordinate2=cut_off_line_2[0][:2] + [level], vector2=fem_vector_2_points(point1=cut_off_line_2[0], point2=cut_off_line_2[1])) # Create foundation strip return project.viia_create_fstrip( name='F', material=material, geometry=f'VLOER-{thickness}', points=[strip_points])
[docs]def _viia_create_foundation_column_and_strip( project: ViiaProject, foundation_column_top_point: List[float], foundation_depth: float, foundation_column_thickness: float, foundation_column_material: Material, strip_width: float, strip_thickness: float, strip_material: Material) -> Tuple[Column, Fstrip]: """This function creates and returns the foundation column and strip.""" if not fem_greater(foundation_column_top_point[2], foundation_depth): raise ValueError( "ERROR: The top node of the foundation column is lower than the given foundation depth. " "Please check your input.") # The materials should be linear if not foundation_column_material.is_linear: raise ValueError("ERROR: The material of the foundation column should be linear.") if not strip_material.is_linear: raise ValueError("ERROR: The material of the foundation strip should be linear.") strip_z = foundation_depth + strip_thickness / 2e3 strip_half_width = strip_width / 2e3 foundation_column_bottom_point = [foundation_column_top_point[0], foundation_column_top_point[1], strip_z] foundation_column = project.viia_create_column( name='F', material=foundation_column_material.name, geometry=f'{int(foundation_column_thickness)}x{int(foundation_column_thickness)}', points=[foundation_column_bottom_point, foundation_column_top_point]) foundation_strip_points = [ [foundation_column_top_point[0] - strip_half_width, foundation_column_top_point[1] - strip_half_width, strip_z], [foundation_column_top_point[0] + strip_half_width, foundation_column_top_point[1] - strip_half_width, strip_z], [foundation_column_top_point[0] + strip_half_width, foundation_column_top_point[1] + strip_half_width, strip_z], [foundation_column_top_point[0] - strip_half_width, foundation_column_top_point[1] + strip_half_width, strip_z]] foundation_strip = project.viia_create_fstrip( name='F', material=strip_material.name, geometry=int(strip_thickness), points=[foundation_strip_points]) return foundation_column, foundation_strip
[docs]def _viia_create_foundation_column_and_strip_stepped_foundation( project: ViiaProject, foundation_column_top_point: List[float], foundation_depth: float, foundation_column_thickness: float, foundation_material: Material, strip_extensions: List[float], strip_heights: List[float], column_extends: bool) -> \ Tuple[Optional[Column], Column, Fstrip]: """This function creates and returns the equivalent column and the strip of the stepped foundation.""" if not fem_greater(foundation_column_top_point[2], foundation_depth): raise ValueError( "ERROR: The top node of the foundation column is lower than the given foundation depth. " "Please check your input.") # Check the height and determine if 1 or 2 columns are created total_height = (foundation_column_top_point[2] - foundation_depth) * 1000 steps_height = 0 for step in strip_heights: steps_height += step if not fem_smaller(steps_height, total_height): raise ValueError( "ERROR: The step heights are higher than the distance between the foundation depth and the bottom side of " "the column. Please check the input.") # The material of the stepped foundation should be linear if not foundation_material.is_linear: raise ValueError("ERROR: The material of the stepped foundation below the column should be linear.") # Create the strip strip_width = foundation_column_thickness for step in strip_extensions: strip_width += 2 * step strip_half_width = strip_width / 2E3 strip_z = foundation_depth + strip_heights[-1] / 2E3 foundation_strip_points = [ [foundation_column_top_point[0] - strip_half_width, foundation_column_top_point[1] - strip_half_width, strip_z], [foundation_column_top_point[0] + strip_half_width, foundation_column_top_point[1] - strip_half_width, strip_z], [foundation_column_top_point[0] + strip_half_width, foundation_column_top_point[1] + strip_half_width, strip_z], [foundation_column_top_point[0] - strip_half_width, foundation_column_top_point[1] + strip_half_width, strip_z]] foundation_strip = project.viia_create_fstrip( name='F', material=foundation_material.name, geometry=int(strip_heights[-1]), points=[foundation_strip_points]) normal_column = None if column_extends: rest_height = total_height - sum(strip_heights) if fem_smaller(rest_height, 250): # Column is not split equivalent_top_level = foundation_column_top_point[2] else: # Two columns are created equivalent_top_level = foundation_depth + steps_height / 1E3 normal_column = project.viia_create_column( name='F', material=foundation_material.name, geometry=f'{int(foundation_column_thickness)}x{int(foundation_column_thickness)}', points=[[foundation_column_top_point[0], foundation_column_top_point[1], equivalent_top_level], foundation_column_top_point]) else: # In case of different material between ground and foundation consider the whole geometry as stepped foundation equivalent_top_level = foundation_column_top_point[2] # Calculate the equivalent properties for the stepped foundation eq_column_width_x, eq_column_width_y, _, eq_density = viia_get_equivalent_properties_masonry_column_foundation( column_thickness_x=foundation_column_thickness, column_thickness_y=foundation_column_thickness, bottom_of_strip=foundation_depth, heights_levels_strip=strip_heights, strip_extensions_x=strip_extensions, strip_extensions_y=strip_extensions, original_density=foundation_material.mass_density, top_level=equivalent_top_level) # Create the equivalent foundation column eq_column = project.viia_create_column( name='F', material=f'{foundation_material.name}-DENSIT{int(eq_density)}', geometry=f'{int(eq_column_width_x)}x{int(eq_column_width_y)}', points=[[foundation_column_top_point[0], foundation_column_top_point[1], strip_z], [foundation_column_top_point[0], foundation_column_top_point[1], equivalent_top_level]]) return normal_column, eq_column, foundation_strip
[docs]def viia_create_foundation_columns_and_strips( project: ViiaProject, columns: List[Union[Column, str]], foundation_depth: float, foundation_column_material: str, foundation_column_width: float, strip_material: Optional[str] = None, strip_width: Optional[float] = None, strip_thickness: Optional[int] = None, stepped_foundation_strip_extensions: Optional[List[float]] = None, stepped_foundation_strip_heights: Optional[List[float]] = None) -> \ Tuple[Optional[List[Column]], Optional[List[Fstrip]]]: """ This function creates the foundation underneath all columns in the list. Only square cross-sections can be created for foundation columns and strips. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - columns (list): List with all the columns underneath which the foundation has to be made. The columns may be provided as string or as object reference of Column. - foundation_depth (float): Depth of the foundation strip, in [m]. - foundation_column_material (str): Name of the foundation column material. - foundation_column_width (float): Width of the foundation column, in [mm]. Only square cross-sections can be used for foundation columns. So, the width and the height of the column are the same. In case of stepped foundation the width of the foundation column exactly below the ground column should be given. - strip_material (str): Name of the strip material. Default value is None. - strip_width (int): Width of the strip, in [mm]. In case of stepped foundation this input parameter should not be provided. Default value None. - strip_thickness (int): Thickness of the strip, in [mm]. In case of stepped foundation this input parameter should not be provided. Default value None. - stepped_foundation_strip_extensions (list of float): List of extensions for stepped foundations, in [mm]. Input parameter should only be provided for stepped foundations. Default value None. The extensions are provided at each level of the stepped foundation going from top to bottom 60 | | 60 ---- ---- 75 | | 75 ---- ---- 40 | | 40 ---- ---- | | ----------------------- strip_extensions = [60, 75, 40] - stepped_foundation_strip_heights (list of float): List of extensions for stepped foundations, values in [mm]. Input parameter should only be provided for stepped foundations. Default value None. Height of the various levels of the stepped foundation going from top to bottom, in [mm]. | | ---- ---- 120 | | ---- ---- 50 | | ---- ---- 60 | | ----------------------- height_levels = [120, 50, 60] Output: - Returns lists of object references of newly created foundation columns (Column) and foundation strips (Fstrip). """ # Input for columns should be list # In case input for columns is not provided as list but as single column, proceed with function if isinstance(columns, Column): columns = [columns] if not isinstance(columns, list): raise ValueError(f"ERROR: Input for viia_create_foundation_columns_and_strips requires a list of columns.") for i, column in enumerate(columns): if isinstance(column, str): if 'column_' in column: columns[i] = fem_find_object( reference=int(column.replace('column_', '')), collection=project.collections.columns) else: columns[i] = fem_find_object(reference=column, collection=project.collections.columns) if not isinstance(columns[i], Column): raise ValueError(f"ERROR: The column to create foundation under could not be found.") # Check if supplied foundation column material is present foundation_column_material = project.viia_materials(foundation_column_material) if not isinstance(foundation_column_material, Material): raise ValueError("ERROR: The foundation column material is not provided correctly.") # Check if supplied strip material is present if isinstance(strip_material, str): strip_material = project.viia_materials(strip_material) if not isinstance(strip_material, Material): raise ValueError("ERROR: The foundation strip material is not provided correctly.") else: # Use the same material with the foundation column strip_material = foundation_column_material # Check if stepped foundation is applied stepped_foundation = False if stepped_foundation_strip_extensions or stepped_foundation_strip_heights: if not stepped_foundation_strip_extensions and stepped_foundation_strip_heights: raise ValueError("ERROR: Input for stepped foundation received, but incomplete.") if not len(stepped_foundation_strip_extensions) == len(stepped_foundation_strip_heights): raise ValueError("ERROR: Input for stepped foundation is not complying, lists should have same length.") stepped_foundation = True # Create the foundations per column f_columns = [] f_strips = [] if stepped_foundation: if not isinstance(foundation_column_material, Masonry): raise ValueError("ERROR: The stepped foundation is only available for masonry columns.") if not isinstance(strip_material, Masonry): raise ValueError("ERROR: The stepped foundation is only available for masonry strips.") if foundation_column_material != strip_material: raise ValueError("ERROR: The material of the foundation column and strip should be the same.") for column in columns: # Check if the column extends to the foundation column_extends = True if (column.material != foundation_column_material or column.geometry.geometry_model.name != f'{int(foundation_column_width)}x{int(foundation_column_width)}'): column_extends = False normal_column, eq_column, foundation_strip = _viia_create_foundation_column_and_strip_stepped_foundation( project=project, foundation_column_top_point=column.contour.get_bottom_node().coordinates, foundation_depth=foundation_depth, foundation_column_thickness=foundation_column_width, foundation_material=foundation_column_material, strip_extensions=stepped_foundation_strip_extensions, strip_heights=stepped_foundation_strip_heights, column_extends=column_extends) f_columns.append(eq_column) if normal_column: f_columns.append(normal_column) f_strips.append(foundation_strip) # Store foundation dimensions to meta data for C1 pictures equiv_dict = {'equiv_column': eq_column} if normal_column: equiv_dict['normal_column'] = normal_column foundation_strip.add_meta_data({ 'stepped_foundation': True, 'supported_column': column, 'real_dimensions': [stepped_foundation_strip_extensions, stepped_foundation_strip_heights], 'equiv_dimensions': equiv_dict}) else: # Only square cross-sections are valid if not foundation_column_width: raise ValueError("ERROR: the foundation column width is not provided.") if not strip_thickness: raise ValueError("ERROR: the foundation strip thickness is not provided.") if not strip_width: raise ValueError("ERROR: the foundation strip width is not provided.") for column in columns: foundation_column, foundation_strip = _viia_create_foundation_column_and_strip( project=project, foundation_column_top_point=column.contour.get_bottom_node().coordinates, foundation_depth=foundation_depth, foundation_column_thickness=foundation_column_width, foundation_column_material=foundation_column_material, strip_width=strip_width, strip_thickness=strip_thickness, strip_material=strip_material) f_columns.append(foundation_column) f_strips.append(foundation_strip) # Store foundation dimensions to meta data for C1 pictures foundation_strip.add_meta_data({ 'strip_foundation': True, 'supported_column': column, 'foundation_column': foundation_column}) _check_fstrips_connectivity(project=project) return f_columns, f_strips
### ==================================================================================================================== ### 3. Get equivalent properties for masonry wall and column foundation ### ====================================================================================================================
[docs]def viia_get_equivalent_properties_masonry_wall_foundation( wall_thickness: float, bottom_of_strip: float, heights_levels_strip: List[float], strip_extensions: List[float], original_density: float, top_level: float = 0, cavity: float = 0) \ -> Tuple[int, float, float]: """ This function calculates the equivalent properties for a foundation wall. Tool is based on version 3 of: `VIIA_XXXX_Equiv_fundering.xlsx <https://royalhaskoningdhv.box.com/s/5wk3rlt0tfjmgha6c4q2ivli5nhdphkf>`__ Input: - wall_thickness (float): Thickness of the wall original wall, in [mm]. In case of a cavity wall the thickness is the total of the inner and outer leaf and the distance between the two. - bottom_of_strip (float): Bottom level of the strip foundation, relative to z=0, in [m]. - heights_levels_strip (list of floats): Height of the various levels of the stepped foundation going from top to bottom, in [mm]. | | ---- ---- 120 | | ---- ---- 50 | | ---- ---- 60 | | ----------------------- height_levels = [120, 50, 60] - strip_extensions (list of floats): Extensions at each level of the stepped foundation going from top to bottom 60 | | 60 ---- ---- 75 | | 75 ---- ---- 40 | | 40 ---- ---- | | ----------------------- strip_extensions = [60, 75, 40] - original_density: The density of the stepped foundation material, in [kg/m3]. - top_level (float): Top level of the foundation wall, relative to z=0, in [m]. - cavity (float): In case of a cavity wall specify the distance between inner and outer leaf. Default value is 0, in which case no cavity wall is taken into account. Output: - Returns the equivalent width, depth and density of the modified foundation wall for the stepped foundation. Returned values are in [mm] and the density is in [kg/m3]. """ # Check if the number of inputs for the extensions and height are the same if len(strip_extensions) != len(heights_levels_strip): raise ValueError( "ERROR: The number of inputs for the extensions and level heights for the levels of the strips do not " "match. Please check your input.") stepped_foundation = ViiaSteppedFoundationWall( wall_thickness=wall_thickness, top_level=top_level, bottom_of_strip=bottom_of_strip, heights_levels_strip=heights_levels_strip, strip_extensions=strip_extensions, original_density=original_density, cavity=cavity) return stepped_foundation.eq_wall_width, stepped_foundation.eq_wall_height, stepped_foundation.eq_density
[docs]def viia_get_equivalent_properties_masonry_column_foundation( column_thickness_x: float, column_thickness_y: float, bottom_of_strip: float, heights_levels_strip: List[float], strip_extensions_x: List[float], strip_extensions_y: List[float], original_density: float, top_level: float = 0) \ -> Tuple[int, int, float, float]: """ This function calculates the equivalent properties for a foundation column. Tool is based on version 3 of: `VIIA_XXXX_Equiv_fundering.xlsx <https://royalhaskoningdhv.box.com/s/5wk3rlt0tfjmgha6c4q2ivli5nhdphkf>`__ Input: - column_thickness_x (float): Thickness of the original column for the x direction, in [mm]. - column_thickness_x (float): Thickness of the original column for the y direction, in [mm]. - bottom_of_strip (float): Bottom level of the strip foundation, relative to z=0, in [m]. - heights_levels_strip (list of floats): Height of the various levels of the stepped foundation going from top to bottom, in [mm]. | | ---- ---- 120 | | ---- ---- 50 | | ---- ---- 60 | | ----------------------- height_levels = [120, 50, 60] - strip_extensions_x (list of floats): Extensions at each level for the x direction of the stepped foundation going from top to bottom. in [mm]. 60 | | 60 ---- ---- 75 | | 75 ---- ---- 40 | | 40 ---- ---- | | ----------------------- strip_extensions_x = [60, 75, 40] - strip_extensions_y (list of floats): Extensions at each level for the y direction of the stepped foundation going from top to bottom, in [mm]. 70 | | 70 ---- ---- 80 | | 80 ---- ---- 60 | | 60 ---- ---- | | ----------------------- strip_extensions_y = [70, 80, 60] - original_density: The density of the stepped foundation material, in [kg/m3]. - top_level (float): Top level of the foundation column, relative to z=0, in [m]. Output: - Returns the equivalent width x, equivalent width y, depth and density of the modified foundation column for the stepped foundation. Returned values are in [mm] and the density is in [kg/m3]. """ # Check if the number of inputs for the extensions and height are the same if not len(strip_extensions_x) == len(strip_extensions_y) == len(heights_levels_strip): raise ValueError( "ERROR: The number of inputs for the extensions and level heights for the levels of the strips do not " "match. Please check your input.") # The column is treated like two separate walls for x and y direction stepped_foundation_x = ViiaSteppedFoundationWall( wall_thickness=column_thickness_x, top_level=top_level, bottom_of_strip=bottom_of_strip, heights_levels_strip=heights_levels_strip, strip_extensions=strip_extensions_x, original_density=original_density) stepped_foundation_y = ViiaSteppedFoundationWall( wall_thickness=column_thickness_y, top_level=top_level, bottom_of_strip=bottom_of_strip, heights_levels_strip=heights_levels_strip, strip_extensions=strip_extensions_y, original_density=original_density) eq_column_width_x = stepped_foundation_x.eq_wall_width eq_column_height = stepped_foundation_x.eq_wall_height eq_column_width_y = stepped_foundation_y.eq_wall_width # The modified density should be calculated considering both equivalent widths x and y # The strip is excluded from the calculation strip_widths_x = stepped_foundation_x.total_strip_widths[1:] strip_areas_y = stepped_foundation_y.strip_areas()[1:] eq_volume = sum([width * area for width, area in zip(strip_widths_x, strip_areas_y)]) eq_area_y = eq_column_width_y * eq_column_height modified_density = original_density * eq_volume / eq_area_y / eq_column_width_x return eq_column_width_x, eq_column_width_y, round(eq_column_height, 3), round(modified_density, 3)
### ==================================================================================================================== ### 4. Determine points for cavity wall ### ====================================================================================================================
[docs]def _determine_foundation_points_for_cavity_wall(inner_leaf: Wall, outer_leaf: Wall) -> List[List[float]]: """ This function determines the location of the foundation wall in case of a cavity wall. It should be placed in the middle of the cavity. This function constructs vectors from the bottom corner points of the inner leaf to the corresponding bottom point of the outer leaf. The points for placing the foundation are halfway along this vector. Input: - inner_leaf (Wall): Object reference to the Wall object describing the inner leaf. - outer_leaf (Wall): Object reference to the Wall object describing the outer leaf. Output: - Coordinates of the line under which to place the foundation wall and strip are returned as a list of lists of floats """ # Find all points on bottom contours points_inner = [] for line in inner_leaf.get_bottom_edges(include_openings=True): for point in line.get_points(): points_inner.append(point) points_outer = [] for line in outer_leaf.get_bottom_edges(include_openings=True): for point in line.get_points(): points_outer.append(point) # Determine outermost points points_inner, points_outer = fem_longest_distance(points_inner), fem_longest_distance(points_outer) # Determine corresponding points distances = [fem_distance_coordinates(points_inner[0], point_outer) for point_outer in points_outer] if fem_greater(distances[0], distances[1]): points_outer.reverse() pair_1, pair_2 = [points_inner[0], points_outer[0]], \ [points_inner[1], points_outer[1]] # Construct vectors vector_1, vector_2 = fem_vector_2_points(pair_1[0], pair_1[1]), fem_vector_2_points(pair_2[0], pair_2[1]) # Take the half of these vectors vector_1 = [0.5 * value for value in vector_1] vector_2 = [0.5 * value for value in vector_2] # Determine foundation points point_1 = [a + b for a, b in zip(pair_1[0], vector_1)] point_2 = [a + b for a, b in zip(pair_2[0], vector_2)] return [point_1, point_2]
### ==================================================================================================================== ### 5. End of the script ### ====================================================================================================================