Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 13 additions & 2 deletions src/zepben/ewb/model/cim/iec61970/base/core/feeder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

from typing import Optional, Dict, List, Generator, TYPE_CHECKING

from typing_extensions import deprecated

from zepben.ewb import get_by_mrid
from zepben.ewb.model.cim.extensions.zbex import zbex
from zepben.ewb.model.cim.iec61970.base.core.equipment_container import EquipmentContainer
Expand All @@ -33,8 +35,7 @@ class Feeder(EquipmentContainer):
_normal_head_terminal: Terminal | None = None
"""The normal head terminal or terminals of the feeder."""

normal_energizing_substation: Substation | None = None
"""The substation that normally energizes the feeder. Also used for naming purposes."""
Comment thread
chestm007 marked this conversation as resolved.
_normal_energizing_substation: Substation | None = None

_current_equipment: Dict[str, Equipment] | None = None
"""The equipment contained in this feeder in the current state of the network."""
Expand Down Expand Up @@ -93,6 +94,16 @@ def normal_head_terminal(self, term: Optional[Terminal]):
else:
raise ValueError(f"Feeder {self.mrid} has equipment assigned to it. Cannot update normalHeadTerminal on a feeder with equipment assigned.")

@property
def normal_energizing_substation(self):
"""The substation that normally energizes the feeder. Also used for naming purposes."""
return self._normal_energizing_substation

@normal_energizing_substation.setter
@deprecated("normal_energizing_substation should never be set directly - it is automatically set when adding it to the `feeders` list")
Comment thread
chestm007 marked this conversation as resolved.
def normal_energizing_substation(self, value):
Comment thread
chestm007 marked this conversation as resolved.
self._normal_energizing_substation = value

@property
def current_equipment(self) -> Generator[Equipment, None, None]:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

from typing import Optional, List, Generator, TYPE_CHECKING

from typing_extensions import deprecated

from zepben.ewb.model.cim.iec61970.base.core.identified_object import IdentifiedObject
from zepben.ewb.util import nlen, ngen, get_by_mrid, safe_remove, require
from zepben.ewb.dataclass_descriptors.dataclass_base import zb_dataclass
Expand All @@ -24,8 +26,7 @@ class SubGeographicalRegion(IdentifiedObject):
A subset of a geographical region of a power system network model.
"""

geographical_region: Optional[GeographicalRegion] = None
"""The geographical region to which this sub-geographical region is within."""
_geographical_region: Optional[GeographicalRegion] = None

_substations: Optional[List[Substation]] = None

Expand All @@ -35,6 +36,17 @@ def __init__(self, *args, substations: List[Substation] = None, **kwargs):
for sub in substations:
self.add_substation(sub)


@property
def geographical_region(self):
"""The geographical region to which this sub-geographical region is within."""
return self._geographical_region

@geographical_region.setter
@deprecated("geographical_region should never be set directly - it is automatically set when adding it to the `sub_geographical_regions` list")
def geographical_region(self, value):
self._geographical_region = value

def num_substations(self) -> int:
"""
Returns The number of `Substation`s associated with this `SubGeographicalRegion`
Expand Down
16 changes: 14 additions & 2 deletions src/zepben/ewb/model/cim/iec61970/base/core/substation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

from typing import Optional, Generator, List, TYPE_CHECKING

from typing_extensions import deprecated

from zepben.ewb.model.cim.iec61970.base.core.equipment_container import EquipmentContainer
from zepben.ewb.util import nlen, get_by_mrid, ngen, safe_remove, require
from zepben.ewb.dataclass_descriptors.dataclass_base import zb_dataclass
Expand All @@ -27,8 +29,7 @@ class Substation(EquipmentContainer):
is passed for the purposes of switching or modifying its characteristics.
"""

sub_geographical_region: Optional[SubGeographicalRegion] = None
"""The SubGeographicalRegion containing the substation."""
_sub_geographical_region: Optional[SubGeographicalRegion] = None

_normal_energized_feeders: Optional[List[Feeder]] = None

Expand All @@ -53,6 +54,17 @@ def __init__(self, *args, normal_energized_feeders: List[Feeder] = None, loops:
for circuit in circuits:
self.add_circuit(circuit)


@property
def sub_geographical_region(self):
"""The SubGeographicalRegion containing the substation."""
return self._sub_geographical_region

@sub_geographical_region.setter
@deprecated("sub_geographical_region should never be set directly - it is automatically set when adding it to the `substations` list")
def sub_geographical_region(self, value):
self._sub_geographical_region = value

@property
def circuits(self) -> Generator[Circuit, None, None]:
"""
Expand Down
3 changes: 3 additions & 0 deletions src/zepben/ewb/model/cim/iec61970/base/core/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from typing import TYPE_CHECKING
from weakref import ref, ReferenceType

