Source code for viiapackage.results.collect_results_for_myviia.viia_collect_results_a15

### ===================================================================================================================
###   A15  NLTH of strengthened structure analysis result handling
### ===================================================================================================================
# Copyright ©VIIA 2024

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

# General imports
from __future__ import annotations
from datetime import date
from pathlib import Path
from typing import TYPE_CHECKING, Dict, Optional, Union, List

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject


### ===================================================================================================================
###   2. Function to combine information in model with results from software for A15 analysis
### ===================================================================================================================

[docs]def viia_collect_results_a15( project: ViiaProject, signal: str, base_shear_data: Optional[Dict] = None) \ -> Dict[str, Union[str, Optional[float], Dict[str, List[float]]]]: """ This function collects the data from the A15 analysis that will be sent to MYVIIA. Includes: - Aggregation of A15 results. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - center_of_mass (dict): Dictionary with required information from the analysis. The required keys are 'sum_vertical_loads', 'center_of_mass_x' and 'center_of_mass_y'. The values are floats. - json_file (path): Path of the json-file of the model. Output: - Returns dictionary with collected information required for the A1 analysis. """ # Collect the name of the analysis, normal use is the timestamp at creation of the files (folder name) # The folder for result handling should be set as the current analysis folder in project if not isinstance(project.current_analysis_folder, Path): raise FileNotFoundError( "ERROR: An issue occurred while collecting the A15 analysis results for MYVIIA. Please make sure to set " "the current analysis folder.") name = str(project.current_analysis_folder.parent.name) # Construct the dictionary for the results data = { 'date': str(date.today()), 'name': name, 'object_deel_id': project.get_myviia_object_deel_id(), 'signal': signal} # Add the data for base shear, if available if base_shear_data: data.update({ 'base_shear_diagrams': { 'time': base_shear_data['time'], 'x': base_shear_data['base_shear_x'], 'y': base_shear_data['base_shear_y'], 'z': base_shear_data['vertical_force_z']}, 'max_base_shear_x': base_shear_data['max_base_shear_x'] / 1E3, 'max_base_shear_y': base_shear_data['max_base_shear_y'] / 1E3, 'max_vertical_force_z': base_shear_data['max_normal_force_z'] / 1E3, 'min_vertical_force_z': base_shear_data['min_normal_force_z'] / 1E3}) # Return collected data in dictionary return data
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================