Class ParameterObject

Inheritance Relationships

Base Type

Class Documentation

class ParameterObject : public eipScanner::BaseObject

Implements interface to Parameter Object (0x0F).

It reads all data from the CIP instance in the constructor

Public Functions

ParameterObject(cip::CipUint instanceId, bool fullAttributes, const SessionInfoIf::SPtr &si)

Creates an instance and reads all its data via EIP.

Parameters
  • instanceId: the ID of the CIP instance

  • fullAttributes: if true, then read all the attributes including scaling attributes and text descriptions

  • si: the EIP session for explicit messaging

Exceptions
  • std::runtime_error:

  • std::system_error:

ParameterObject(cip::CipUint instanceId, bool fullAttributes, size_t typeSize)

Creates an empty instance without any EIP requests.

Parameters
  • instanceId: the ID of the CIP instance

  • fullAttributes: if true, then read all the attributes including scaling attributes and text descriptions

  • typeSize: the size of the value in bytes

Exceptions
  • std::runtime_error:

  • std::system_error:

ParameterObject(cip::CipUint instanceId, bool fullAttributes, const SessionInfoIf::SPtr &si, const MessageRouter::SPtr &messageRouter)

Creates an instance and reads all its data via EIP.

Note

Used for testing

Parameters
  • instanceId:

  • fullAttributes:

  • si:

~ParameterObject()

Default destructor.

void updateValue(const SessionInfoIf::SPtr &si)

Updates the parameter value from the instance.

Parameters
  • si: the Session Info for explicit messaging

Exceptions
  • std::runtime_error:

  • std::system_error:

bool isScalable() const

Return

true if the parameter supports scaling

void setScalable(bool isScalable)

Parameters
  • isScalable: true if the parameter supports scaling

bool isReadOnly() const

Return

true if the parameter value is read only

void setReadOnly(bool isReadOnly)

Parameters
  • isReadOnly: true if the parameter value is read only

template<typename T>
T getActualValue() const

Gets an actual value [AttrID=1] of the parameter.

Note

This is just a getter. To read value from EIP device, use ParameterObject::updateValue

Return

the value of type T

Template Parameters
  • T: the type of the parameter

template<typename T>
cip::CipLreal getEngValue() const

Gets a value of the parameter in EU For scaling the method uses scalling attributes (Multiplier [AttrID=13], Divisor [AttrID=14], Base [AttrID=15], Offset[ ID=16] and Precision [AttrID=21].

The formula is: Value in EU = ((Actual Value + Offset)*Multiplier*Base)/(Divisor*10^Precision)

Note

it scales the actual value if ParameterObject::isScalable is true, else it returns the original actual value

Return

the value in EU

Template Parameters
  • T: the type of the parameter

template<typename T>
T getMinValue() const

Gets a minimal value [AttrID=10] of the parameter.

Note

The behavior is the same as ParameterObject::getActualValue

Return

the value of type T

Template Parameters
  • T: the type of the parameter

template<typename T>
cip::CipLreal getEngMinValue() const

Gets a minimal value of the parameter in EU.

Note

The behavior is the same as ParameterObject::getEngValue

Return

the value in EU

Template Parameters
  • T: the type of the parameter

template<typename T>
void setEngMinValue(cip::CipLreal value)

Sets a minimal value of the parameter in EU.

Template Parameters
  • T: the type of the parameter

Parameters
  • value:

template<typename T>
T getMaxValue() const

Gets a maximal value [AttrID=11] of the parameter.

Note

The behavior is the same as ParameterObject::getActualValue

Return

the value of type T

Template Parameters
  • T: the type of the parameter

template<typename T>
cip::CipLreal getEngMaxValue() const

Gets a maximal value of the parameter in EU.

Note

The behavior is the same as ParameterObject::getEngValue

Return

the value in EU

Template Parameters
  • T: the type of the parameter

template<typename T>
void setEngMaxValue(cip::CipLreal value)

Sets a maximal value of the parameter in EU.

Template Parameters
  • T: the type of the parameter

Parameters
  • value:

template<typename T>
T getDefaultValue() const

Gets an default value [AttrID=12] of the parameter.

Note

The behavior is the same as ParameterObject::getActualValue

Return

the value of type T

Template Parameters
  • T: the type of the parameter

template<typename T>
cip::CipLreal getEngDefaultValue() const

Gets a default value of the parameter in EU.

Note

The behavior is the same as ParameterObject::getEngValue

Return

the value in EU

Template Parameters
  • T: the type of the parameter

template<typename T>
void setEngDefaultValue(cip::CipLreal value)

Sets a default value of the parameter in EU.

Template Parameters
  • T: the type of the parameter

Parameters
  • value:

bool hasFullAttributes() const

Return

true if the parameter supports full data including scaling attributes and text descriptions

cip::CipDataTypes getType() const

Gets the type code [AttrID=5] of the parameter.

Return

void setType(cip::CipDataTypes type)

Sets the type code [AttrID=5] of the parameter.

Parameters
  • type:

const std::string &getName() const

Gets the name [AttrID=7] of the parameter.

Return

const std::string &getUnits() const

Gets the units [AttrID=8] of the parameter.

Return

const std::string &getHelp() const

Gets the help string [AttrID=9] of the parameter.

Return

const cip::CipUint &getParameter() const

Gets the number of parameter (instance ID)

Return

void setName(const std::string &name)

Sets the name [AttrID=7] of the parameter.

Parameters
  • name:

void setUnits(const std::string &units)

Sets the units [AttrID=8] of the parameter.

Parameters
  • units:

void setHelp(const std::string &help)

Sets the help string [AttrID=9] of the parameter.

Parameters
  • help:

CipUint getScalingMultiplier() const

Gets the multiplier [AttrID=13] of the parameter.

Return

CipUint getScalingDivisor() const

Gets the divisor [AttrID=14] of the parameter.

Return

CipUint getScalingBase() const

Gets the base [AttrID=15] of the parameter.

Return

CipInt getScalingOffset() const

Gets the offset [AttrID=16] of the parameter.

Return

CipUsint getPrecision() const

Gets the precision [AttrID=21] of the parameter.

Return

void setScalingMultiplier(cip::CipUint scalingMultiplier)

Sets the multiplier [AttrID=13] of the parameter.

Parameters
  • scalingMultiplier:

void setScalingDivisor(cip::CipUint scalingDivisor)

Sets the divisor [AttrID=14] of the parameter.

Parameters
  • scalingDivisor:

void setScalingBase(cip::CipUint scalingBase)

Sets the base [AttrID=15] of the parameter.

Parameters
  • scalingBase:

void setScalingOffset(cip::CipInt scalingOffset)

Sets the offset [AttrID=16] of the parameter.

Parameters
  • scalingOffset:

void setPrecision(cip::CipUsint precision)

Sets the precision [AttrID=21] of the parameter.

Parameters
  • precision:

cip::CipLreal actualToEngValue(cip::CipLreal actualValue) const
cip::CipLreal engToActualValue(cip::CipLreal engValue) const

Public Static Attributes

const cip::CipUint CLASS_ID = 0x0f