github.com/simpleiot/simpleiot@v0.18.3/docs/user/signal-generator.md (about)

     1  # Signal Generator Client
     2  
     3  The signal generator can be used to generate various signals including:
     4  
     5  - Sine wave
     6  - Square wave
     7  - Triangle wave
     8  - Random walk
     9  
    10  Below is a screen-shot of the generated data displayed in Grafana.
    11  
    12  ![image-20231108165150571](./assets/image-20231108165150571.png)
    13  
    14  ## Configuration
    15  
    16  The signal generated can be configured with the following parameters:
    17  
    18  <img src="./assets/image-20231106151540546.png" alt="image-20231106151540546" style="zoom:50%;" />
    19  
    20  Most of the parameters are self-explanatory. With a Random Walk, you typically
    21  need to enter a negative number for the Min. Increment as shown above. This
    22  causes the negative number generated to be negative roughly half the time.
    23  
    24  The rounding can also be used to generate binary signals. Imagine a signal
    25  generator with these settings:
    26  
    27  - Max. value = 1
    28  - Min. value = 0
    29  - Initial value = 0
    30  - Round to = 1
    31  - Min. increment = -7
    32  - Max. increment = 3
    33  - Sample Rate = 20mins
    34  
    35  Due to min/max/round to options, this is a binary value, either 0 or 1, biased
    36  toward 0 (due to min/max increment options). This could be useful for simulating
    37  binary switches or something like it. Effectively, this will hold the value for
    38  at least 20m and picks a random number between -7 and 3. Due to rounding, if
    39  value is currently 0, there's a 25% chance it becomes 1. If 1, there's a 65%
    40  chance it becomes 0. This means that the value will be 0 roughly 91.25% (= 75% +
    41  (1 - 75%) \* 65%) of the time.
    42  
    43  ## Schema
    44  
    45  Below is an export of several types of signal generator nodes:
    46  
    47  ```yaml
    48  children:
    49    - id: 2556a696-a7af-4138-a899-1df6a895aab0
    50      type: signalGenerator
    51      points:
    52        - type: batchPeriod
    53          value: 1000.0
    54        - type: description
    55          text: Variable pulse width
    56        - type: disabled
    57        - type: frequency
    58          value: 1.0
    59        - type: initialValue
    60          text: "0"
    61        - type: maxIncrement
    62          value: 3.0
    63        - type: maxValue
    64          value: 1.0
    65        - type: minIncrement
    66          value: -7.0
    67        - type: minValue
    68          text: "0"
    69        - type: roundTo
    70          value: 1.0
    71        - type: sampleRate
    72          value: 5.0
    73        - type: signalType
    74          text: random walk
    75        - type: units
    76          text: Amps
    77        - type: value
    78          value: 1.0
    79    - id: b67f8ef6-4607-42c9-ab59-9b5ad91af213
    80      type: signalGenerator
    81      points:
    82        - type: batchPeriod
    83          value: 1000.0
    84        - type: description
    85          text: Triangle
    86        - type: disabled
    87        - type: frequency
    88          value: 1.0
    89        - type: initialValue
    90          text: "0"
    91        - type: maxIncrement
    92          value: 0.5
    93        - type: maxValue
    94          value: 10.0
    95        - type: minIncrement
    96          value: 0.1
    97        - type: minValue
    98          text: "0"
    99        - type: sampleRate
   100          value: 100.0
   101        - type: signalType
   102          text: triangle
   103        - type: value
   104          value: 6.465714272450723e-12
   105    - id: e2e6b79a-1d72-475e-a7f4-dfc30b427c91
   106      type: signalGenerator
   107      points:
   108        - type: batchPeriod
   109          value: 1000.0
   110        - type: description
   111          text: Square
   112        - type: disabled
   113        - type: frequency
   114          value: 1.0
   115        - type: initialValue
   116          text: "0"
   117        - type: maxValue
   118          value: 10.0
   119        - type: minValue
   120          text: "0"
   121        - type: sampleRate
   122          value: 100.0
   123        - type: signalType
   124          text: square
   125        - type: value
   126          value: 10.0
   127    - id: fffe6e4e-3887-4eba-9192-e34562940292
   128      type: signalGenerator
   129      points:
   130        - type: batchPeriod
   131          value: 1000.0
   132        - type: description
   133          text: Sine
   134        - type: disabled
   135        - type: frequency
   136          value: 1.0
   137        - type: initialValue
   138          text: "0"
   139        - type: maxValue
   140          value: 10.0
   141        - type: minValue
   142          text: "0"
   143        - type: sampleRate
   144          value: 100.0
   145        - type: signalType
   146          text: sine
   147        - type: value
   148          value: 4.999999999989843
   149    - id: a8e1648c-8d07-448b-b16c-44353ab0fd93
   150      type: signalGenerator
   151      points:
   152        - type: batchPeriod
   153          value: 1000.0
   154        - type: description
   155          text: Random Walk
   156        - type: disabled
   157        - type: frequency
   158          value: 1.0
   159        - type: initialValue
   160          text: "0"
   161        - type: maxIncrement
   162          value: 0.5
   163        - type: maxValue
   164          value: 10.0
   165        - type: minIncrement
   166          value: -0.5
   167        - type: minValue
   168          text: "0"
   169        - type: roundTo
   170          value: 0.1
   171        - type: sampleRate
   172          value: 10.0
   173        - type: signalType
   174          text: random walk
   175        - type: units
   176          text: Amps
   177        - type: value
   178          value: 9.1
   179  ```