1 # Copyright (C) 2010-2011 Richard Lincoln
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to
5 # deal in the Software without restriction, including without limitation the
6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 # sell copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 from CIM14
.ENTSOE
.Dynamics
.IEC61970
.Core
.CoreEquipment
import CoreEquipment
23 class CoreConductingEquipment(CoreEquipment
):
25 def __init__(self
, phases
="ABC", SvStatus
=None, ClearanceTags
=None, Terminals
=None, ProtectionEquipments
=None, BaseVoltage
=None, *args
, **kw_args
):
26 """Initialises a new 'CoreConductingEquipment' instance.
28 @param phases: Values are: "ABC", "splitSecondary2N", "ABN", "CN", "ACN", "BC", "AN", "BN", "AB", "splitSecondary1N", "N", "C", "AC", "ABCN", "splitSecondary12N", "A", "B", "BCN"
32 @param ProtectionEquipments:
35 #: Values are: "ABC", "splitSecondary2N", "ABN", "CN", "ACN", "BC", "AN", "BN", "AB", "splitSecondary1N", "N", "C", "AC", "ABCN", "splitSecondary12N", "A", "B", "BCN"
39 self
.SvStatus
= SvStatus
41 self
._ClearanceTags
= []
42 self
.ClearanceTags
= [] if ClearanceTags
is None else ClearanceTags
45 self
.Terminals
= [] if Terminals
is None else Terminals
47 self
._ProtectionEquipments
= []
48 self
.ProtectionEquipments
= [] if ProtectionEquipments
is None else ProtectionEquipments
50 self
._BaseVoltage
= None
51 self
.BaseVoltage
= BaseVoltage
53 super(CoreConductingEquipment
, self
).__init
__(*args
, **kw_args
)
56 _attr_types
= {"phases": str}
57 _defaults
= {"phases": "ABC"}
58 _enums
= {"phases": "CorePhaseCode"}
59 _refs
= ["SvStatus", "ClearanceTags", "Terminals", "ProtectionEquipments", "BaseVoltage"]
60 _many_refs
= ["ClearanceTags", "Terminals", "ProtectionEquipments"]
62 def getSvStatus(self
):
66 def setSvStatus(self
, value
):
67 if self
._SvStatus
is not None:
68 self
._SvStatus
._ConductingEquipment
= None
70 self
._SvStatus
= value
71 if self
._SvStatus
is not None:
72 self
._SvStatus
.ConductingEquipment
= None
73 self
._SvStatus
._ConductingEquipment
= self
75 SvStatus
= property(getSvStatus
, setSvStatus
)
77 def getClearanceTags(self
):
79 return self
._ClearanceTags
81 def setClearanceTags(self
, value
):
82 for x
in self
._ClearanceTags
:
83 x
.ConductingEquipment
= None
85 y
._ConductingEquipment
= self
86 self
._ClearanceTags
= value
88 ClearanceTags
= property(getClearanceTags
, setClearanceTags
)
90 def addClearanceTags(self
, *ClearanceTags
):
91 for obj
in ClearanceTags
:
92 obj
.ConductingEquipment
= self
94 def removeClearanceTags(self
, *ClearanceTags
):
95 for obj
in ClearanceTags
:
96 obj
.ConductingEquipment
= None
98 def getTerminals(self
):
100 return self
._Terminals
102 def setTerminals(self
, value
):
103 for x
in self
._Terminals
:
104 x
.ConductingEquipment
= None
106 y
._ConductingEquipment
= self
107 self
._Terminals
= value
109 Terminals
= property(getTerminals
, setTerminals
)
111 def addTerminals(self
, *Terminals
):
112 for obj
in Terminals
:
113 obj
.ConductingEquipment
= self
115 def removeTerminals(self
, *Terminals
):
116 for obj
in Terminals
:
117 obj
.ConductingEquipment
= None
119 def getProtectionEquipments(self
):
121 return self
._ProtectionEquipments
123 def setProtectionEquipments(self
, value
):
124 for p
in self
._ProtectionEquipments
:
125 filtered
= [q
for q
in p
.ConductingEquipments
if q
!= self
]
126 self
._ProtectionEquipments
._ConductingEquipments
= filtered
128 if self
not in r
._ConductingEquipments
:
129 r
._ConductingEquipments
.append(self
)
130 self
._ProtectionEquipments
= value
132 ProtectionEquipments
= property(getProtectionEquipments
, setProtectionEquipments
)
134 def addProtectionEquipments(self
, *ProtectionEquipments
):
135 for obj
in ProtectionEquipments
:
136 if self
not in obj
._ConductingEquipments
:
137 obj
._ConductingEquipments
.append(self
)
138 self
._ProtectionEquipments
.append(obj
)
140 def removeProtectionEquipments(self
, *ProtectionEquipments
):
141 for obj
in ProtectionEquipments
:
142 if self
in obj
._ConductingEquipments
:
143 obj
._ConductingEquipments
.remove(self
)
144 self
._ProtectionEquipments
.remove(obj
)
146 def getBaseVoltage(self
):
148 return self
._BaseVoltage
150 def setBaseVoltage(self
, value
):
151 if self
._BaseVoltage
is not None:
152 filtered
= [x
for x
in self
.BaseVoltage
.ConductingEquipment
if x
!= self
]
153 self
._BaseVoltage
._ConductingEquipment
= filtered
155 self
._BaseVoltage
= value
156 if self
._BaseVoltage
is not None:
157 if self
not in self
._BaseVoltage
._ConductingEquipment
:
158 self
._BaseVoltage
._ConductingEquipment
.append(self
)
160 BaseVoltage
= property(getBaseVoltage
, setBaseVoltage
)