Source code for viiapackage.viiaSettings

### =============================================================================================================== ###
###                                                                                                                 ###
###                                                 viiaSettings.py                                                 ###
###                                                                                                                 ###
### =============================================================================================================== ###
# This module contains all default settings for the VIIA project.
# Units are in m, N, rads and kg

# Module is based on:
# VIIA_QE_R376 Basis of Design Retrofit Advice NLTH, v11.0, d.d. 29 August 2024
# VIIA_QE_R376 Basis of Design Step-by-Step MRS, v1.0, d.d. 21 January 2022
# VIIA_QE_R1674 Uitgangspuntenrapport engineering NLPO, v1.0, d.d. 1 August 2019

# This script was based upon the Constitution For Python At VIIA
# For use by VIIA
# Copyright RHDHV

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

# General imports
import re
import warnings
from os import path
from pathlib import Path
from typing import Optional


### ===================================================================================================================
###   2. Settings used in the VIIA project
### ===================================================================================================================

[docs]class ViiaSettings: """ This class contains all the VIIA specific information. """ # Server for MYVIIA webtool MYVIIA_SERVER = 'myviia' MYVIIA_SERVER_URL = 'https://viiaproductionbackend.azurewebsites.net' # MYVIIA_SERVER_URL = 'https://viiadevbackend.azurewebsites.net' DEFAULT_PLANK_WIDTH = 0.165 MYVIIA_REPORT = False DEBUG = False # Server for GMC API GMC_SERVER = 'gmc' warnings.simplefilter('once', DeprecationWarning) # Dummy material properties for point-mass, in [kg] and [Ns/m] DUMMY_MASS_VERTEX = 1.00000E+00 DUMMY_DAMP_VERTEX = 0.00000E+00 # Default setting for the number of integration points of shapes and connections INTEGRATION_POINTS_LINEAR = 3 INTEGRATION_POINTS_NONLINEAR = 7 # Default folder names DEFAULT_IMAGES_FOLDER = 'Manual Images' DEFAULT_ACCELERATION_GRAPHS = 'Acceleration Graphs' DEFAULT_APPENDIX_PICTURES_FOLDER = 'Appendix Pictures' DEFAULT_MESH_CHECK_FOLDER = 'Mesh Check' DEFAULT_NODE_DATA_FOLDER = 'Mesh Check' DEFAULT_SHAPE_DATA_FOLDER = 'Mesh Check' DEFAULT_DIANA_MOVIE_FOLDER = 'Diana Movie' # Default settings for graphs, dimensions in inches GRAPH_HEIGHT = 5 GRAPH_WIDTH = 15 # Default limit for name generation of connections between shapes NAME_COUNTER_LIMIT = 200000 # General constants for the engineering IMPORTANCE_FACTORS = { 'CC1A': 1.0, 'CC1a': 1.0, 'CC1B': 1.0, 'CC1b': 1.0, 'CC2': 1.1, 'CC3': 1.2, 'CC4': 1.2} # Default NLTH output steps NLTH_OUTPUT_STEPS = { 'OUTPUT_1A_MAX': '10-100(10) 150-x(50) LAST', 'OUTPUT_1A_MAX_TB': 'last', 'OUTPUT_1B_MIN': '10-100(10) 150-x(50) LAST', 'OUTPUT_1B_MIN_TB': 'last', 'OUTPUT_1C': '1-5 50-400(5) LAST', 'OUTPUT_2': 'all', 'OUTPUT_3': 'all', 'OUTPUT_4': 'last', 'OUTPUT_4_TB': 'last', 'OUTPUT_4_TB_INT': 'last', 'OUTPUT_4A': 'last', 'OUTPUT_4B': 'all', 'OUTPUT_5A': 'all', 'OUTPUT_5B': 'all', 'OUTPUT_GEO1': '1-10 50-x(50) LAST', 'OUTPUT_GEO2': '1-10 50-x(50) LAST', 'OUTPUT_GEO3': 'last', 'OUTPUT_GEO_REF': 'all', 'OUTPUT_MOVIE': 'all', 'OUTPUT_INTERFACE': 'last'} # Settings for mesh checks MIN_ANGLE = 15 MAX_ANGLE = 165 MAX_SKEWNESS = 45 MAX_ASPECT_RATIO = 5 # Links to box location of UPR versions upr_versions = { 'UPR NLTH v10.0': 'https://royalhaskoningdhv.box.com/s/e39yjvlrhp1g7p4hj9u75o8pisqge9i5' }
[docs] def __init__(self, language: str = 'NL'): """ Input: - language (str): Language selection for the engineering report and figures. Available languages are 'EN' for English and 'NL' for Dutch. Default value is 'NL'. """ self.project_specific_package_location = Path(path.dirname(path.realpath(__file__))) self.pushover_directions = ['X_pos', 'X_neg', 'Y_pos', 'Y_neg'] self.support_type = None self.language = language # Setting for creating result plots self.python_result_plotting = False # Settings for the Newmark integration parameters used in response spectrum analysis, both floats self.RSABeta = 0.25 self.RSAGamma = 0.5 # Damping percentage used for response spectrum analysis, float self.RSADamping = 0.05 # Interval for the natural period to be used for response spectrum analysis, floats self.RSANaturalPeriodInterval = 0.01 # Amount of natural periods (starting from 1 interval) to be used for response spectrum analysis, integer self.RSAAmountNaturalPeriods = 200
@property def support_type(self): return self.__support_type @support_type.setter def support_type(self, new_support_type: Optional[str]): if new_support_type is not None and not isinstance(new_support_type, str): raise ValueError("ERROR: To set the support_type provide input as string.") if new_support_type and new_support_type not in ['FixedBase', 'FlexBaseGlobal', 'FlexBaseFinal']: raise NotImplementedError( f"ERROR: Support-type requested {new_support_type} should be 'FixedBase', 'FlexBaseGlobal' or " f"'FlexBaseFinal'. Note that selection for linear is deprecated.") self.__support_type = new_support_type
[docs] @staticmethod def output_steps(output_name: str, nr_steps: Optional[int] = None) -> str: """ Static method of 'ViiaSettings' to get the default output-steps required for NLTH analysis. Including dependency on the length of the signal (number of steps).""" if output_name not in ViiaSettings.NLTH_OUTPUT_STEPS: raise ValueError( f"ERROR: The output-name is unknown ({output_name}). Please select from " f"{', '.join(ViiaSettings.NLTH_OUTPUT_STEPS.keys())}.") output_steps = ViiaSettings.NLTH_OUTPUT_STEPS[output_name] if output_steps.lower() == 'all': return 'all' if output_steps.lower() == 'last': return 'last' if nr_steps is None: raise ValueError( "ERROR: You should provide the number of steps derived from the signal length to update the " "output-steps for tha analysis.") output_steps = output_steps.split(' ') last_step = False step_counter = 0 output_list = [] for steps_part in output_steps: if steps_part.lower() == 'last': last_step = True continue nr_steps_part = 1 if '(' in steps_part and ')' in steps_part: nr_steps_part = int(steps_part.split('(')[-1].split(')')[0]) steps_part = steps_part.split('(')[0] start = int(steps_part.split('-')[0]) if steps_part.split('-')[-1].lower() == 'x': end = nr_steps else: end = int(steps_part.split('-')[-1]) if start <= nr_steps: if end < nr_steps: if nr_steps_part == 1: output_list.append(f"{start}-{end}") else: output_list.append(f"{start}-{end}({nr_steps_part})") else: end = start + ((nr_steps - start) // nr_steps_part) * nr_steps_part if end == nr_steps: end = start + (((nr_steps - start) // nr_steps_part) - 1) * nr_steps_part if nr_steps_part == 1: output_list.append(f"{start}-{end}") else: output_list.append(f"{start}-{end}({nr_steps_part})") if last_step: output_list.append('LAST') return ' '.join(output_list)
@property def graph_style_sheet(self) -> Path: return self.project_specific_package_location / 'viiaGraph.mplstyle'
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================