TwiceAsNice  2019-02-18
Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Basda::Tempo::JumoDevice Class Reference

#include <JumoDevice.h>

Inheritance diagram for Basda::Tempo::JumoDevice:
Inheritance graph
Collaboration diagram for Basda::Tempo::JumoDevice:
Collaboration graph

Public Types

typedef ::Basda::DeviceAsync DeviceAsync
 
typedef ::Basda::DeviceAsync DeviceAsync
 

Public Member Functions

 JumoDevice (const Nice::JointPtr &config)
 
virtual ~JumoDevice ()
 
virtual void open (void)
 
virtual void close (void)
 close device More...
 
virtual void reset (DeviceAsync &=::Basda::Device::s_async)
 reset the device More...
 
virtual void init (DeviceAsync &=Basda::Device::s_async)
 init the device More...
 
virtual void deinit (DeviceAsync &=::Basda::Device::s_async)
 deinit the device More...
 
virtual void activate (DeviceAsync &=::Basda::Device::s_async)
 activate the device More...
 
virtual void deactivate (DeviceAsync &=::Basda::Device::s_async)
 deactivate the device More...
 
virtual void updateProperties ()
 
virtual void version ()
 
virtual bool isReachable ()
 function to check whether the device is reachable or not More...
 
void setReachable (const bool state)
 set reachability status of the device More...
 
void queryDataFromJumo ()
 queries the Jumo device for current data More...
 
 JumoDevice (const Nice::JointPtr &config)
 
virtual ~JumoDevice ()
 
virtual void open (void)
 open device More...
 
virtual void close (void)
 close device More...
 
virtual void reset (DeviceAsync &=::Basda::Device::s_async)
 reset the device More...
 
virtual void init (DeviceAsync &=Basda::Device::s_async)
 init the device More...
 
virtual void deinit (DeviceAsync &=::Basda::Device::s_async)
 deinit the device More...
 
virtual void activate (DeviceAsync &=::Basda::Device::s_async)
 activate the device More...
 
virtual void deactivate (DeviceAsync &=::Basda::Device::s_async)
 deactivate the device More...
 
virtual void updateProperties ()
 
virtual void version ()
 version More...
 
virtual bool isReachable ()
 function to check whether the device is reachable or not More...
 
void setReachable (const bool state)
 set reachability status of the device More...
 
void queryDataFromJumo ()
 queries the Jumo device for current data More...
 
- Public Member Functions inherited from Basda::Tempo::TempoDevice
 TempoDevice (const Nice::JointPtr &config)
 
virtual ~TempoDevice ()
 
 TempoDevice (const Nice::JointPtr &config)
 
virtual ~TempoDevice ()
 
 TempoDevice (const Nice::JointPtr &config)
 
virtual ~TempoDevice ()
 
- Public Member Functions inherited from Basda::Device
 Device (const Nice::JointPtr &_config)
 constructor. This is an elementary (lazy) action which stores the name and gets configuration. More...
 
virtual ~Device ()
 destructor Does nothing More...
 
virtual void setConfig (const Nice::JointPtr &_config)
 init with config tree ptr More...
 
Nice::JointPtrconfig ()
 retrieve the property tree More...
 
std::string & name ()
 retrieve the name set at ctor time. More...
 
 Device (const Nice::JointPtr &_config)
 constructor. This is an elementary (lazy) action which stores the name and gets configuration. More...
 
virtual ~Device ()
 destructor Does nothing More...
 
virtual void setConfig (const Nice::JointPtr &_config)
 init with config tree ptr More...
 
Nice::JointPtrconfig ()
 retrieve the property tree More...
 
std::string & name ()
 retrieve the name set at ctor time. More...
 

Protected Attributes

jumoData m_data
 The collection of analog and digital data read most recently from the device. More...
 
- Protected Attributes inherited from Basda::Device
Nice::JointPtr m_config
 
Nice::JointPtr m_cfg
 
Nice::JointPtr m_var
 
std::string m_name
 

Private Member Functions

void setPropertiesToUnknown ()
 set all device properties to unknown More...
 
void handleErrors ()
 does the device specific error handling More...
 
