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

Added Power to latest Pelicun #90

Merged
merged 21 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
bff99fc
Added Power to latest Pelicun
snaeimi Dec 31, 2024
b2277b2
added empty loss to power substation.
snaeimi Jan 3, 2025
c6f684c
Add the power fragility location to the dlml path file
snaeimi Jan 3, 2025
559f68d
Added Circuit and Generation Power subassets to the autopop
snaeimi Jan 6, 2025
1781142
Linted and other things
snaeimi Jan 7, 2025
20754b0
Exclude TRY003
snaeimi Jan 7, 2025
d6a67e9
Ruff check and Ruff formatted
snaeimi Jan 7, 2025
ab14e83
Fixed a small issue
snaeimi Jan 7, 2025
7199642
Merge branch 'NHERI-SimCenter:develop' into develop
snaeimi Jan 7, 2025
ec0fd90
Spell Check Done for Hazus_Earthquake_IM
snaeimi Jan 7, 2025
54562a0
Merge branch 'develop' of https://github.com/snaeimi/pelicun into dev…
snaeimi Jan 7, 2025
e0c2a5d
bug fix
snaeimi Jan 8, 2025
0d4abf7
Merge branch 'NHERI-SimCenter:develop' into develop
snaeimi Jan 9, 2025
db33027
fixed typos in the file
zsarnoczay Jan 28, 2025
e41718d
added kW and MW as options and fixed the conversion
zsarnoczay Jan 28, 2025
f5dcf60
Confirmed that the archetype ID uses capital S and fixed this typo.
zsarnoczay Jan 28, 2025
5632f66
Added 'mw' to the list of acceptable power units
zsarnoczay Jan 28, 2025
32051d1
Edited anchor property parser to make sure we throw errors in all cases
zsarnoczay Jan 28, 2025
95121a4
replaced checking for falsy values with explicit checks for `None`
zsarnoczay Jan 28, 2025
f13c106
bugfix: use correct exponentiation operator
zsarnoczay Jan 28, 2025
15d2ff0
ruff fix: remove whitespaces
zsarnoczay Jan 28, 2025
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 pelicun/assessment.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
'Hazus Earthquake - Stories': 'damage_DB_Hazus_EQ_story.csv',
'Hazus Earthquake - Transportation': 'damage_DB_Hazus_EQ_trnsp.csv',
'Hazus Earthquake - Water': 'damage_DB_Hazus_EQ_water.csv',
'Hazus Earthquake - Power': 'damage_DB_Hazus_EQ_power.csv',
'Hazus Hurricane': 'damage_DB_SimCenter_Hazus_HU_bldg.csv',
},
'repair': {
Expand Down
115 changes: 115 additions & 0 deletions pelicun/resources/auto/Hazus_Earthquake_IM.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,121 @@ def auto_populate(aim): # noqa: C901
dl_ap = None
comp = None

elif asset_type == 'PowerNetwork':
# initialize the auto-populated GI
power_asset_type = gi_ap.get("type", "MISSING")
asset_name = gi_ap.get("AIM_id", None)

if power_asset_type == "Substation":
snaeimi marked this conversation as resolved.
Show resolved Hide resolved

ep_s_size = ""
substation_voltage = gi_ap.get("Voltage", None)
if not substation_voltage:
print("Substation feature \"Voltage\" is missing. "
f" substation \"{asset_name}\" assuemd to be "
"\" Low Voltage\".")
substation_voltage = "low"

if isinstance(substation_voltage, str):
if substation_voltage.lower() == "low":
ep_s_size = "L"
elif substation_voltage.lower() == "medium":
ep_s_size = "M"
elif substation_voltage.lower() == "high":
ep_s_size = "H"
else:
raise ValueError("substation Voltage value is = "
f"{substation_voltage}. "
"The value must be either \"low\" "
", \" medium\", or \" high\".")
elif isinstance(substation_voltage, (float, int)):

# Substation Voltage unit is kV. ANy number smaller than
zsarnoczay marked this conversation as resolved.
Show resolved Hide resolved
# 34 kv is not supported by HAZUS methodlogy. Furthermore,
zsarnoczay marked this conversation as resolved.
Show resolved Hide resolved
# values significantly larger may refer to a voltage value in
# different unit. The upper bound value is set ro 1200 kV.
snaeimi marked this conversation as resolved.
Show resolved Hide resolved


if substation_voltage < 34:
raise ValueError(f"The subtation Viltage for asset \"{asset_name}\" "
zsarnoczay marked this conversation as resolved.
Show resolved Hide resolved
f"is too low({substation_voltage}). The current "
"methodology support voltage ebtween 34 kV and 1200 "
snaeimi marked this conversation as resolved.
Show resolved Hide resolved
" kV. Please make sure that the units are in kV.")

elif substation_voltage > 1200:
raise ValueError(f"The subtation Viltage for asset \"{asset_name}\" "
f"is too high({substation_voltage}). The current "
"methodology support voltage ebtween 34 kV and 1200 "
" kV. Please make sure that the units are in kV.")

if substation_voltage <= 150:
ep_s_size = "L"
elif substation_voltage <= 230:
ep_s_size = "M"
elif substation_voltage >= 500:
ep_s_size = "H"
else:
raise RuntimeError("This should never have happed. Please "
zsarnoczay marked this conversation as resolved.
Show resolved Hide resolved
"report this to the devloper(SimCenter)"
". (Value = {substation_voltage}).")
else:
raise ValueError("substation Voltage value is = "
f"{substation_voltage}. It should be "
"string or a numebr. For more information, "
"refer to the documentation please.")


substation_anchored = gi_ap.get("Anchored", None)

if not substation_anchored:
zsarnoczay marked this conversation as resolved.
Show resolved Hide resolved
print("Substation feature \"Anchored\" is missing. "
f" substation \"{asset_name}\" assuemd to be "
"\" Unanchored\".")

substation_anchored = False

if isinstance(substation_anchored, str):
if substation_anchored.lower() in ["a", "anchored", "yes", "true",
"possitive", "1"]:
ep_s_anchored = "A"
elif substation_anchored.lower() in ["u", "unanchored", "no",
"false", "negative", "0"]:
ep_s_anchored = "U"
elif isinstance(substation_anchored, (bool, int, float)):
zsarnoczay marked this conversation as resolved.
Show resolved Hide resolved
if abs(substation_anchored - True) < 0.001:
ep_s_anchored = "A"
elif abs(substation_anchored) < 0.001:
ep_s_anchored = "U"
else:
raise RuntimeError("This should never have happed. Please "
"report this to the devloper(SimCenter)"
". (Value = {substation_anchored}).")
else:
raise ValueError("substation anchored value is = "
f"{substation_anchored}. It should be "
"string, boolean, or a number representing "
"True or False. For more information, "
"refer to the documentation please.")


# Define performance model
# fmt: off
comp = pd.DataFrame( # noqa
{f'EP.S.{ep_s_size}.{ep_s_anchored}': ['ea', 1, 1, 1, 'N/A']}, # noqa
index = ['Units','Location','Direction','Theta_0','Family'] # noqa
).T # noqa

# Define the auto-populated config
dl_ap = {
"Asset": {
"ComponentAssignmentFile": "CMP_QNT.csv",
"ComponentDatabase": "Hazus Earthquake - Power",
"Substation Voltage": ep_s_size,
"Substation Anchored": ep_s_anchored,
},
"Damage": {"DamageProcess": "Hazus Earthquake"},
"Demands": {},
}
else:
print(
f'AssetType: {asset_type} is not supported '
Expand Down
Loading