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 ReadingType(IdentifiedObject
):
24 """Type of data conveyed by a specific Reading.
27 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
):
28 """Initialises a new 'ReadingType' instance.
30 @param multiplier: Multiplier for 'unit'. Values are: "k", "d", "n", "M", "none", "G", "micro", "T", "c", "m", "p"
31 @param kind: Kind of reading. Values are: "voltageAngle", "current", "time", "powerFactor", "voltage", "frequency", "power", "other", "energy", "demand", "volume", "date", "phaseAngle", "pressure", "currentAngle"
32 @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", "oC", "s-1", "min", "J", "Hz-1", "J/s", "m", "W", "V"
33 @param reverseChronology: True for systems that must operate in 'reverse' chronological order.
34 @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.
35 @param defaultValueDataType: Numeric type to be expected for the associated IntervalBlock.value (e.g. unsignedInteger).
36 @param channelNumber: Logical positioning of this measurement data.
37 @param intervalLength: (if incremental reading value) Length of increment interval.
38 @param Readings: All reading values with this type information.
39 @param dynamicConfiguration: Demand configuration.
40 @param IntervalBlocks: All blocks containing interval reading values with this type information.
41 @param Pending: Pending conversion that produced this reading type.
42 @param Register: Register displaying values with this type information.
44 #: Multiplier for 'unit'. Values are: "k", "d", "n", "M", "none", "G", "micro", "T", "c", "m", "p"
45 self
.multiplier
= multiplier
47 #: Kind of reading. Values are: "voltageAngle", "current", "time", "powerFactor", "voltage", "frequency", "power", "other", "energy", "demand", "volume", "date", "phaseAngle", "pressure", "currentAngle"
50 #: 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", "oC", "s-1", "min", "J", "Hz-1", "J/s", "m", "W", "V"
53 #: True for systems that must operate in 'reverse' chronological order.
54 self
.reverseChronology
= reverseChronology
56 #: Characteristics of a data value conveyed by a specific Reading, which allow an application to understand how a specific Reading is to be interpreted.
57 self
.defaultQuality
= defaultQuality
59 #: Numeric type to be expected for the associated IntervalBlock.value (e.g. unsignedInteger).
60 self
.defaultValueDataType
= defaultValueDataType
62 #: Logical positioning of this measurement data.
63 self
.channelNumber
= channelNumber
65 #: (if incremental reading value) Length of increment interval.
66 self
.intervalLength
= intervalLength
69 self
.Readings
= [] if Readings
is None else Readings
71 self
.dynamicConfiguration
= dynamicConfiguration
73 self
._IntervalBlocks
= []
74 self
.IntervalBlocks
= [] if IntervalBlocks
is None else IntervalBlocks
77 self
.Pending
= Pending
80 self
.Register
= Register
82 super(ReadingType
, self
).__init
__(*args
, **kw_args
)
84 _attrs
= ["multiplier", "kind", "unit", "reverseChronology", "defaultQuality", "defaultValueDataType", "channelNumber", "intervalLength"]
85 _attr_types
= {"multiplier": str, "kind": str, "unit": str, "reverseChronology": bool, "defaultQuality": str, "defaultValueDataType": str, "channelNumber": int, "intervalLength": float}
86 _defaults
= {"multiplier": "k", "kind": "voltageAngle", "unit": "N", "reverseChronology": False, "defaultQuality": '', "defaultValueDataType": '', "channelNumber": 0, "intervalLength": 0.0}
87 _enums
= {"multiplier": "UnitMultiplier", "kind": "ReadingKind", "unit": "UnitSymbol"}
88 _refs
= ["Readings", "dynamicConfiguration", "IntervalBlocks", "Pending", "Register"]
89 _many_refs
= ["Readings", "IntervalBlocks"]
91 def getReadings(self
):
92 """All reading values with this type information.
96 def setReadings(self
, value
):
97 for x
in self
._Readings
:
100 y
._ReadingType
= self
101 self
._Readings
= value
103 Readings
= property(getReadings
, setReadings
)
105 def addReadings(self
, *Readings
):
107 obj
.ReadingType
= self
109 def removeReadings(self
, *Readings
):
111 obj
.ReadingType
= None
113 # Demand configuration.
114 dynamicConfiguration
= None
116 def getIntervalBlocks(self
):
117 """All blocks containing interval reading values with this type information.
119 return self
._IntervalBlocks
121 def setIntervalBlocks(self
, value
):
122 for x
in self
._IntervalBlocks
:
125 y
._ReadingType
= self
126 self
._IntervalBlocks
= value
128 IntervalBlocks
= property(getIntervalBlocks
, setIntervalBlocks
)
130 def addIntervalBlocks(self
, *IntervalBlocks
):
131 for obj
in IntervalBlocks
:
132 obj
.ReadingType
= self
134 def removeIntervalBlocks(self
, *IntervalBlocks
):
135 for obj
in IntervalBlocks
:
136 obj
.ReadingType
= None
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
= None
150 self
._Pending
._ReadingType
= self
152 Pending
= property(getPending
, setPending
)
154 def getRegister(self
):
155 """Register displaying values with this type information.
157 return self
._Register
159 def setRegister(self
, value
):
160 if self
._Register
is not None:
161 self
._Register
._ReadingType
= None
163 self
._Register
= value
164 if self
._Register
is not None:
165 self
._Register
.ReadingType
= None
166 self
._Register
._ReadingType
= self
168 Register
= property(getRegister
, setRegister
)