The Ramp node increases or decreases in a linear way the value of the Output connector until it reaches the value of the Input connector. The linear increment consists of adding (or subtracting) to the Output a value represented by the Step size property every time interval specified by the Time step property.
The value of the Output can't go beyond the Input value, so the node reduces the step to adapt the output to the input.
Behaviour of Ramp
| Connector | Type | Description |
|---|---|---|
| Input | Input | Target analog value that the node must reach progressively. |
| Output | Output | Analog value generated by the node. It is increased or decreased step by step until it reaches the Input value. |
| Property | Description |
|---|---|
| Step size | Value added to or subtracted from the Output at each step. |
| Time step | Time interval between two consecutive increments or decrements of the Output value. |
The Ramp node is used to change an analog value progressively instead of applying the final target value immediately.
When the value of the Input connector changes, the node compares it with the current Output value:
At every time interval defined by Time step, the node changes the Output value by the amount defined in Step size.
Conceptually:
Output(n+1) = Output(n) ± Step size
The node continues this operation until the Output value reaches the Input value.
The Output value never exceeds the Input value.
If the remaining difference is smaller than the configured Step size, the node automatically reduces the last step so that the output reaches the target exactly.
Consider the following configuration:
| Property | Value |
|---|---|
| Step size | 5 |
| Time step | 1 s |
If the initial Output value is 20 and the Input value becomes 35, the Ramp node behaves as follows:
| Time | Output |
|---|---|
| 0 s | 20 |
| 1 s | 25 |
| 2 s | 30 |
| 3 s | 35 |
If the Input value then changes to 12, the node decreases the output:
| Time | Output |
|---|---|
| 0 s | 35 |
| 1 s | 30 |
| 2 s | 25 |
| 3 s | 20 |
| 4 s | 15 |
| 5 s | 12 |
In the last step, the node does not go below the target value. Instead, it adapts the final decrement to reach the Input value exactly.
The Ramp node is useful whenever a value must change smoothly over time instead of changing abruptly.
Typical applications include:
The Ramp node can be tested using the Logic Module simulation tools.
A typical test procedure is the following:
If the Input value changes again while the ramp is already in progress, the node continues adapting the Output toward the new target value.