Adding CIM15 package.
[PyCIM.git] / CIM15 / IEC61968 / Metering / Register.py
blobf14737e602100181d88aa23b58e43408a5802082
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 CIM15.IEC61970.Core.IdentifiedObject import IdentifiedObject
23 class Register(IdentifiedObject):
24 """Display for quantity that is metered on an end device such as a meter.Display for quantity that is metered on an end device such as a meter.
25 """
27 def __init__(self, leftDigitCount=0, rightDigitCount=0, ReadingType=None, EndDeviceFunction=None, *args, **kw_args):
28 """Initialises a new 'Register' instance.
30 @param leftDigitCount: Number of digits (dials on a mechanical meter) to the left of the decimal place; default is 5.
31 @param rightDigitCount: Number of digits (dials on a mechanical meter) to the right of the decimal place.
32 @param ReadingType: Reading type for values displayed by this register.
33 @param EndDeviceFunction: End device function metering quantities displayed by this register.
34 """
35 #: Number of digits (dials on a mechanical meter) to the left of the decimal place; default is 5.
36 self.leftDigitCount = leftDigitCount
38 #: Number of digits (dials on a mechanical meter) to the right of the decimal place.
39 self.rightDigitCount = rightDigitCount
41 self._ReadingType = None
42 self.ReadingType = ReadingType
44 self._EndDeviceFunction = None
45 self.EndDeviceFunction = EndDeviceFunction
47 super(Register, self).__init__(*args, **kw_args)
49 _attrs = ["leftDigitCount", "rightDigitCount"]
50 _attr_types = {"leftDigitCount": int, "rightDigitCount": int}
51 _defaults = {"leftDigitCount": 0, "rightDigitCount": 0}
52 _enums = {}
53 _refs = ["ReadingType", "EndDeviceFunction"]
54 _many_refs = []
56 def getReadingType(self):
57 """Reading type for values displayed by this register.
58 """
59 return self._ReadingType
61 def setReadingType(self, value):
62 if self._ReadingType is not None:
63 self._ReadingType._Register = None
65 self._ReadingType = value
66 if self._ReadingType is not None:
67 self._ReadingType.Register = None
68 self._ReadingType._Register = self
70 ReadingType = property(getReadingType, setReadingType)
72 def getEndDeviceFunction(self):
73 """End device function metering quantities displayed by this register.
74 """
75 return self._EndDeviceFunction
77 def setEndDeviceFunction(self, value):
78 if self._EndDeviceFunction is not None:
79 filtered = [x for x in self.EndDeviceFunction.Registers if x != self]
80 self._EndDeviceFunction._Registers = filtered
82 self._EndDeviceFunction = value
83 if self._EndDeviceFunction is not None:
84 if self not in self._EndDeviceFunction._Registers:
85 self._EndDeviceFunction._Registers.append(self)
87 EndDeviceFunction = property(getEndDeviceFunction, setEndDeviceFunction)