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
.PowerSystemResource
import PowerSystemResource
23 class ConnectivityNodeContainer(PowerSystemResource
):
24 """A base class for all objects that may contain ConnectivityNodes or TopologicalNodes.
27 def __init__(self
, ConnectivityNodes
=None, TopologicalNode
=None, *args
, **kw_args
):
28 """Initialises a new 'ConnectivityNodeContainer' instance.
30 @param ConnectivityNodes: Connectivity nodes contained by this container.
31 @param TopologicalNode: The topological nodes which belong to this connectivity node container.
33 self
._ConnectivityNodes
= []
34 self
.ConnectivityNodes
= [] if ConnectivityNodes
is None else ConnectivityNodes
36 self
._TopologicalNode
= []
37 self
.TopologicalNode
= [] if TopologicalNode
is None else TopologicalNode
39 super(ConnectivityNodeContainer
, self
).__init
__(*args
, **kw_args
)
45 _refs
= ["ConnectivityNodes", "TopologicalNode"]
46 _many_refs
= ["ConnectivityNodes", "TopologicalNode"]
48 def getConnectivityNodes(self
):
49 """Connectivity nodes contained by this container.
51 return self
._ConnectivityNodes
53 def setConnectivityNodes(self
, value
):
54 for x
in self
._ConnectivityNodes
:
55 x
.ConnectivityNodeContainer
= None
57 y
._ConnectivityNodeContainer
= self
58 self
._ConnectivityNodes
= value
60 ConnectivityNodes
= property(getConnectivityNodes
, setConnectivityNodes
)
62 def addConnectivityNodes(self
, *ConnectivityNodes
):
63 for obj
in ConnectivityNodes
:
64 obj
.ConnectivityNodeContainer
= self
66 def removeConnectivityNodes(self
, *ConnectivityNodes
):
67 for obj
in ConnectivityNodes
:
68 obj
.ConnectivityNodeContainer
= None
70 def getTopologicalNode(self
):
71 """The topological nodes which belong to this connectivity node container.
73 return self
._TopologicalNode
75 def setTopologicalNode(self
, value
):
76 for x
in self
._TopologicalNode
:
77 x
.ConnectivityNodeContainer
= None
79 y
._ConnectivityNodeContainer
= self
80 self
._TopologicalNode
= value
82 TopologicalNode
= property(getTopologicalNode
, setTopologicalNode
)
84 def addTopologicalNode(self
, *TopologicalNode
):
85 for obj
in TopologicalNode
:
86 obj
.ConnectivityNodeContainer
= self
88 def removeTopologicalNode(self
, *TopologicalNode
):
89 for obj
in TopologicalNode
:
90 obj
.ConnectivityNodeContainer
= None