1 # Copyright (C) 2010 Richard Lincoln
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA
17 from CIM14
.IEC61970
.Core
.PowerSystemResource
import PowerSystemResource
19 class Block(PowerSystemResource
):
20 """A specific usage of a dynamics block, supplied with parameters and any linkages to the power system static model that are required. Sometimes a block is used to simply specify a location of input or output from dyanmics equations to the static model.
23 def __init__(self
, positiveFlowIn
=False, inService
=False, Terminal
=None, MemberOf_BlockConnectivity
=None, blockUsageInputReference0
=None, BlockUsageOutputReference
=None, PowerSystemResource
=None, slotReference0
=None, tieToMeasurement0
=None, MetaBlock
=None, BlockConnection
=None, BlockParameter
=None, *args
, **kw_args
):
24 """Initialises a new 'Block' instance.
26 @param positiveFlowIn: If true then any flows associated with a terminal are referenced as positive into the device.
28 @param Terminal: The optional terminal to which the block applies. This is used to link a specific terminal flow to the dynamics block.
29 @param MemberOf_BlockConnectivity:
30 @param blockUsageInputReference0:
31 @param BlockUsageOutputReference:
32 @param PowerSystemResource: The power system resource associated with the dyanmics block instance. This is optional because sometimes no linkage is needed, yet parameters must be specified. Also the linkage to Terminal can be used instead of the linkage to PowerSystemResource.
33 @param slotReference0:
34 @param tieToMeasurement0:
36 @param BlockConnection:
37 @param BlockParameter:
39 #: If true then any flows associated with a terminal are referenced as positive into the device.
40 self
.positiveFlowIn
= positiveFlowIn
43 self
.inService
= inService
46 self
.Terminal
= Terminal
48 self
._MemberOf
_BlockConnectivity
= None
49 self
.MemberOf_BlockConnectivity
= MemberOf_BlockConnectivity
51 self
._blockUsageInputReference
0 = []
52 self
.blockUsageInputReference0
= [] if blockUsageInputReference0
is None else blockUsageInputReference0
54 self
._BlockUsageOutputReference
= []
55 self
.BlockUsageOutputReference
= [] if BlockUsageOutputReference
is None else BlockUsageOutputReference
57 self
._PowerSystemResource
= None
58 self
.PowerSystemResource
= PowerSystemResource
60 self
._slotReference
0 = None
61 self
.slotReference0
= slotReference0
63 self
._tieToMeasurement
0 = []
64 self
.tieToMeasurement0
= [] if tieToMeasurement0
is None else tieToMeasurement0
66 self
._MetaBlock
= None
67 self
.MetaBlock
= MetaBlock
69 self
._BlockConnection
= []
70 self
.BlockConnection
= [] if BlockConnection
is None else BlockConnection
72 self
._BlockParameter
= []
73 self
.BlockParameter
= [] if BlockParameter
is None else BlockParameter
75 super(Block
, self
).__init
__(*args
, **kw_args
)
77 _attrs
= ["positiveFlowIn", "inService"]
78 _attr_types
= {"positiveFlowIn": bool, "inService": bool}
79 _defaults
= {"positiveFlowIn": False, "inService": False}
81 _refs
= ["Terminal", "MemberOf_BlockConnectivity", "blockUsageInputReference0", "BlockUsageOutputReference", "PowerSystemResource", "slotReference0", "tieToMeasurement0", "MetaBlock", "BlockConnection", "BlockParameter"]
82 _many_refs
= ["blockUsageInputReference0", "BlockUsageOutputReference", "tieToMeasurement0", "BlockConnection", "BlockParameter"]
84 def getTerminal(self
):
85 """The optional terminal to which the block applies. This is used to link a specific terminal flow to the dynamics block.
89 def setTerminal(self
, value
):
90 if self
._Terminal
is not None:
91 filtered
= [x
for x
in self
.Terminal
.Block
if x
!= self
]
92 self
._Terminal
._Block
= filtered
94 self
._Terminal
= value
95 if self
._Terminal
is not None:
96 if self
not in self
._Terminal
._Block
:
97 self
._Terminal
._Block
.append(self
)
99 Terminal
= property(getTerminal
, setTerminal
)
101 def getMemberOf_BlockConnectivity(self
):
103 return self
._MemberOf
_BlockConnectivity
105 def setMemberOf_BlockConnectivity(self
, value
):
106 if self
._MemberOf
_BlockConnectivity
is not None:
107 filtered
= [x
for x
in self
.MemberOf_BlockConnectivity
.Block
if x
!= self
]
108 self
._MemberOf
_BlockConnectivity
._Block
= filtered
110 self
._MemberOf
_BlockConnectivity
= value
111 if self
._MemberOf
_BlockConnectivity
is not None:
112 if self
not in self
._MemberOf
_BlockConnectivity
._Block
:
113 self
._MemberOf
_BlockConnectivity
._Block
.append(self
)
115 MemberOf_BlockConnectivity
= property(getMemberOf_BlockConnectivity
, setMemberOf_BlockConnectivity
)
117 def getblockUsageInputReference0(self
):
119 return self
._blockUsageInputReference
0
121 def setblockUsageInputReference0(self
, value
):
122 for x
in self
._blockUsageInputReference
0:
126 self
._blockUsageInputReference
0 = value
128 blockUsageInputReference0
= property(getblockUsageInputReference0
, setblockUsageInputReference0
)
130 def addblockUsageInputReference0(self
, *blockUsageInputReference0
):
131 for obj
in blockUsageInputReference0
:
134 def removeblockUsageInputReference0(self
, *blockUsageInputReference0
):
135 for obj
in blockUsageInputReference0
:
138 def getBlockUsageOutputReference(self
):
140 return self
._BlockUsageOutputReference
142 def setBlockUsageOutputReference(self
, value
):
143 for x
in self
._BlockUsageOutputReference
:
147 self
._BlockUsageOutputReference
= value
149 BlockUsageOutputReference
= property(getBlockUsageOutputReference
, setBlockUsageOutputReference
)
151 def addBlockUsageOutputReference(self
, *BlockUsageOutputReference
):
152 for obj
in BlockUsageOutputReference
:
155 def removeBlockUsageOutputReference(self
, *BlockUsageOutputReference
):
156 for obj
in BlockUsageOutputReference
:
159 def getPowerSystemResource(self
):
160 """The power system resource associated with the dyanmics block instance. This is optional because sometimes no linkage is needed, yet parameters must be specified. Also the linkage to Terminal can be used instead of the linkage to PowerSystemResource.
162 return self
._PowerSystemResource
164 def setPowerSystemResource(self
, value
):
165 if self
._PowerSystemResource
is not None:
166 filtered
= [x
for x
in self
.PowerSystemResource
.Block
if x
!= self
]
167 self
._PowerSystemResource
._Block
= filtered
169 self
._PowerSystemResource
= value
170 if self
._PowerSystemResource
is not None:
171 if self
not in self
._PowerSystemResource
._Block
:
172 self
._PowerSystemResource
._Block
.append(self
)
174 PowerSystemResource
= property(getPowerSystemResource
, setPowerSystemResource
)
176 def getslotReference0(self
):
178 return self
._slotReference
0
180 def setslotReference0(self
, value
):
181 if self
._slotReference
0 is not None:
182 filtered
= [x
for x
in self
.slotReference0
.block0
if x
!= self
]
183 self
._slotReference
0._block
0 = filtered
185 self
._slotReference
0 = value
186 if self
._slotReference
0 is not None:
187 if self
not in self
._slotReference
0._block
0:
188 self
._slotReference
0._block
0.append(self
)
190 slotReference0
= property(getslotReference0
, setslotReference0
)
192 def gettieToMeasurement0(self
):
194 return self
._tieToMeasurement
0
196 def settieToMeasurement0(self
, value
):
197 for x
in self
._tieToMeasurement
0:
201 self
._tieToMeasurement
0 = value
203 tieToMeasurement0
= property(gettieToMeasurement0
, settieToMeasurement0
)
205 def addtieToMeasurement0(self
, *tieToMeasurement0
):
206 for obj
in tieToMeasurement0
:
209 def removetieToMeasurement0(self
, *tieToMeasurement0
):
210 for obj
in tieToMeasurement0
:
213 def getMetaBlock(self
):
215 return self
._MetaBlock
217 def setMetaBlock(self
, value
):
218 if self
._MetaBlock
is not None:
219 filtered
= [x
for x
in self
.MetaBlock
.Block
if x
!= self
]
220 self
._MetaBlock
._Block
= filtered
222 self
._MetaBlock
= value
223 if self
._MetaBlock
is not None:
224 if self
not in self
._MetaBlock
._Block
:
225 self
._MetaBlock
._Block
.append(self
)
227 MetaBlock
= property(getMetaBlock
, setMetaBlock
)
229 def getBlockConnection(self
):
231 return self
._BlockConnection
233 def setBlockConnection(self
, value
):
234 for x
in self
._BlockConnection
:
238 self
._BlockConnection
= value
240 BlockConnection
= property(getBlockConnection
, setBlockConnection
)
242 def addBlockConnection(self
, *BlockConnection
):
243 for obj
in BlockConnection
:
246 def removeBlockConnection(self
, *BlockConnection
):
247 for obj
in BlockConnection
:
250 def getBlockParameter(self
):
252 return self
._BlockParameter
254 def setBlockParameter(self
, value
):
255 for x
in self
._BlockParameter
:
256 x
.MemberOf_Block
= None
258 y
._MemberOf
_Block
= self
259 self
._BlockParameter
= value
261 BlockParameter
= property(getBlockParameter
, setBlockParameter
)
263 def addBlockParameter(self
, *BlockParameter
):
264 for obj
in BlockParameter
:
265 obj
.MemberOf_Block
= self
267 def removeBlockParameter(self
, *BlockParameter
):
268 for obj
in BlockParameter
:
269 obj
.MemberOf_Block
= None