OpcUaCanOpen
CANopen OPC-UA server
|
This class ensure a value which calculates from input variable based on analytic formula. More...
#include <UaCalcItem.h>
Inherits AddressSpace::UaControlVariable, and AddressSpace::UaControlVariable.
Public Types | |
typedef map< std::string, UaControlVariable * > | variableSet |
typedef map< std::string, UaControlVariable * > | variableSet |
Public Member Functions | |
virtual void | calculateOnChange (Session *pSession, const UaDataValue &dataValue, OpcUa_Boolean checkAccessLevel) |
type of set of variable for formula More... | |
virtual void | initCalculation () |
initial calculation after startup More... | |
UaCalcItem (const UaString &name, UaNodeId &uaId, const UaNode *parent, NmBuildingAutomation *pNodeConfig, UaVariant &dv, ITEM &citem, UaControlVariableMap &cvs, UaMutexRefCounted *pSharedMutex) | |
Constructor. More... | |
bool | compile () |
virtual | ~UaCalcItem (void) |
destructor More... | |
bool | pushDataVariable (const string &name, UaControlVariable *obd) |
Connect to the input object. More... | |
bool | pushConditionVariable (const string &name, UaControlVariable *obd) |
Connect to the object using in conditional formula. More... | |
bool | pushStatusVariable (const string &name, UaControlVariable *obd) |
Connect to the object using in conditional formula. More... | |
bool | fExists () |
void | replaceAll (std::string &str, const std::string &from, const std::string &to) |
bool | checkDouble (const string &str, double &res) |
OpcUa_StatusCode | checkStatus (variableSet &vs) |
virtual void | calculateOnChange (Session *pSession, const UaDataValue &dataValue, OpcUa_Boolean checkAccessLevel) |
type of set of variable for formula More... | |
virtual void | initCalculation () |
initial calculation after startup More... | |
UaCalcItem (const UaString &name, UaNodeId &uaId, const UaNode *parent, NmBuildingAutomation *pNodeConfig, UaVariant &dv, ITEM &citem, UaControlVariableMap &cvs, UaMutexRefCounted *pSharedMutex) | |
Constructor. More... | |
virtual | ~UaCalcItem (void) |
destructor More... | |
void | pushDataVariable (std::string &name, UaControlVariable *obd) |
Connect to the input object. More... | |
void | pushConditionVariable (std::string &name, UaControlVariable *obd) |
Connect to the object using in conditional formula. More... | |
void | pushStatusVariable (std::string &name, UaControlVariable *obd) |
Connect to the object using in conditional formula. More... | |
OpcUa_StatusCode | checkStatus (variableSet &vs) |
string & | getFormula () |
string & | getWhenCondition () |
string & | getStatusCondition () |
![]() | |
UaControlVariable (UaNode *cur, NmBuildingAutomation *pNodeManager, UaVariable *instance, UaMutexRefCounted *pSharedMutex) | |
Constructor. More... | |
UaControlVariable (const UaString &name, const UaNodeId &newNodeId, NmBuildingAutomation *pNodeManager, UaVariant &dv, UaMutexRefCounted *pSharedMutex) | |
virtual | ~UaControlVariable () |
virtual UaStatus | write (UaDataValue &udv) |
virtual UaStatus | read () |
virtual UaStatus | setValue (Session *pSession, const UaDataValue &dataValue, OpcUa_Boolean checkAccessLevel) |
Redefine setValue function to sent data change signal;. More... | |
virtual UaStatus | setValueOnChange (Session *pSession, const UaDataValue &dataValue, OpcUa_Boolean checkAccessLevel) |
Redefine setValue function to sent data change signal;. More... | |
virtual void | connectItem (UaControlVariable *item) |
virtual UaNodeId | typeDefinitionId () const |
virtual void | setTypeDefinition (UaNodeId uni) |
set node id of type of variable More... | |
void | convertToDouble (const UaDataValue &dataValue) |
Signal. More... | |
UaControlVariable (UaNode *cur, NmBuildingAutomation *pNodeManager, UaVariable *instance, UaMutexRefCounted *pSharedMutex) | |
Constructor. More... | |
UaControlVariable (const UaString &name, const UaNodeId &newNodeId, NmBuildingAutomation *pNodeManager, UaVariant &dv, UaMutexRefCounted *pSharedMutex) | |
virtual | ~UaControlVariable () |
virtual UaStatus | write (UaDataValue &udv) |
virtual UaStatus | read () |
virtual UaStatus | setValue (Session *pSession, const UaDataValue &dataValue, OpcUa_Boolean checkAccessLevel) |
Redefine setValue function to sent data change signal;. More... | |
virtual UaStatus | setValueOnChange (Session *pSession, const UaDataValue &dataValue, OpcUa_Boolean checkAccessLevel) |
Redefine setValue function to sent data change signal;. More... | |
virtual void | connectItem (UaControlVariable *item) |
virtual UaNodeId | typeDefinitionId () const |
virtual void | setTypeDefinition (UaNodeId uni) |
set node id of type of variable More... | |
void | convertToDouble (const UaDataValue &dataValue) |
Signal. More... | |
Static Public Member Functions | |
static mu::value_type * | getValueFromItem (const mu::char_type *ind, void *pNode) |
bind function which calculator uses to take data from OpcUa variable More... | |
static mu::value_type * | getValueFromWhenItem (const mu::char_type *ind, void *pNode) |
static mu::value_type * | getValueFromStatusItem (const mu::char_type *ind, void *pNode) |
static double | PowFunc (double a_fVal, double b_fVal) |
Public Attributes | |
const OpcUa::BaseObjectType * | m_pParent |
NmBuildingAutomation * | m_pNodeManager |
status logical formula More... | |
![]() | |
boost::signals2::signal< void(Session *pSession, const UaDataValue &dataValue, OpcUa_Boolean checkAccessLevel) > | valueChange |
write date to hardware More... | |
OpcUa_Double | curValue |
Private Member Functions | |
UA_DISABLE_COPY (UaCalcItem) | |
UA_DISABLE_COPY (UaCalcItem) | |
Private Attributes | |
expression_t | m_formul |
bind function which calculator uses to take data from OpcUa variable More... | |
expression_t | m_whenCondition |
expression_t | m_statusFormula |
symbol_table_t | m_formul_table |
parser_t | parser_d |
parser_t | parser_b |
parser_t | parser_i |
string | m_sFormul |
variables using in status formula More... | |
string | m_sWhenCondition |
formula in text form More... | |
string | m_sStatusCondition |
condition formula More... | |
bool | m_fExists |
status logical formula More... | |
bool | m_cExists |
bool | m_sExists |
variableSet | m_whenVar |
variableSet | m_var |
variable using in condition formula More... | |
variableSet | m_statusVar |
variables using in formula More... | |
mu::Parser | m_whenCondition |
mu::Parser | m_formul |
logical formula if it s true the calculation will be executed More... | |
mu::Parser | m_statusFormula |
analytic formula to calculate More... | |
const UaNode * | m_pParent |
This class ensure a value which calculates from input variable based on analytic formula.
The calculation item takes value when the logical condition formula becomes true.
When the value of control variable is changed it send the signal to this class.
The callback function "calculateOnChange" first of all checks th "when condition" and if it is true calculate the value.
Definition at line 65 of file UaCalcItem.h.
typedef map<std::string, UaControlVariable*> AddressSpace::UaCalcItem::variableSet |
Definition at line 61 of file UaCalcItem.hpp.
typedef map<std::string, UaControlVariable*> AddressSpace::UaCalcItem::variableSet |
Definition at line 70 of file UaCalcItem.h.
AddressSpace::UaCalcItem::UaCalcItem | ( | const UaString & | name, |
UaNodeId & | uaId, | ||
const UaNode * | parent, | ||
NmBuildingAutomation * | pNodeConfig, | ||
UaVariant & | dv, | ||
ITEM & | citem, | ||
UaControlVariableMap & | cvs, | ||
UaMutexRefCounted * | pSharedMutex | ||
) |
Constructor.
name | the name of ua node |
uaId | item ua node id |
pNodeConfig | pointer to node manager |
dv | initial value of item (usually empty) |
formul | pointer to formula object |
whenCondition | pointer to conditional formulas |
statusCondition | formula status conditions |
pSharedMutex | pointer to shared mutex (using toolkit) |
< set change date by event
< set change date by event
Definition at line 67 of file UaCalcItem.cpp.
|
inlinevirtual |
destructor
Definition at line 100 of file UaCalcItem.h.
AddressSpace::UaCalcItem::UaCalcItem | ( | const UaString & | name, |
UaNodeId & | uaId, | ||
const UaNode * | parent, | ||
NmBuildingAutomation * | pNodeConfig, | ||
UaVariant & | dv, | ||
ITEM & | citem, | ||
UaControlVariableMap & | cvs, | ||
UaMutexRefCounted * | pSharedMutex | ||
) |
Constructor.
name | the name of ua node |
uaId | item ua node id |
pNodeConfig | pointer to node manager |
dv | initial value of item (usually empty) |
formul | pointer to formula object |
whenCondition | pointer to conditional formulas |
statusCondition | formula status conditions |
pSharedMutex | pointer to shared mutex (using toolkit) |
|
inlinevirtual |
destructor
Definition at line 92 of file UaCalcItem.hpp.
|
virtual |
type of set of variable for formula
The callback function to calculate the value.
dValue | the value of changed control variable |
|
virtual |
type of set of variable for formula
The callback function to calculate the value.
dValue | the value of changed control variable |
< boost placeholder for binding argument
bind function which calculator uses to take data from OpcUa variable
< boost placeholder for binding argument
bind function which calculator uses to take data from OpcUa variable
Definition at line 253 of file UaCalcItem.cpp.
|
inline |
Definition at line 168 of file UaCalcItem.h.
|
inline |
Definition at line 148 of file UaCalcItem.hpp.
|
inline |
Definition at line 202 of file UaCalcItem.h.
bool AddressSpace::UaCalcItem::compile | ( | ) |
Definition at line 157 of file UaCalcItem.cpp.
|
inline |
Definition at line 157 of file UaCalcItem.h.
|
inline |
Definition at line 169 of file UaCalcItem.hpp.
|
inline |
Definition at line 171 of file UaCalcItem.hpp.
|
static |
bind function which calculator uses to take data from OpcUa variable
this function take data from OpcUa variable.
the pointer saved in vector m_var
ind | index of vector of pointer to variable |
std::replace(nam.begin(), nam.end(), '.', '_');
Definition at line 555 of file UaCalcItem.cxx.
|
static |
Definition at line 601 of file UaCalcItem.cxx.
|
static |
Definition at line 579 of file UaCalcItem.cxx.
|
inline |
Definition at line 170 of file UaCalcItem.hpp.
|
virtual |
initial calculation after startup
|
virtual |
initial calculation after startup
boost placeholder for binding argument
bind function which calculator uses to take data from OpcUa variable
boost placeholder for binding argument
bind function which calculator uses to take data from OpcUa variable
Definition at line 330 of file UaCalcItem.cpp.
|
inlinestatic |
Definition at line 175 of file UaCalcItem.hpp.
|
inline |
Connect to the object using in conditional formula.
Set callback function
name | name of control variable |
obd | pointer to the input control variable |
Definition at line 121 of file UaCalcItem.hpp.
|
inline |
Connect to the object using in conditional formula.
Set callback function
name | name of control variable |
obd | pointer to the input control variable |
Definition at line 127 of file UaCalcItem.h.
|
inline |
Connect to the input object.
Set callback function
name | name of control variable |
obd | pointer to the input control variable |
Definition at line 99 of file UaCalcItem.hpp.
|
inline |
Connect to the input object.
Set callback function
name | name of control variable |
obd | pointer to the input control variable |
Definition at line 107 of file UaCalcItem.h.
|
inline |
Connect to the object using in conditional formula.
Set callback function
name | name of control variable |
obd | pointer to the input control variable |
Definition at line 138 of file UaCalcItem.hpp.
|
inline |
Connect to the object using in conditional formula.
Set callback function
name | name of control variable |
obd | pointer to the input control variable |
Definition at line 146 of file UaCalcItem.h.
|
inline |
Definition at line 159 of file UaCalcItem.h.
|
private |
|
private |
|
private |
Definition at line 290 of file UaCalcItem.h.
|
private |
status logical formula
logical formula to calculate the status of variable
Definition at line 289 of file UaCalcItem.h.
|
private |
logical formula if it s true the calculation will be executed
Definition at line 185 of file UaCalcItem.hpp.
|
private |
bind function which calculator uses to take data from OpcUa variable
double getValueFromItem(std::string); double getValueFromWhenItem(std::string); double getValueFromStatusItem(std::string);
Definition at line 273 of file UaCalcItem.h.
|
private |
Definition at line 277 of file UaCalcItem.h.
NmBuildingAutomation * AddressSpace::UaCalcItem::m_pNodeManager |
status logical formula
Definition at line 262 of file UaCalcItem.h.
|
private |
Definition at line 200 of file UaCalcItem.hpp.
const OpcUa::BaseObjectType* AddressSpace::UaCalcItem::m_pParent |
Definition at line 261 of file UaCalcItem.h.
|
private |
Definition at line 291 of file UaCalcItem.h.
|
private |
variables using in status formula
Definition at line 285 of file UaCalcItem.h.
|
private |
condition formula
Definition at line 287 of file UaCalcItem.h.
|
private |
analytic formula to calculate
Definition at line 186 of file UaCalcItem.hpp.
|
private |
Definition at line 275 of file UaCalcItem.h.
|
private |
variables using in formula
Definition at line 295 of file UaCalcItem.h.
|
private |
formula in text form
Definition at line 286 of file UaCalcItem.h.
|
private |
variable using in condition formula
Definition at line 294 of file UaCalcItem.h.
|
private |
Definition at line 184 of file UaCalcItem.hpp.
|
private |
Definition at line 274 of file UaCalcItem.h.
|
private |
Definition at line 293 of file UaCalcItem.h.
|
private |
Definition at line 282 of file UaCalcItem.h.
|
private |
Definition at line 281 of file UaCalcItem.h.
|
private |
Definition at line 283 of file UaCalcItem.h.