1 # Copyright (C) 2010 Richard Lincoln
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA
17 from CIM14
.IEC61970
.Core
.IdentifiedObject
import IdentifiedObject
19 class TieToMeasurement(IdentifiedObject
):
20 """Ties a block input to a specific state variable measurment. Thus giving a unit type, a location in the network (typically a terminal). A specific value is not given, just enough information to obtain the value from the model during a solution. This has nothing to do with SCADA.
23 def __init__(self
, measurement0
=None, block0
=None, metaBlockInput0
=None, *args
, **kw_args
):
24 """Initialises a new 'TieToMeasurement' instance.
28 @param metaBlockInput0: The identified block input to which this measurement applies. Note this applies only to the external interface of blocks.
30 self
._measurement
0 = None
31 self
.measurement0
= measurement0
36 self
._metaBlockInput
0 = None
37 self
.metaBlockInput0
= metaBlockInput0
39 super(TieToMeasurement
, self
).__init
__(*args
, **kw_args
)
45 _refs
= ["measurement0", "block0", "metaBlockInput0"]
48 def getmeasurement0(self
):
50 return self
._measurement
0
52 def setmeasurement0(self
, value
):
53 if self
._measurement
0 is not None:
54 filtered
= [x
for x
in self
.measurement0
.tieToMeasurement0
if x
!= self
]
55 self
._measurement
0._tieToMeasurement
0 = filtered
57 self
._measurement
0 = value
58 if self
._measurement
0 is not None:
59 if self
not in self
._measurement
0._tieToMeasurement
0:
60 self
._measurement
0._tieToMeasurement
0.append(self
)
62 measurement0
= property(getmeasurement0
, setmeasurement0
)
68 def setblock0(self
, value
):
69 if self
._block
0 is not None:
70 filtered
= [x
for x
in self
.block0
.tieToMeasurement0
if x
!= self
]
71 self
._block
0._tieToMeasurement
0 = filtered
74 if self
._block
0 is not None:
75 if self
not in self
._block
0._tieToMeasurement
0:
76 self
._block
0._tieToMeasurement
0.append(self
)
78 block0
= property(getblock0
, setblock0
)
80 def getmetaBlockInput0(self
):
81 """The identified block input to which this measurement applies. Note this applies only to the external interface of blocks.
83 return self
._metaBlockInput
0
85 def setmetaBlockInput0(self
, value
):
86 if self
._metaBlockInput
0 is not None:
87 filtered
= [x
for x
in self
.metaBlockInput0
.tieToMeasurement0
if x
!= self
]
88 self
._metaBlockInput
0._tieToMeasurement
0 = filtered
90 self
._metaBlockInput
0 = value
91 if self
._metaBlockInput
0 is not None:
92 if self
not in self
._metaBlockInput
0._tieToMeasurement
0:
93 self
._metaBlockInput
0._tieToMeasurement
0.append(self
)
95 metaBlockInput0
= property(getmetaBlockInput0
, setmetaBlockInput0
)