Supported platforms: CODESYS 2.3, CODESYS 3.5

 

SCD_CurveScale (FB)

Description

SCD_CurveScale FB scales ADC value to some calibrated unit (e.g. bar) with a specified calibration curve. The calibration curve is given to the FB with two arrays, both with ten indices. These arrays include the calibration curve points. The curve is linear between the two adjacent calibration curve points.

 

When the input value is outside the limits given with i_CalibrationCurvePointsIn[1] and i_CalibrationCurvePoints[i_FinalCalibrationPoint], FB limits o_ScaledValue output accordingly to i_CalibrationCurvePointOut[1] and i_CalibrationCurvePointOut[i_FinalCalibrationPoint]. In this case, o_InputOutOfRange output is true.

 

The FB uses SCD_LinearScale to scale the input value to the scaled value between the adjacent calibration curve points.

 

 

Limitations

This function block is primarily intended for SensorCalibrationAndDiagnostic library's internal use.

Inputs

Input variable name

Data type

Range

Description

i_InputValue

WORD

0..65535

AD converter value to be scaled

i_CalibrationCurvePointsIn

ARRAY [1..10] OF WORD

 

ADC values in array which corresponds to CalibrationCurvePointsOut array’s values.

i_CalibrationCurvePointsOut

ARRAY  [1..10] OF INT

 

Scaled values in array which corresponds to CalibrationCurvePointsIn array’s values.

i_LastCalibrationPoint

BYTE

2..10

Index number for last calibration curve point used. Amount of used calibration points can be limited with this input

Outputs

Output variable name

Data type

Range

Description

o_ScaledValue

INT

-32768..32767

Scaled value.

o_InputOutOfRange

BOOL

TRUE/FALSE

Input value is out of range given in array.

Example code

See also

 

Source file Topic000254.htm

Last updated 24-Apr-2025