from typing_extensions import deprecated

from zepben.ewb.model.cim.iec61970.base.core.ac_dc_terminal import AcDcTerminal
from zepben.ewb.model.cim.iec61970.base.core.feeder import Feeder
from zepben.ewb.model.cim.iec61970.base.core.phase_code import PhaseCode
Expand Down Expand Up @@ -91,6 +93,7 @@ def conducting_equipment(self):
return self._conducting_equipment

@conducting_equipment.setter
@deprecated("conducting_equipment should never be set directly - it is automatically set when adding it to the `terminals` list")
def conducting_equipment(self, ce):
if self._conducting_equipment is None or self._conducting_equipment is ce:
self._conducting_equipment = ce
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

from typing import Optional, List, Generator, Callable, TYPE_CHECKING, Any

from typing_extensions import deprecated

from zepben.ewb.model.cim.iec61970.base.core.identified_object import IdentifiedObject
from zepben.ewb.model.cim.iec61970.base.diagramlayout.diagram_object_point import DiagramObjectPoint
from zepben.ewb.util import nlen, ngen, require, safe_remove
Expand All @@ -26,7 +28,6 @@ class DiagramObject(IdentifiedObject):
"""

_diagram: Optional[Diagram] = None
"""A diagram object is part of a diagram."""
Comment thread
chestm007 marked this conversation as resolved.

identified_object_mrid: Optional[str] = None
"""The domain object to which this diagram object is associated."""
Expand All @@ -49,9 +50,11 @@ def __init__(self, *args, diagram: Diagram = None, diagram_object_points: List[D

@property
def diagram(self):
"""A diagram object is part of a diagram."""
return self._diagram

@diagram.setter
@deprecated("diagram should never be set directly - it is automatically set when adding it to the `diagram_objects` list")
def diagram(self, diag):
if self._diagram is None or self._diagram is diag:
self._diagram = diag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

from typing import TYPE_CHECKING

from typing_extensions import deprecated

from zepben.ewb.model.cim.iec61970.base.core.power_system_resource import PowerSystemResource
from zepben.ewb.model.cim.iec61970.base.wires.single_phase_kind import SinglePhaseKind
from zepben.ewb.model.cim.iec61968.assetinfo.wire_info import WireInfo
Expand Down Expand Up @@ -45,6 +47,7 @@ def ac_line_segment(self) -> 'AcLineSegment | None':
return self._ac_line_segment

@ac_line_segment.setter
@deprecated("ac_line_segment should never be set directly - it is automatically set when adding it to the `phases` list")
def ac_line_segment(self, ac_line_segment: 'AcLineSegment') -> None:
if self._ac_line_segment is None or self._ac_line_segment is ac_line_segment:
self._ac_line_segment = ac_line_segment
Expand Down
15 changes: 13 additions & 2 deletions src/zepben/ewb/model/cim/iec61970/base/wires/clamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from typing import Optional, TYPE_CHECKING

from typing_extensions import deprecated

from zepben.ewb.model.cim.iec61970.base.core.conducting_equipment import ConductingEquipment
from zepben.ewb.dataclass_descriptors.dataclass_base import zb_dataclass

Expand All @@ -24,11 +26,20 @@ class Clamp(ConductingEquipment):
length_from_terminal_1: Optional[float] = None
"""The length to the place where the clamp is located starting from side one of the line segment, i.e. the line segment terminal with sequence number equal to 1."""

ac_line_segment: Optional['AcLineSegment'] = None
"""The line segment to which the clamp is connected."""
_ac_line_segment: Optional['AcLineSegment'] = None

max_terminals = 1

@property
def ac_line_segment(self) -> Optional['AcLineSegment']:
"""The line segment to which the clamp is connected."""
return self._ac_line_segment

@ac_line_segment.setter
@deprecated("ac_line_segment should never be set directly - it is automatically set when adding it to the `clamps` list")
def ac_line_segment(self, value):
self._ac_line_segment = value

@property
def length_from_t1_or_0(self) -> float:
return self.length_from_terminal_1 or 0.0
15 changes: 13 additions & 2 deletions src/zepben/ewb/model/cim/iec61970/base/wires/cut.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from typing import Optional, TYPE_CHECKING

from typing_extensions import deprecated

from zepben.ewb.model.cim.iec61970.base.wires.switch import Switch
from zepben.ewb.dataclass_descriptors.dataclass_base import zb_dataclass

Expand All @@ -30,8 +32,17 @@ class Cut(Switch):
length_from_terminal_1: Optional[float] = None
"""The length to the place where the cut is located starting from side one of the cut line segment, i.e. the line segment Terminal with sequenceNumber equal to 1."""

ac_line_segment: Optional['AcLineSegment'] = None
"""The line segment to which the cut is applied."""
_ac_line_segment: Optional['AcLineSegment'] = None

@property
def ac_line_segment(self) -> Optional['AcLineSegment']:
"""The line segment to which the cut is applied."""
return self._ac_line_segment

@ac_line_segment.setter
@deprecated("ac_line_segment should never be set directly - it is automatically set when adding it to the `cuts` list")
def ac_line_segment(self, value):
self._ac_line_segment = value

@property
def length_from_t1_or_0(self) -> float:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from typing import Optional, TYPE_CHECKING

from typing_extensions import deprecated

from zepben.ewb.model.cim.iec61970.base.core.power_system_resource import PowerSystemResource
from zepben.ewb.model.cim.iec61970.base.wires.single_phase_kind import SinglePhaseKind
from zepben.ewb.dataclass_descriptors.dataclass_base import zb_dataclass
Expand Down Expand Up @@ -51,6 +53,7 @@ def energy_consumer(self):
return self._energy_consumer

@energy_consumer.setter
@deprecated("energy_consumer should never be set directly - it is automatically set when adding it to the `phases` list")
def energy_consumer(self, ec):
if self._energy_consumer is None or self._energy_consumer is ec:
self._energy_consumer = ec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from typing import Optional, TYPE_CHECKING

from typing_extensions import deprecated

from zepben.ewb.model.cim.iec61970.base.core.power_system_resource import PowerSystemResource
from zepben.ewb.model.cim.iec61970.base.wires.single_phase_kind import SinglePhaseKind
from zepben.ewb.dataclass_descriptors.dataclass_base import zb_dataclass
Expand Down Expand Up @@ -40,6 +42,7 @@ def energy_source(self):
return self._energy_source

@energy_source.setter
@deprecated("energy_sounrce should never be set directly - it is automatically set when adding it to the `phases` list")
def energy_source(self, es):
if self._energy_source is None or self._energy_source is es:
self._energy_source = es
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from typing import Optional, TYPE_CHECKING

from typing_extensions import deprecated

from zepben.ewb.model.cim.iec61970.base.core.power_system_resource import PowerSystemResource
from zepben.ewb.model.cim.iec61970.base.wires.single_phase_kind import SinglePhaseKind
from zepben.ewb.dataclass_descriptors.dataclass_base import zb_dataclass
Expand All @@ -19,8 +21,7 @@
class PowerElectronicsConnectionPhase(PowerSystemResource):
"""A single phase of a power electronics connection."""

power_electronics_connection: Optional['PowerElectronicsConnection'] = None
"""The power electronics connection to which the phase belongs."""
_power_electronics_connection: Optional['PowerElectronicsConnection'] = None

p: Optional[float] = None
"""Active power injection. Load sign convention is used, i.e. positive sign means flow into the equipment from the network."""
Expand All @@ -34,3 +35,13 @@ class PowerElectronicsConnectionPhase(PowerSystemResource):

q: Optional[float] = None
"""Reactive power injection. Load sign convention is used, i.e. positive sign means flow into the equipment from the network."""

@property
def power_electronics_connection(self):
"""The power electronics connection to which the phase belongs."""
return self._power_electronics_connection

@power_electronics_connection.setter
@deprecated("power_electronics_connection should never be set directly - it is automatically set when adding it to the `phases` list")
def power_electronics_connection(self, value):
self._power_electronics_connection = value

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lucky you have been given a free pass on

Image

Loading