FB_BA_AI
The function block is used for measured data processing and terminal configuration of all standard K-bus analog input terminals.
Terminal configuration
The first step when using this function block is to select the corresponding terminal type eTerminal. Correct functioning of the function block is only guaranteed if the terminal selected with the eTerminal variable matches the terminal actually inserted and linked.
With the terminals for resistance temperature measurement of type KL3208_0010 and KL320x_0000, the temperature sensor used at the terminal input is additionally selected with the enumeration eSensor.
A rising edge at bConfigurate writes the terminal settings to the terminal using the variables TO_usiCtrl and TO_iDataOut.
Measured value scaling
At the analog input terminals of types:
KL300x, KL306x, KL3132_0000, KL3162_0000, KL3172_0000, KL3172_0500, KL3172_1000, KL3182_0000, KL3404, KL3464, KL3408, KL3468, the raw value TI_iDataIn of the terminal is scaled by the internal function block FB_BA_Chrct02. (See diagram). The parameterization of the scaling function is carried out using parameters X(01/02) and Y(01/02). A signal offset that may be required for measured value correction can be parameterized with the variable rOffset. rSmoothingFactor attenuates the scaled measurement signal, including the offset.
Signal flow:
Scaling:
With the temperature measurement terminals of types KL3208_0010 and KL320x_0000, the measuring signal is not scaled within the function block, but directly in the terminal. Attenuation of excessively fluctuating measuring signals takes place with the factor rSmoothingFactor. If an error is detected at the terminal, such as bShortCircuit or bWireBrake, the last valid value is output until the error is eliminated at the output of the function block.
Signal flow:
Measuring range monitoring
The variables rHighLimit and rLowLimit are used to monitor the measured value rVal at the output of the function block for compliance with a valid range. If the measured value rVal is above rHighLimit or below rLowLimit, this is displayed at the outputs bHighLimit or bLowLimit. Measuring range monitoring is deactivated if the input variable bEnLimitCtrl is FALSE or if an error (e.g. short circuit) is detected by means of the terminal status TI_usiState.
The response of the measuring range monitoring can be delayed by the variable udiDelayLimitCtrl_sec.
VAR_INPUT
TI_usiState : USINT;
TI_iDataIn : INT;
eTerminal : E_BA_TERMINAL_KL;
eSensor : E_BA_SENSOR;
bConfigurate : BOOL;
rX01 : REAL;
rX02 : REAL;
rY01 : REAL;
rY02 : REAL;
rOffset : REAL;
rSmoothingFactor : REAL;
udiDecimalPlace : UDINT(1..6);
bEnLimitCtrl : BOOL;
rHighLimit : REAL;
rLowLimit : REAL;
udiDelayLimitCtrl_sec : UDINT;
TI_usiState: Linking with the corresponding status byte of the Bus Terminal in the I/O area of the program.
TI_iDataIn: Linking with the corresponding raw data (Data In) of the Bus Terminal in the I/O area of the program (0..32767).
eTerminal: Selection of the respective Bus Terminal (see E_BA_Terminal_KL).
eSensor: Selection of the sensor type (see E_BA_Sensor).
bConfigurate: A rising edge starts the configuration of the Bus Terminal.
rX01: x-value for the interpolation point P1.
rX02: x-value for the interpolation point P2.
rY01: y-value for the interpolation point P1.
rY02: y-value for the interpolation point P2.
rOffset: Offset.
rSmoothingFactor: attenuation factor. Internally limited to between 1 and 10000.
udiDecimalPlace: Specifies the decimal places for the value rVal. Preset to 1.
bEnLimitCtrl: Enable limit value monitoring.
rHighLimit: Upper limit value.
rLowLimit: Lower limit value.
udiDelayLimitCtrl_sec: Time delay until limit value monitoring is activated.
VAR_OUTPUT
TO_usiCtrl : USINT;
TO_iDataOut : INT;
rVal : REAL;
bWireBreak : BOOL;
bShortCircuit : BOOL;
bHighLimit : BOOL;
bLowLimit : BOOL;
bErr : BOOL;
sErrDescr : T_MAXSTRING;
TO_usiCtrl: Linking with the corresponding control byte of the Bus Terminal in the I/O area of the program.
TO_iDataOut: Linking with the corresponding raw data (Data Out) of the Bus Terminal in the I/O area of the program.
rVal: Scaled output value.
bWireBreak: Broken wire at the sensor.
bShortCircuit: Short-circuit at the sensor.
bHighLimit: Upper limit value exceeded.
bLowLimit: Value below lower limit.
bErr: This output is switched to TRUE if the parameters entered are erroneous.
sErrDescr: Contains the error description.
Error description |
---|
01: Error: Incorrect scaling parameter rX01/rX02/rY01/rY02 |
02: Error: Check the terminal configuration KL32xx eTerminal/eSensor/TI_usiState/TI_iDataIn/TO_usiCtrl/IO_iDataOut |
Requirements
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4024.7 | Tc3_BA from v1.1.6.0 |