### ===================================================================================================================
### FUNCTION: Identify the load-combination for the NLPO load
### ===================================================================================================================
# Copyright ©VIIA 2025
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from __future__ import annotations
from typing import TYPE_CHECKING
from typing import Tuple
# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
from viiapackage.viiaStatus import ViiaProject
### ===================================================================================================================
### 2. Function identify the pushover load-combination
### ===================================================================================================================
[docs]def viia_identify_pushover_load_combination(project: ViiaProject, direction: str) -> Tuple[int, str]:
"""
This function identifies the load number associated to default NLPO load-types, based on the pushover direction.
Input:
- project (obj): VIIA project object containing collections of fem objects and project variables.
- direction (str): The pushover direction, select from 'X_pos', 'X_neg', 'Y_pos' or 'Y_neg'.
Output:
- Returns the type of loading identified as string: e.g. 'modal', 'tri', 'eqacc' or 'uni'.
- Returns the associated ID (as integer) of the LoadCombination instance with the name corresponding to the
default load-cases, if available.
"""
# Find load numbers for associated load-cases
if direction == 'X_pos':
load_combination = project.get_load_combination(name='NLPO_modal_po_+X')
if load_combination is None:
load_combination = project.get_load_combination(name='NLPO_uniform_acc_+X')
elif direction == 'X_neg':
load_combination = project.get_load_combination(name='NLPO_modal_po_-X')
if load_combination is None:
load_combination = project.get_load_combination(name='NLPO_uniform_acc_-X')
elif direction == 'Y_pos':
load_combination = project.get_load_combination(name='NLPO_modal_po_+Y')
if load_combination is None:
load_combination = project.get_load_combination(name='NLPO_uniform_acc_+Y')
elif direction == 'Y_neg':
load_combination = project.get_load_combination(name='NLPO_modal_po_-Y')
if load_combination is None:
load_combination = project.get_load_combination(name='NLPO_uniform_acc_-Y')
else:
# Error if the load direction is not present
raise ValueError(f"ERROR: Pushover load direction '{direction}' not recognised.")
# Error if load-combination is not found
if load_combination is None:
raise ValueError(f"ERROR: Load-combination for direction '{direction}' could not be found.")
# Return requested info
if 'modal' in load_combination.name:
return load_combination.id, 'modal'
elif 'uniform' in load_combination.name:
return load_combination.id, 'uni'
raise ValueError(
f"ERROR: The pushover load-combination could not be found. The type of load-combination is not correctly "
f"provided: {load_combination.name}. Expecting 'modal' in name of 'uniform' in name.")
### ===================================================================================================================
### 3. End of script
### ===================================================================================================================