VFD Speed Ref
medium
Clamps an operator percent setpoint to 0-100 and scales it for a VFD configured to accept a 0-32767 raw speed reference.
What it teaches
Composition: clamp, then scale. The percent arrives from an HMI and can be outside 0-100, while this drive interface is configured for 0-32767 raw counts — which is an INT at full scale, not a number someone picked. Pin the input to its valid range first, then scale it into the reference. Clamping is what keeps the result inside the type: an unclamped percent above 100 would wrap to a negative speed rather than simply overshooting.
Parameters
| Tag | Direction | Type | Default | Description |
|---|---|---|---|---|
| In_Percent | Input | REAL | 50 | Operator percent speed reference from HMI |
| Out_SpeedRef | Output | INT | 0 | Raw speed reference for a VFD, full scale at the top of the INT range |
Required behavior
- Out_SpeedRef is clamped to 0 when In_Percent is less than or equal to 0.
- Out_SpeedRef is clamped to 32767, the largest value an INT holds when In_Percent is greater than or equal to 100.
- Out_SpeedRef scales linearly between 0 and 32767 for In_Percent values between 0 and 100, rounded to the nearest whole number.