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 ReadingType(IdentifiedObject
):
20 """Type of data conveyed by a specific Reading.
23 def __init__(self
, multiplier
="k", kind
="voltageAngle", unit
="N", reverseChronology
=False, defaultQuality
='', defaultValueDataType
='', channelNumber
=0, intervalLength
=0.0, Readings
=None, dynamicConfiguration
=None, IntervalBlocks
=None, Pending
=None, Register
=None, *args
, **kw_args
):
24 """Initialises a new 'ReadingType' instance.
26 @param multiplier: Multiplier for 'unit'. Values are: "k", "d", "n", "M", "none", "G", "micro", "T", "c", "m", "p"
27 @param kind: Kind of reading. Values are: "voltageAngle", "current", "time", "powerFactor", "voltage", "frequency", "power", "other", "energy", "demand", "volume", "date", "phaseAngle", "pressure", "currentAngle"
28 @param unit: Unit for the reading value. Values are: "N", "VArh", "VA", "none", "m3", "kg/J", "deg", "W/Hz", "g", "Wh", "W/s", "Pa", "V/VAr", "ohm", "h", "F", "H", "m2", "VAr", "A", "rad", "s", "S", "VAh", "Hz", "_C", "s-1", "min", "J", "Hz-1", "J/s", "m", "W", "V"
29 @param reverseChronology: True for systems that must operate in 'reverse' chronological order.
30 @param defaultQuality: Characteristics of a data value conveyed by a specific Reading, which allow an application to understand how a specific Reading is to be interpreted.
31 @param defaultValueDataType: Numeric type to be expected for the associated IntervalBlock.value (e.g. unsignedInteger).
32 @param channelNumber: Logical positioning of this measurement data.
33 @param intervalLength: (if incremental reading value) Length of increment interval.
34 @param Readings: All reading values with this type information.
35 @param dynamicConfiguration: Demand configuration.
36 @param IntervalBlocks: All blocks containing interval reading values with this type information.
37 @param Pending: Pending conversion that produced this reading type.
38 @param Register: Register displaying values with this type information.
40 #: Multiplier for 'unit'. Values are: "k", "d", "n", "M", "none", "G", "micro", "T", "c", "m", "p"
41 self
.multiplier
= multiplier
43 #: Kind of reading. Values are: "voltageAngle", "current", "time", "powerFactor", "voltage", "frequency", "power", "other", "energy", "demand", "volume", "date", "phaseAngle", "pressure", "currentAngle"
46 #: Unit for the reading value. Values are: "N", "VArh", "VA", "none", "m3", "kg/J", "deg", "W/Hz", "g", "Wh", "W/s", "Pa", "V/VAr", "ohm", "h", "F", "H", "m2", "VAr", "A", "rad", "s", "S", "VAh", "Hz", "_C", "s-1", "min", "J", "Hz-1", "J/s", "m", "W", "V"
49 #: True for systems that must operate in 'reverse' chronological order.
50 self
.reverseChronology
= reverseChronology
52 #: Characteristics of a data value conveyed by a specific Reading, which allow an application to understand how a specific Reading is to be interpreted.
53 self
.defaultQuality
= defaultQuality
55 #: Numeric type to be expected for the associated IntervalBlock.value (e.g. unsignedInteger).
56 self
.defaultValueDataType
= defaultValueDataType
58 #: Logical positioning of this measurement data.
59 self
.channelNumber
= channelNumber
61 #: (if incremental reading value) Length of increment interval.
62 self
.intervalLength
= intervalLength
65 self
.Readings
= [] if Readings
is None else Readings
67 self
.dynamicConfiguration
= dynamicConfiguration
69 self
._IntervalBlocks
= []
70 self
.IntervalBlocks
= [] if IntervalBlocks
is None else IntervalBlocks
73 self
.Pending
= Pending
76 self
.Register
= Register
78 super(ReadingType
, self
).__init
__(*args
, **kw_args
)
80 _attrs
= ["multiplier", "kind", "unit", "reverseChronology", "defaultQuality", "defaultValueDataType", "channelNumber", "intervalLength"]
81 _attr_types
= {"multiplier": str, "kind": str, "unit": str, "reverseChronology": bool, "defaultQuality": str, "defaultValueDataType": str, "channelNumber": int, "intervalLength": float}
82 _defaults
= {"multiplier": "k", "kind": "voltageAngle", "unit": "N", "reverseChronology": False, "defaultQuality": '', "defaultValueDataType": '', "channelNumber": 0, "intervalLength": 0.0}
83 _enums
= {"multiplier": "UnitMultiplier", "kind": "ReadingKind", "unit": "UnitSymbol"}
84 _refs
= ["Readings", "dynamicConfiguration", "IntervalBlocks", "Pending", "Register"]
85 _many_refs
= ["Readings", "IntervalBlocks"]
87 def getReadings(self
):
88 """All reading values with this type information.
92 def setReadings(self
, value
):
93 for x
in self
._Readings
:
97 self
._Readings
= value
99 Readings
= property(getReadings
, setReadings
)
101 def addReadings(self
, *Readings
):
103 obj
._ReadingType
= self
104 self
._Readings
.append(obj
)
106 def removeReadings(self
, *Readings
):
108 obj
._ReadingType
= None
109 self
._Readings
.remove(obj
)
111 # Demand configuration.
112 dynamicConfiguration
= None
114 def getIntervalBlocks(self
):
115 """All blocks containing interval reading values with this type information.
117 return self
._IntervalBlocks
119 def setIntervalBlocks(self
, value
):
120 for x
in self
._IntervalBlocks
:
121 x
._ReadingType
= None
123 y
._ReadingType
= self
124 self
._IntervalBlocks
= value
126 IntervalBlocks
= property(getIntervalBlocks
, setIntervalBlocks
)
128 def addIntervalBlocks(self
, *IntervalBlocks
):
129 for obj
in IntervalBlocks
:
130 obj
._ReadingType
= self
131 self
._IntervalBlocks
.append(obj
)
133 def removeIntervalBlocks(self
, *IntervalBlocks
):
134 for obj
in IntervalBlocks
:
135 obj
._ReadingType
= None
136 self
._IntervalBlocks
.remove(obj
)
138 def getPending(self
):
139 """Pending conversion that produced this reading type.
143 def setPending(self
, value
):
144 if self
._Pending
is not None:
145 self
._Pending
._ReadingType
= None
147 self
._Pending
= value
148 if self
._Pending
is not None:
149 self
._Pending
._ReadingType
= self
151 Pending
= property(getPending
, setPending
)
153 def getRegister(self
):
154 """Register displaying values with this type information.
156 return self
._Register
158 def setRegister(self
, value
):
159 if self
._Register
is not None:
160 self
._Register
._ReadingType
= None
162 self
._Register
= value
163 if self
._Register
is not None:
164 self
._Register
._ReadingType
= self
166 Register
= property(getRegister
, setRegister
)