Function Block 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:

UDFB ScaleInput

Figure 7-227: Scale Input

 

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

UDFB ScaleOutput

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

UDFB ScaleInput: LD example

 

Function Block Diagram

UDFB ScaleInput: FBD example

 

Go back to the top of the page [Top]