Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename nonstructural building damage #582

Merged
merged 4 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Update Non-structural Building Damage to support flood [#562](https://github.com/IN-CORE/pyincore/issues/562)
- Update flood input to non-structural building damage for combined wind-wave-surge building [#566](https://github.com/IN-CORE/pyincore/issues/566)
- Rename transportation recovery analysis to traffic flow recovery analysis [#558](https://github.com/IN-CORE/pyincore/issues/558)
- Rename nonstructural building damage [#537](https://github.com/IN-CORE/pyincore/issues/537)

### Added
- Gas Facility Damage Analysis [#568](https://github.com/IN-CORE/pyincore/issues/568)
Expand Down
9 changes: 9 additions & 0 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ analyses/buildingfunctionality
.. autoclass:: buildingfunctionality.buildingfunctionality.BuildingFunctionality
:members:

analyses/buildingnonstructdamage
================================
.. autoclass:: buildingnonstructdamage.buildingnonstructdamage.BuildingNonStructDamage
:members:
.. autoclass:: buildingnonstructdamage.buildingnonstructutil.BuildingNonStructUtil
:members:

analyses/buildingportfolio
==========================

Expand Down Expand Up @@ -231,6 +238,8 @@ analyses/nonstructbuildingdamage
:members:
.. autoclass:: nonstructbuildingdamage.nonstructbuildingutil.NonStructBuildingUtil
:members:
.. deprecated:: 1.19.0
This class will be deprecated soon. Use :class:`buildingnonstructdamage.BuildingNonStructDamage` instead.

analyses/pipelinedamage
=======================
Expand Down
9 changes: 9 additions & 0 deletions pyincore/analyses/buildingnonstructuraldamage/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2019 University of Illinois and others. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Mozilla Public License v2.0 which accompanies this distribution,
# and is available at https://www.mozilla.org/en-US/MPL/2.0/


from pyincore.analyses.buildingnonstructuraldamage.buildingnonstructuraldamage import BuildingNonStructDamage
from pyincore.analyses.buildingnonstructuraldamage.buildingnonstructuralutil import BuildingNonStructUtil

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright (c) 2019 University of Illinois and others. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Mozilla Public License v2.0 which accompanies this distribution,
# and is available at https://www.mozilla.org/en-US/MPL/2.0/

import collections


class BuildingNonStructUtil:
"""Utility methods for the non-structural building damage analysis."""
BUILDING_FRAGILITY_KEYSBUILDING_FRAGILITY_KEYS = {
"drift-sensitive fragility id code": ["Drift Sensitive", "DS"],
"parametric non-retrofit fragility id code": ["Parametric Non-Retrofit", "PNR"],
"acceleration-sensitive fragility id code": ["Acceleration Sensitive", "AS"],
"non-retrofit fragility id code": ["as built", "none"]
}

DEFAULT_FRAGILITY_KEY_DS = "Drift-Sensitive Fragility ID Code"
DEFAULT_FRAGILITY_KEY_AS = "Acceleration-Sensitive Fragility ID Code"

@staticmethod
def adjust_damage_for_liquefaction(limit_state_probabilities, ground_failure_probabilities):
"""Adjusts building damage probability based on liquefaction ground failure probability
with the liq_dmg, we know that it is 3 values, the first two are the same.
The 3rd might be different.
We always want to apply the first two to all damage states except the highest.

Args:
limit_state_probabilities (obj): Limit state probabilities.
ground_failure_probabilities (list): Ground failure probabilities.

Returns:
OrderedDict: Adjusted limit state probability.

"""
keys = list(limit_state_probabilities.keys())
adjusted_limit_state_probabilities = collections.OrderedDict()

for i in range(len(keys)):
# check and see...if we are trying to use the last ground failure
# number for something other than the
# last limit-state-probability, then we should use the
# second-to-last probability of ground failure instead.

if i > len(ground_failure_probabilities) - 1:
prob_ground_failure = ground_failure_probabilities[len(ground_failure_probabilities) - 2]
else:
prob_ground_failure = ground_failure_probabilities[i]

adjusted_limit_state_probabilities[keys[i]] = \
limit_state_probabilities[keys[i]] + prob_ground_failure \
- limit_state_probabilities[keys[i]] * prob_ground_failure

# the final one is the last of limitStates should match with the last of ground failures
j = len(limit_state_probabilities) - 1
prob_ground_failure = ground_failure_probabilities[-1]
adjusted_limit_state_probabilities[keys[j]] = \
limit_state_probabilities[keys[j]] \
+ prob_ground_failure - limit_state_probabilities[keys[j]] * prob_ground_failure

return adjusted_limit_state_probabilities
Loading
Loading