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 MetaBlockConOutput(IdentifiedObject
):
24 """If model uses MeasurementType association, it means the output is pushed back to the steady state model (if reasonable).
27 def __init__(self
, MetaBlockConSignal
=None, MemberOf_MetaBlockConnection
=None, Unit
=None, *args
, **kw_args
):
28 """Initialises a new 'MetaBlockConOutput' instance.
30 @param MetaBlockConSignal:
31 @param MemberOf_MetaBlockConnection:
34 self
._MetaBlockConSignal
= []
35 self
.MetaBlockConSignal
= [] if MetaBlockConSignal
is None else MetaBlockConSignal
37 self
._MemberOf
_MetaBlockConnection
= None
38 self
.MemberOf_MetaBlockConnection
= MemberOf_MetaBlockConnection
43 super(MetaBlockConOutput
, self
).__init
__(*args
, **kw_args
)
49 _refs
= ["MetaBlockConSignal", "MemberOf_MetaBlockConnection", "Unit"]
50 _many_refs
= ["MetaBlockConSignal"]
52 def getMetaBlockConSignal(self
):
54 return self
._MetaBlockConSignal
56 def setMetaBlockConSignal(self
, value
):
57 for x
in self
._MetaBlockConSignal
:
58 x
.MetaBlockConOutput
= None
60 y
._MetaBlockConOutput
= self
61 self
._MetaBlockConSignal
= value
63 MetaBlockConSignal
= property(getMetaBlockConSignal
, setMetaBlockConSignal
)
65 def addMetaBlockConSignal(self
, *MetaBlockConSignal
):
66 for obj
in MetaBlockConSignal
:
67 obj
.MetaBlockConOutput
= self
69 def removeMetaBlockConSignal(self
, *MetaBlockConSignal
):
70 for obj
in MetaBlockConSignal
:
71 obj
.MetaBlockConOutput
= None
73 def getMemberOf_MetaBlockConnection(self
):
75 return self
._MemberOf
_MetaBlockConnection
77 def setMemberOf_MetaBlockConnection(self
, value
):
78 if self
._MemberOf
_MetaBlockConnection
is not None:
79 filtered
= [x
for x
in self
.MemberOf_MetaBlockConnection
.MetaBlockConOutput
if x
!= self
]
80 self
._MemberOf
_MetaBlockConnection
._MetaBlockConOutput
= filtered
82 self
._MemberOf
_MetaBlockConnection
= value
83 if self
._MemberOf
_MetaBlockConnection
is not None:
84 if self
not in self
._MemberOf
_MetaBlockConnection
._MetaBlockConOutput
:
85 self
._MemberOf
_MetaBlockConnection
._MetaBlockConOutput
.append(self
)
87 MemberOf_MetaBlockConnection
= property(getMemberOf_MetaBlockConnection
, setMemberOf_MetaBlockConnection
)
93 def setUnit(self
, value
):
94 if self
._Unit
is not None:
95 filtered
= [x
for x
in self
.Unit
.MetaBlockConOutput
if x
!= self
]
96 self
._Unit
._MetaBlockConOutput
= filtered
99 if self
._Unit
is not None:
100 if self
not in self
._Unit
._MetaBlockConOutput
:
101 self
._Unit
._MetaBlockConOutput
.append(self
)
103 Unit
= property(getUnit
, setUnit
)