# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_pyupm_h803x', [dirname(__file__)])
except ImportError:
import _pyupm_h803x
return _pyupm_h803x
if fp is not None:
try:
_mod = imp.load_module('_pyupm_h803x', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_h803x = swig_import_helper()
del swig_import_helper
else:
import _pyupm_h803x
del version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
if _newclass:
object.__setattr__(self, name, value)
else:
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
if (not static):
return object.__getattr__(self, name)
else:
raise AttributeError(name)
def _swig_getattr(self, class_type, name):
return _swig_getattr_nondynamic(self, class_type, name, 0)
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except AttributeError:
class _object:
pass
_newclass = 0
def getVersion():
return _pyupm_h803x.getVersion()
getVersion = _pyupm_h803x.getVersion
[docs]class H803X(_object):
"""
UPM API for the Veris H803X Energy Meter.
ID: h803x
Name: Veris H803X Energy Meter Module
Category: electric
Manufacturer: veris
Connection: uart
Link:http://www.veris.com/Item/H8035-0100-2.aspx This module
implements support for the Veris H8035 and H8036 Energy Meters.
The H8036 is similar to the H8035, but provides much more data.
The Enercept H8035/H8036 is an innovative three-phase networked
(Modbus RTU) power transducer that combines electronics and high
accuracy industrial grade CTs in a single package. The need for
external electrical enclosures is eliminated, greatly reducing
installation time and cost. Color-coordination between voltage leads
and CTs makes phase matching easy. Additionally, these transducers
automatically detect and compensate for phase reversal, eliminating
the concern of CT load orientation. Up to 63 Transducers can be daisy-
chained on a single RS-485 network.
This module was developed using libmodbus 3.1.2, and the H8035. The
H8036 has not been tested. libmodbus 3.1.2 must be present for this
module to build.
It was developed using an RS232->RS485 interface. You cannot use the
built in MCU TTL UART pins for accessing this device you must use a
full Serial RS232->RS485 or USB-RS485 interface connected via USB.
C++ includes: h803x.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, H803X, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, H803X, name)
__repr__ = _swig_repr
HOLDING_CONSUMPTION_KWH_INT_L = _pyupm_h803x.H803X_HOLDING_CONSUMPTION_KWH_INT_L
HOLDING_CONSUMPTION_KWH_INT_H = _pyupm_h803x.H803X_HOLDING_CONSUMPTION_KWH_INT_H
HOLDING_CONSUMPTION_KWH = _pyupm_h803x.H803X_HOLDING_CONSUMPTION_KWH
HOLDING_REAL_POWER_KW = _pyupm_h803x.H803X_HOLDING_REAL_POWER_KW
HOLDING_REACTIVE_POWER_KVAR = _pyupm_h803x.H803X_HOLDING_REACTIVE_POWER_KVAR
HOLDING_APPARENT_POWER_KVA = _pyupm_h803x.H803X_HOLDING_APPARENT_POWER_KVA
HOLDING_POWER_FACTOR = _pyupm_h803x.H803X_HOLDING_POWER_FACTOR
HOLDING_VOLTS_LINE_TO_LINE = _pyupm_h803x.H803X_HOLDING_VOLTS_LINE_TO_LINE
HOLDING_VOLTS_LINE_TO_NEUTRAL = _pyupm_h803x.H803X_HOLDING_VOLTS_LINE_TO_NEUTRAL
HOLDING_CURRENT = _pyupm_h803x.H803X_HOLDING_CURRENT
HOLDING_REAL_POWER_PHASE_A_KWH = _pyupm_h803x.H803X_HOLDING_REAL_POWER_PHASE_A_KWH
HOLDING_REAL_POWER_PHASE_B_KWH = _pyupm_h803x.H803X_HOLDING_REAL_POWER_PHASE_B_KWH
HOLDING_REAL_POWER_PHASE_C_KWH = _pyupm_h803x.H803X_HOLDING_REAL_POWER_PHASE_C_KWH
HOLDING_POWER_FACTOR_PHASE_A = _pyupm_h803x.H803X_HOLDING_POWER_FACTOR_PHASE_A
HOLDING_POWER_FACTOR_PHASE_B = _pyupm_h803x.H803X_HOLDING_POWER_FACTOR_PHASE_B
HOLDING_POWER_FACTOR_PHASE_C = _pyupm_h803x.H803X_HOLDING_POWER_FACTOR_PHASE_C
HOLDING_VOLTS_PHASE_AB = _pyupm_h803x.H803X_HOLDING_VOLTS_PHASE_AB
HOLDING_VOLTS_PHASE_BC = _pyupm_h803x.H803X_HOLDING_VOLTS_PHASE_BC
HOLDING_VOLTS_PHASE_AC = _pyupm_h803x.H803X_HOLDING_VOLTS_PHASE_AC
HOLDING_VOLTS_PHASE_AN = _pyupm_h803x.H803X_HOLDING_VOLTS_PHASE_AN
HOLDING_VOLTS_PHASE_BN = _pyupm_h803x.H803X_HOLDING_VOLTS_PHASE_BN
HOLDING_VOLTS_PHASE_CN = _pyupm_h803x.H803X_HOLDING_VOLTS_PHASE_CN
HOLDING_CURRENT_PHASE_A = _pyupm_h803x.H803X_HOLDING_CURRENT_PHASE_A
HOLDING_CURRENT_PHASE_B = _pyupm_h803x.H803X_HOLDING_CURRENT_PHASE_B
HOLDING_CURRENT_PHASE_C = _pyupm_h803x.H803X_HOLDING_CURRENT_PHASE_C
HOLDING_AVG_REAL_POWER_KW = _pyupm_h803x.H803X_HOLDING_AVG_REAL_POWER_KW
HOLDING_MIN_REAL_POWER_KW = _pyupm_h803x.H803X_HOLDING_MIN_REAL_POWER_KW
HOLDING_MAX_REAL_POWER_KW = _pyupm_h803x.H803X_HOLDING_MAX_REAL_POWER_KW
MULT_100A = _pyupm_h803x.H803X_MULT_100A
MULT_300A_400A = _pyupm_h803x.H803X_MULT_300A_400A
MULT_800A = _pyupm_h803x.H803X_MULT_800A
MULT_1600A = _pyupm_h803x.H803X_MULT_1600A
MULT_2400A = _pyupm_h803x.H803X_MULT_2400A
def __init__(self, *args):
"""
H803X(std::string device,
int address, int baud=9600, int bits=8, char parity='N', int
stopBits=2)
H803X constructor
Parameters:
-----------
device: Path to the serial device
address: The MODBUS slave address
baud: The baudrate of the device. Default: 9600
bits: The number of bits per byte. Default: 8
parity: The parity of the connection, 'N' for None, 'E' for Even, 'O'
for Odd. Default: 'N'
stopBits: The number of stop bits. Default: 2
"""
this = _pyupm_h803x.new_H803X(*args)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_h803x.delete_H803X
__del__ = lambda self: None
[docs] def update(self):
"""
void update()
Read current values from the sensor and update internal stored values.
This method must be called prior to querying any values.
"""
return _pyupm_h803x.H803X_update(self)
[docs] def getSlaveID(self):
"""
string getSlaveID()
Return a string corresponding the the device's MODBUS slave ID.
string represnting the MODBUS slave ID
"""
return _pyupm_h803x.H803X_getSlaveID(self)
[docs] def setSlaveAddress(self, addr):
"""
void
setSlaveAddress(int addr)
Set a new MODBUS slave address. This is useful if you have multiple
H803X devices on a single bus. When this method is called, the current
stored data is cleared, and a new attempt is made to determine whether
the target device is an H8035 or H8036.
Parameters:
-----------
addr: The new slave address to set
"""
return _pyupm_h803x.H803X_setSlaveAddress(self, addr)
[docs] def presetConsumption(self, value, multiplier):
"""
void
presetConsumption(float value, MULTIPLIERS_T multiplier)
Preset the kWh accumulated Consumption registers to a predefined
value. This is generally not advised, but is provided for those
installations that might require it. The multiplier depends on the
current range of your device. Be sure to select the right multiplier
for your devices' supported current capacity.
Parameters:
-----------
value: The desired value for the consumption accumulator registers in
kWh.
multiplier: The correct MULTIPLIERS_T value for your device.
"""
return _pyupm_h803x.H803X_presetConsumption(self, value, multiplier)
[docs] def getConsumption(self):
"""
float
getConsumption()
Return the accumulated consumption value, in kWh. update() must have
been called prior to calling this method.
The accumulated consumption.
"""
return _pyupm_h803x.H803X_getConsumption(self)
[docs] def getRealPower(self):
"""
float getRealPower()
Return the real power value in kW. update() must have been called
prior to calling this method.
The real power value in kW.
"""
return _pyupm_h803x.H803X_getRealPower(self)
[docs] def getReactivePower(self):
"""
float
getReactivePower()
Return the reactive power value in kVAR (kilo-volt Amperes Reactive).
update() must have been called prior to calling this method.
The reactive power value in kVAR.
"""
return _pyupm_h803x.H803X_getReactivePower(self)
[docs] def getApparentPower(self):
"""
float
getApparentPower()
Return the apparent power value in kVA. update() must have been called
prior to calling this method.
The apparent power value in kVA.
"""
return _pyupm_h803x.H803X_getApparentPower(self)
[docs] def getPowerFactor(self):
"""
float
getPowerFactor()
Return the power factor value. update() must have been called prior to
calling this method.
The power factor.
"""
return _pyupm_h803x.H803X_getPowerFactor(self)
[docs] def getVoltsLineToLine(self):
"""
float
getVoltsLineToLine()
Return the voltage line to line value. update() must have been called
prior to calling this method.
The voltage, line to line.
"""
return _pyupm_h803x.H803X_getVoltsLineToLine(self)
[docs] def getVoltsLineToNeutral(self):
"""
float
getVoltsLineToNeutral()
Return the voltage line to neutral. update() must have been called
prior to calling this method.
The voltage, line to neutral.
"""
return _pyupm_h803x.H803X_getVoltsLineToNeutral(self)
[docs] def getCurrent(self):
"""
float getCurrent()
Return the current value in amps. update() must have been called prior
to calling this method.
The current value in amps.
"""
return _pyupm_h803x.H803X_getCurrent(self)
[docs] def getRealPowerPhaseA(self):
"""
float
getRealPowerPhaseA()
Return the real power for phase A. update() must have been called
prior to calling this method.
The real power for phase A.
"""
return _pyupm_h803x.H803X_getRealPowerPhaseA(self)
[docs] def getRealPowerPhaseB(self):
"""
float
getRealPowerPhaseB()
Return the real power for phase B. update() must have been called
prior to calling this method.
The real power for phase B.
"""
return _pyupm_h803x.H803X_getRealPowerPhaseB(self)
[docs] def getRealPowerPhaseC(self):
"""
float
getRealPowerPhaseC()
Return the real power for phase C. update() must have been called
prior to calling this method.
The real power for phase C.
"""
return _pyupm_h803x.H803X_getRealPowerPhaseC(self)
[docs] def getPowerFactorPhaseA(self):
"""
float
getPowerFactorPhaseA()
Return the power factor for phase A. update() must have been called
prior to calling this method.
The power factor for phase A.
"""
return _pyupm_h803x.H803X_getPowerFactorPhaseA(self)
[docs] def getPowerFactorPhaseB(self):
"""
float
getPowerFactorPhaseB()
Return the power factor for phase B. update() must have been called
prior to calling this method.
The power factor for phase B.
"""
return _pyupm_h803x.H803X_getPowerFactorPhaseB(self)
[docs] def getPowerFactorPhaseC(self):
"""
float
getPowerFactorPhaseC()
Return the power factor for phase C. update() must have been called
prior to calling this method.
The power factor for phase C.
"""
return _pyupm_h803x.H803X_getPowerFactorPhaseC(self)
[docs] def getVoltsPhaseAToB(self):
"""
float
getVoltsPhaseAToB()
Return the voltage for phase A to B. update() must have been called
prior to calling this method.
The voltage for phase A to B.
"""
return _pyupm_h803x.H803X_getVoltsPhaseAToB(self)
[docs] def getVoltsPhaseBToC(self):
"""
float
getVoltsPhaseBToC()
Return the voltage for phase B to C. update() must have been called
prior to calling this method.
The voltage for phase B to C.
"""
return _pyupm_h803x.H803X_getVoltsPhaseBToC(self)
[docs] def getVoltsPhaseAToC(self):
"""
float
getVoltsPhaseAToC()
Return the voltage for phase A to B. update() must have been called
prior to calling this method.
The voltage for phase A to B.
"""
return _pyupm_h803x.H803X_getVoltsPhaseAToC(self)
[docs] def getVoltsPhaseAToNeutral(self):
"""
float
getVoltsPhaseAToNeutral()
Return the voltage for phase A to neutral. update() must have been
called prior to calling this method.
The voltage for phase A to neutral.
"""
return _pyupm_h803x.H803X_getVoltsPhaseAToNeutral(self)
[docs] def getVoltsPhaseBToNeutral(self):
"""
float
getVoltsPhaseBToNeutral()
Return the voltage for phase B to neutral. update() must have been
called prior to calling this method.
The voltage for phase B to neutral.
"""
return _pyupm_h803x.H803X_getVoltsPhaseBToNeutral(self)
[docs] def getVoltsPhaseCToNeutral(self):
"""
float
getVoltsPhaseCToNeutral()
Return the voltage for phase C to neutral. update() must have been
called prior to calling this method.
The voltage for phase C to neutral.
"""
return _pyupm_h803x.H803X_getVoltsPhaseCToNeutral(self)
[docs] def getCurrentPhaseA(self):
"""
float
getCurrentPhaseA()
Return the current for phase A. update() must have been called prior
to calling this method.
The current for phase A.
"""
return _pyupm_h803x.H803X_getCurrentPhaseA(self)
[docs] def getCurrentPhaseB(self):
"""
float
getCurrentPhaseB()
Return the current for phase B. update() must have been called prior
to calling this method.
The current for phase B.
"""
return _pyupm_h803x.H803X_getCurrentPhaseB(self)
[docs] def getCurrentPhaseC(self):
"""
float
getCurrentPhaseC()
Return the current for phase C. update() must have been called prior
to calling this method.
The current for phase C.
"""
return _pyupm_h803x.H803X_getCurrentPhaseC(self)
[docs] def getAvgRealPower(self):
"""
float
getAvgRealPower()
Return the average real power. update() must have been called prior to
calling this method.
The average real power.
"""
return _pyupm_h803x.H803X_getAvgRealPower(self)
[docs] def getMinRealPower(self):
"""
float
getMinRealPower()
Return the minimum real power. update() must have been called prior to
calling this method.
The minimum real power.
"""
return _pyupm_h803x.H803X_getMinRealPower(self)
[docs] def getMaxRealPower(self):
"""
float
getMaxRealPower()
Return the maximum real power. update() must have been called prior to
calling this method.
The maximum real power.
"""
return _pyupm_h803x.H803X_getMaxRealPower(self)
[docs] def setDebug(self, enable):
"""
void setDebug(bool
enable)
Enable or disable debugging output. This primarily enables and
disables libmodbus debugging output.
Parameters:
-----------
enable: true to enable debugging, false otherwise
"""
return _pyupm_h803x.H803X_setDebug(self, enable)
[docs] def isH8036(self):
"""
bool isH8036()
Indicate whether the connected device is an H8035 or an H8036. The
H8036 provides many more data registers.
true if we are using an H8036, false otherwise.
"""
return _pyupm_h803x.H803X_isH8036(self)
H803X_swigregister = _pyupm_h803x.H803X_swigregister
H803X_swigregister(H803X)
# This file is compatible with both classic and new-style classes.