← All exercises

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. Pin the input to its valid range first, then scale it to the configured DINT reference.

Inputs and outputs

TagTypeDefaultDescription
In_PercentREAL50Operator percent speed reference from HMI
Out_SpeedRefDINTRaw speed reference for a VFD configured for 0-32767

Required behavior

  • Out_SpeedRef is clamped to 0 when In_Percent is less than or equal to 0.
  • Out_SpeedRef is clamped to 32767 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.