Implementing RDF/XML serialisation using meta-data attributes.
[PyCIM.git] / schemata / CIM14 / Dynamics / MetaBlock.py
blob3cdee670ddcb0572bd878a821fffedbff96372d3
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.IdentifiedObject import IdentifiedObject
19 class MetaBlock(IdentifiedObject):
20 """A block is a meta-data representation of a control block. It has an external interface and an optinal internal interface. Blocks internals can be ommitted if the block is well understood by both exchange parties. When well understood by both partice the block can be treated as a primitive block. All dynamic models must be defined to the level of primtive blocks in order for the model to be consumed and used for dynamic simulation. Examples of primitive blocks include a well known IEEE exciter model, a summation block, or an integrator block.
21 """
23 def __init__(self, blockKind="powerSystemStabilizer", internal=False, proprietary=False, primitive=False, MetaBlockReference=None, MetaBlockOutput=None, MetaBlockState=None, MetaBlockSignal=None, blockType0=None, MetaBlockInput=None, blockConstant0=None, Block=None, MetaBlockParameter=None, *args, **kw_args):
24 """Initialises a new 'MetaBlock' instance.
26 @param blockKind: Enumeration type: StandardControlBlock, Excitation System, ... Name used to distinguish which standard control block (Integration, Summation, ...)? Values are: "powerSystemStabilizer", "automaticVoltageControl", "turbine", "govenor", "dotDotDot", "energySource", "exciter"
27 @param internal: This block is intended to be used only internally within other blocks. An example would be a summation or integrator block. Such bocks are typically also primitive, though more complex internal blocks made up of other primitive controls could be built.
28 @param proprietary: This block is a proprietary block. Only inputs, outputs and parameters are exchanged.
29 @param primitive: Iindicates this type is treated as a primitive type and therefore the internal block model can be ignored and is not typically defined in the model. Primitive blocks include such basic things as summation and standard IEEEexciter models. The exchange parties must agree on the meaning of primitive blocks according to their identification.
30 @param MetaBlockReference:
31 @param MetaBlockOutput: Outputs that belong to the block.
32 @param MetaBlockState:
33 @param MetaBlockSignal:
34 @param blockType0:
35 @param MetaBlockInput: Inputs belong to a block.
36 @param blockConstant0:
37 @param Block:
38 @param MetaBlockParameter: Paramters belong to a block.
39 """
40 #: Enumeration type: StandardControlBlock, Excitation System, ... Name used to distinguish which standard control block (Integration, Summation, ...)? Values are: "powerSystemStabilizer", "automaticVoltageControl", "turbine", "govenor", "dotDotDot", "energySource", "exciter"
41 self.blockKind = blockKind
43 #: This block is intended to be used only internally within other blocks. An example would be a summation or integrator block. Such bocks are typically also primitive, though more complex internal blocks made up of other primitive controls could be built.
44 self.internal = internal
46 #: This block is a proprietary block. Only inputs, outputs and parameters are exchanged.
47 self.proprietary = proprietary
49 #: Iindicates this type is treated as a primitive type and therefore the internal block model can be ignored and is not typically defined in the model. Primitive blocks include such basic things as summation and standard IEEEexciter models. The exchange parties must agree on the meaning of primitive blocks according to their identification.
50 self.primitive = primitive
52 self._MetaBlockReference = []
53 self.MetaBlockReference = [] if MetaBlockReference is None else MetaBlockReference
55 self._MetaBlockOutput = []
56 self.MetaBlockOutput = [] if MetaBlockOutput is None else MetaBlockOutput
58 self._MetaBlockState = []
59 self.MetaBlockState = [] if MetaBlockState is None else MetaBlockState
61 self._MetaBlockSignal = []
62 self.MetaBlockSignal = [] if MetaBlockSignal is None else MetaBlockSignal
64 self._blockType0 = None
65 self.blockType0 = blockType0
67 self._MetaBlockInput = []
68 self.MetaBlockInput = [] if MetaBlockInput is None else MetaBlockInput
70 self._blockConstant0 = []
71 self.blockConstant0 = [] if blockConstant0 is None else blockConstant0
73 self._Block = []
74 self.Block = [] if Block is None else Block
76 self._MetaBlockParameter = []
77 self.MetaBlockParameter = [] if MetaBlockParameter is None else MetaBlockParameter
79 super(MetaBlock, self).__init__(*args, **kw_args)
81 _attrs = ["blockKind", "internal", "proprietary", "primitive"]
82 _attr_types = {"blockKind": str, "internal": bool, "proprietary": bool, "primitive": bool}
83 _defaults = {"blockKind": "powerSystemStabilizer", "internal": False, "proprietary": False, "primitive": False}
84 _enums = {"blockKind": "BlockKind"}
85 _refs = ["MetaBlockReference", "MetaBlockOutput", "MetaBlockState", "MetaBlockSignal", "blockType0", "MetaBlockInput", "blockConstant0", "Block", "MetaBlockParameter"]
86 _many_refs = ["MetaBlockReference", "MetaBlockOutput", "MetaBlockState", "MetaBlockSignal", "MetaBlockInput", "blockConstant0", "Block", "MetaBlockParameter"]
88 def getMetaBlockReference(self):
90 return self._MetaBlockReference
92 def setMetaBlockReference(self, value):
93 for x in self._MetaBlockReference:
94 x._MemberOf_MetaBlock = None
95 for y in value:
96 y._MemberOf_MetaBlock = self
97 self._MetaBlockReference = value
99 MetaBlockReference = property(getMetaBlockReference, setMetaBlockReference)
101 def addMetaBlockReference(self, *MetaBlockReference):
102 for obj in MetaBlockReference:
103 obj._MemberOf_MetaBlock = self
104 self._MetaBlockReference.append(obj)
106 def removeMetaBlockReference(self, *MetaBlockReference):
107 for obj in MetaBlockReference:
108 obj._MemberOf_MetaBlock = None
109 self._MetaBlockReference.remove(obj)
111 def getMetaBlockOutput(self):
112 """Outputs that belong to the block.
114 return self._MetaBlockOutput
116 def setMetaBlockOutput(self, value):
117 for x in self._MetaBlockOutput:
118 x._MemberOf_MetaBlock = None
119 for y in value:
120 y._MemberOf_MetaBlock = self
121 self._MetaBlockOutput = value
123 MetaBlockOutput = property(getMetaBlockOutput, setMetaBlockOutput)
125 def addMetaBlockOutput(self, *MetaBlockOutput):
126 for obj in MetaBlockOutput:
127 obj._MemberOf_MetaBlock = self
128 self._MetaBlockOutput.append(obj)
130 def removeMetaBlockOutput(self, *MetaBlockOutput):
131 for obj in MetaBlockOutput:
132 obj._MemberOf_MetaBlock = None
133 self._MetaBlockOutput.remove(obj)
135 def getMetaBlockState(self):
137 return self._MetaBlockState
139 def setMetaBlockState(self, value):
140 for x in self._MetaBlockState:
141 x._MemberOf_MetaBlock = None
142 for y in value:
143 y._MemberOf_MetaBlock = self
144 self._MetaBlockState = value
146 MetaBlockState = property(getMetaBlockState, setMetaBlockState)
148 def addMetaBlockState(self, *MetaBlockState):
149 for obj in MetaBlockState:
150 obj._MemberOf_MetaBlock = self
151 self._MetaBlockState.append(obj)
153 def removeMetaBlockState(self, *MetaBlockState):
154 for obj in MetaBlockState:
155 obj._MemberOf_MetaBlock = None
156 self._MetaBlockState.remove(obj)
158 def getMetaBlockSignal(self):
160 return self._MetaBlockSignal
162 def setMetaBlockSignal(self, value):
163 for x in self._MetaBlockSignal:
164 x._MemberOf_MetaBlock = None
165 for y in value:
166 y._MemberOf_MetaBlock = self
167 self._MetaBlockSignal = value
169 MetaBlockSignal = property(getMetaBlockSignal, setMetaBlockSignal)
171 def addMetaBlockSignal(self, *MetaBlockSignal):
172 for obj in MetaBlockSignal:
173 obj._MemberOf_MetaBlock = self
174 self._MetaBlockSignal.append(obj)
176 def removeMetaBlockSignal(self, *MetaBlockSignal):
177 for obj in MetaBlockSignal:
178 obj._MemberOf_MetaBlock = None
179 self._MetaBlockSignal.remove(obj)
181 def getblockType0(self):
183 return self._blockType0
185 def setblockType0(self, value):
186 if self._blockType0 is not None:
187 filtered = [x for x in self.blockType0.metaBlock0 if x != self]
188 self._blockType0._metaBlock0 = filtered
190 self._blockType0 = value
191 if self._blockType0 is not None:
192 self._blockType0._metaBlock0.append(self)
194 blockType0 = property(getblockType0, setblockType0)
196 def getMetaBlockInput(self):
197 """Inputs belong to a block.
199 return self._MetaBlockInput
201 def setMetaBlockInput(self, value):
202 for x in self._MetaBlockInput:
203 x._MemberOf_MetaBlock = None
204 for y in value:
205 y._MemberOf_MetaBlock = self
206 self._MetaBlockInput = value
208 MetaBlockInput = property(getMetaBlockInput, setMetaBlockInput)
210 def addMetaBlockInput(self, *MetaBlockInput):
211 for obj in MetaBlockInput:
212 obj._MemberOf_MetaBlock = self
213 self._MetaBlockInput.append(obj)
215 def removeMetaBlockInput(self, *MetaBlockInput):
216 for obj in MetaBlockInput:
217 obj._MemberOf_MetaBlock = None
218 self._MetaBlockInput.remove(obj)
220 def getblockConstant0(self):
222 return self._blockConstant0
224 def setblockConstant0(self, value):
225 for x in self._blockConstant0:
226 x._metaBlock0 = None
227 for y in value:
228 y._metaBlock0 = self
229 self._blockConstant0 = value
231 blockConstant0 = property(getblockConstant0, setblockConstant0)
233 def addblockConstant0(self, *blockConstant0):
234 for obj in blockConstant0:
235 obj._metaBlock0 = self
236 self._blockConstant0.append(obj)
238 def removeblockConstant0(self, *blockConstant0):
239 for obj in blockConstant0:
240 obj._metaBlock0 = None
241 self._blockConstant0.remove(obj)
243 def getBlock(self):
245 return self._Block
247 def setBlock(self, value):
248 for x in self._Block:
249 x._MetaBlock = None
250 for y in value:
251 y._MetaBlock = self
252 self._Block = value
254 Block = property(getBlock, setBlock)
256 def addBlock(self, *Block):
257 for obj in Block:
258 obj._MetaBlock = self
259 self._Block.append(obj)
261 def removeBlock(self, *Block):
262 for obj in Block:
263 obj._MetaBlock = None
264 self._Block.remove(obj)
266 def getMetaBlockParameter(self):
267 """Paramters belong to a block.
269 return self._MetaBlockParameter
271 def setMetaBlockParameter(self, value):
272 for x in self._MetaBlockParameter:
273 x._MemberOf_MetaBlock = None
274 for y in value:
275 y._MemberOf_MetaBlock = self
276 self._MetaBlockParameter = value
278 MetaBlockParameter = property(getMetaBlockParameter, setMetaBlockParameter)
280 def addMetaBlockParameter(self, *MetaBlockParameter):
281 for obj in MetaBlockParameter:
282 obj._MemberOf_MetaBlock = self
283 self._MetaBlockParameter.append(obj)
285 def removeMetaBlockParameter(self, *MetaBlockParameter):
286 for obj in MetaBlockParameter:
287 obj._MemberOf_MetaBlock = None
288 self._MetaBlockParameter.remove(obj)