diff --git a/src/zepben/ewb/model/cim/iec61970/base/core/feeder.py b/src/zepben/ewb/model/cim/iec61970/base/core/feeder.py index 12a89060..f703b4e7 100644 --- a/src/zepben/ewb/model/cim/iec61970/base/core/feeder.py +++ b/src/zepben/ewb/model/cim/iec61970/base/core/feeder.py @@ -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 @@ -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.""" + _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.""" @@ -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") + def normal_energizing_substation(self, value): + self._normal_energizing_substation = value + @property def current_equipment(self) -> Generator[Equipment, None, None]: """ diff --git a/src/zepben/ewb/model/cim/iec61970/base/core/sub_geographical_region.py b/src/zepben/ewb/model/cim/iec61970/base/core/sub_geographical_region.py index c85a7a8a..12996f72 100644 --- a/src/zepben/ewb/model/cim/iec61970/base/core/sub_geographical_region.py +++ b/src/zepben/ewb/model/cim/iec61970/base/core/sub_geographical_region.py @@ -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 @@ -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 @@ -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` diff --git a/src/zepben/ewb/model/cim/iec61970/base/core/substation.py b/src/zepben/ewb/model/cim/iec61970/base/core/substation.py index 8e3aa4f5..8027c538 100644 --- a/src/zepben/ewb/model/cim/iec61970/base/core/substation.py +++ b/src/zepben/ewb/model/cim/iec61970/base/core/substation.py @@ -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 @@ -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 @@ -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]: """ diff --git a/src/zepben/ewb/model/cim/iec61970/base/core/terminal.py b/src/zepben/ewb/model/cim/iec61970/base/core/terminal.py index 9c4a4054..a7d43f2d 100644 --- a/src/zepben/ewb/model/cim/iec61970/base/core/terminal.py +++ b/src/zepben/ewb/model/cim/iec61970/base/core/terminal.py @@ -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 @@ -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 diff --git a/src/zepben/ewb/model/cim/iec61970/base/diagramlayout/diagram_object.py b/src/zepben/ewb/model/cim/iec61970/base/diagramlayout/diagram_object.py index d203c13d..9bf75a7f 100644 --- a/src/zepben/ewb/model/cim/iec61970/base/diagramlayout/diagram_object.py +++ b/src/zepben/ewb/model/cim/iec61970/base/diagramlayout/diagram_object.py @@ -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 @@ -26,7 +28,6 @@ class DiagramObject(IdentifiedObject): """ _diagram: Optional[Diagram] = None - """A diagram object is part of a diagram.""" identified_object_mrid: Optional[str] = None """The domain object to which this diagram object is associated.""" @@ -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 diff --git a/src/zepben/ewb/model/cim/iec61970/base/wires/ac_line_segment_phase.py b/src/zepben/ewb/model/cim/iec61970/base/wires/ac_line_segment_phase.py index 6e8feba1..4ca992a9 100644 --- a/src/zepben/ewb/model/cim/iec61970/base/wires/ac_line_segment_phase.py +++ b/src/zepben/ewb/model/cim/iec61970/base/wires/ac_line_segment_phase.py @@ -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 @@ -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 diff --git a/src/zepben/ewb/model/cim/iec61970/base/wires/clamp.py b/src/zepben/ewb/model/cim/iec61970/base/wires/clamp.py index 890df154..f845a3c8 100644 --- a/src/zepben/ewb/model/cim/iec61970/base/wires/clamp.py +++ b/src/zepben/ewb/model/cim/iec61970/base/wires/clamp.py @@ -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 @@ -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 diff --git a/src/zepben/ewb/model/cim/iec61970/base/wires/cut.py b/src/zepben/ewb/model/cim/iec61970/base/wires/cut.py index abb8a5d6..2a9cd9e1 100644 --- a/src/zepben/ewb/model/cim/iec61970/base/wires/cut.py +++ b/src/zepben/ewb/model/cim/iec61970/base/wires/cut.py @@ -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 @@ -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: diff --git a/src/zepben/ewb/model/cim/iec61970/base/wires/energy_consumer_phase.py b/src/zepben/ewb/model/cim/iec61970/base/wires/energy_consumer_phase.py index 7f9bb94b..fa7f3e22 100644 --- a/src/zepben/ewb/model/cim/iec61970/base/wires/energy_consumer_phase.py +++ b/src/zepben/ewb/model/cim/iec61970/base/wires/energy_consumer_phase.py @@ -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 @@ -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 diff --git a/src/zepben/ewb/model/cim/iec61970/base/wires/energy_source_phase.py b/src/zepben/ewb/model/cim/iec61970/base/wires/energy_source_phase.py index 1246b46c..1824b259 100644 --- a/src/zepben/ewb/model/cim/iec61970/base/wires/energy_source_phase.py +++ b/src/zepben/ewb/model/cim/iec61970/base/wires/energy_source_phase.py @@ -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 @@ -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 diff --git a/src/zepben/ewb/model/cim/iec61970/base/wires/power_electronics_connection_phase.py b/src/zepben/ewb/model/cim/iec61970/base/wires/power_electronics_connection_phase.py index b1fc8cc4..97bc92b8 100644 --- a/src/zepben/ewb/model/cim/iec61970/base/wires/power_electronics_connection_phase.py +++ b/src/zepben/ewb/model/cim/iec61970/base/wires/power_electronics_connection_phase.py @@ -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 @@ -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.""" @@ -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 \ No newline at end of file