void initJumoData ()
 init the Jumo data More...
 
void readRegister (modbus_t *ctx, int add, int nReg, Nice::U16 *dataReg)
 work-around method for logging data into a file at a certain rate More...
 
void writeRegister (modbus_t *ctx, int add, int nReg)
 
float getFloatFromReading (Nice::U16 byteOne, Nice::U16 byteTwo)
 helper function to extract correct float value from read data bytes via modbus More...
 
void extractBinaryInputs (Nice::U16 inByte)
 helper function to get the binary inputs More...
 
void extractAlarmOutputs (const Nice::BitSet &_alarms)
 helper function to get the binary alarm outputs More...
 
void setPropertiesToUnknown ()
 set all device properties to unknown More...
 
void handleErrors ()
 does the device specific error handling More...
 
void initJumoData ()
 init the Jumo data More...
 
void readRegister (modbus_t *ctx, int add, int nReg, Nice::U16 *dataReg)
 work-around method for logging data into a file at a certain rate More...
 
void writeRegister (modbus_t *ctx, int add, int nReg)
 
float getFloatFromReading (Nice::U16 byteOne, Nice::U16 byteTwo)
 helper function to extract correct float value from read data bytes via modbus More...
 
void extractBinaryInputs (Nice::U16 inByte)
 helper function to get the binary inputs More...
 
void extractAlarmOutputs (const Nice::BitSet &_alarms)
 helper function to get the binary alarm outputs More...
 

Private Attributes

std::string m_connection
 stores the connection address of the device currently connected to More...
 
IceUtil::RecMutex m_syncMutex
 
bool m_isReachable
 reachable flag More...
 
modbus_tm_modbus
 storing the modbus context More...
 

Additional Inherited Members

- Static Public Attributes inherited from Basda::Device
static DeviceAsyncImpl s_async
 

Detailed Description


A JUMO controller with a set of analog and digital inputs and outputs.

Member Typedef Documentation

◆ DeviceAsync [1/2]

◆ DeviceAsync [2/2]

Constructor & Destructor Documentation

◆ JumoDevice() [1/2]

Basda::Tempo::JumoDevice::JumoDevice ( const Nice::JointPtr config)

Ctor. Set the state to unreachable and configure the leaves.

Parameters
configThe Nice node to be configured.

◆ ~JumoDevice() [1/2]

Basda::Tempo::JumoDevice::~JumoDevice ( )
virtual

Dtor. This is a dummy action and does nothing.

◆ JumoDevice() [2/2]

Basda::Tempo::JumoDevice::JumoDevice ( const Nice::JointPtr config)

◆ ~JumoDevice() [2/2]

virtual Basda::Tempo::JumoDevice::~JumoDevice ( )
virtual

Member Function Documentation

◆ activate() [1/2]

virtual void Basda::Tempo::JumoDevice::activate ( DeviceAsync = ::Basda::Device::s_async)
inlinevirtual

activate the device

Implements Basda::Device.

◆ activate() [2/2]

virtual void Basda::Tempo::JumoDevice::activate ( DeviceAsync = ::Basda::Device::s_async)
inlinevirtual

activate the device

Implements Basda::Device.

◆ close() [1/2]

virtual void Basda::Tempo::JumoDevice::close ( void  )
virtual

close device

Implements Basda::Device.

◆ close() [2/2]

void Basda::Tempo::JumoDevice::close ( void  )
virtual

close device

Implements Basda::Device.

◆ deactivate() [1/2]

virtual void Basda::Tempo::JumoDevice::deactivate ( DeviceAsync = ::Basda::Device::s_async)
inlinevirtual

deactivate the device

Implements Basda::Device.

◆ deactivate() [2/2]

virtual void Basda::Tempo::JumoDevice::deactivate ( DeviceAsync = ::Basda::Device::s_async)
inlinevirtual

deactivate the device

Implements Basda::Device.

◆ deinit() [1/2]

void Basda::Tempo::JumoDevice::deinit ( DeviceAsync = ::Basda::Device::s_async)
virtual

deinit the device

Implements Basda::Device.

◆ deinit() [2/2]

