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 TieToMeasurement(IdentifiedObject
):
24 """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.
27 def __init__(self
, measurement0
=None, block0
=None, metaBlockInput0
=None, *args
, **kw_args
):
28 """Initialises a new 'TieToMeasurement' instance.
32 @param metaBlockInput0: The identified block input to which this measurement applies. Note this applies only to the external interface of blocks.
34 self
._measurement
0 = None
35 self
.measurement0
= measurement0
40 self
._metaBlockInput
0 = None
41 self
.metaBlockInput0
= metaBlockInput0
43 super(TieToMeasurement
, self
).__init
__(*args
, **kw_args
)
49 _refs
= ["measurement0", "block0", "metaBlockInput0"]
52 def getmeasurement0(self
):
54 return self
._measurement
0
56 def setmeasurement0(self
, value
):
57 if self
._measurement
0 is not None:
58 filtered
= [x
for x
in self
.measurement0
.tieToMeasurement0
if x
!= self
]
59 self
._measurement
0._tieToMeasurement
0 = filtered
61 self
._measurement
0 = value
62 if self
._measurement
0 is not None:
63 if self
not in self
._measurement
0._tieToMeasurement
0:
64 self
._measurement
0._tieToMeasurement
0.append(self
)
66 measurement0
= property(getmeasurement0
, setmeasurement0
)
72 def setblock0(self
, value
):
73 if self
._block
0 is not None:
74 filtered
= [x
for x
in self
.block0
.tieToMeasurement0
if x
!= self
]
75 self
._block
0._tieToMeasurement
0 = filtered
78 if self
._block
0 is not None:
79 if self
not in self
._block
0._tieToMeasurement
0:
80 self
._block
0._tieToMeasurement
0.append(self
)
82 block0
= property(getblock0
, setblock0
)
84 def getmetaBlockInput0(self
):
85 """The identified block input to which this measurement applies. Note this applies only to the external interface of blocks.
87 return self
._metaBlockInput
0
89 def setmetaBlockInput0(self
, value
):
90 if self
._metaBlockInput
0 is not None:
91 filtered
= [x
for x
in self
.metaBlockInput0
.tieToMeasurement0
if x
!= self
]
92 self
._metaBlockInput
0._tieToMeasurement
0 = filtered
94 self
._metaBlockInput
0 = value
95 if self
._metaBlockInput
0 is not None:
96 if self
not in self
._metaBlockInput
0._tieToMeasurement
0:
97 self
._metaBlockInput
0._tieToMeasurement
0.append(self
)
99 metaBlockInput0
= property(getmetaBlockInput0
, setmetaBlockInput0
)