### ===================================================================================================================
### Calculate spring values
### ===================================================================================================================
# Copyright ©VIIA 2024
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from __future__ import annotations
from typing import TYPE_CHECKING, Optional
from pathlib import Path
import math
# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
from viiapackage.viiaStatus import ViiaProject
from viiapackage.supports.pile_foundation.pile_properties.cut_off_pile_stiffness_horizontal import \
viia_cut_off_pile_stiffness_horizontal
from viiapackage.supports.pile_foundation.pile_properties.analyse_force_elongation_curve import \
viia_analyse_force_elongation_curve
from viiapackage.supports.pile_foundation.pile_properties.calculate_coupled_system_properties import \
viia_calculate_coupled_system_properties
from viiapackage.supports.pile_foundation.pile_properties.calculate_equivalent_damping import \
viia_calculate_equivalent_damping
from viiapackage.supports.pile_foundation.pile_properties.calculate_pile_strength import \
viia_calculate_pile_strength
### ===================================================================================================================
### 2. Function to calculate spring value
### ===================================================================================================================
[docs]def viia_calculate_spring_values(project: ViiaProject, data: dict, folder: Optional[Path] = None) -> dict:
"""
Function to calculate pile spring stiffness and damping values of the horizontal pile springs.
Input:
- project (obj): VIIA project object containing collections of fem objects and project variables.
- data_dict (dict): Dictionary contains geo inputs for the calculation.
- folder (path): Optional input to specify the input folder. By default, the default location for the file is
used, which should be the location for the VIIA workflow. Input used for component testing.
Output:
- Returns spring properties as a dictionary.
"""
spring_values = {}
# Calculate horizontal spring initial stiffness
spring_stiffness_h = \
data['force_elongation_diagram']['force'][1] / data['force_elongation_diagram']['elongation'][1]
# Apply cut-off value for 30Hz boundary
pile_mass = data['pile_total_load'] / project.gravitational_acceleration
spring_stiffness_h = viia_cut_off_pile_stiffness_horizontal(
project=project, stiffness=spring_stiffness_h, mass=pile_mass)
# Calculate horizontal spring damping
# Get yield stiffness based on geo input
yield_stiffness = viia_analyse_force_elongation_curve(data_dict=data)
# Get the coupled system properties
coupled_frequency, coupled_stiffness = viia_calculate_coupled_system_properties(
project=project, data_dict=data, yield_stiffness=yield_stiffness, folder=folder)
# Calculate the equivalent damping
equivalent_damping = viia_calculate_equivalent_damping(data_dict=data, frequency=coupled_frequency)
# Get final value of pile spring damping
spring_damping_h = \
2 * math.sqrt(
yield_stiffness * data['pile_total_load'] /
project.gravitational_acceleration) * equivalent_damping
spring_values['spring_stiffness_x'] = spring_stiffness_h
spring_values['spring_stiffness_y'] = spring_stiffness_h
spring_values['spring_damping_x'] = spring_damping_h
spring_values['spring_damping_y'] = spring_damping_h
# Define complete force-elongation diagram in DIANA
elongation_pos_lst = data['force_elongation_diagram']['elongation']
elongation_neg_lst = [-x for x in elongation_pos_lst]
elongation_neg_lst.reverse()
force_pos_lst = data['force_elongation_diagram']['force']
force_neg_lst = [-x for x in force_pos_lst]
force_neg_lst.reverse()
spring_values['force_elongation_diagram'] = [
elongation_neg_lst + elongation_pos_lst[1:],
force_neg_lst + force_pos_lst[1:]]
# Calculate vertical spring values
# Check the data (stiffness z) format with geo
spring_stiffness_v = data['spring_stiffness_z_geo']
spring_damping_v = \
2 * math.sqrt(
spring_stiffness_v * data['pile_total_load'] / project.gravitational_acceleration) * 0.05
spring_values['spring_stiffness_z'] = spring_stiffness_v
spring_values['spring_damping_z'] = spring_damping_v
# Calculate rotational stiffness (based on bending stiffness)
spring_stiffness_ro = data['flexural_stiffness'] / data['stiffness_length']
spring_damping_ro = \
2 * 0.05 * math.sqrt(
spring_stiffness_ro * 2500 * 0.5 * 1 * 3 * data['pile_cross_section_dimension']
* (0.5 * 3 * data['pile_cross_section_dimension']) ** 2)
spring_values['spring_stiffness_rx'] = spring_stiffness_ro
spring_values['spring_stiffness_ry'] = spring_stiffness_ro
spring_values['spring_damping_rx'] = spring_damping_ro
spring_values['spring_damping_ry'] = spring_damping_ro
# Nonlinear properties for translational springs
spring_values['max_tensile_force_z'], spring_values['max_compressive_force_z'] = \
viia_calculate_pile_strength(project=project, data_dict=data)
return spring_values
### ===================================================================================================================
### 3. End of script
### ===================================================================================================================