virtual void Basda::Tempo::JumoDevice::deinit ( DeviceAsync = ::Basda::Device::s_async)
virtual

deinit the device

Implements Basda::Device.

◆ extractAlarmOutputs() [1/2]

void Basda::Tempo::JumoDevice::extractAlarmOutputs ( const Nice::BitSet _alarms)
private

helper function to get the binary alarm outputs

◆ extractAlarmOutputs() [2/2]

void Basda::Tempo::JumoDevice::extractAlarmOutputs ( const Nice::BitSet _alarms)
private

helper function to get the binary alarm outputs


Split the contents of a register into the logical bits.

Extracts the bits of siren alarm and LBT alarm.

Parameters
inByteThe register value to be split.

◆ extractBinaryInputs() [1/2]

void Basda::Tempo::JumoDevice::extractBinaryInputs ( Nice::U16  inByte)
private

helper function to get the binary inputs


Split the contents of a register into the logical bits.

Extracts the bits of cooling flow and cabling alarms and fans with a hardcoded mask that gives meaning to the individual bits.

Parameters
inByteThe register value to be split.

◆ extractBinaryInputs() [2/2]

void Basda::Tempo::JumoDevice::extractBinaryInputs ( Nice::U16  inByte)
private

helper function to get the binary inputs

◆ getFloatFromReading() [1/2]

float Basda::Tempo::JumoDevice::getFloatFromReading ( Nice::U16  byteOne,
Nice::U16  byteTwo 
)
private

helper function to extract correct float value from read data bytes via modbus


Combine two register values of the the internal Jumo format to one floating point values.

Parameters
byteOneThe first register.
byteTwothe second register
Returns
The equivalent numberical value.

◆ getFloatFromReading() [2/2]

float Basda::Tempo::JumoDevice::getFloatFromReading ( Nice::U16  byteOne,
Nice::U16  byteTwo 
)
private

helper function to extract correct float value from read data bytes via modbus

◆ handleErrors() [1/2]

void Basda::Tempo::JumoDevice::handleErrors ( )
private

does the device specific error handling

◆ handleErrors() [2/2]

void Basda::Tempo::JumoDevice::handleErrors ( )
private

does the device specific error handling


Set the property values to unknown, the device to unreachable and disconnect.

◆ init() [1/2]

void Basda::Tempo::JumoDevice::init ( DeviceAsync = Basda::Device::s_async)
virtual

init the device

Implements Basda::Device.

◆ init() [2/2]

virtual void Basda::Tempo::JumoDevice::init ( DeviceAsync = Basda::Device::s_async)
virtual

init the device

Implements Basda::Device.

◆ initJumoData() [1/2]

void Basda::Tempo::JumoDevice::initJumoData ( )
private

init the Jumo data

◆ initJumoData() [2/2]

void Basda::Tempo::JumoDevice::initJumoData ( )
private

init the Jumo data


Set all temperatures to zero, all status to false and all alarms to true.

◆ isReachable() [1/2]

bool Basda::Tempo::JumoDevice::isReachable ( )
virtual

function to check whether the device is reachable or not

Returns
true if reachable, false otherwise

Returns
true if the device is flagged as reachable

Implements Basda::Tempo::TempoDevice.

◆ isReachable() [2/2]

virtual bool Basda::Tempo::JumoDevice::isReachable ( )
virtual

function to check whether the device is reachable or not

Returns
true if reachable, false otherwise

Implements Basda::Tempo::TempoDevice.

◆ open() [1/2]

void Basda::Tempo::JumoDevice::open ( void  )
virtual

Reopen and reconnect to the device.

If the device is already open, close first

Get the way of communication from the CON node. This must start with "tcp". Other attempts of connectino are refused.

open the MODBUS RTU_TCP connection given host and port

Implements Basda::Device.

◆ open() [2/2]

virtual void Basda::Tempo::JumoDevice::open ( void  )
virtual

open device

Implements Basda::Device.

◆ queryDataFromJumo() [1/2]

void Basda::Tempo::JumoDevice::queryDataFromJumo ( )

queries the Jumo device for current data

◆ queryDataFromJumo() [2/2]

