Source code for viiapackage.reporting.helper_functions.get_acceptance_criteria

### ===================================================================================================================
###   FUNCTION: Collect the acceptance criteria for the elements in the NLTH model
### ===================================================================================================================
# Copyright ©VIIA 2024

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

# General imports
from __future__ import annotations
from typing import TYPE_CHECKING, List, Dict

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.materials import Concrete, Timber
from rhdhv_fem.geometries.geometry_models import IsotropicThickness

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject
from viiapackage.connections.get_dimensions import viia_get_timberfloor_dimensions
from viiapackage.results.result_functions.viia_limits import viia_find_limits_NLTH


### ===================================================================================================================
###   2. Function to collect the applicable acceptance criteria in the NLTH model
### ===================================================================================================================

[docs]def viia_get_acceptance_criteria(project: ViiaProject, shape_type: str = 'floors') -> List[Dict[str, str]]: """ Function to collect the acceptance criteria per shape in the model of the object, for which a NLTH analysis is performed. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - shape_type (string): The type of shape that should be considered. Possible are 'floors' and 'roofs'. Default is 'floors'. Output: - Returns a list with dictionaries with the acceptance criteria per shape. """ shape_types = ['floors', 'roofs'] if shape_type not in shape_types: raise ValueError( f"ERROR: Provided input for shape_type should be one of {shape_types}. Provided was: {shape_type}") _table_dict = {'floors': 'floor', 'roofs': 'roof'} collection = getattr(project.collections, shape_type) if not collection: return [] check_combinations = {} list_shapes_dict = [] for shape in collection: _relevant_properties = '' _dict = {} material = shape.material geometry = shape.geometry if material in check_combinations and geometry in check_combinations[material]: continue # Get shape type and properties if isinstance(material, Concrete): _dict['type'] = f"Concrete {_table_dict[shape_type]}" if isinstance(geometry.geometry_model, IsotropicThickness): _relevant_properties += f'Thickness = {int(geometry.geometry_model.thickness*1000)} mm' if material.name == 'LIN-BETON': if _relevant_properties: _relevant_properties += '\n' _relevant_properties += 'Concrete strength C20/25' elif isinstance(material, Timber): if 'PLANKEN' in material.name: _dict['type'] = f"Timber {_table_dict[shape_type]} with joists and planks" properties = viia_get_timberfloor_dimensions(shape=shape)['thickness'] _relevant_properties += f'Plank thickness = {int(properties*1000)} mm' elif 'PLATEN' in material.name: _dict['type'] = f"Timber {_table_dict[shape_type]} with joists and plates" properties = viia_get_timberfloor_dimensions(shape=shape)['thickness'] thickness = int(properties*1000) _relevant_properties += f'Plate thickness = {thickness} mm' if thickness > 10: if _relevant_properties: _relevant_properties += '\n' _relevant_properties += f'Double layer of plates' else: project.write_log(f"WARNING: No acceptance criteria found for shape {shape.name}.") _dict['relevant_properties'] = _relevant_properties # Get the required limits limit = viia_find_limits_NLTH(project=project, shape=shape) if limit and 'N_in' in limit: _dict['in_plane_shear_limit'] = round(limit['N_in'] / 1000, 1) list_shapes_dict.append(_dict) if material not in check_combinations: check_combinations[material] = [] check_combinations[material].append(geometry) return list_shapes_dict
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================