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 MetaBlockReference(IdentifiedObject
):
24 """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.
27 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
):
28 """Initialises a new 'MetaBlockReference' instance.
30 @param equationType: should be enum, initial conditions vs. simulation equations
31 @param blockInputReference0:
32 @param MemberOf_MetaBlock:
34 @param blockOutputReference0:
35 @param MetaBlockStateReference:
36 @param MetaBlockInputReference:
37 @param MetaBlockOutputReference:
38 @param BlockParameter:
39 @param MetaBlockParameterReference:
41 #: should be enum, initial conditions vs. simulation equations
42 self
.equationType
= equationType
44 self
._blockInputReference
0 = []
45 self
.blockInputReference0
= [] if blockInputReference0
is None else blockInputReference0
47 self
._MemberOf
_MetaBlock
= None
48 self
.MemberOf_MetaBlock
= MemberOf_MetaBlock
50 self
.MetaBlock
= MetaBlock
52 self
._blockOutputReference
0 = []
53 self
.blockOutputReference0
= [] if blockOutputReference0
is None else blockOutputReference0
55 self
._MetaBlockStateReference
= []
56 self
.MetaBlockStateReference
= [] if MetaBlockStateReference
is None else MetaBlockStateReference
58 self
._MetaBlockInputReference
= []
59 self
.MetaBlockInputReference
= [] if MetaBlockInputReference
is None else MetaBlockInputReference
61 self
._MetaBlockOutputReference
= []
62 self
.MetaBlockOutputReference
= [] if MetaBlockOutputReference
is None else MetaBlockOutputReference
64 self
._BlockParameter
= []
65 self
.BlockParameter
= [] if BlockParameter
is None else BlockParameter
67 self
._MetaBlockParameterReference
= []
68 self
.MetaBlockParameterReference
= [] if MetaBlockParameterReference
is None else MetaBlockParameterReference
70 super(MetaBlockReference
, self
).__init
__(*args
, **kw_args
)
72 _attrs
= ["equationType"]
73 _attr_types
= {"equationType": str}
74 _defaults
= {"equationType": ''}
76 _refs
= ["blockInputReference0", "MemberOf_MetaBlock", "MetaBlock", "blockOutputReference0", "MetaBlockStateReference", "MetaBlockInputReference", "MetaBlockOutputReference", "BlockParameter", "MetaBlockParameterReference"]
77 _many_refs
= ["blockInputReference0", "blockOutputReference0", "MetaBlockStateReference", "MetaBlockInputReference", "MetaBlockOutputReference", "BlockParameter", "MetaBlockParameterReference"]
79 def getblockInputReference0(self
):
81 return self
._blockInputReference
0
83 def setblockInputReference0(self
, value
):
84 for x
in self
._blockInputReference
0:
85 x
.metaBlockReference0
= None
87 y
._metaBlockReference
0 = self
88 self
._blockInputReference
0 = value
90 blockInputReference0
= property(getblockInputReference0
, setblockInputReference0
)
92 def addblockInputReference0(self
, *blockInputReference0
):
93 for obj
in blockInputReference0
:
94 obj
.metaBlockReference0
= self
96 def removeblockInputReference0(self
, *blockInputReference0
):
97 for obj
in blockInputReference0
:
98 obj
.metaBlockReference0
= None
100 def getMemberOf_MetaBlock(self
):
102 return self
._MemberOf
_MetaBlock
104 def setMemberOf_MetaBlock(self
, value
):
105 if self
._MemberOf
_MetaBlock
is not None:
106 filtered
= [x
for x
in self
.MemberOf_MetaBlock
.MetaBlockReference
if x
!= self
]
107 self
._MemberOf
_MetaBlock
._MetaBlockReference
= filtered
109 self
._MemberOf
_MetaBlock
= value
110 if self
._MemberOf
_MetaBlock
is not None:
111 if self
not in self
._MemberOf
_MetaBlock
._MetaBlockReference
:
112 self
._MemberOf
_MetaBlock
._MetaBlockReference
.append(self
)
114 MemberOf_MetaBlock
= property(getMemberOf_MetaBlock
, setMemberOf_MetaBlock
)
118 def getblockOutputReference0(self
):
120 return self
._blockOutputReference
0
122 def setblockOutputReference0(self
, value
):
123 for p
in self
._blockOutputReference
0:
124 filtered
= [q
for q
in p
.metaBlockReference0
if q
!= self
]
125 self
._blockOutputReference
0._metaBlockReference
0 = filtered
127 if self
not in r
._metaBlockReference
0:
128 r
._metaBlockReference
0.append(self
)
129 self
._blockOutputReference
0 = value
131 blockOutputReference0
= property(getblockOutputReference0
, setblockOutputReference0
)
133 def addblockOutputReference0(self
, *blockOutputReference0
):
134 for obj
in blockOutputReference0
:
135 if self
not in obj
._metaBlockReference
0:
136 obj
._metaBlockReference
0.append(self
)
137 self
._blockOutputReference
0.append(obj
)
139 def removeblockOutputReference0(self
, *blockOutputReference0
):
140 for obj
in blockOutputReference0
:
141 if self
in obj
._metaBlockReference
0:
142 obj
._metaBlockReference
0.remove(self
)
143 self
._blockOutputReference
0.remove(obj
)
145 def getMetaBlockStateReference(self
):
147 return self
._MetaBlockStateReference
149 def setMetaBlockStateReference(self
, value
):
150 for x
in self
._MetaBlockStateReference
:
151 x
.MemberOf_MetaBlockReference
= None
153 y
._MemberOf
_MetaBlockReference
= self
154 self
._MetaBlockStateReference
= value
156 MetaBlockStateReference
= property(getMetaBlockStateReference
, setMetaBlockStateReference
)
158 def addMetaBlockStateReference(self
, *MetaBlockStateReference
):
159 for obj
in MetaBlockStateReference
:
160 obj
.MemberOf_MetaBlockReference
= self
162 def removeMetaBlockStateReference(self
, *MetaBlockStateReference
):
163 for obj
in MetaBlockStateReference
:
164 obj
.MemberOf_MetaBlockReference
= None
166 def getMetaBlockInputReference(self
):
168 return self
._MetaBlockInputReference
170 def setMetaBlockInputReference(self
, value
):
171 for x
in self
._MetaBlockInputReference
:
172 x
.MemberOf_MetaBlockReference
= None
174 y
._MemberOf
_MetaBlockReference
= self
175 self
._MetaBlockInputReference
= value
177 MetaBlockInputReference
= property(getMetaBlockInputReference
, setMetaBlockInputReference
)
179 def addMetaBlockInputReference(self
, *MetaBlockInputReference
):
180 for obj
in MetaBlockInputReference
:
181 obj
.MemberOf_MetaBlockReference
= self
183 def removeMetaBlockInputReference(self
, *MetaBlockInputReference
):
184 for obj
in MetaBlockInputReference
:
185 obj
.MemberOf_MetaBlockReference
= None
187 def getMetaBlockOutputReference(self
):
189 return self
._MetaBlockOutputReference
191 def setMetaBlockOutputReference(self
, value
):
192 for x
in self
._MetaBlockOutputReference
:
193 x
.MemberOf_MetaBlockReference
= None
195 y
._MemberOf
_MetaBlockReference
= self
196 self
._MetaBlockOutputReference
= value
198 MetaBlockOutputReference
= property(getMetaBlockOutputReference
, setMetaBlockOutputReference
)
200 def addMetaBlockOutputReference(self
, *MetaBlockOutputReference
):
201 for obj
in MetaBlockOutputReference
:
202 obj
.MemberOf_MetaBlockReference
= self
204 def removeMetaBlockOutputReference(self
, *MetaBlockOutputReference
):
205 for obj
in MetaBlockOutputReference
:
206 obj
.MemberOf_MetaBlockReference
= None
208 def getBlockParameter(self
):
210 return self
._BlockParameter
212 def setBlockParameter(self
, value
):
213 for x
in self
._BlockParameter
:
214 x
.MemberOf_MetaBlockReference
= None
216 y
._MemberOf
_MetaBlockReference
= self
217 self
._BlockParameter
= value
219 BlockParameter
= property(getBlockParameter
, setBlockParameter
)
221 def addBlockParameter(self
, *BlockParameter
):
222 for obj
in BlockParameter
:
223 obj
.MemberOf_MetaBlockReference
= self
225 def removeBlockParameter(self
, *BlockParameter
):
226 for obj
in BlockParameter
:
227 obj
.MemberOf_MetaBlockReference
= None
229 def getMetaBlockParameterReference(self
):
231 return self
._MetaBlockParameterReference
233 def setMetaBlockParameterReference(self
, value
):
234 for x
in self
._MetaBlockParameterReference
:
235 x
.MemberOf_MetaBlockReference
= None
237 y
._MemberOf
_MetaBlockReference
= self
238 self
._MetaBlockParameterReference
= value
240 MetaBlockParameterReference
= property(getMetaBlockParameterReference
, setMetaBlockParameterReference
)
242 def addMetaBlockParameterReference(self
, *MetaBlockParameterReference
):
243 for obj
in MetaBlockParameterReference
:
244 obj
.MemberOf_MetaBlockReference
= self
246 def removeMetaBlockParameterReference(self
, *MetaBlockParameterReference
):
247 for obj
in MetaBlockParameterReference
:
248 obj
.MemberOf_MetaBlockReference
= None