### ===================================================================================================================
### Function to export overburdenloads to excel
### ===================================================================================================================
# Copyright ©VIIA 2024
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from __future__ import annotations
from typing import TYPE_CHECKING, Optional, List
# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.shapes import Wall
from rhdhv_fem.fem_math import fem_distance_coordinates
# References for functions and classes in the datafusr_py_base package
from datafusr_py_base.deprecation import rename_argument
# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
from viiapackage.viiaStatus import ViiaProject
from viiapackage.results.overburden_load.get_diana_load_case import get_diana_load_case
from viiapackage.results.overburden_load.overburden_load_to_excel import overburden_load_to_excel
from viiapackage.results.overburden_load.probe_curve import ProbeCurve
### ===================================================================================================================
### 2. Function viia_find_wall_overburden_load
### ===================================================================================================================
[docs]@rename_argument(old='loadcase', new='load_case', since='71.1.0', until='72.0.0', package='viiapackage')
def viia_find_wall_overburden_load(
project: ViiaProject, walls: Optional[List[Wall]] = None, load_case: Optional[str] = None,
steps=50, view: list = None):
"""
This function creates the overburden load for the walls in input list as their attribute, it is only applicable
for rectangular walls at this stage.
Input:
- project (obj): Project object containing collections and of fem objects and project variables.
- walls (list of obj.): The selected wall objects. If none are given, all walls are selected.
- load_case (str): The load-case selected from the analysis.
- steps (int): Number of segments for the probe curve. Default value is 50. Creates 50 sample points.
- view (list of 2 str): default arguments, specifically, for example: ['Distributed Forces/mappedintpnt', 'Nyy']
for the purpose of calculating the overburden load.
Output:
- All rectangular wall objects have an additional attribute for the overburden load. If overburden load is >0,
it is set to 0 (wall cannot be in tension under self weight).
- An Excel is created in the workfolder with the wall names and overburden loads.
"""
# Check if the script is running in DIANA
if not project.rhdhvDIANA.run_diana:
project.write_log(
"WARNING: The overburden load function is not running in DIANA. The overburden loads are not calculated.")
return None
# Check if more than 1 analysis found
if len(project.rhdhvDIANA.analyses()) > 1:
project.write_log("WARNING: Multiple analyses found. A1, A1A or A16 is used.")
# Check if more than 1 load-case found
if len(project.rhdhvDIANA.loadCases()) > 1:
project.write_log(
"WARNING: Multiple load-cases found. For correct overburden load, please convert imposed load to self "
"weight. First load-case is used.")
# Check if the static analysis is conducted (A1, A1a or A16)
if not any(('A1 -' or 'A1a' or 'A16') in analysis.name for analysis in project.collections.analyses):
raise ValueError(
"ERROR: Linear static analyses not conducted yet. Please carry out linear static analysis before running "
"this function.")
# Select static analysis
analysis = None
result_case = None
for analysis in project.collections.analyses:
if ('A1 -' or 'A1a' or 'A16') in analysis.name:
load_case = get_diana_load_case(project=project, analysis=analysis, load_case=load_case)
result_case = [analysis.name, project.rhdhvDIANA.outputBlocks(analysis.name)[0], load_case]
break
# Check if more than 1 result-case found
if len(project.rhdhvDIANA.resultCases(analysis.name)) > 1:
project.write_log("WARNING: Multiple result cases found. First result case is used.")
# Check the view list
if not view:
view = [project.diana_settings.result_pictures['Static-ForceXY']['output_name'],
project.diana_settings.result_pictures['Static-ForceXY']['output_item']]
# Check if walls input is list or 'all'
if type(walls) == list:
walls = walls
if walls is None:
walls = [wall for wall in project.collections.walls if 'F-' not in wall.name]
# Set up probe curve for each wall object
for wall in walls:
# Add the correct settings for the wall to check overburden load in DIANA
# Only the corresponding wall needs to be shown, otherwise the results are influenced by connecting shapes
project.rhdhvDIANA.showOnly('ELEMENTSET', [wall.name])
project.rhdhvDIANA.setViewSettingValue('view setting', 'RESULT/DEFORM/MODE', 'OFF')
project.rhdhvDIANA.setViewSettingValue('view setting', 'RESULT/EDGES/RENDEF', 'OFF')
# Get top edges of wall
top_lines = wall.get_top_edges()
if not top_lines:
project.write_log(
f"WARNING: The wall {wall.name} is not rectangular, this wall is not applicable for the overburden "
f"load yet.")
continue
# Get average overburden load per top edge, in case there are openings on the top edge
total_top_edge_distance = 0
total_force = 0
for line in top_lines:
line_points = line.get_points()
edge_distance = fem_distance_coordinates(line_points[0], line_points[1])
total_top_edge_distance +=edge_distance
# Get overburden load for each top edge
edge_load = ProbeCurve(
project=project, start_point=line_points[0], end_point=line_points[1], view=view,
result_case=result_case, steps=steps).get_values(average=True)
# Get total force per edge
total_force += edge_load*edge_distance
load = total_force / total_top_edge_distance
if load > 0:
load = 0
wall.add_meta_data({'overburden_load': load})
# Show all the elements after the execution
project.rhdhvDIANA.showAll('ELEMENTSET')
# Write overburden load to Excel file
return overburden_load_to_excel(project, walls=walls)
### ===================================================================================================================
### 3. End of script
### ===================================================================================================================