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 CIM15
.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.Connectivity nodes are points where terminals of conducting equipment are connected together with zero impedance.
27 def __init__(self
, TopologicalNode
=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 ConnectivityNodeContainer: Container of this connectivity node.
32 @param Terminals: Terminals interconnect with zero impedance at a node. Measurements on a node apply to all of its terminals.
34 self
._TopologicalNode
= None
35 self
.TopologicalNode
= TopologicalNode
37 self
._ConnectivityNodeContainer
= None
38 self
.ConnectivityNodeContainer
= ConnectivityNodeContainer
41 self
.Terminals
= [] if Terminals
is None else Terminals
43 super(ConnectivityNode
, self
).__init
__(*args
, **kw_args
)
49 _refs
= ["TopologicalNode", "ConnectivityNodeContainer", "Terminals"]
50 _many_refs
= ["Terminals"]
52 def getTopologicalNode(self
):
53 """Several ConnectivityNode(s) may combine together to form a single TopologicalNode, depending on the current state of the network.
55 return self
._TopologicalNode
57 def setTopologicalNode(self
, value
):
58 if self
._TopologicalNode
is not None:
59 filtered
= [x
for x
in self
.TopologicalNode
.ConnectivityNodes
if x
!= self
]
60 self
._TopologicalNode
._ConnectivityNodes
= filtered
62 self
._TopologicalNode
= value
63 if self
._TopologicalNode
is not None:
64 if self
not in self
._TopologicalNode
._ConnectivityNodes
:
65 self
._TopologicalNode
._ConnectivityNodes
.append(self
)
67 TopologicalNode
= property(getTopologicalNode
, setTopologicalNode
)
69 def getConnectivityNodeContainer(self
):
70 """Container of this connectivity node.
72 return self
._ConnectivityNodeContainer
74 def setConnectivityNodeContainer(self
, value
):
75 if self
._ConnectivityNodeContainer
is not None:
76 filtered
= [x
for x
in self
.ConnectivityNodeContainer
.ConnectivityNodes
if x
!= self
]
77 self
._ConnectivityNodeContainer
._ConnectivityNodes
= filtered
79 self
._ConnectivityNodeContainer
= value
80 if self
._ConnectivityNodeContainer
is not None:
81 if self
not in self
._ConnectivityNodeContainer
._ConnectivityNodes
:
82 self
._ConnectivityNodeContainer
._ConnectivityNodes
.append(self
)
84 ConnectivityNodeContainer
= property(getConnectivityNodeContainer
, setConnectivityNodeContainer
)
86 def getTerminals(self
):
87 """Terminals interconnect with zero impedance at a node. Measurements on a node apply to all of its terminals.
89 return self
._Terminals
91 def setTerminals(self
, value
):
92 for x
in self
._Terminals
:
93 x
.ConnectivityNode
= None
95 y
._ConnectivityNode
= self
96 self
._Terminals
= value
98 Terminals
= property(getTerminals
, setTerminals
)
100 def addTerminals(self
, *Terminals
):
101 for obj
in Terminals
:
102 obj
.ConnectivityNode
= self
104 def removeTerminals(self
, *Terminals
):
105 for obj
in Terminals
:
106 obj
.ConnectivityNode
= None