Source code for viiapackage.strengthening.l3.l3_multiplex_panel

### ===================================================================================================================
###   L3 strengthening measure
### ===================================================================================================================
# Copyright ©VIIA 2024

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

# General imports
from __future__ import annotations
from typing import Union, TYPE_CHECKING

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.shapes import Floor, Roof
from rhdhv_fem.materials.timber import Timber

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject
from viiapackage.strengthening.helper_functions import viia_check_shape_argument
from viiapackage.strengthening.helper_functions import viia_check_measure_in_gmc
from viiapackage.materials import viia_get_material_group_constants, viia_get_material_model_properties, \
    viia_create_material_model, viia_get_material_group


### ===================================================================================================================
###   2. Function to create L3 strengthening measure of multiplex panels
### ===================================================================================================================

[docs]def viia_l3_multiplex_panel( project: ViiaProject, surface: Union[str, Floor, Roof], material_name: str, function_name: str, variant: int) -> Union[Floor, Roof]: """ This function creates an L3 measure for a selected surface. With this measure, one or two multiplex panels are glued or screwed onto the existing timber floor/roof. When applied to a timber joist with planks, the strength and stiffness of the planks is neglected. In the model the material of the floor/roof will be adjusted with an updated in-plane shear stiffness and an increased density. The thickness of the surface is adjusted. .. note:: This function only accepts surfaces with a timber material applied. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - surface (obj): The object reference of the surface shape (floor/roof) that has to be strengthened. Alternative (str): Name of the surface shape to be strengthened. - material_name (str): Name of the material for the strengthening in the VIIA material database. These properties are set in the BoD and adjusted for the properties of the original surface. - function_name (str): Name of the measure function to be applied to the surface. - variant (int): The variant number of the measure that is in the GMC. Output: - The strengthening measure is added to the floor or roof. - When running in DIANA after creating the model, the DIANA model is updated. - Returns the surface shape on which the measure is applied. """ # Check if surface can be strengthened surface = viia_check_shape_argument(project=project, shape=surface, function_name=function_name) if not isinstance(surface, (Floor, Roof)): raise TypeError("ERROR: The measure can only be applied on floors or roofs.") # Collect the name for notifications measure_name = material_name.replace('LIN-', '')[:2] + '-' + material_name.replace('LIN-', '')[2:] # Check if measure is in GMC measure_sub_type = f"{measure_name}-{int(variant)}" viia_check_measure_in_gmc(project=project, measure_sub_type=measure_sub_type) # These measures are only applicable on timber materials if not isinstance(surface.material, Timber): raise NotImplementedError( f"ERROR: The material of {surface.name}: {surface.material}, is not timber material, the " f"{measure_name} strengthening measure cannot be added.") # Notification project.write_log( f"Start applying {measure_name} measure to {surface.name}, the material and the geometry of the original " f"shape will be modified.") # Select the materialgroup material_group = viia_get_material_group(project=project, material_name=material_name) # Set material group properties material_group_properties = viia_get_material_group_constants(project=project, material_group=material_group) # Collect the material properties from the database material_model_properties = viia_get_material_model_properties( project=project, material_name=material_name, material_group=material_group) # Create the material model material_model = viia_create_material_model( project=project, material_group=material_group, material_group_properties=material_group_properties, material_name=material_name, material_model_properties=material_model_properties) # Calculate the new density and added mass density existing_mass = surface.geometry.geometry_model.thickness * surface.material.total_mass() new_mass = existing_mass + material_model_properties['mass_density'] * material_model_properties['thickness'] new_mass_density = new_mass / material_model_properties['thickness'] existing_mass_density = existing_mass / material_model_properties['thickness'] added_mass_density = new_mass_density - existing_mass_density # Create new material and remove original if not used anymore surface.material = project.create_user_defined_timber( name=f"{surface.material.name}-{measure_name.replace('-', '')}", material_model=material_model, mass_density=existing_mass_density, added_mass=added_mass_density) # Create new geometry and remove original if not used anymore surface.geometry = project.create_user_defined_geometry( name=f'{surface.geometry.name}-{measure_name}', geometry_model=project.create_isotropic_thickness(thickness=material_model_properties['thickness'])) # Update name of the shape new_surface_name = surface.name.split('-') new_surface_name.insert(len(surface.name.split('-')) - 1, measure_name.replace('-', '')) surface.name = '-'.join(new_surface_name) # Add meta-data to the floor surface.add_meta_data( {'strengthening': measure_sub_type}) project.write_log( f"{measure_name} measure is applied on {surface.name} with updated material and geometry.") return surface
### =================================================================================================================== ### 4. End of script ### ===================================================================================================================