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 Block(PowerSystemResource
):
24 """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.
27 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
):
28 """Initialises a new 'Block' instance.
30 @param positiveFlowIn: If true then any flows associated with a terminal are referenced as positive into the device.
32 @param Terminal: The optional terminal to which the block applies. This is used to link a specific terminal flow to the dynamics block.
33 @param MemberOf_BlockConnectivity:
34 @param blockUsageInputReference0:
35 @param BlockUsageOutputReference:
36 @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.
37 @param slotReference0:
38 @param tieToMeasurement0:
40 @param BlockConnection:
41 @param BlockParameter:
43 #: If true then any flows associated with a terminal are referenced as positive into the device.
44 self
.positiveFlowIn
= positiveFlowIn
47 self
.inService
= inService
50 self
.Terminal
= Terminal
52 self
._MemberOf
_BlockConnectivity
= None
53 self
.MemberOf_BlockConnectivity
= MemberOf_BlockConnectivity
55 self
._blockUsageInputReference
0 = []
56 self
.blockUsageInputReference0
= [] if blockUsageInputReference0
is None else blockUsageInputReference0
58 self
._BlockUsageOutputReference
= []
59 self
.BlockUsageOutputReference
= [] if BlockUsageOutputReference
is None else BlockUsageOutputReference
61 self
._PowerSystemResource
= None
62 self
.PowerSystemResource
= PowerSystemResource
64 self
._slotReference
0 = None
65 self
.slotReference0
= slotReference0
67 self
._tieToMeasurement
0 = []
68 self
.tieToMeasurement0
= [] if tieToMeasurement0
is None else tieToMeasurement0
70 self
._MetaBlock
= None
71 self
.MetaBlock
= MetaBlock
73 self
._BlockConnection
= []
74 self
.BlockConnection
= [] if BlockConnection
is None else BlockConnection
76 self
._BlockParameter
= []
77 self
.BlockParameter
= [] if BlockParameter
is None else BlockParameter
79 super(Block
, self
).__init
__(*args
, **kw_args
)
81 _attrs
= ["positiveFlowIn", "inService"]
82 _attr_types
= {"positiveFlowIn": bool, "inService": bool}
83 _defaults
= {"positiveFlowIn": False, "inService": False}
85 _refs
= ["Terminal", "MemberOf_BlockConnectivity", "blockUsageInputReference0", "BlockUsageOutputReference", "PowerSystemResource", "slotReference0", "tieToMeasurement0", "MetaBlock", "BlockConnection", "BlockParameter"]
86 _many_refs
= ["blockUsageInputReference0", "BlockUsageOutputReference", "tieToMeasurement0", "BlockConnection", "BlockParameter"]
88 def getTerminal(self
):
89 """The optional terminal to which the block applies. This is used to link a specific terminal flow to the dynamics block.
93 def setTerminal(self
, value
):
94 if self
._Terminal
is not None:
95 filtered
= [x
for x
in self
.Terminal
.Block
if x
!= self
]
96 self
._Terminal
._Block
= filtered
98 self
._Terminal
= value
99 if self
._Terminal
is not None:
100 if self
not in self
._Terminal
._Block
:
101 self
._Terminal
._Block
.append(self
)
103 Terminal
= property(getTerminal
, setTerminal
)
105 def getMemberOf_BlockConnectivity(self
):
107 return self
._MemberOf
_BlockConnectivity
109 def setMemberOf_BlockConnectivity(self
, value
):
110 if self
._MemberOf
_BlockConnectivity
is not None:
111 filtered
= [x
for x
in self
.MemberOf_BlockConnectivity
.Block
if x
!= self
]
112 self
._MemberOf
_BlockConnectivity
._Block
= filtered
114 self
._MemberOf
_BlockConnectivity
= value
115 if self
._MemberOf
_BlockConnectivity
is not None:
116 if self
not in self
._MemberOf
_BlockConnectivity
._Block
:
117 self
._MemberOf
_BlockConnectivity
._Block
.append(self
)
119 MemberOf_BlockConnectivity
= property(getMemberOf_BlockConnectivity
, setMemberOf_BlockConnectivity
)
121 def getblockUsageInputReference0(self
):
123 return self
._blockUsageInputReference
0
125 def setblockUsageInputReference0(self
, value
):
126 for x
in self
._blockUsageInputReference
0:
130 self
._blockUsageInputReference
0 = value
132 blockUsageInputReference0
= property(getblockUsageInputReference0
, setblockUsageInputReference0
)
134 def addblockUsageInputReference0(self
, *blockUsageInputReference0
):
135 for obj
in blockUsageInputReference0
:
138 def removeblockUsageInputReference0(self
, *blockUsageInputReference0
):
139 for obj
in blockUsageInputReference0
:
142 def getBlockUsageOutputReference(self
):
144 return self
._BlockUsageOutputReference
146 def setBlockUsageOutputReference(self
, value
):
147 for x
in self
._BlockUsageOutputReference
:
151 self
._BlockUsageOutputReference
= value
153 BlockUsageOutputReference
= property(getBlockUsageOutputReference
, setBlockUsageOutputReference
)
155 def addBlockUsageOutputReference(self
, *BlockUsageOutputReference
):
156 for obj
in BlockUsageOutputReference
:
159 def removeBlockUsageOutputReference(self
, *BlockUsageOutputReference
):
160 for obj
in BlockUsageOutputReference
:
163 def getPowerSystemResource(self
):
164 """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.
166 return self
._PowerSystemResource
168 def setPowerSystemResource(self
, value
):
169 if self
._PowerSystemResource
is not None:
170 filtered
= [x
for x
in self
.PowerSystemResource
.Block
if x
!= self
]
171 self
._PowerSystemResource
._Block
= filtered
173 self
._PowerSystemResource
= value
174 if self
._PowerSystemResource
is not None:
175 if self
not in self
._PowerSystemResource
._Block
:
176 self
._PowerSystemResource
._Block
.append(self
)
178 PowerSystemResource
= property(getPowerSystemResource
, setPowerSystemResource
)
180 def getslotReference0(self
):
182 return self
._slotReference
0
184 def setslotReference0(self
, value
):
185 if self
._slotReference
0 is not None:
186 filtered
= [x
for x
in self
.slotReference0
.block0
if x
!= self
]
187 self
._slotReference
0._block
0 = filtered
189 self
._slotReference
0 = value
190 if self
._slotReference
0 is not None:
191 if self
not in self
._slotReference
0._block
0:
192 self
._slotReference
0._block
0.append(self
)
194 slotReference0
= property(getslotReference0
, setslotReference0
)
196 def gettieToMeasurement0(self
):
198 return self
._tieToMeasurement
0
200 def settieToMeasurement0(self
, value
):
201 for x
in self
._tieToMeasurement
0:
205 self
._tieToMeasurement
0 = value
207 tieToMeasurement0
= property(gettieToMeasurement0
, settieToMeasurement0
)
209 def addtieToMeasurement0(self
, *tieToMeasurement0
):
210 for obj
in tieToMeasurement0
:
213 def removetieToMeasurement0(self
, *tieToMeasurement0
):
214 for obj
in tieToMeasurement0
:
217 def getMetaBlock(self
):
219 return self
._MetaBlock
221 def setMetaBlock(self
, value
):
222 if self
._MetaBlock
is not None:
223 filtered
= [x
for x
in self
.MetaBlock
.Block
if x
!= self
]
224 self
._MetaBlock
._Block
= filtered
226 self
._MetaBlock
= value
227 if self
._MetaBlock
is not None:
228 if self
not in self
._MetaBlock
._Block
:
229 self
._MetaBlock
._Block
.append(self
)
231 MetaBlock
= property(getMetaBlock
, setMetaBlock
)
233 def getBlockConnection(self
):
235 return self
._BlockConnection
237 def setBlockConnection(self
, value
):
238 for x
in self
._BlockConnection
:
242 self
._BlockConnection
= value
244 BlockConnection
= property(getBlockConnection
, setBlockConnection
)
246 def addBlockConnection(self
, *BlockConnection
):
247 for obj
in BlockConnection
:
250 def removeBlockConnection(self
, *BlockConnection
):
251 for obj
in BlockConnection
:
254 def getBlockParameter(self
):
256 return self
._BlockParameter
258 def setBlockParameter(self
, value
):
259 for x
in self
._BlockParameter
:
260 x
.MemberOf_Block
= None
262 y
._MemberOf
_Block
= self
263 self
._BlockParameter
= value
265 BlockParameter
= property(getBlockParameter
, setBlockParameter
)
267 def addBlockParameter(self
, *BlockParameter
):
268 for obj
in BlockParameter
:
269 obj
.MemberOf_Block
= self
271 def removeBlockParameter(self
, *BlockParameter
):
272 for obj
in BlockParameter
:
273 obj
.MemberOf_Block
= None