Skip to content

Commit

Permalink
refactor: change s_base to baseMVA
Browse files Browse the repository at this point in the history
  • Loading branch information
danielolsen committed Apr 4, 2022
1 parent e568dbb commit eabc0e6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion prereise/gather/griddata/hifld/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
s_base = 100 # MVA
baseMVA = 100 # noqa: N816. apparent power base for per-unit calculations

mile_to_meter = 1609.34
meter_to_mile = 1.0 / mile_to_meter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ def test_estimate_branch_impedance_lines():
{"VOLTAGE": [69, 70, 345], "type": ["Line"] * 3, "Line": fake_lines}
)
x = estimate_branch_impedance(branch.iloc[0], pd.Series())
assert x == reactance / (69**2 / const.s_base)
assert x == reactance / (69**2 / const.baseMVA)
x = estimate_branch_impedance(branch.iloc[1], pd.Series())
assert x == reactance / (70**2 / const.s_base)
assert x == reactance / (70**2 / const.baseMVA)
x = estimate_branch_impedance(branch.iloc[2], pd.Series())
assert x == reactance / (345**2 / const.s_base)
assert x == reactance / (345**2 / const.baseMVA)


def test_estimate_branch_impedance_transformers():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def _euclidian(a, b):
)
return const.transformer_reactance[closest_voltage_tuple]
elif branch.loc["type"] == "Line":
z_base = calculate_z_base(v_base=branch["VOLTAGE"], s_base=const.s_base)
z_base = calculate_z_base(v_base=branch["VOLTAGE"], s_base=const.baseMVA)
return translate_to_per_unit(branch["Line"].series_impedance.imag, "x", z_base)
else:
raise ValueError(f"{branch.loc['type']} not a valid branch type")
Expand Down

0 comments on commit eabc0e6

Please sign in to comment.