The FB_Scaling function block is developed to convert an input value to a specified output range linearly and an error is detected in case of an invalid parameter.
This function block scales an input signal to a linear output, relative to a defined maximum and minimum range. The minimum and maximum values used for scaling are not limiting the output value.
The input signal is scaled in a linear manner with reference to two value ranges as shown in the figure below:
The output changes dynamically based on the change in input:
Slope = (i_rMaxOput-i_rMinOput) / (i_rMaxIput - i_rMinIput)
Offset = i_rOutMax - (Slope * i_rMaxIput)
q_rOput = (Slope * i_rIput) + Offset
The q_xEn is TRUE as long as the input i_xEn is TRUE, regardless of a detected error.
An invalid parameter at the function block inputs results in a detected error and a corresponding detected error ID is generated. The output is set to zero during a detected error. The detected error can be reset only through a rising edge of i_xErrRst. The input q_xBusy is TRUE whenever the function block is enabled and there is no detected error.