Skip to content

LoadingAndFailureCheck#

LoadingAndFailureCheck is the public load workflow class. It inherits the full FinalFailureCheck chain and adds convenience getters for final loads and final resistances.

Use this class when you want the output object passed into cheersafe.damage_ratio_calculation.DamageRatioCalculation.

Related API: Loads API Planned notebook: loads workflow notebook

Inputs#

Constructor inputs:

  • rRSt, rRCt, rRWCt, rOt, rWt: resistance arrays with the shapes described in the loads overview.
  • Building: cheersafe.inventory.Building.
  • WindOrientation: degrees.
  • WindSpeed: mph for the wind-pressure equations.

update_inputs_and_outputs() accepts the same inputs and reruns the workflow by calling update_outputs().

Outputs And Returns#

Inherited automatic attributes include all initial loads, final loads, final resistances, pInternal, and RWCFails.

Public getters:

  • get_final_resistance() -> dict[str, np.ndarray]
  • get_final_loads() -> dict[str, np.ndarray]

Both dictionaries use the component keys "Openings", "Walls", "Roof Sheathings", "Roof Coverings", and "Roof-Wall Connections".

Config Behavior#

With AUTO_LOAD_DATASETS = True, coefficient files are loaded automatically. With it disabled, assign or load coefficients before execution.

With AUTO_EXECUTE_METHODS = True, the complete workflow runs during construction. With it disabled, get_final_resistance() and get_final_loads() only work after you have manually populated the corresponding attributes.

Automatic Example#

import numpy as np
from cheersafe.inventory import BuildingInventory
from cheersafe.loads import LoadingAndFailureCheck
from cheersafe.tools import Utils

building = BuildingInventory(buildings_file_name="BuildingGeometry.json").buildings[0]
mean = Utils.from_json("Inputs/MeanResistanceValue.json")

workflow = LoadingAndFailureCheck(
    np.full(sum(building.NumPanel), mean[1, 0]),
    np.full(sum(building.NumPanel), mean[0, 0]),
    np.full(sum(building.NumConnection), mean[2, 0]),
    np.full(building.DoorFront + building.DoorBack + building.DoorGarage
            + building.OpeningFront + building.OpeningBack
            + 2 * (building.OpeningSideR + building.OpeningSideH), mean[3, 0]),
    np.full(12, mean[4, 0]),
    building,
    0,
    50,
)
print(workflow.get_final_resistance().keys())

Manual-Control Example#

import numpy as np
from cheersafe.config import Config
from cheersafe.inventory import BuildingInventory
from cheersafe.loads import LoadingAndFailureCheck
from cheersafe.tools import Utils

building = BuildingInventory(buildings_file_name="BuildingGeometry.json").buildings[0]
old_execute = Config.AUTO_EXECUTE_METHODS
Config.AUTO_EXECUTE_METHODS = False
try:
    mean = Utils.from_json("Inputs/MeanResistanceValue.json")
    workflow = LoadingAndFailureCheck(
        np.full(sum(building.NumPanel), mean[1, 0]),
        np.full(sum(building.NumPanel), mean[0, 0]),
        np.full(sum(building.NumConnection), mean[2, 0]),
        np.full(building.DoorFront + building.DoorBack + building.DoorGarage
                + building.OpeningFront + building.OpeningBack
                + 2 * (building.OpeningSideR + building.OpeningSideH), mean[3, 0]),
        np.full(12, mean[4, 0]),
        building,
        0,
        50,
    )
    workflow.PressureZoneCoordinate, workflow.NumZone = workflow.fn_pressure_zone_coordinate()
    workflow.PressureZoneArea, workflow.PanelArea = workflow.fn_preprocess_rs()
    workflow.pRS = workflow.fn_initial_load_rs()
    workflow.pRC = workflow.fn_initial_load_rc()
    workflow.pRWC = workflow.fn_initial_load_rwc()
    workflow.pO = workflow.fn_initial_load_o()
    workflow.pW = workflow.fn_initial_load_w()
    resistance = workflow.fn_initial_failure_check()
    workflow.rRSt = resistance["Roof Sheathings"]
    workflow.rRCt = resistance["Roof Coverings"]
    workflow.rRWCt = resistance["Roof-Wall Connections"]
    workflow.rOt = resistance["Openings"]
    workflow.rWt = resistance["Walls"]
    workflow.pInternal = workflow.fn_pressure_internal()
    workflow.pfRC = workflow.fn_final_load_rc()
    workflow.pfRS = workflow.fn_final_load_rs() if workflow.pInternal else workflow.pRS
    workflow.pfRWC = workflow.fn_final_load_rwc() if workflow.pInternal else workflow.pRWC
    workflow.pfO = workflow.fn_final_load_o() if workflow.pInternal else workflow.pO
    workflow.pfW = workflow.fn_final_load_w() if workflow.pInternal else workflow.pW
    workflow.rRWCt, workflow.RWCFails = workflow.fn_final_failure_check_rwc()
    print(workflow.get_final_loads().keys())
finally:
    Config.AUTO_EXECUTE_METHODS = old_execute