Update README.rst
[PyCIM.git] / CIM14 / IEC61970 / Dynamics / MetaBlockConnection.py
blobcb230fb56891ecd61e100636a651cea2d42ba655
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
19 # IN THE SOFTWARE.
21 from CIM14.IEC61970.Core.IdentifiedObject import IdentifiedObject
23 class MetaBlockConnection(IdentifiedObject):
25 def __init__(self, slotname='', MetaBlockConOutput=None, MetaBlockConInput=None, metaBlockConnectivity0=None, BlockConnection=None, MemberOf_MetaBlockConnectivity=None, *args, **kw_args):
26 """Initialises a new 'MetaBlockConnection' instance.
28 @param slotname: Used for standard connection situations where multiple blocks of same class or same MetaBlock::blockkind have to be connected. The slotnames used are defined in the Reference Manual for Exchanging Standard Power System Dynamic Models. Application: Cross-compound or Combined Cycle connections.
29 @param MetaBlockConOutput:
30 @param MetaBlockConInput:
31 @param metaBlockConnectivity0:
32 @param BlockConnection:
33 @param MemberOf_MetaBlockConnectivity:
34 """
35 #: Used for standard connection situations where multiple blocks of same class or same MetaBlock::blockkind have to be connected. The slotnames used are defined in the Reference Manual for Exchanging Standard Power System Dynamic Models. Application: Cross-compound or Combined Cycle connections.
36 self.slotname = slotname
38 self._MetaBlockConOutput = []
39 self.MetaBlockConOutput = [] if MetaBlockConOutput is None else MetaBlockConOutput
41 self._MetaBlockConInput = []
42 self.MetaBlockConInput = [] if MetaBlockConInput is None else MetaBlockConInput
44 self._metaBlockConnectivity0 = None
45 self.metaBlockConnectivity0 = metaBlockConnectivity0
47 self._BlockConnection = []
48 self.BlockConnection = [] if BlockConnection is None else BlockConnection
50 self._MemberOf_MetaBlockConnectivity = None
51 self.MemberOf_MetaBlockConnectivity = MemberOf_MetaBlockConnectivity
53 super(MetaBlockConnection, self).__init__(*args, **kw_args)
55 _attrs = ["slotname"]
56 _attr_types = {"slotname": str}
57 _defaults = {"slotname": ''}
58 _enums = {}
59 _refs = ["MetaBlockConOutput", "MetaBlockConInput", "metaBlockConnectivity0", "BlockConnection", "MemberOf_MetaBlockConnectivity"]
60 _many_refs = ["MetaBlockConOutput", "MetaBlockConInput", "BlockConnection"]
62 def getMetaBlockConOutput(self):
64 return self._MetaBlockConOutput
66 def setMetaBlockConOutput(self, value):
67 for x in self._MetaBlockConOutput:
68 x.MemberOf_MetaBlockConnection = None
69 for y in value:
70 y._MemberOf_MetaBlockConnection = self
71 self._MetaBlockConOutput = value
73 MetaBlockConOutput = property(getMetaBlockConOutput, setMetaBlockConOutput)
75 def addMetaBlockConOutput(self, *MetaBlockConOutput):
76 for obj in MetaBlockConOutput:
77 obj.MemberOf_MetaBlockConnection = self
79 def removeMetaBlockConOutput(self, *MetaBlockConOutput):
80 for obj in MetaBlockConOutput:
81 obj.MemberOf_MetaBlockConnection = None
83 def getMetaBlockConInput(self):
85 return self._MetaBlockConInput
87 def setMetaBlockConInput(self, value):
88 for x in self._MetaBlockConInput:
89 x.MemberOf_MetaBlockConnection = None
90 for y in value:
91 y._MemberOf_MetaBlockConnection = self
92 self._MetaBlockConInput = value
94 MetaBlockConInput = property(getMetaBlockConInput, setMetaBlockConInput)
96 def addMetaBlockConInput(self, *MetaBlockConInput):
97 for obj in MetaBlockConInput:
98 obj.MemberOf_MetaBlockConnection = self
100 def removeMetaBlockConInput(self, *MetaBlockConInput):
101 for obj in MetaBlockConInput:
102 obj.MemberOf_MetaBlockConnection = None
104 def getmetaBlockConnectivity0(self):
106 return self._metaBlockConnectivity0
108 def setmetaBlockConnectivity0(self, value):
109 if self._metaBlockConnectivity0 is not None:
110 filtered = [x for x in self.metaBlockConnectivity0.metaBlockConnection0 if x != self]
111 self._metaBlockConnectivity0._metaBlockConnection0 = filtered
113 self._metaBlockConnectivity0 = value
114 if self._metaBlockConnectivity0 is not None:
115 if self not in self._metaBlockConnectivity0._metaBlockConnection0:
116 self._metaBlockConnectivity0._metaBlockConnection0.append(self)
118 metaBlockConnectivity0 = property(getmetaBlockConnectivity0, setmetaBlockConnectivity0)
120 def getBlockConnection(self):
122 return self._BlockConnection
124 def setBlockConnection(self, value):
125 for x in self._BlockConnection:
126 x.MetaBlockConnection = None
127 for y in value:
128 y._MetaBlockConnection = self
129 self._BlockConnection = value
131 BlockConnection = property(getBlockConnection, setBlockConnection)
133 def addBlockConnection(self, *BlockConnection):
134 for obj in BlockConnection:
135 obj.MetaBlockConnection = self
137 def removeBlockConnection(self, *BlockConnection):
138 for obj in BlockConnection:
139 obj.MetaBlockConnection = None
141 def getMemberOf_MetaBlockConnectivity(self):
143 return self._MemberOf_MetaBlockConnectivity
145 def setMemberOf_MetaBlockConnectivity(self, value):
146 if self._MemberOf_MetaBlockConnectivity is not None:
147 filtered = [x for x in self.MemberOf_MetaBlockConnectivity.MetaBlockConnection if x != self]
148 self._MemberOf_MetaBlockConnectivity._MetaBlockConnection = filtered
150 self._MemberOf_MetaBlockConnectivity = value
151 if self._MemberOf_MetaBlockConnectivity is not None:
152 if self not in self._MemberOf_MetaBlockConnectivity._MetaBlockConnection:
153 self._MemberOf_MetaBlockConnectivity._MetaBlockConnection.append(self)
155 MemberOf_MetaBlockConnectivity = property(getMemberOf_MetaBlockConnectivity, setMemberOf_MetaBlockConnectivity)