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 TopologicalNode(IdentifiedObject
):
24 """For a detailed substation model a TopologicalNode is a set of connectivity nodes that, in the current network state, are connected together through any type of closed switches, including jumpers. Topological nodes changes as the current network state changes (i.e., switches, breakers, etc. change state). For a planning model switch statuses are not used to form TopologicalNodes. Instead they are manually created or deleted in a model builder tool. TopologialNodes maintained this way are also called 'busses'.
27 def __init__(self
, Terminal
=None, TopologicalIsland
=None, ReportingGroup
=None, ConnectivityNodes
=None, SvInjection
=None, SvVoltage
=None, SvShortCircuit
=None, BaseVoltage
=None, ConnectivityNodeContainer
=None, AngleRef_TopologicalIsland
=None, *args
, **kw_args
):
28 """Initialises a new 'TopologicalNode' instance.
30 @param Terminal: The terminals associated with the topological node. This can be used as an alternative to the connectivity node path to terminal, thus making it unneccesary to model connedtivity nodes in some cases. Note that the if connectivity nodes are in the model, this association would proably not be used.
31 @param TopologicalIsland: A topological node belongs to a topological island
32 @param ReportingGroup: The reporting group to which the topological node belongs.
33 @param ConnectivityNodes: Several ConnectivityNode(s) may combine together to form a single TopologicalNode, depending on the current state of the network.
34 @param SvInjection: The injection state associated with the topological node.
35 @param SvVoltage: The state voltage associated with the topological node.
36 @param SvShortCircuit: The short circuit state associated with the topological node.
37 @param BaseVoltage: The base voltage of the topologocial node.
38 @param ConnectivityNodeContainer: The connectivity node container to which the toplogical node belongs.
39 @param AngleRef_TopologicalIsland: The island for which the node is an angle reference. Normally there is one angle reference node for each island.
42 self
.Terminal
= [] if Terminal
is None else Terminal
44 self
._TopologicalIsland
= None
45 self
.TopologicalIsland
= TopologicalIsland
47 self
._ReportingGroup
= None
48 self
.ReportingGroup
= ReportingGroup
50 self
._ConnectivityNodes
= []
51 self
.ConnectivityNodes
= [] if ConnectivityNodes
is None else ConnectivityNodes
53 self
._SvInjection
= None
54 self
.SvInjection
= SvInjection
56 self
._SvVoltage
= None
57 self
.SvVoltage
= SvVoltage
59 self
._SvShortCircuit
= None
60 self
.SvShortCircuit
= SvShortCircuit
62 self
._BaseVoltage
= None
63 self
.BaseVoltage
= BaseVoltage
65 self
._ConnectivityNodeContainer
= None
66 self
.ConnectivityNodeContainer
= ConnectivityNodeContainer
68 self
._AngleRef
_TopologicalIsland
= None
69 self
.AngleRef_TopologicalIsland
= AngleRef_TopologicalIsland
71 super(TopologicalNode
, self
).__init
__(*args
, **kw_args
)
77 _refs
= ["Terminal", "TopologicalIsland", "ReportingGroup", "ConnectivityNodes", "SvInjection", "SvVoltage", "SvShortCircuit", "BaseVoltage", "ConnectivityNodeContainer", "AngleRef_TopologicalIsland"]
78 _many_refs
= ["Terminal", "ConnectivityNodes"]
80 def getTerminal(self
):
81 """The terminals associated with the topological node. This can be used as an alternative to the connectivity node path to terminal, thus making it unneccesary to model connedtivity nodes in some cases. Note that the if connectivity nodes are in the model, this association would proably not be used.
85 def setTerminal(self
, value
):
86 for x
in self
._Terminal
:
87 x
.TopologicalNode
= None
89 y
._TopologicalNode
= self
90 self
._Terminal
= value
92 Terminal
= property(getTerminal
, setTerminal
)
94 def addTerminal(self
, *Terminal
):
96 obj
.TopologicalNode
= self
98 def removeTerminal(self
, *Terminal
):
100 obj
.TopologicalNode
= None
102 def getTopologicalIsland(self
):
103 """A topological node belongs to a topological island
105 return self
._TopologicalIsland
107 def setTopologicalIsland(self
, value
):
108 if self
._TopologicalIsland
is not None:
109 filtered
= [x
for x
in self
.TopologicalIsland
.TopologicalNodes
if x
!= self
]
110 self
._TopologicalIsland
._TopologicalNodes
= filtered
112 self
._TopologicalIsland
= value
113 if self
._TopologicalIsland
is not None:
114 if self
not in self
._TopologicalIsland
._TopologicalNodes
:
115 self
._TopologicalIsland
._TopologicalNodes
.append(self
)
117 TopologicalIsland
= property(getTopologicalIsland
, setTopologicalIsland
)
119 def getReportingGroup(self
):
120 """The reporting group to which the topological node belongs.
122 return self
._ReportingGroup
124 def setReportingGroup(self
, value
):
125 if self
._ReportingGroup
is not None:
126 filtered
= [x
for x
in self
.ReportingGroup
.TopologicalNode
if x
!= self
]
127 self
._ReportingGroup
._TopologicalNode
= filtered
129 self
._ReportingGroup
= value
130 if self
._ReportingGroup
is not None:
131 if self
not in self
._ReportingGroup
._TopologicalNode
:
132 self
._ReportingGroup
._TopologicalNode
.append(self
)
134 ReportingGroup
= property(getReportingGroup
, setReportingGroup
)
136 def getConnectivityNodes(self
):
137 """Several ConnectivityNode(s) may combine together to form a single TopologicalNode, depending on the current state of the network.
139 return self
._ConnectivityNodes
141 def setConnectivityNodes(self
, value
):
142 for x
in self
._ConnectivityNodes
:
143 x
.TopologicalNode
= None
145 y
._TopologicalNode
= self
146 self
._ConnectivityNodes
= value
148 ConnectivityNodes
= property(getConnectivityNodes
, setConnectivityNodes
)
150 def addConnectivityNodes(self
, *ConnectivityNodes
):
151 for obj
in ConnectivityNodes
:
152 obj
.TopologicalNode
= self
154 def removeConnectivityNodes(self
, *ConnectivityNodes
):
155 for obj
in ConnectivityNodes
:
156 obj
.TopologicalNode
= None
158 def getSvInjection(self
):
159 """The injection state associated with the topological node.
161 return self
._SvInjection
163 def setSvInjection(self
, value
):
164 if self
._SvInjection
is not None:
165 self
._SvInjection
._TopologicalNode
= None
167 self
._SvInjection
= value
168 if self
._SvInjection
is not None:
169 self
._SvInjection
.TopologicalNode
= None
170 self
._SvInjection
._TopologicalNode
= self
172 SvInjection
= property(getSvInjection
, setSvInjection
)
174 def getSvVoltage(self
):
175 """The state voltage associated with the topological node.
177 return self
._SvVoltage
179 def setSvVoltage(self
, value
):
180 if self
._SvVoltage
is not None:
181 self
._SvVoltage
._TopologicalNode
= None
183 self
._SvVoltage
= value
184 if self
._SvVoltage
is not None:
185 self
._SvVoltage
.TopologicalNode
= None
186 self
._SvVoltage
._TopologicalNode
= self
188 SvVoltage
= property(getSvVoltage
, setSvVoltage
)
190 def getSvShortCircuit(self
):
191 """The short circuit state associated with the topological node.
193 return self
._SvShortCircuit
195 def setSvShortCircuit(self
, value
):
196 if self
._SvShortCircuit
is not None:
197 self
._SvShortCircuit
._TopologicalNode
= None
199 self
._SvShortCircuit
= value
200 if self
._SvShortCircuit
is not None:
201 self
._SvShortCircuit
.TopologicalNode
= None
202 self
._SvShortCircuit
._TopologicalNode
= self
204 SvShortCircuit
= property(getSvShortCircuit
, setSvShortCircuit
)
206 def getBaseVoltage(self
):
207 """The base voltage of the topologocial node.
209 return self
._BaseVoltage
211 def setBaseVoltage(self
, value
):
212 if self
._BaseVoltage
is not None:
213 filtered
= [x
for x
in self
.BaseVoltage
.TopologicalNode
if x
!= self
]
214 self
._BaseVoltage
._TopologicalNode
= filtered
216 self
._BaseVoltage
= value
217 if self
._BaseVoltage
is not None:
218 if self
not in self
._BaseVoltage
._TopologicalNode
:
219 self
._BaseVoltage
._TopologicalNode
.append(self
)
221 BaseVoltage
= property(getBaseVoltage
, setBaseVoltage
)
223 def getConnectivityNodeContainer(self
):
224 """The connectivity node container to which the toplogical node belongs.
226 return self
._ConnectivityNodeContainer
228 def setConnectivityNodeContainer(self
, value
):
229 if self
._ConnectivityNodeContainer
is not None:
230 filtered
= [x
for x
in self
.ConnectivityNodeContainer
.TopologicalNode
if x
!= self
]
231 self
._ConnectivityNodeContainer
._TopologicalNode
= filtered
233 self
._ConnectivityNodeContainer
= value
234 if self
._ConnectivityNodeContainer
is not None:
235 if self
not in self
._ConnectivityNodeContainer
._TopologicalNode
:
236 self
._ConnectivityNodeContainer
._TopologicalNode
.append(self
)
238 ConnectivityNodeContainer
= property(getConnectivityNodeContainer
, setConnectivityNodeContainer
)
240 def getAngleRef_TopologicalIsland(self
):
241 """The island for which the node is an angle reference. Normally there is one angle reference node for each island.
243 return self
._AngleRef
_TopologicalIsland
245 def setAngleRef_TopologicalIsland(self
, value
):
246 if self
._AngleRef
_TopologicalIsland
is not None:
247 self
._AngleRef
_TopologicalIsland
._AngleRef
_TopologicalNode
= None
249 self
._AngleRef
_TopologicalIsland
= value
250 if self
._AngleRef
_TopologicalIsland
is not None:
251 self
._AngleRef
_TopologicalIsland
.AngleRef_TopologicalNode
= None
252 self
._AngleRef
_TopologicalIsland
._AngleRef
_TopologicalNode
= self
254 AngleRef_TopologicalIsland
= property(getAngleRef_TopologicalIsland
, setAngleRef_TopologicalIsland
)