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
.IEC61970
.Core
.IdentifiedObject
import IdentifiedObject
23 class ConnectivityNode(IdentifiedObject
):
24 """Connectivity nodes are points where terminals of conducting equipment are connected together with zero impedance.
27 def __init__(self
, TopologicalNode
=None, BusNameMarker
=None, ConnectivityNodeContainer
=None, Terminals
=None, *args
, **kw_args
):
28 """Initialises a new 'ConnectivityNode' instance.
30 @param TopologicalNode: Several ConnectivityNode(s) may combine together to form a single TopologicalNode, depending on the current state of the network.
31 @param BusNameMarker: The associated name of the bus (TopologicalNode) containing the ConnectivityNode is derived by an algorithm that uses the bus name marker.
32 @param ConnectivityNodeContainer: Container of this connectivity node.
33 @param Terminals: Terminals interconnect with zero impedance at a node. Measurements on a node apply to all of its terminals.
35 self
._TopologicalNode
= None
36 self
.TopologicalNode
= TopologicalNode
38 self
._BusNameMarker
= None
39 self
.BusNameMarker
= BusNameMarker
41 self
._ConnectivityNodeContainer
= None
42 self
.ConnectivityNodeContainer
= ConnectivityNodeContainer
45 self
.Terminals
= [] if Terminals
is None else Terminals
47 super(ConnectivityNode
, self
).__init
__(*args
, **kw_args
)
53 _refs
= ["TopologicalNode", "BusNameMarker", "ConnectivityNodeContainer", "Terminals"]
54 _many_refs
= ["Terminals"]
56 def getTopologicalNode(self
):
57 """Several ConnectivityNode(s) may combine together to form a single TopologicalNode, depending on the current state of the network.
59 return self
._TopologicalNode
61 def setTopologicalNode(self
, value
):
62 if self
._TopologicalNode
is not None:
63 filtered
= [x
for x
in self
.TopologicalNode
.ConnectivityNodes
if x
!= self
]
64 self
._TopologicalNode
._ConnectivityNodes
= filtered
66 self
._TopologicalNode
= value
67 if self
._TopologicalNode
is not None:
68 if self
not in self
._TopologicalNode
._ConnectivityNodes
:
69 self
._TopologicalNode
._ConnectivityNodes
.append(self
)
71 TopologicalNode
= property(getTopologicalNode
, setTopologicalNode
)
73 def getBusNameMarker(self
):
74 """The associated name of the bus (TopologicalNode) containing the ConnectivityNode is derived by an algorithm that uses the bus name marker.
76 return self
._BusNameMarker
78 def setBusNameMarker(self
, value
):
79 if self
._BusNameMarker
is not None:
80 filtered
= [x
for x
in self
.BusNameMarker
.ConnectivityNode
if x
!= self
]
81 self
._BusNameMarker
._ConnectivityNode
= filtered
83 self
._BusNameMarker
= value
84 if self
._BusNameMarker
is not None:
85 if self
not in self
._BusNameMarker
._ConnectivityNode
:
86 self
._BusNameMarker
._ConnectivityNode
.append(self
)
88 BusNameMarker
= property(getBusNameMarker
, setBusNameMarker
)
90 def getConnectivityNodeContainer(self
):
91 """Container of this connectivity node.
93 return self
._ConnectivityNodeContainer
95 def setConnectivityNodeContainer(self
, value
):
96 if self
._ConnectivityNodeContainer
is not None:
97 filtered
= [x
for x
in self
.ConnectivityNodeContainer
.ConnectivityNodes
if x
!= self
]
98 self
._ConnectivityNodeContainer
._ConnectivityNodes
= filtered
100 self
._ConnectivityNodeContainer
= value
101 if self
._ConnectivityNodeContainer
is not None:
102 if self
not in self
._ConnectivityNodeContainer
._ConnectivityNodes
:
103 self
._ConnectivityNodeContainer
._ConnectivityNodes
.append(self
)
105 ConnectivityNodeContainer
= property(getConnectivityNodeContainer
, setConnectivityNodeContainer
)
107 def getTerminals(self
):
108 """Terminals interconnect with zero impedance at a node. Measurements on a node apply to all of its terminals.
110 return self
._Terminals
112 def setTerminals(self
, value
):
113 for x
in self
._Terminals
:
114 x
.ConnectivityNode
= None
116 y
._ConnectivityNode
= self
117 self
._Terminals
= value
119 Terminals
= property(getTerminals
, setTerminals
)
121 def addTerminals(self
, *Terminals
):
122 for obj
in Terminals
:
123 obj
.ConnectivityNode
= self
125 def removeTerminals(self
, *Terminals
):
126 for obj
in Terminals
:
127 obj
.ConnectivityNode
= None