Supported platforms: CODESYS 3.5

 

LinearSensor (FB)

Description

This FB calibrates linear sensor value i_InputValue (mV, mA) to SI unit (°C, bar, km/h, kg, etc…).

To operate correctly it is required that sensor operates linearly.

Calibrated output value and alarm/warning limits are the same unit than input variables i_OutputMin and i_OutputMax.  

 

Enabled alarm/warning limits are sanity checked: i_HighAlarmLimit > i_HighWarningLimit > i_LowWarningLimit > i_LowAlarmLimit. Deviation cause parameter error.

 

The output value o_CalibratedValue is set to zero if i_Enable is FALSE, or parameter error is diagnosed.  

 

All internal FB initializations are done on the rising edge of i_Enable.

All errors are reset on the rising edge of i_Enable.

 

Limitations

 

The FB uses internally

- S_ValueDiagnostic FB from SafeDataValidation library.

 

Following parameters are taken into use at the rising edge of i_Enable:

- i_HighAlarmLimit

- i_HighWarningLimit

- i_LowWarningLimit

- i_LowAlarmLimit

- i_EnableHighAlarm

- i_EnableHighWarning

- i_EnableLowWarning

- i_EnableLowAlarm

- i_DiagnosticDelay

+ Any initialized event code.

 

Inputs

Input variable name

Data type

Range

Description

i_Enable

BOOL

FALSE/TRUE

Enable operation.

i_InputValue

DINT

-

Measured sensor value.

i_InputMin

DINT

-

Minimum of measured sensor value.

i_InputMax

DINT

-

Maximum of measured sensor value.

i_OutputMin

DINT

-

Minimum SI-unit value of the sensor, corresponds to i_InputMin.

i_OutputMax

DINT

-

Maximum SI-unit value of the sensor, corresponds to i_InputMax.

i_HighAlarmLimit

DINT

-

High alarm limit for calibrated value.

i_HighWarningLimit

DINT

-

High warning limit for calibrated value.

i_LowWarningLimit

DINT

-

Low warning limit for calibrated value.

i_LowAlarmLimit

DINT

-

Low alarm limit for calibrated value.

i_EnableHighAlarm

BOOL

FALSE/TRUE

High value alarm in use.

i_EnableHighWarning

BOOL

FALSE/TRUE

High value warning in use.

i_EnableLowWarning

BOOL

FALSE/TRUE

Low value warning in use.

i_EnableLowAlarm

BOOL

FALSE/TRUE

Low value alarm in use.

i_DiagnosticDelay

UINT

-

Diagnostic delay for alarms and warnings (ms).

Outputs

Output variable name

Data type

Range

Description

o_CalibratedValue

DINT

-

Calibrated SI-unit value.

o_HighAlarm

BOOL

FALSE/TRUE

Calibrated value high alarm status.

o_HighWarning

BOOL

FALSE/TRUE

Calibrated value high warning status.

o_LowWarning

BOOL

FALSE/TRUE

Calibrated value low warning status.

o_LowAlarm

BOOL

FALSE/TRUE

Calibrated value low alarm status.

o_ParameterError

BOOL

FALSE/TRUE

Error in input parameters.

 

EventCodeInit (Public Method)

This optional method sets pointer for event code.

 

Inputs

Input variable name

Data type

Description

i_Enable

BOOL

Enable operation.

i_pEventCode

POINTER TO EPEC_DITF.EventCode

Pointer to signal event code value provided by the application.

 

 

Example code

 

 

 

 

 

 

See also

 

 

 

 

Source file topic100749.htm

Last updated 19-Dec-2024