Signal Generator (v2)
The signal.v2 node-type is a simple signal generator which can be used to generate sine, square, ramp, triangle or random signals at user definable frequencies, rates, amplitudes.
Its a re-implementation of the original signal node-type which just changed the way of configuration.
Most commonly it is used for testing when no real simulation data is available.
Note: There is also the villas-signal tool which has a similar purpose.
Prerequisites
This node-type does not have any special library dependencies. It is always available.
Implementation
The source code of the node-type is available here: https://github.com/VILLASframework/node/blob/master/lib/nodes/signal_v2.cpp
Configuration
| realtime | boolean Default: true Pace the generation of samples by the |
| limit | integer Default: 0 Stop the node after the provided number of samples. |
| rate | number The rate at which the samples are generated if operating in real-time mode (See |
| monitor_missed | boolean Default: false Raise warnings if the signal generator fails to operate in real-time due to missed deadlines. |
object (Input configuration (received by VILLASnode)) | |
| vectorize | integer Default: 1 This setting allows to send multiple samples in a single message to the destination nodes. The value of this setting determines how many samples will be combined into one packet. |
Array of Hook Object (object) or Hook Name (string) (hook_list) | |
| builtin | boolean (Builtin hook functions) Default: true By default, each node and paths has a couple of default hooks attached to them. With this setting the attachment of built-in hooks can be disabled. |
object (Output configuration (sent out by VILLASnode)) |
{- "realtime": true,
- "limit": 0,
- "rate": 0,
- "monitor_missed": false,
- "in": {
- "signals": [
- {
- "signal": "random",
- "amplitude": 1,
- "frequency": 1,
- "phase": 0,
- "pulse_width": 1,
- "pulse_low": 0,
- "pulse_high": 1,
- "stddev": 0.2,
- "offset": 0,
- "name": "Bus123_U",
- "unit": "V",
- "type": "integer",
- "init": 0,
- "enabled": true
}
], - "vectorize": 1,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
]
}, - "vectorize": 1,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
], - "builtin": true,
- "out": {
- "vectorize": 0,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
]
}
}Example
nodes = {
signal_node = {
type = "signal.v2"
rate = 10.0
# Wait between emitting each sample
realtime = true
# Only emit 1000 samples, then stop
limit = 1000
# Count and warn about missed steps
monitor_missed = true
in = {
signals = (
{ name = "sine1", signal = "sine", amplitude = 123.456, frequency = 10, offset = 1.0 },
{ name = "sine2", signal = "sine", amplitude = 12.456, frequency = 20, offset = 10.0 },
{ name = "sine3", signal = "sine", amplitude = 2, frequency = 1, offset = 100.0 },
{ name = "random1", signal = "random", amplitude = 2, stddev = 2, offset = 13.0 },
{ name = "pulse1", signal = "pulse", frequency = 1.0, pulse_width = 1, pulse_high = 100, pulse_low = 50 }
)
}
}
signal_node2 = {
type = "signal.v2"
in = {
signals = {
count = 8
signal = "mixed"
}
}
}
}