Skip to content
Merged
Changes from all 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
21 changes: 16 additions & 5 deletions src/gdm/distribution/components/base/distribution_branch_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pydantic import model_validator, Field

from gdm.distribution.components.distribution_bus import DistributionBus
from gdm.distribution.enums import Phase
from gdm.distribution.enums import Phase, VoltageTypes
from gdm.distribution.components.base.distribution_component_base import (
InServiceDistributionComponentBase,
)
Expand Down Expand Up @@ -48,14 +48,25 @@
)
raise ValueError(msg)

rated_voltage_LN_from = (

Check warning on line 51 in src/gdm/distribution/components/base/distribution_branch_base.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this local variable "rated_voltage_LN_from" to match the regular expression ^[_a-z][a-z0-9_]*$.

See more on https://sonarcloud.io/project/issues?id=NREL-Distribution-Suites_grid-data-models&issues=AaDvUkLDliyZ9jhb_DQ6&open=AaDvUkLDliyZ9jhb_DQ6&pullRequest=222
self.buses[0].rated_voltage
if self.buses[0].voltage_type == VoltageTypes.LINE_TO_GROUND
else self.buses[0].rated_voltage / math.sqrt(3)
)
rated_voltage_LN_to = (

Check warning on line 56 in src/gdm/distribution/components/base/distribution_branch_base.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this local variable "rated_voltage_LN_to" to match the regular expression ^[_a-z][a-z0-9_]*$.

See more on https://sonarcloud.io/project/issues?id=NREL-Distribution-Suites_grid-data-models&issues=AaDvUkLDliyZ9jhb_DQ7&open=AaDvUkLDliyZ9jhb_DQ7&pullRequest=222
self.buses[1].rated_voltage
if self.buses[1].voltage_type == VoltageTypes.LINE_TO_GROUND
else self.buses[1].rated_voltage / math.sqrt(3)
)

if not math.isclose(
self.buses[0].rated_voltage.magnitude,
self.buses[1].rated_voltage.magnitude,
rated_voltage_LN_from.magnitude,
rated_voltage_LN_to.magnitude,
rel_tol=0.001, # 10^-3
):
msg = (
f"From bus {self.buses[0].rated_voltage=}"
f"and to bus voltage {self.buses[1].rated_voltage=} rating should be same."
f"From bus line to ground voltage {rated_voltage_LN_from=}"
f"and to bus line to ground voltage {rated_voltage_LN_to=} rating should be same."
)
raise ValueError(msg)

Expand Down
Loading