|
@@ -18,7 +18,7 @@
|
|
|
A collection of useful enumerations that you can use to construct or
|
|
|
interpret OpenADR messages. Can also be useful during testing.
|
|
|
"""
|
|
|
-from openleadr import objects
|
|
|
+from openleadr.objects import Measurement, PowerAttributes
|
|
|
|
|
|
|
|
|
class Enum(type):
|
|
@@ -195,29 +195,28 @@ _CURRENCIES = ("AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "B
|
|
|
"XFU", "XOF", "XPD", "XPF", "XPF", "XPF", "XPT", "XTS", "XXX", "YER",
|
|
|
"ZAR", "ZMK", "ZWL")
|
|
|
|
|
|
-
|
|
|
_ACCEPTABLE_UNITS = {'currency': _CURRENCIES,
|
|
|
'currencyPerKW': _CURRENCIES,
|
|
|
'currencyPerKWh': _CURRENCIES,
|
|
|
- 'currencyPerTherm': _CURRENCIES,
|
|
|
+ 'currencyPerThm': _CURRENCIES,
|
|
|
'current': ('A',),
|
|
|
'energyApparent': ('VAh',),
|
|
|
- 'energyReactive': ('VArh',),
|
|
|
+ 'energyReactive': ('VARh',),
|
|
|
'energyReal': ('Wh',),
|
|
|
'frequency': ('Hz',),
|
|
|
'powerApparent': ('VA',),
|
|
|
- 'powerReactive': ('VAr',),
|
|
|
+ 'powerReactive': ('VAR',),
|
|
|
'powerReal': ('W',),
|
|
|
'pulseCount': ('count',),
|
|
|
'temperature': ('celsius', 'fahrenheit'),
|
|
|
- 'therm': ('thm',),
|
|
|
+ 'Therm': ('thm',),
|
|
|
'voltage': ('V',)}
|
|
|
|
|
|
-
|
|
|
-_MEASUREMENT_DESCRIPTIONS = {'currency': 'Currency',
|
|
|
- 'currencyPerKW': 'CurrencyPerKW',
|
|
|
- 'currencyPerKWh': 'CurrencyPerKWh',
|
|
|
- 'currencyPerTherm': 'CurrencyPerTherm',
|
|
|
+_MEASUREMENT_DESCRIPTIONS = {'currency': 'currency',
|
|
|
+ 'currencyPerKW': 'currencyPerKW',
|
|
|
+ 'currencyPerKWh': 'currencyPerKWh',
|
|
|
+ 'currencyPerThm': 'currency',
|
|
|
+ 'current': 'Current',
|
|
|
'energyApparent': 'ApparentEnergy',
|
|
|
'energyReactive': 'ReactiveEnergy',
|
|
|
'energyReal': 'RealEnergy',
|
|
@@ -227,144 +226,167 @@ _MEASUREMENT_DESCRIPTIONS = {'currency': 'Currency',
|
|
|
'powerReal': 'RealPower',
|
|
|
'pulseCount': 'pulse count',
|
|
|
'temperature': 'temperature',
|
|
|
- 'therm': 'Therm',
|
|
|
+ 'Therm': 'Therm',
|
|
|
'voltage': 'Voltage'}
|
|
|
|
|
|
+_MEASUREMENT_NAMESPACES = {'currency': 'oadr',
|
|
|
+ 'currencyPerWK': 'oadr',
|
|
|
+ 'currencyPerKWh': 'oadr',
|
|
|
+ 'currencyPerThm': 'oadr',
|
|
|
+ 'current': 'oadr',
|
|
|
+ 'energyApparent': 'power',
|
|
|
+ 'energyReactive': 'power',
|
|
|
+ 'energyReal': 'power',
|
|
|
+ 'frequency': 'oadr',
|
|
|
+ 'powerApparent': 'power',
|
|
|
+ 'powerReactive': 'power',
|
|
|
+ 'powerReal': 'power',
|
|
|
+ 'pulseCount': 'oadr',
|
|
|
+ 'temperature': 'oadr',
|
|
|
+ 'Therm': 'oadr',
|
|
|
+ 'voltage': 'power',
|
|
|
+ 'customUnit': 'oadr'}
|
|
|
+
|
|
|
|
|
|
class MEASUREMENTS(metaclass=Enum):
|
|
|
- VOLTAGE = objects.Measurement(name='voltage',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['voltage'],
|
|
|
- unit=_ACCEPTABLE_UNITS['voltage'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['voltage'],
|
|
|
- scale='none')
|
|
|
- ENERGY_REAL = objects.Measurement(name='energyReal',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['energyReal'],
|
|
|
- unit=_ACCEPTABLE_UNITS['energyReal'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['energyReal'],
|
|
|
- scale='none')
|
|
|
- REAL_ENERGY = objects.Measurement(name='energyReal',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['energyReal'],
|
|
|
- unit=_ACCEPTABLE_UNITS['energyReal'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['energyReal'],
|
|
|
- scale='none')
|
|
|
- ACTIVE_ENERGY = objects.Measurement(name='energyReal',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['energyReal'],
|
|
|
- unit=_ACCEPTABLE_UNITS['energyReal'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['energyReal'],
|
|
|
- scale='none')
|
|
|
- ENERGY_REACTIVE = objects.Measurement(name='energyReactive',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['energyReactive'],
|
|
|
- unit=_ACCEPTABLE_UNITS['energyReactive'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['energyReactive'],
|
|
|
- scale='none')
|
|
|
- REACTIVE_ENERGY = objects.Measurement(name='energyReactive',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['energyReactive'],
|
|
|
- unit=_ACCEPTABLE_UNITS['energyReactive'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['energyReactive'],
|
|
|
- scale='none')
|
|
|
- ENERGY_APPARENT = objects.Measurement(name='energyApparent',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['energyApparent'],
|
|
|
- unit=_ACCEPTABLE_UNITS['energyApparent'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['energyApparent'],
|
|
|
- scale='none')
|
|
|
- APPARENT_ENERGY = objects.Measurement(name='energyApparent',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['energyApparent'],
|
|
|
- unit=_ACCEPTABLE_UNITS['energyApparent'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['energyApparent'],
|
|
|
- scale='none')
|
|
|
- ACTIVE_POWER = objects.Measurement(name='powerReal',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['powerReal'],
|
|
|
- unit=_ACCEPTABLE_UNITS['powerReal'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['powerReal'],
|
|
|
- scale='none',
|
|
|
- power_attributes=objects.PowerAttributes(hertz=50,
|
|
|
- voltage=230,
|
|
|
- ac=True))
|
|
|
- REAL_POWER = objects.Measurement(name='powerReal',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['powerReal'],
|
|
|
- unit=_ACCEPTABLE_UNITS['powerReal'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['powerReal'],
|
|
|
- scale='none',
|
|
|
- power_attributes=objects.PowerAttributes(hertz=50,
|
|
|
- voltage=230,
|
|
|
- ac=True))
|
|
|
- POWER_REAL = objects.Measurement(name='powerReal',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['powerReal'],
|
|
|
- unit=_ACCEPTABLE_UNITS['powerReal'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['powerReal'],
|
|
|
- scale='none',
|
|
|
- power_attributes=objects.PowerAttributes(hertz=50,
|
|
|
- voltage=230,
|
|
|
- ac=True))
|
|
|
- REACTIVE_POWER = objects.Measurement(name='powerReactive',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['powerReactive'],
|
|
|
- unit=_ACCEPTABLE_UNITS['powerReactive'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['powerReactive'],
|
|
|
- scale='none',
|
|
|
- power_attributes=objects.PowerAttributes(hertz=50,
|
|
|
- voltage=230,
|
|
|
- ac=True))
|
|
|
- POWER_REACTIVE = objects.Measurement(name='powerReactive',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['powerReactive'],
|
|
|
- unit=_ACCEPTABLE_UNITS['powerReactive'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['powerReactive'],
|
|
|
- scale='none',
|
|
|
- power_attributes=objects.PowerAttributes(hertz=50,
|
|
|
- voltage=230,
|
|
|
- ac=True))
|
|
|
- APPARENT_POWER = objects.Measurement(name='powerApparent',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['powerApparent'],
|
|
|
- unit=_ACCEPTABLE_UNITS['powerApparent'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['powerApparent'],
|
|
|
- scale='none',
|
|
|
- power_attributes=objects.PowerAttributes(hertz=50,
|
|
|
- voltage=230,
|
|
|
- ac=True))
|
|
|
- POWER_APPARENT = objects.Measurement(name='powerApparent',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['powerApparent'],
|
|
|
- unit=_ACCEPTABLE_UNITS['powerApparent'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['powerApparent'],
|
|
|
- scale='none',
|
|
|
- power_attributes=objects.PowerAttributes(hertz=50,
|
|
|
- voltage=230,
|
|
|
- ac=True))
|
|
|
- FREQUENCY = objects.Measurement(name='frequency',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['frequency'],
|
|
|
- unit=_ACCEPTABLE_UNITS['frequency'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['frequency'],
|
|
|
- scale='none')
|
|
|
- PULSE_COUNT = objects.Measurement(name='pulseCount',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['pulseCount'],
|
|
|
- unit=_ACCEPTABLE_UNITS['pulseCount'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['pulseCount'],
|
|
|
- scale='none')
|
|
|
- TEMPERATURE = objects.Measurement(name='temperature',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['temperature'],
|
|
|
- unit=_ACCEPTABLE_UNITS['temperature'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['temperature'],
|
|
|
- scale='none')
|
|
|
- THERM = objects.Measurement(name='therm',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['therm'],
|
|
|
- unit=_ACCEPTABLE_UNITS['therm'][0],
|
|
|
- acceptable_units=_ACCEPTABLE_UNITS['therm'],
|
|
|
+ VOLTAGE = Measurement(name='voltage',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['voltage'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['voltage'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['voltage'],
|
|
|
+ scale='none')
|
|
|
+ CURRENT = Measurement(name='current',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['current'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['current'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['current'],
|
|
|
+ scale='none')
|
|
|
+ ENERGY_REAL = Measurement(name='energyReal',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['energyReal'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['energyReal'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['energyReal'],
|
|
|
+ scale='none')
|
|
|
+ REAL_ENERGY = Measurement(name='energyReal',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['energyReal'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['energyReal'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['energyReal'],
|
|
|
+ scale='none')
|
|
|
+ ACTIVE_ENERGY = Measurement(name='energyReal',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['energyReal'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['energyReal'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['energyReal'],
|
|
|
scale='none')
|
|
|
- CURRENCY = objects.Measurement(name='currency',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['currency'],
|
|
|
+ ENERGY_REACTIVE = Measurement(name='energyReactive',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['energyReactive'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['energyReactive'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['energyReactive'],
|
|
|
+ scale='none')
|
|
|
+ REACTIVE_ENERGY = Measurement(name='energyReactive',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['energyReactive'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['energyReactive'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['energyReactive'],
|
|
|
+ scale='none')
|
|
|
+ ENERGY_APPARENT = Measurement(name='energyApparent',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['energyApparent'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['energyApparent'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['energyApparent'],
|
|
|
+ scale='none')
|
|
|
+ APPARENT_ENERGY = Measurement(name='energyApparent',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['energyApparent'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['energyApparent'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['energyApparent'],
|
|
|
+ scale='none')
|
|
|
+ ACTIVE_POWER = Measurement(name='powerReal',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['powerReal'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['powerReal'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['powerReal'],
|
|
|
+ scale='none',
|
|
|
+ power_attributes=PowerAttributes(hertz=50,
|
|
|
+ voltage=230,
|
|
|
+ ac=True))
|
|
|
+ REAL_POWER = Measurement(name='powerReal',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['powerReal'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['powerReal'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['powerReal'],
|
|
|
+ scale='none',
|
|
|
+ power_attributes=PowerAttributes(hertz=50,
|
|
|
+ voltage=230,
|
|
|
+ ac=True))
|
|
|
+ POWER_REAL = Measurement(name='powerReal',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['powerReal'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['powerReal'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['powerReal'],
|
|
|
+ scale='none',
|
|
|
+ power_attributes=PowerAttributes(hertz=50,
|
|
|
+ voltage=230,
|
|
|
+ ac=True))
|
|
|
+ REACTIVE_POWER = Measurement(name='powerReactive',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['powerReactive'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['powerReactive'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['powerReactive'],
|
|
|
+ scale='none',
|
|
|
+ power_attributes=PowerAttributes(hertz=50,
|
|
|
+ voltage=230,
|
|
|
+ ac=True))
|
|
|
+ POWER_REACTIVE = Measurement(name='powerReactive',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['powerReactive'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['powerReactive'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['powerReactive'],
|
|
|
+ scale='none',
|
|
|
+ power_attributes=PowerAttributes(hertz=50,
|
|
|
+ voltage=230,
|
|
|
+ ac=True))
|
|
|
+ APPARENT_POWER = Measurement(name='powerApparent',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['powerApparent'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['powerApparent'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['powerApparent'],
|
|
|
+ scale='none',
|
|
|
+ power_attributes=PowerAttributes(hertz=50,
|
|
|
+ voltage=230,
|
|
|
+ ac=True))
|
|
|
+ POWER_APPARENT = Measurement(name='powerApparent',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['powerApparent'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['powerApparent'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['powerApparent'],
|
|
|
+ scale='none',
|
|
|
+ power_attributes=PowerAttributes(hertz=50,
|
|
|
+ voltage=230,
|
|
|
+ ac=True))
|
|
|
+ FREQUENCY = Measurement(name='frequency',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['frequency'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['frequency'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['frequency'],
|
|
|
+ scale='none')
|
|
|
+ PULSE_COUNT = Measurement(name='pulseCount',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['pulseCount'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['pulseCount'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['pulseCount'],
|
|
|
+ pulse_factor=1000)
|
|
|
+ TEMPERATURE = Measurement(name='temperature',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['temperature'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['temperature'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['temperature'],
|
|
|
+ scale='none')
|
|
|
+ THERM = Measurement(name='Therm',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['Therm'],
|
|
|
+ unit=_ACCEPTABLE_UNITS['Therm'][0],
|
|
|
+ acceptable_units=_ACCEPTABLE_UNITS['Therm'],
|
|
|
+ scale='none')
|
|
|
+ CURRENCY = Measurement(name='currency',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['currency'],
|
|
|
+ unit=_CURRENCIES[0],
|
|
|
+ acceptable_units=_CURRENCIES,
|
|
|
+ scale='none')
|
|
|
+ CURRENCY_PER_KW = Measurement(name='currencyPerKW',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['currencyPerKW'],
|
|
|
+ unit=_CURRENCIES[0],
|
|
|
+ acceptable_units=_CURRENCIES,
|
|
|
+ scale='none')
|
|
|
+ CURRENCY_PER_KWH = Measurement(name='currencyPerKWh',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['currencyPerKWh'],
|
|
|
+ unit=_CURRENCIES[0],
|
|
|
+ acceptable_units=_CURRENCIES,
|
|
|
+ scale='none')
|
|
|
+ CURRENCY_PER_THM = Measurement(name='currencyPerThm',
|
|
|
+ description=_MEASUREMENT_DESCRIPTIONS['currencyPerThm'],
|
|
|
unit=_CURRENCIES[0],
|
|
|
acceptable_units=_CURRENCIES,
|
|
|
scale='none')
|
|
|
- CURRENCY_PER_KW = objects.Measurement(name='currencyPerKW',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['currencyPerKW'],
|
|
|
- unit=_CURRENCIES[0],
|
|
|
- acceptable_units=_CURRENCIES,
|
|
|
- scale='none')
|
|
|
- CURRENCY_PER_KWH = objects.Measurement(name='currencyPerKWh',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['currencyPerKWh'],
|
|
|
- unit=_CURRENCIES[0],
|
|
|
- acceptable_units=_CURRENCIES,
|
|
|
- scale='none')
|
|
|
- CURRENCY_PER_THERM = objects.Measurement(name='currencyPerTherm',
|
|
|
- description=_MEASUREMENT_DESCRIPTIONS['currencyPerTherm'],
|
|
|
- unit=_CURRENCIES[0],
|
|
|
- acceptable_units=_CURRENCIES,
|
|
|
- scale='none')
|