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 MetaBlockReference(IdentifiedObject
):
20 """References a control block at the internal meta dynamics model level. These references are contained in other blocks and reference the single instance of the meta model that defines a particular block definition. One would not expect to see bock references contained within a primitive block.
23 def __init__(self
, equationType
='', blockInputReference0
=None, MemberOf_MetaBlock
=None, MetaBlock
=None, blockOutputReference0
=None, MetaBlockStateReference
=None, MetaBlockInputReference
=None, MetaBlockOutputReference
=None, BlockParameter
=None, MetaBlockParameterReference
=None, *args
, **kw_args
):
24 """Initialises a new 'MetaBlockReference' instance.
26 @param equationType: should be enum, initial conditions vs. simulation equations
27 @param blockInputReference0:
28 @param MemberOf_MetaBlock:
30 @param blockOutputReference0:
31 @param MetaBlockStateReference:
32 @param MetaBlockInputReference:
33 @param MetaBlockOutputReference:
34 @param BlockParameter:
35 @param MetaBlockParameterReference:
37 #: should be enum, initial conditions vs. simulation equations
38 self
.equationType
= equationType
40 self
._blockInputReference
0 = []
41 self
.blockInputReference0
= [] if blockInputReference0
is None else blockInputReference0
43 self
._MemberOf
_MetaBlock
= None
44 self
.MemberOf_MetaBlock
= MemberOf_MetaBlock
46 self
.MetaBlock
= MetaBlock
48 self
._blockOutputReference
0 = []
49 self
.blockOutputReference0
= [] if blockOutputReference0
is None else blockOutputReference0
51 self
._MetaBlockStateReference
= []
52 self
.MetaBlockStateReference
= [] if MetaBlockStateReference
is None else MetaBlockStateReference
54 self
._MetaBlockInputReference
= []
55 self
.MetaBlockInputReference
= [] if MetaBlockInputReference
is None else MetaBlockInputReference
57 self
._MetaBlockOutputReference
= []
58 self
.MetaBlockOutputReference
= [] if MetaBlockOutputReference
is None else MetaBlockOutputReference
60 self
._BlockParameter
= []
61 self
.BlockParameter
= [] if BlockParameter
is None else BlockParameter
63 self
._MetaBlockParameterReference
= []
64 self
.MetaBlockParameterReference
= [] if MetaBlockParameterReference
is None else MetaBlockParameterReference
66 super(MetaBlockReference
, self
).__init
__(*args
, **kw_args
)
68 _attrs
= ["equationType"]
69 _attr_types
= {"equationType": str}
70 _defaults
= {"equationType": ''}
72 _refs
= ["blockInputReference0", "MemberOf_MetaBlock", "MetaBlock", "blockOutputReference0", "MetaBlockStateReference", "MetaBlockInputReference", "MetaBlockOutputReference", "BlockParameter", "MetaBlockParameterReference"]
73 _many_refs
= ["blockInputReference0", "blockOutputReference0", "MetaBlockStateReference", "MetaBlockInputReference", "MetaBlockOutputReference", "BlockParameter", "MetaBlockParameterReference"]
75 def getblockInputReference0(self
):
77 return self
._blockInputReference
0
79 def setblockInputReference0(self
, value
):
80 for x
in self
._blockInputReference
0:
81 x
.metaBlockReference0
= None
83 y
._metaBlockReference
0 = self
84 self
._blockInputReference
0 = value
86 blockInputReference0
= property(getblockInputReference0
, setblockInputReference0
)
88 def addblockInputReference0(self
, *blockInputReference0
):
89 for obj
in blockInputReference0
:
90 obj
.metaBlockReference0
= self
92 def removeblockInputReference0(self
, *blockInputReference0
):
93 for obj
in blockInputReference0
:
94 obj
.metaBlockReference0
= None
96 def getMemberOf_MetaBlock(self
):
98 return self
._MemberOf
_MetaBlock
100 def setMemberOf_MetaBlock(self
, value
):
101 if self
._MemberOf
_MetaBlock
is not None:
102 filtered
= [x
for x
in self
.MemberOf_MetaBlock
.MetaBlockReference
if x
!= self
]
103 self
._MemberOf
_MetaBlock
._MetaBlockReference
= filtered
105 self
._MemberOf
_MetaBlock
= value
106 if self
._MemberOf
_MetaBlock
is not None:
107 if self
not in self
._MemberOf
_MetaBlock
._MetaBlockReference
:
108 self
._MemberOf
_MetaBlock
._MetaBlockReference
.append(self
)
110 MemberOf_MetaBlock
= property(getMemberOf_MetaBlock
, setMemberOf_MetaBlock
)
114 def getblockOutputReference0(self
):
116 return self
._blockOutputReference
0
118 def setblockOutputReference0(self
, value
):
119 for p
in self
._blockOutputReference
0:
120 filtered
= [q
for q
in p
.metaBlockReference0
if q
!= self
]
121 self
._blockOutputReference
0._metaBlockReference
0 = filtered
123 if self
not in r
._metaBlockReference
0:
124 r
._metaBlockReference
0.append(self
)
125 self
._blockOutputReference
0 = value
127 blockOutputReference0
= property(getblockOutputReference0
, setblockOutputReference0
)
129 def addblockOutputReference0(self
, *blockOutputReference0
):
130 for obj
in blockOutputReference0
:
131 if self
not in obj
._metaBlockReference
0:
132 obj
._metaBlockReference
0.append(self
)
133 self
._blockOutputReference
0.append(obj
)
135 def removeblockOutputReference0(self
, *blockOutputReference0
):
136 for obj
in blockOutputReference0
:
137 if self
in obj
._metaBlockReference
0:
138 obj
._metaBlockReference
0.remove(self
)
139 self
._blockOutputReference
0.remove(obj
)
141 def getMetaBlockStateReference(self
):
143 return self
._MetaBlockStateReference
145 def setMetaBlockStateReference(self
, value
):
146 for x
in self
._MetaBlockStateReference
:
147 x
.MemberOf_MetaBlockReference
= None
149 y
._MemberOf
_MetaBlockReference
= self
150 self
._MetaBlockStateReference
= value
152 MetaBlockStateReference
= property(getMetaBlockStateReference
, setMetaBlockStateReference
)
154 def addMetaBlockStateReference(self
, *MetaBlockStateReference
):
155 for obj
in MetaBlockStateReference
:
156 obj
.MemberOf_MetaBlockReference
= self
158 def removeMetaBlockStateReference(self
, *MetaBlockStateReference
):
159 for obj
in MetaBlockStateReference
:
160 obj
.MemberOf_MetaBlockReference
= None
162 def getMetaBlockInputReference(self
):
164 return self
._MetaBlockInputReference
166 def setMetaBlockInputReference(self
, value
):
167 for x
in self
._MetaBlockInputReference
:
168 x
.MemberOf_MetaBlockReference
= None
170 y
._MemberOf
_MetaBlockReference
= self
171 self
._MetaBlockInputReference
= value
173 MetaBlockInputReference
= property(getMetaBlockInputReference
, setMetaBlockInputReference
)
175 def addMetaBlockInputReference(self
, *MetaBlockInputReference
):
176 for obj
in MetaBlockInputReference
:
177 obj
.MemberOf_MetaBlockReference
= self
179 def removeMetaBlockInputReference(self
, *MetaBlockInputReference
):
180 for obj
in MetaBlockInputReference
:
181 obj
.MemberOf_MetaBlockReference
= None
183 def getMetaBlockOutputReference(self
):
185 return self
._MetaBlockOutputReference
187 def setMetaBlockOutputReference(self
, value
):
188 for x
in self
._MetaBlockOutputReference
:
189 x
.MemberOf_MetaBlockReference
= None
191 y
._MemberOf
_MetaBlockReference
= self
192 self
._MetaBlockOutputReference
= value
194 MetaBlockOutputReference
= property(getMetaBlockOutputReference
, setMetaBlockOutputReference
)
196 def addMetaBlockOutputReference(self
, *MetaBlockOutputReference
):
197 for obj
in MetaBlockOutputReference
:
198 obj
.MemberOf_MetaBlockReference
= self
200 def removeMetaBlockOutputReference(self
, *MetaBlockOutputReference
):
201 for obj
in MetaBlockOutputReference
:
202 obj
.MemberOf_MetaBlockReference
= None
204 def getBlockParameter(self
):
206 return self
._BlockParameter
208 def setBlockParameter(self
, value
):
209 for x
in self
._BlockParameter
:
210 x
.MemberOf_MetaBlockReference
= None
212 y
._MemberOf
_MetaBlockReference
= self
213 self
._BlockParameter
= value
215 BlockParameter
= property(getBlockParameter
, setBlockParameter
)
217 def addBlockParameter(self
, *BlockParameter
):
218 for obj
in BlockParameter
:
219 obj
.MemberOf_MetaBlockReference
= self
221 def removeBlockParameter(self
, *BlockParameter
):
222 for obj
in BlockParameter
:
223 obj
.MemberOf_MetaBlockReference
= None
225 def getMetaBlockParameterReference(self
):
227 return self
._MetaBlockParameterReference
229 def setMetaBlockParameterReference(self
, value
):
230 for x
in self
._MetaBlockParameterReference
:
231 x
.MemberOf_MetaBlockReference
= None
233 y
._MemberOf
_MetaBlockReference
= self
234 self
._MetaBlockParameterReference
= value
236 MetaBlockParameterReference
= property(getMetaBlockParameterReference
, setMetaBlockParameterReference
)
238 def addMetaBlockParameterReference(self
, *MetaBlockParameterReference
):
239 for obj
in MetaBlockParameterReference
:
240 obj
.MemberOf_MetaBlockReference
= self
242 def removeMetaBlockParameterReference(self
, *MetaBlockParameterReference
):
243 for obj
in MetaBlockParameterReference
:
244 obj
.MemberOf_MetaBlockReference
= None