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 MetaBlockOutput(MetaBlockConnectable
):
24 """Output state of a block. This is a public interface external to the block. One or more block outputs should be specified in order to link blocks together. Certain block kinds might require a specific output. For example, an exciter block might require an output called 'Ea'.
27 def __init__(self
, BlockOutputReference
=None, MemberOf_MetaBlock
=None, blockUsageOutputReference0
=None, blockOutputType0
=None, *args
, **kw_args
):
28 """Initialises a new 'MetaBlockOutput' instance.
30 @param BlockOutputReference: A block output reference for the block output. The output of the block is passed to the block output reference which is a block connectable and thus can be connected at the dynamics metadata level to another block.
31 @param MemberOf_MetaBlock: The block that contains the output.
32 @param blockUsageOutputReference0:
33 @param blockOutputType0:
35 self
._BlockOutputReference
= []
36 self
.BlockOutputReference
= [] if BlockOutputReference
is None else BlockOutputReference
38 self
._MemberOf
_MetaBlock
= None
39 self
.MemberOf_MetaBlock
= MemberOf_MetaBlock
41 self
._blockUsageOutputReference
0 = []
42 self
.blockUsageOutputReference0
= [] if blockUsageOutputReference0
is None else blockUsageOutputReference0
44 self
._blockOutputType
0 = None
45 self
.blockOutputType0
= blockOutputType0
47 super(MetaBlockOutput
, self
).__init
__(*args
, **kw_args
)
53 _refs
= ["BlockOutputReference", "MemberOf_MetaBlock", "blockUsageOutputReference0", "blockOutputType0"]
54 _many_refs
= ["BlockOutputReference", "blockUsageOutputReference0"]
56 def getBlockOutputReference(self
):
57 """A block output reference for the block output. The output of the block is passed to the block output reference which is a block connectable and thus can be connected at the dynamics metadata level to another block.
59 return self
._BlockOutputReference
61 def setBlockOutputReference(self
, value
):
62 for x
in self
._BlockOutputReference
:
63 x
.metaBlockOutput0
= None
65 y
._metaBlockOutput
0 = self
66 self
._BlockOutputReference
= value
68 BlockOutputReference
= property(getBlockOutputReference
, setBlockOutputReference
)
70 def addBlockOutputReference(self
, *BlockOutputReference
):
71 for obj
in BlockOutputReference
:
72 obj
.metaBlockOutput0
= self
74 def removeBlockOutputReference(self
, *BlockOutputReference
):
75 for obj
in BlockOutputReference
:
76 obj
.metaBlockOutput0
= None
78 def getMemberOf_MetaBlock(self
):
79 """The block that contains the output.
81 return self
._MemberOf
_MetaBlock
83 def setMemberOf_MetaBlock(self
, value
):
84 if self
._MemberOf
_MetaBlock
is not None:
85 filtered
= [x
for x
in self
.MemberOf_MetaBlock
.MetaBlockOutput
if x
!= self
]
86 self
._MemberOf
_MetaBlock
._MetaBlockOutput
= filtered
88 self
._MemberOf
_MetaBlock
= value
89 if self
._MemberOf
_MetaBlock
is not None:
90 if self
not in self
._MemberOf
_MetaBlock
._MetaBlockOutput
:
91 self
._MemberOf
_MetaBlock
._MetaBlockOutput
.append(self
)
93 MemberOf_MetaBlock
= property(getMemberOf_MetaBlock
, setMemberOf_MetaBlock
)
95 def getblockUsageOutputReference0(self
):
97 return self
._blockUsageOutputReference
0
99 def setblockUsageOutputReference0(self
, value
):
100 for x
in self
._blockUsageOutputReference
0:
101 x
.metaBlockOutput0
= None
103 y
._metaBlockOutput
0 = self
104 self
._blockUsageOutputReference
0 = value
106 blockUsageOutputReference0
= property(getblockUsageOutputReference0
, setblockUsageOutputReference0
)
108 def addblockUsageOutputReference0(self
, *blockUsageOutputReference0
):
109 for obj
in blockUsageOutputReference0
:
110 obj
.metaBlockOutput0
= self
112 def removeblockUsageOutputReference0(self
, *blockUsageOutputReference0
):
113 for obj
in blockUsageOutputReference0
:
114 obj
.metaBlockOutput0
= None
116 def getblockOutputType0(self
):
118 return self
._blockOutputType
0
120 def setblockOutputType0(self
, value
):
121 if self
._blockOutputType
0 is not None:
122 filtered
= [x
for x
in self
.blockOutputType0
.metaBlockOutput0
if x
!= self
]
123 self
._blockOutputType
0._metaBlockOutput
0 = filtered
125 self
._blockOutputType
0 = value
126 if self
._blockOutputType
0 is not None:
127 if self
not in self
._blockOutputType
0._metaBlockOutput
0:
128 self
._blockOutputType
0._metaBlockOutput
0.append(self
)
130 blockOutputType0
= property(getblockOutputType0
, setblockOutputType0
)