void Basda::Tempo::JumoDevice::queryDataFromJumo ( )

queries the Jumo device for current data


Send request of obtaining the 4 temperatures, fan speeds and alarm bits.

The JUMO register addresses are hardcoded here for any of the pieces of information. Temperatures above 50 lead to setting status flags of the temperatures to false.

◆ readRegister() [1/2]

void Basda::Tempo::JumoDevice::readRegister ( modbus_t ctx,
int  add,
int  nReg,
Nice::U16 dataReg 
)
private

work-around method for logging data into a file at a certain rate

wrapper around modbus lib read method for advanced handling (if wanted)


Extract a number of register values from the device This is forwarded to a call of the libmodbus library.

Parameters
ctxThe handle of the libmodbus library
addAddress of the Modbus
nregNumber of registers to be read
dataRegWhere the result is stored.

◆ readRegister() [2/2]

void Basda::Tempo::JumoDevice::readRegister ( modbus_t ctx,
int  add,
int  nReg,
Nice::U16 dataReg 
)
private

work-around method for logging data into a file at a certain rate

wrapper around modbus lib read method for advanced handling (if wanted)

◆ reset() [1/2]

virtual void Basda::Tempo::JumoDevice::reset ( DeviceAsync = ::Basda::Device::s_async)
virtual

reset the device

Implements Basda::Device.

◆ reset() [2/2]

void Basda::Tempo::JumoDevice::reset ( DeviceAsync = ::Basda::Device::s_async)
virtual

reset the device

Implements Basda::Device.

◆ setPropertiesToUnknown() [1/2]

void Basda::Tempo::JumoDevice::setPropertiesToUnknown ( )
private

set all device properties to unknown


Set all properties of fans to unknown and status flags to false.

The temperature and fan values themselves are not touched, nor the alarms. So this is conservatively preserving data that are actually read off the device.

◆ setPropertiesToUnknown() [2/2]

void Basda::Tempo::JumoDevice::setPropertiesToUnknown ( )
private

set all device properties to unknown

◆ setReachable() [1/2]

void Basda::Tempo::JumoDevice::setReachable ( const bool  state)

set reachability status of the device

Parameters
statetrue if reachable, false otherwise

◆ setReachable() [2/2]

void Basda::Tempo::JumoDevice::setReachable ( const bool  state)

set reachability status of the device

Parameters
statetrue if reachable, false otherwise

Assign a new state of being reachable or not.

Parameters
stateThe new state on return of this function.

◆ updateProperties() [1/2]

void Basda::Tempo::JumoDevice::updateProperties ( )
virtual

Load the currente values into the properties.

This updates the data on fans, the 4 temperatures, the 4 alarm flags and the 4 status flags. The data are those read earlier, and not obtained in this function.

Implements Basda::Tempo::TempoDevice.

◆ updateProperties() [2/2]

virtual void Basda::Tempo::JumoDevice::updateProperties ( )
virtual

◆ version() [1/2]

void Basda::Tempo::JumoDevice::version ( void  )
virtual

Print the version information to the log file.

Implements Basda::Device.

◆ version() [2/2]

virtual void Basda::Tempo::JumoDevice::version ( )
virtual

version

Implements Basda::Device.

◆ writeRegister() [1/2]

void Basda::Tempo::JumoDevice::writeRegister ( modbus_t ctx,
int  add,
int  nReg 
)
private

◆ writeRegister() [2/2]

void Basda::Tempo::JumoDevice::writeRegister ( modbus_t ctx,
int  add,
int  nReg 
)
private

Member Data Documentation

◆ m_connection

std::string Basda::Tempo::JumoDevice::m_connection
private

stores the connection address of the device currently connected to

◆ m_data

jumoData Basda::Tempo::JumoDevice::m_data
protected

The collection of analog and digital data read most recently from the device.

◆ m_isReachable

bool Basda::Tempo::JumoDevice::m_isReachable
private

reachable flag

◆ m_modbus

modbus_t * Basda::Tempo::JumoDevice::m_modbus
private

storing the modbus context

◆ m_syncMutex

IceUtil::RecMutex Basda::Tempo::JumoDevice::m_syncMutex
private

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