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
.Dynamics
.MetaBlockConnectable
import MetaBlockConnectable
23 class MetaBlockInput(MetaBlockConnectable
):
24 """Linkage at the dynanics meta model level. The output of a block could link to this. This is a public interface external to the block.
27 def __init__(self
, blockInputReference0
=None, MemberOf_MetaBlock
=None, blockUsageInputReference0
=None, blockInputType0
=None, tieToMeasurement0
=None, *args
, **kw_args
):
28 """Initialises a new 'MetaBlockInput' instance.
30 @param blockInputReference0: References the idenfiied input for the block reference.
31 @param MemberOf_MetaBlock: Inputs belong to a block.
32 @param blockUsageInputReference0:
33 @param blockInputType0:
34 @param tieToMeasurement0: The identified block input to which this measurement applies. Note this applies only to the external interface of blocks.
36 self
._blockInputReference
0 = []
37 self
.blockInputReference0
= [] if blockInputReference0
is None else blockInputReference0
39 self
._MemberOf
_MetaBlock
= None
40 self
.MemberOf_MetaBlock
= MemberOf_MetaBlock
42 self
._blockUsageInputReference
0 = []
43 self
.blockUsageInputReference0
= [] if blockUsageInputReference0
is None else blockUsageInputReference0
45 self
._blockInputType
0 = None
46 self
.blockInputType0
= blockInputType0
48 self
._tieToMeasurement
0 = []
49 self
.tieToMeasurement0
= [] if tieToMeasurement0
is None else tieToMeasurement0
51 super(MetaBlockInput
, self
).__init
__(*args
, **kw_args
)
57 _refs
= ["blockInputReference0", "MemberOf_MetaBlock", "blockUsageInputReference0", "blockInputType0", "tieToMeasurement0"]
58 _many_refs
= ["blockInputReference0", "blockUsageInputReference0", "tieToMeasurement0"]
60 def getblockInputReference0(self
):
61 """References the idenfiied input for the block reference.
63 return self
._blockInputReference
0
65 def setblockInputReference0(self
, value
):
66 for x
in self
._blockInputReference
0:
67 x
.metaBlockInput0
= None
69 y
._metaBlockInput
0 = self
70 self
._blockInputReference
0 = value
72 blockInputReference0
= property(getblockInputReference0
, setblockInputReference0
)
74 def addblockInputReference0(self
, *blockInputReference0
):
75 for obj
in blockInputReference0
:
76 obj
.metaBlockInput0
= self
78 def removeblockInputReference0(self
, *blockInputReference0
):
79 for obj
in blockInputReference0
:
80 obj
.metaBlockInput0
= None
82 def getMemberOf_MetaBlock(self
):
83 """Inputs belong to a block.
85 return self
._MemberOf
_MetaBlock
87 def setMemberOf_MetaBlock(self
, value
):
88 if self
._MemberOf
_MetaBlock
is not None:
89 filtered
= [x
for x
in self
.MemberOf_MetaBlock
.MetaBlockInput
if x
!= self
]
90 self
._MemberOf
_MetaBlock
._MetaBlockInput
= filtered
92 self
._MemberOf
_MetaBlock
= value
93 if self
._MemberOf
_MetaBlock
is not None:
94 if self
not in self
._MemberOf
_MetaBlock
._MetaBlockInput
:
95 self
._MemberOf
_MetaBlock
._MetaBlockInput
.append(self
)
97 MemberOf_MetaBlock
= property(getMemberOf_MetaBlock
, setMemberOf_MetaBlock
)
99 def getblockUsageInputReference0(self
):
101 return self
._blockUsageInputReference
0
103 def setblockUsageInputReference0(self
, value
):
104 for x
in self
._blockUsageInputReference
0:
105 x
.metaBlockInput0
= None
107 y
._metaBlockInput
0 = self
108 self
._blockUsageInputReference
0 = value
110 blockUsageInputReference0
= property(getblockUsageInputReference0
, setblockUsageInputReference0
)
112 def addblockUsageInputReference0(self
, *blockUsageInputReference0
):
113 for obj
in blockUsageInputReference0
:
114 obj
.metaBlockInput0
= self
116 def removeblockUsageInputReference0(self
, *blockUsageInputReference0
):
117 for obj
in blockUsageInputReference0
:
118 obj
.metaBlockInput0
= None
120 def getblockInputType0(self
):
122 return self
._blockInputType
0
124 def setblockInputType0(self
, value
):
125 if self
._blockInputType
0 is not None:
126 filtered
= [x
for x
in self
.blockInputType0
.metaBlockInput0
if x
!= self
]
127 self
._blockInputType
0._metaBlockInput
0 = filtered
129 self
._blockInputType
0 = value
130 if self
._blockInputType
0 is not None:
131 if self
not in self
._blockInputType
0._metaBlockInput
0:
132 self
._blockInputType
0._metaBlockInput
0.append(self
)
134 blockInputType0
= property(getblockInputType0
, setblockInputType0
)
136 def gettieToMeasurement0(self
):
137 """The identified block input to which this measurement applies. Note this applies only to the external interface of blocks.
139 return self
._tieToMeasurement
0
141 def settieToMeasurement0(self
, value
):
142 for x
in self
._tieToMeasurement
0:
143 x
.metaBlockInput0
= None
145 y
._metaBlockInput
0 = self
146 self
._tieToMeasurement
0 = value
148 tieToMeasurement0
= property(gettieToMeasurement0
, settieToMeasurement0
)
150 def addtieToMeasurement0(self
, *tieToMeasurement0
):
151 for obj
in tieToMeasurement0
:
152 obj
.metaBlockInput0
= self
154 def removetieToMeasurement0(self
, *tieToMeasurement0
):
155 for obj
in tieToMeasurement0
:
156 obj
.metaBlockInput0
= None