openpectus.lang.exec.tags_impl

Attributes

MARK_SEPARATOR

logger

Classes

ReadingTag

Represents a common reading, i.e. a input tag with float values.

SelectTag

Represents a tag with choice values.

MarkTag

Base class for tags. Most tags do not need their own class but can just use this class.

AccumulatorTag

Generic accumulator tag. Can be used as the system tag

BlockTimeTag

Base class for tags. Most tags do not need their own class but can just use this class.

ScopeTimeTag

Base class for tags. Most tags do not need their own class but can just use this class.

AccumulatorBlockTag

Implements a block accumulator. Can be used as the system tag

AccumulatedColumnVolume

Base class for tags. Most tags do not need their own class but can just use this class.

Module Contents

openpectus.lang.exec.tags_impl.MARK_SEPARATOR = '; '
openpectus.lang.exec.tags_impl.logger
class openpectus.lang.exec.tags_impl.ReadingTag(name, unit=None, format_fn=None)

Bases: openpectus.lang.exec.tags.Tag

Represents a common reading, i.e. a input tag with float values.

Parameters:
  • name (str)

  • unit (str | None)

  • format_fn (openpectus.lang.exec.tags.TagFormatFunction | None)

set_value(val, *args, **kwargs)
class openpectus.lang.exec.tags_impl.SelectTag(name, value, unit, choices, direction=TagDirection.NA)

Bases: openpectus.lang.exec.tags.Tag

Represents a tag with choice values.

Parameters:
choices
set_value(val, *args, **kwargs)
class openpectus.lang.exec.tags_impl.MarkTag

Bases: openpectus.lang.exec.tags.Tag

Base class for tags. Most tags do not need their own class but can just use this class.

Supports change tracking which is used by engine to detect changes between reads of hardware values.

Supports lifetime notification events that are automatically invoked by the engine.

Supports masking the actual value with a simulated value.

set_value(val, tick_time, *args, **kwargs)

Append value to existing value

Parameters:
  • val (int | float | str | None)

  • tick_time (float)

Return type:

None

archive()

Reset value and return it

Return type:

str | None

class openpectus.lang.exec.tags_impl.AccumulatorTag(name, totalizer)

Bases: openpectus.lang.exec.tags.Tag

Generic accumulator tag. Can be used as the system tag SystemTagName.ACCUMULATED_VOLUME.

Parameters:
totalizer: openpectus.lang.exec.tags.Tag
unit
v0: float | None = None
__str__()
Return type:

str

reset()
on_start(run_id)

Is invoked by the Start command when method is started.

Parameters:

run_id (str)

on_tick(tick_time, increment_time)

Is invoked on each tick.

Intended for NA (calculated/derived) tags to calculate the value for the tick and apply it to the value property.

Parameters:
  • tick_time (float)

  • increment_time (float)

class openpectus.lang.exec.tags_impl.BlockTimeTag

Bases: openpectus.lang.exec.tags.Tag

Base class for tags. Most tags do not need their own class but can just use this class.

Supports change tracking which is used by engine to detect changes between reads of hardware values.

Supports lifetime notification events that are automatically invoked by the engine.

Supports masking the actual value with a simulated value.

tracer
class StackItem(name)
name
value: float = 0.0
_stack: list[BlockTimeTag] = []
_paused = False
value = 0.0
on_start(run_id)

Is invoked by the Start command when method is started.

on_block_start(block_info)

Invoked just after a new block is started, before on_tick, in the same engine tick.

on_block_end(block_info, new_block_info)

Invoked just after a block is completed, before on_tick, in the same engine tick. If the new block is the root/program scope, the name is the empty string.

on_tick(tick_time, increment_time)

Is invoked on each tick.

Intended for NA (calculated/derived) tags to calculate the value for the tick and apply it to the value property.

on_runstate_change(state_change)

Is invoked when method interpretation is complete.

get_value()
class openpectus.lang.exec.tags_impl.ScopeTimeTag

Bases: openpectus.lang.exec.tags.Tag

Base class for tags. Most tags do not need their own class but can just use this class.

Supports change tracking which is used by engine to detect changes between reads of hardware values.

Supports lifetime notification events that are automatically invoked by the engine.

Supports masking the actual value with a simulated value.

tracer
_timers: dict[str, float]
_stack: list[str] = []
_paused = False
value = 0.0
on_start(run_id)

Is invoked by the Start command when method is started.

on_scope_start(scope_info)
on_scope_activate(scope_info)
on_scope_end(scope_info)
on_tick(tick_time, increment_time)

Is invoked on each tick.

Intended for NA (calculated/derived) tags to calculate the value for the tick and apply it to the value property.

on_runstate_change(state_change)

Is invoked when method interpretation is complete.

get_value()
class openpectus.lang.exec.tags_impl.AccumulatorBlockTag(name, totalizer)

Bases: openpectus.lang.exec.tags.Tag

Implements a block accumulator. Can be used as the system tag SystemTagName.BLOCK_VOLUME.

Parameters:
totalizer: openpectus.lang.exec.tags.Tag
root_block
accumulator_stack: list[AccumulatorTag] = []
cur_block
cur_accumulator
value = 0.0
unit
on_start(run_id)

Is invoked by the Start command when method is started.

Parameters:

run_id (str)

on_tick(tick_time, increment_time)

Is invoked on each tick.

Intended for NA (calculated/derived) tags to calculate the value for the tick and apply it to the value property.

Parameters:
  • tick_time (float)

  • increment_time (float)

on_block_start(block_info)

Invoked just after a new block is started, before on_tick, in the same engine tick.

Parameters:

block_info (openpectus.lang.exec.events.BlockInfo)

on_block_end(block_info, new_block_info)

Invoked just after a block is completed, before on_tick, in the same engine tick. If the new block is the root/program scope, the name is the empty string.

Parameters:
class openpectus.lang.exec.tags_impl.AccumulatedColumnVolume(name, column_volume, totalizer)

Bases: openpectus.lang.exec.tags.Tag

Base class for tags. Most tags do not need their own class but can just use this class.

Supports change tracking which is used by engine to detect changes between reads of hardware values.

Supports lifetime notification events that are automatically invoked by the engine.

Supports masking the actual value with a simulated value.

Parameters:
totalizer: openpectus.lang.exec.tags.Tag
column_volume: openpectus.lang.exec.tags.Tag
unit = 'CV'
v0 = 0.0
reset()
on_start(run_id)

Is invoked by the Start command when method is started.

Parameters:

run_id (str)

on_tick(tick_time, increment_time)

Is invoked on each tick.

Intended for NA (calculated/derived) tags to calculate the value for the tick and apply it to the value property.

Parameters:
  • tick_time (float)

  • increment_time (float)