Signal Generator (v1)
This node-type is deprecated. Please use the newer signal.v2 node-type.
The signal 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.
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.cpp
Configuration
| signal required | string Enum: "random" "sine" "square" "triangle" "ramp" "counter" "constant" "mixed" "pulse" The type of signal which should be generated:
|
| values | integer Default: 1 The number of signals which each of the generated samples should contain. |
| rate | integer Default: 10 The rate at which sample should be generated by the node. |
| amplitude | number Default: 1 The amplitude of the signal when the |
| frequency | number Default: 1 The frequency of the signal when the |
| phase | number Default: 0 Tha pase of the signal when the |
| pulse_width | number Default: 1 The width of the pulse, with respect to the rate |
| pulse_low | number Default: 0 The low value of the pulse signal. |
| pulse_high | number Default: 1 The high value of the pulse signal. |
| stddev | number Default: 0.2 The standard deviation of the normal distributed steps if the |
| offset | number Default: 0 Adds a constant offset to each of the generated signals. |
| limit | integer Default: -1 Limit the number of generated output samples by this node-type. A negative number disables the limitation. |
| realtime | boolean Default: true Wait |
| monitor_missed | boolean Default: true If |
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)) |
{- "signal": "random",
- "values": 1,
- "rate": 10,
- "amplitude": 1,
- "frequency": 1,
- "phase": 0,
- "pulse_width": 1,
- "pulse_low": 0,
- "pulse_high": 1,
- "stddev": 0.2,
- "offset": 0,
- "limit": -1,
- "realtime": true,
- "monitor_missed": true,
- "in": {
- "signals": [
- {
- "name": "tap_position",
- "type": "integer",
- "init": 0
}, - {
- "name": "voltage",
- "type": "float",
- "unit": "V",
- "init": 230
}
], - "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"
# One of "sine", "square", "ramp", "triangle", "random", "mixed", "counter"
signal = [ "sine", "pulse", "square" ]
# Number of values per sample
values = 3
# Amplitude of generated signals
amplitude = [ 1.2, 0.0, 4.0 ]
# Frequency of generated signals in Hz
frequency = 10
# Standard deviation of random signals (normal distributed)
stddev = 2
# Sample rate in Hz
rate = 10.0
# Constant offset
offset = 1.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
}
}