# yaml-language-server: $schema=http://json-schema.org/draft-07/schema
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0
---
allOf:
- type: object
  required:
  - signal
  properties:
    signal:
      type: string
      enum:
      - random
      - sine
      - square
      - triangle
      - ramp
      - counter
      - constant
      - mixed
      - pulse
      description: |
        The type of signal which should be generated:

        - `random`: a random walk with normal distributed step sizes will be generated.
        - `sine`: a sine signal will be generated.
        - `square`: a square / rectangle wave will be generated.
        - `triangle`: a triangle wave will be generated.
        - `ramp`: the generator will produce a ramp signal in the interval `[ 0, 1 / f ]`.
        - `counter`: increasing integer counter is generated.
        - `constant`: a constant value generated.
        - `mixed`: the signals of of each sample are generated by cycling over all remaining signal types.
        - `pulse`: generates pulses with a set frequency, phase and width

    values:
      type: integer
      default: 1
      description: The number of signals which each of the generated samples should contain.

    rate:
      type: integer
      description: The rate at which sample should be generated by the node.
      default: 10

    amplitude:
      type: number
      description: The amplitude of the signal when the `signal` setting is one of `sine`, `square` or `triangle`.
      default: 1.0

    frequency:
      type: number
      description: The frequency of the signal when the `signal` setting is one of `sine`, `square`, `triangle`,`pulse` or `ramp`.
      default: 1.0

    phase:
      type: number
      default: 0.0
      description: Tha pase of the signal when the `signal` setting is one of `sine` or `pulse`.

    pulse_width:
      type: number
      default: 1.0
      description: The width of the pulse, with respect to the rate

    pulse_low:
      type: number
      default: 0.0
      description: The low value of the pulse signal.

    pulse_high:
      type: number
      default: 1.0
      description: The high value of the pulse signal.

    stddev:
      type: number
      default: 0.2
      description: The standard deviation of the normal distributed steps if the `signal` setting is set to `random`.

    offset:
      type: number
      default: 0.0
      description: Adds a constant offset to each of the generated signals.

    limit:
      type: integer
      default: -1
      description: |
        Limit the number of generated output samples by this node-type.
        A negative number disables the limitation.

    realtime:
      type: boolean
      default: true
      description: Wait `1 / rate` seconds between emitting each sample.

    monitor_missed:
      type: boolean
      default: true
      description: |
        If `true`, the `signal` node-type will count missed steps and warn the user during every iteration about missed steps.
        Especially at high rates, it can be beneficial for performance to set this flag to `false`.
        Warnings would namely cause system calls which will slow the node down even more, and thus cause even more missed steps.

- $ref: ../node_signals.yaml
- $ref: ../node.yaml
