upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Types | Public Member Functions

UPM API for the Veris E50HX Energy Meter. More...

Detailed Description

This module implements support for the Veris E50H2 and E50H5 BACnet Energy Meters.

From the datasheet: The E50H5 BACnet MS/TP DIN Rail Meter with Data Logging combines exceptional performance and easy installation to deliver a cost-effective solution for power monitoring applications. Native serial communication via BACnet MS/TP provides complete accessibility of all measurements to your Building Automation System The data logging capability protects data in the event of a power failure. The E50H5 can be easily installed on standard DIN rail, surface mounted or contained in an optional NEMA 4 enclosure, as needed. The front-panel LCD display makes device installation and setup easy and provides local access to the full set of detailed measurements.

This module was developed using the upm::BACNETMSTP module, based on libbacnet-stack 0.8.3. Both libbacnet 0.8.3 and the upm::BACNETMSTP libraries must be present in order to build this module. This driver was developed on the E50H5. The Trend Log functionality is not currently supported.

The Binary Input Objects are also not supported as these are only used for the Alarm bits which are already available from Analog Input Object 52 as an alarm bitfield incorporating all of the supported alarm indicators.

It was connected 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.

// You will need to edit this example to conform to your site and your
// devices, specifically the Device Object Instance ID passed to the
// constructor, and the arguments to initMaster() that are
// appropriate for your BACnet network.
string defaultDev = "/dev/ttyUSB0";
// if an argument was specified, use it as the device instead
if (argc > 1)
defaultDev = string(argv[1]);
cout << "Using device " << defaultDev << endl;
cout << "Initializing..." << endl;
// Instantiate an E50HX object for an E50HX device that has 1075425
// as it's unique Device Object Instance ID. NOTE: You will
// certainly want to change this to the correct value for your
// device(s).
E50HX sensor(1075425);
// Initialize our BACnet master, if it has not already been
// initialized, with the device and baudrate, choosing 1000001 as
// our unique Device Object Instance ID, 2 as our MAC address and
// using default values for maxMaster and maxInfoFrames
sensor.initMaster(defaultDev, 38400, 1000001, 2);
// Uncomment to enable debugging output
// sensor.setDebug(true);
cout << endl;
cout << "Device Description: " << sensor.getDeviceDescription() << endl;
cout << "Device Location: " << sensor.getDeviceLocation() << endl;
cout << endl;
// update and print a few values every 5 seconds
while (shouldRun) {
cout << "System Voltage: " << sensor.getAnalogValue(E50HX::AV_System_Voltage) << " "
<< sensor.getAnalogValueUnits(E50HX::AV_System_Voltage) << endl;
cout << "System Type: " << sensor.getAnalogValue(E50HX::AV_System_Type) << endl;
cout << "Energy Consumption: " << sensor.getAnalogInput(E50HX::AI_Energy) << " "
<< sensor.getAnalogInputUnits(E50HX::AI_Energy) << endl;
cout << "Power Up Counter: " << sensor.getAnalogInput(E50HX::AI_Power_Up_Count) << endl;
cout << endl;
cout << "Exiting..." << endl;

Public Types

enum  ANALOG_VALUES_T : uint32_t {
  AV_Config = 1, AV_System_Type = 2, AV_CT_Ratio_Primary = 3, AV_CT_Ratio_Secondary = 4,
  AV_PT_Ratio = 5, AV_System_Voltage = 6, AV_Display_Units = 7, AV_Phase_Loss_Voltage_Threshold = 8,
  AV_Phase_Loss_Imbalance_Threshold = 9, AV_Subintervals = 10, AV_Subinterval_Length = 11
enum  ANALOG_INPUTS_T : uint32_t {
  AI_Energy = 1, AI_kW_Total = 2, AI_kVAR_Total = 3, AI_kVA_Total = 4,
  AI_PF_Total = 5, AI_Volts_LL_Avg = 6, AI_Volts_LN_Avg = 7, AI_Current_Avg = 8,
  AI_kW_A = 9, AI_kW_B = 10, AI_kW_C = 11, AI_PF_A = 12,
  AI_PF_B = 13, AI_PF_C = 14, AI_Volts_AB = 15, AI_Volts_BC = 16,
  AI_Volts_AC = 17, AI_Volts_AN = 18, AI_Volts_BN = 19, AI_Volts_CN = 20,
  AI_Current_A = 21, AI_Current_B = 22, AI_Current_C = 23, AI_Frequency = 25,
  AI_kVAh = 26, AI_kVARh = 27, AI_kVA_A = 28, AI_kVA_B = 29,
  AI_kVA_C = 30, AI_kVAR_A = 31, AI_kVAR_B = 32, AI_kVAR_C = 33,
  AI_KW_Present_Demand = 34, AI_KVAR_Present_Demand = 35, AI_KWA_Present_Demand = 36, AI_KW_Max_Demand = 37,
  AI_KVAR_Max_Demand = 38, AI_KVA_Max_Demand = 39, AI_Pulse_Count_1 = 40, AI_Pulse_Count_2 = 41,
  AI_KWH_A = 42, AI_KWH_B = 43, AI_KWH_C = 44, AI_Max_Power = 45,
  AI_Energy_Resets = 47, AI_Power_Up_Count = 50, AI_Output_Config = 51, AI_Alarm_Bitmap = 52
enum  ALARM_BITS_T : uint16_t {
  ALARM_Volts_Error_A = 0x0001, ALARM_Volts_Error_B = 0x0002, ALARM_Volts_Error_C = 0x0004, ALARM_Current_Error_A = 0x0008,
  ALARM_Current_Error_B = 0x0010, ALARM_Current_Error_C = 0x0020, ALARM_Frequency_Error = 0x0040, ALARM_Reserved_0 = 0x0080,
  ALARM_Phase_Loss_A = 0x0100, ALARM_Phase_Loss_B = 0x0200, ALARM_Phase_Loss_C = 0x0400, ALARM_Power_Factor_A = 0x0800,
  ALARM_Power_Factor_B = 0x1000, ALARM_Power_Factor_C = 0x2000, ALARM_RTC_RESET = 0x4000

Public Member Functions

 E50HX (uint32_t targetDeviceObjectID)
 ~E50HX ()
void writeConfig (CFG_VALUES_T config)
void writeSystemType (SYSTEM_TYPES_T systype)
void writeCTRatioPrimary (float ctRatio)
void writeCTRatioSecondary (CT_SECONDARY_T ctRatio)
void writePTRatio (float ptRatio)
void writeSystemVoltage (float sysVolts)
void writeDisplayUnits (DISP_UNITS_T dispUnits)
void writePhaseLossVT (float phaseLoss)
void writePhaseLossIT (float phaseLoss)
uint16_t getAlarmBits ()
- Public Member Functions inherited from BACNETUTIL
 BACNETUTIL (uint32_t targetDeviceObjectID)
virtual ~BACNETUTIL ()
virtual void initMaster (std::string port, int baudRate, int deviceInstanceNumber, int macAddr, int maxMaster=DEFAULT_MAX_MASTER, int maxInfoFrames=1)
virtual void setDebug (bool enable)
virtual float getAnalogValue (uint32_t objInstance)
virtual void setAnalogValue (uint32_t objInstance, float value)
virtual float getAnalogInput (uint32_t objInstance)
virtual std::string getAnalogValueUnits (uint32_t objInstance)
virtual std::string getAnalogInputUnits (uint32_t objInstance)
virtual bool getBinaryInput (uint32_t objInstance)
virtual std::string lookupBinaryInputText (uint32_t objInstance, bool value)
virtual std::string getBinaryInputText (uint32_t objInstance)
virtual bool getBinaryValue (uint32_t objInstance)
virtual void setBinaryValue (uint32_t objInstance, bool value)
virtual std::string lookupBinaryValueText (uint32_t objInstance, bool value)
virtual std::string getBinaryValueText (uint32_t objInstance)
virtual unsigned int getMultiStateValue (uint32_t objInstance)
virtual std::string lookupMultiStateValueText (uint32_t objInstance, unsigned int value)
virtual std::string getMultiStateValueText (uint32_t objInstance)
virtual unsigned int getMultiStateValueMaxStates (uint32_t objInstance)
virtual void setMultiStateValue (uint32_t objInstance, unsigned int value)
virtual void checkReliability (bool enable)
virtual std::string getDeviceDescription ()
virtual std::string getDeviceLocation ()
virtual bool setDeviceLocation (std::string location)
virtual std::string getDeviceName ()
virtual bool setDeviceName (std::string name)
virtual std::string getAllErrorString ()
virtual BACNETMSTP::BACERR_TYPE_T getErrorType ()
virtual uint8_t getRejectReason ()
virtual std::string getRejectString ()
virtual uint8_t getAbortReason ()
virtual std::string getAbortString ()
virtual BACNET_ERROR_CLASS getErrorClass ()
virtual BACNET_ERROR_CODE getErrorCode ()
virtual std::string getErrorString ()
virtual std::string getUPMErrorString ()

Additional Inherited Members

- Protected Types inherited from BACNETUTIL
typedef std::map< uint32_t, binaryData_tbinaryInfo_t
typedef std::map< uint32_t, multiStateData_tmultiStateInfo_t
typedef std::map< uint32_t, std::string > avCacheMap_t
typedef std::map< uint32_t, std::string > aiCacheMap_t
- Protected Member Functions inherited from BACNETUTIL
virtual void updateMultiStateValueInfo (uint32_t objInstance)
virtual void deleteMultiStateValueInfo (uint32_t objInstance)
virtual void updateBinaryValueInfo (uint32_t objInstance)
virtual void deleteBinaryValueInfo (uint32_t objInstance)
virtual void updateBinaryInputInfo (uint32_t objInstance)
virtual void deleteBinaryInputInfo (uint32_t objInstance)
- Protected Attributes inherited from BACNETUTIL
bool m_debugging
bool m_checkReliability
uint32_t m_targetDeviceObjectID
bool m_initialized
binaryInfo_t m_bvInfo
binaryInfo_t m_biInfo
multiStateInfo_t m_msvInfo
avCacheMap_t m_avUnitCache
aiCacheMap_t m_aiUnitCache

Constructor & Destructor Documentation

E50HX ( uint32_t  targetDeviceObjectID)

E50HX constructor

targetDeviceObjectIDthe unique Instance ID of the Device Object. This number is used to uniquely identify devices on the BACnet network, and ranges from 1 to 4194302. This is not the device's MAC address, though on some devices, the MAC address may be used as part of this number. On the E50HX, this number is randomly generated per device, and you can see this number (or change it) on the BACnet config screens on the LCD.

Here is the call graph for this function:

~E50HX ( )

E50HX Destructor

Member Function Documentation

void writeConfig ( CFG_VALUES_T  config)

Write one of several 'magic' numbers to the configuration object (AV1). This is used to clear certain counters, reset the accumulated Energy consumption values, etc. This method will throw on error.

configOne of the CFG_VALUES_T values

Here is the call graph for this function:

void writeSystemType ( SYSTEM_TYPES_T  systype)

Set the System Type of the device. This defines the voltage lines you have connected. This method will throw on error.

systypeOne of the SYSTEM_TYPES_T values.

Here is the call graph for this function:

void writeCTRatioPrimary ( float  ctRatio)

Set the Primary CT ratio. See the datasheet for details. This method will throw on error.

ctRatioA floating point value between 5-32000

Here is the call graph for this function:

void writeCTRatioSecondary ( CT_SECONDARY_T  ctRatio)

Set the Secondary CT ratio. See the datasheet for details. This method will throw on error.

ctRatioOne of the CT_SECONDARY_T values.

Here is the call graph for this function:

void writePTRatio ( float  ptRatio)

Set the PT ratio. See the datasheet for details. This method will throw on error.

ptRatioA floating point value between 0.01-320.0

Here is the call graph for this function:

void writeSystemVoltage ( float  sysVolts)

Set the System Voltage parmeter. See the datasheet for details. This method will throw on error.

sysVoltsA floating point value between 82.0-32000.0

Here is the call graph for this function:

void writeDisplayUnits ( DISP_UNITS_T  dispUnits)

Set the LCD Display Units in IEC or IEEE format. This method will throw on error.

dispUnitsOne of the DISP_UNITS_T values.

Here is the call graph for this function:

void writePhaseLossVT ( float  phaseLoss)

Set the Phase Loss Voltage Threshold. See the datasheet for details. This method will throw on error.

phaseLossA floating point value between 1.0-99.0

Here is the call graph for this function:

void writePhaseLossIT ( float  phaseLoss)

Set the Phase Loss Imbalance Threshold. See the datasheet for details. This method will throw on error.

phaseLossA floating point value between 1.0-99.0

Here is the call graph for this function:

uint16_t getAlarmBits ( )

Query the AI52 Object and return a bitmask of current Alarms. Compare against ALARM_BITS_T to determine what conditions are signaling an alarm. Alarm conditions will clear on their own as soon as the cause is rectified. This method will throw on error.

A bitmask of values from ALARM_BITS_T indicating current alarm conditions.

Here is the call graph for this function:

Inheritance diagram for E50HX:
Inheritance graph
Collaboration diagram for E50HX:
Collaboration graph

The documentation for this class was generated from the following files: