Source code for viiapackage.supports.pile_foundation.relative_coordinates_rebar

### ===================================================================================================================
###   Calculate the relative coordinates of rebar
### ===================================================================================================================
# Copyright ©VIIA 2024

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

# General imports
from typing import List
import math

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.fem_math import fem_smaller


### ===================================================================================================================
###   2. Function to calculate the relative coordinates for the rebar configuration
### ===================================================================================================================

[docs]def viia_relative_coordinates_pile_rebar( rebar_configuration: str, pile_dimension: float, edge_distance: float, pile_shape: str = 'square') \ -> List[List[float]]: """ This function creates a list with coordinates of the rebar relative to the centre of the pile. Input: - rebar_configuration (str): Configuration of the applied rebar, as string. Select for square or rectangular pile cross-sections from 'V4', 'V5', 'V8' or 'V9' or for circular pile cross-sections from 'R1', 'R2' etc. - pile_dimension (float): Dimension used for the pile, can be diameter or width/height of the cross-section. Implementation based on the pile_shape, in [m]. - edge_distance (float): The distance from center of rebar to the contour of the pile cross-section. This value is limited to half of the pile dimension, in [m]. - pile_shape (str): Type of shape of the pile. If 'circular' is selected a circular cross-section is created otherwise a square cross-section. Default value is 'square'. The shape should relate to the selected rebar configuration. Output: - Returns a list with rebar locations relative to the centre of the pile in [m]. """ # Determine position of rebar distance = .0 if rebar_configuration != 'R1': distance = pile_dimension / 2 - edge_distance if fem_smaller(distance, 0.0): raise ValueError( f"ERROR: The edge distance of {int(edge_distance * 1000)}mm is to big for cross-section of " f"{int(pile_dimension * 1000)}mm.") if rebar_configuration.upper() in ['V4', 'V5', 'V8', 'V9'] and pile_shape.lower() not in ['square', 'rectan']: raise ValueError( f"ERROR: Input for rebartype {rebar_configuration.upper()} does not fit the {pile_shape.lower()} shape " f"of the pile.") elif 'R' in rebar_configuration.upper() and pile_shape.lower() not in ['circular']: raise ValueError( f"ERROR: Input for rebartype {rebar_configuration.upper()} does not fit the circular shape of the pile.") # Return the rebar relative coordinates as list if rebar_configuration.upper() == 'V4': # Square cross-section: 4 bars in corner return [ [distance, distance], [distance, -distance], [-distance, -distance], [-distance, distance]] elif rebar_configuration.upper() == 'V5': # Square cross-section: 4 bars in corner and 1 in center of pile return [ [distance, distance], [distance, -distance], [-distance, -distance], [-distance, distance], [0.00000E+00, 0.00000E+00]] elif rebar_configuration.upper() == 'V8': # Square cross-section: 4 bars in corner and 4 in the middle of the sides return [ [distance, distance], [distance, -distance], [-distance, -distance], [-distance, distance], [distance, 0.00000E+00], [0.00000E+00, distance], [-distance, 0.00000E+00], [0.00000E+00, -distance]] elif rebar_configuration.upper() == 'V9': # Square cross-section: 4 bars in corner, 4 in the middle of the sides and 1 in the center return [ [distance, distance], [distance, -distance], [-distance, -distance], [-distance, distance], [distance, 0.00000E+00], [0.00000E+00, distance], [-distance, 0.00000E+00], [0.00000E+00, -distance], [0.00000E+00, 0.00000E+00]] elif rebar_configuration.upper() == 'R1': # Circular cross-section: 1 bar in the center of the pile return [ [0.00000E+00, 0.00000E+00]] elif 'R' in rebar_configuration.upper(): # Circular cross-section: bars circular distributed around the center of the pile rebar_coord = [[0.00000E+00, distance]] rebar_number = int(rebar_configuration.split('R')[1]) for i in range(1, rebar_number): rebar_coord.append([ math.sin(((i * (360 / rebar_number)) / 360) * 2 * math.pi) * distance, math.cos(((i * (360 / rebar_number)) / 360) * 2 * math.pi) * distance]) return rebar_coord raise NotImplementedError(f"ERROR: Rebar configuration {rebar_configuration.upper()} is not available (yet).")
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================