Given speed and acceleration limits, compute values on a trajectory from the current value to a target position. Supports separate forward and reverse speeds. Updates on a given poll rate in client and designer scopes, and at the scan class rate in gateway scope.
ramp(pollRate, target, rampRate [, revRampRate [, accel]]) returns Double
Argument | Data Type | Description |
---|---|---|
pollRate | Integer | Milliseconds between computations, or zero to short-circuit the target to the output. Polling will cease when the output reaches the target. |
target | Number | Final value the expression attempts to reach. |
rampRate | Number | The positive or forward ramp rate, in units per second. (Not units per poll). |
revRampRate | Number | Optional negative or reverse ramp rate, in units per second, expressed as a positive number. Same as the positive ramp rate if omitted. |
accel | Number | Optional maximum change in ramp rate, in units per second squared, or zero to disable acceleration limiting. Disabled if omitted. |
If triggered faster than the poll rate due to changing argument values, the profile will be computed with the new values and the actual milliseconds interval to the previous computation.