Skip to content

Commit

Permalink
use "difference" instead of "drop" in the variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
joda9 committed Jul 24, 2024
1 parent 8adc372 commit a37c4d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions edisgo/tools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def calculate_voltage_diff_per_line(
cos_phi: float = 0.95,
) -> float | np.ndarray:
"""
Calculate the voltage drop across a line in kV.
Calculate the voltage difference across a line in kV.
Parameters
----------
Expand All @@ -223,7 +223,7 @@ def calculate_voltage_diff_per_line(
Returns
-------
float or array-like
Voltage drop in kV.
Voltage difference in kV.
"""
sin_phi = np.sqrt(1 - cos_phi**2)
voltage_diff = np.abs(
Expand All @@ -243,7 +243,7 @@ def voltage_diff_pu(
sign: int = -1,
) -> float | np.ndarray:
"""
Calculate the voltage drop per unit of nominal voltage.
Calculate the voltage difference per unit of nominal voltage.
Parameters
----------
Expand All @@ -267,7 +267,7 @@ def voltage_diff_pu(
Returns
-------
float
Voltage drop in per unit of nominal voltage.
Voltage difference in per unit of nominal voltage.
"""
# Calculate total resistance and reactance for the given length and
# number of parallel cables
Expand All @@ -279,10 +279,10 @@ def voltage_diff_pu(
s_max, r_total, x_total, v_nom, sign=sign, cos_phi=cos_phi
)

# Convert voltage drop to per unit of nominal voltage
voltage_drop_pu = delta_v / v_nom
# Convert voltage difference to per unit of nominal voltage
voltage_difference_pu = delta_v / v_nom

return voltage_drop_pu
return voltage_difference_pu


def select_cable(
Expand Down Expand Up @@ -313,7 +313,7 @@ def select_cable(
length : float
Length of the cable in km. Default: 0.
max_voltage_diff : float
Maximum voltage drop in pu. Default: None.
Maximum voltage difference in pu. Default: None.
max_cables : int
Maximum number of parallel cables to consider. Default is 7.
cos_phi : float
Expand Down
2 changes: 1 addition & 1 deletion tests/tools/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_voltage_diff(self):
data, np.array([correct_value * 2, correct_value * 2]), rtol=1e-5
)

def test_voltage_drop_pu(self):
def test_voltage_diff_pu(self):
data = tools.voltage_diff_pu(0.1, 0.350, 1, 1, 20, 50, 0.9, -1)
correct_value = 0.52589253567891375 * 1e-2
assert np.isclose(data, correct_value)
Expand Down

0 comments on commit a37c4d5

Please sign in to comment.