Skip to main content

Cast Signal Values

The cast hook casts the data-type of signals and can set a new name and unit to the casted signal.

Implementation​

The source code of the hook is available here: https://github.com/VILLASframework/node/blob/master/lib/hooks/cast.cpp

Configuration​

new_type
string
Enum: "integer" "float" "boolean" "complex"

The type of the casted signal.

new_name
string

The new name of the casted signal.

new_unit
string

The new unit of the casted signal.

signals
Array of strings

A list of signal names to which this hook should be applied

enabled
boolean
Default: true

An optional field which can be used to disable a hook.

priority
integer
Default: 99

The priority of this hook which determines the order in which hooks are executed. Hooks with a lwoer priority are executed before ones with a higher priority.

If no priority is configured, hooks are executed in the order they are configured in the configuration file.

{
  • "new_type": "integer",
  • "new_name": "BusA.V",
  • "new_unit": "V",
  • "signals": [
    ],
  • "enabled": true,
  • "priority": 99
}

Example​

node/etc/examples/hooks/cast.conf
@include "hook-nodes.conf"

paths = (
{
in = "signal_node"
out = "file_node"

hooks = (
{
type = "cast"

signal = "random"

new_name = "int_random"
new_unit = "pts"
new_type = "integer"
}
)
}
)