TagEngine API documentation

class rackio.TagEngine()

Current Value Table Engine class for Tag thread-safe based repository.

This class is intended hold in memory tag based values and observers for those required tags, it is implemented as a singleton so each sub-thread within the Rackio application can access tags in a thread-safe mechanism.

Usage:

>>> from rackio.engine import CVTEngine
>>> tag_egine = CVTEngine()
>>> tag_engine.write_tag("TAG1", 40.43)
>>> value = tag_engine.read_tag("TAG1")
>>> print(value)
40.43
set_tag(self, name, _type, units='')

Sets a new value for a defined tag, in thread-safe mechanism.

Parameters:

  • name (str): Tag name.
  • _type (float, int, bool): Tag value ("int", "float", "bool")
  • units (str): Engineering units.

Usage:

>>> tag_engine.set_tag("speed", "float", "km/h")
tag_defined(self, name)

Checks if a tag name is already defined.

Parameters:

  • name (str): Tag name.
write_tag(self, name, value)

Writes a new value for a defined tag, in thread-safe mechanism.

Parameters:

  • name (str): Tag name.
  • value (float, int, bool): Tag value ("int", "float", "bool")
read_tag(self, name)

Returns a tag value defined by name, in thread-safe mechanism.

Parameters:

  • name (str): Tag name.
set_tags(self, tags)

Sets new values for a defined list of tags, in thread-safe mechanism.

Parameters:

  • tags (list): List of tag name, type and units.
set_group(self, group, tags)

Sets new tags group, which can be retrieved by group name.

Parameters:

  • group (str): Group name.
  • tags (list): List of defined tag names.
get_group(self, group)

Returns the tag list of the a defined group.

Parameters:

  • group (str): Group name.
get_groups(self)

Returns a list of the group names defined.

get_tags(self)

Returns a list of the tag names defined.