FB_ScaleInput
Description
Scale DINT to LREAL.
Converts un-scaled DINT values from Analog Inputs into user units of type LREAL. The input signal is converted based on a linear mapping automatically calculated by two points entered. InputMin is mapped to OutputMin, InputMax is mapped to OutputMax, and all values in between are scaled automatically. If an input value is not between the selected Min/Max, the Boolean output OutsideRange turns TRUE, and the OutputSignal is set to the corresponding OutputMin or OutputMax value.
The following figure shows the function block I/O:
Arguments
Input
InputSignal |
Description |
Un-scaled input signal |
Data type |
DINT |
|
Range |
[0 , 4] |
|
Unit |
n/a |
|
Default |
— |
|
InputMin |
Description |
Minimum value of accepted input signal range |
Data type |
DINT |
|
Range |
[0 , 4] |
|
Unit |
n/a |
|
Default |
— |
|
InputMax |
Description |
Maximum value of accepted input signal range |
Data type |
DINT |
|
Range |
[0 , 4] |
|
Unit |
n/a |
|
Default |
— |
|
OutputMin |
Description |
Output value mapped to the InputMin |
Data type |
LREAL |
|
Range |
[0 , 4] |
|
Unit |
n/a |
|
Default |
— |
|
OutputMax |
Description |
Output value mapped to the InputMax |
Data type |
LREAL |
|
Range |
[0 , 4] |
|
Unit |
n/a |
|
Default |
— |
Output
OutputSignal |
Description |
Scaled value of the Input Signal with type converted to LREAL. Stays within specified Min/Max output values |
Data type |
LREAL |
|
Unit |
n/a |
|
OutsideRange |
Description |
True if InputSignal is outside range setup by min/max values, otherwise FALSE |
Data type |
BOOL |
|
Unit |
n/a |
Usage
Scale an analog signal from a drive.
Related Functions
Example
Structured Text
//Scale an integer based analog input signal into floating point LREAL variable
ScaleInput_1( Analog_In, Analog_In_Min, Analog_In_Max, LREAL_Out_Min, LREAL_Out_Max );
LREAL_OutputSignal:= ScaleInput_1.OutputSignal;
Analog_Range_Err:= ScaleInput_1.OutsideRange;
Ladder Diagram
Function Block Diagram