FB_TempController

The temperature controller function block FB_TempController has a variety of inputs and outputs that are described below. All the controller's parameters are passed to it via structures. The structures and enums are defined here.

Function block

FB_TempController 1:

Interface

VAR_INPUT
    bOn : BOOL; (* start closed loop operating *)
    bInit : BOOL; (* init controller *)
    bTune : BOOL; (* start self tuning *)
    bManual : BOOL; (* manual operation *)
    bSelSetpoint : BOOL; (* FALSE = setpoint 1, TRUE = setpoint 2
*)
    bSelCtrlParameterSet : BOOL; (* FALSE = internal set, TRUE =
external set *)
    bEnableSoftStart : BOOL; (* FALSE = no soft start, TRUE = soft
start *)
    bEnableRamping : BOOL; (* FALSE = no ramping, TRUE = ramping
*)
    fW1 : LREAL; (* first setpoint *)
    fW2 : LREAL; (* second setpoint *)
    fX : LREAL; (* actual value *)
    (* alarming inputs *)
    bOpenThermocouple : BOOL; (* thermocouple *)
    bReverseThermocouple : BOOL;
    bBackVoltage : BOOL;
    bLeakage : BOOL; (* heating system *)
    bShortCircuit : BOOL;
    bOpenCircuit : BOOL;
    sParaControllerExternal : ST_ParaController; (* external
controller parameter set *)
    (* logging *)
    sLogData : ST_LogData := (bLog := FALSE, strLogFileName :=
'', strLogString := '' );
END_VAR
VAR_IN_OUT
    sControllerParameter : ST_ControllerParameter; (* parameters
*)
END_VAR
VAR_OUTPUT
    fYAnalog : LREAL; (* control value analog *)
    bYPWM : BOOL; (* control value PWM *)
    bYDig : BOOL; (* 2-Point *)
    bYDigPos : BOOL; (* 3-Point: control value digital positive
*)
    bYDigNeg : BOOL; (* 3-Point: control value digital
negative*)
    (* alarming *)
    dwAlarm : DWORD; (* max. 32 alarms *)
    (* state *)
    iState : States := TC_STATE_IDLE;
    (* controller parameter *)
    sParaControllerInternal : ST_ParaController;
    (* general errors *)
    bError : BOOL;
    iErrorId : ErrorCodes;
END_VAR

Inputs

Name

Unit

Value range

Description

bOn

1

[TRUE,FALSE]

TRUE switches the controller on.

bInit

1

[TRUE,FALSE]

Initialization flag, which must be active (TRUE) for precisely the first cycle in which the controller is called.

bTune

1

[TRUE,FALSE]

A rising edge switches the self-tuning on. If it is switched to FALSE during the self-tuning process then the self-tuning is aborted and the controller continues operation using the old parameters (if they are still present).

bManual

1

[TRUE,FALSE]

TRUE switches manual operation on. If the signal goes FALSE again, the controller returns to automatic mode.

bSelSetpoint

1

[TRUE,FALSE]

Selects one of two possible setpoints. FALSE selects the normal setpoint, while TRUE selects the standby setpoint.

bSelCtrlParameterSet

1

[TRUE,FALSE]

Selects one of two parameter sets. FALSE causes the internal (determined) parameter set to be used, while TRUE switches to one provided externally.

bEnableSoftStart

1

[TRUE,FALSE]

The soft start-up process is used if TRUE.

bEnableRamping

1

[TRUE,FALSE]

TRUE causes each setpoint step-change to be converted to a ramp.

fW1

°C

LREAL

Setpoint.

fW2

°C

LREAL

Standby setpoint, generally smaller than fW1. fSelSetpoint can be used to switch between fW1 and fW2.

fX

°C

LREAL

Actual value. This value must be converted to LREAL.

bOpenThermocouple

1

[TRUE,FALSE]

The thermocouple is open if TRUE. Must be indicated by the hardware (e.g. KLxxxx).

bReverseThermocouple

1

[TRUE,FALSE]

TRUE indicates that the thermocouple has been connected with the wrong polarity. Must be indicated by the hardware.

bBackVoltage

1

[TRUE,FALSE]

TRUE indicates that the input voltage at the thermocouple is too high. Must be indicated by the hardware.

bLeakage

1

[TRUE,FALSE]

TRUE indicates that leakage current has been detected at the heating element. Must be indicated by the hardware.

bShortCircuit

1

[TRUE,FALSE]

TRUE indicates that a short circuit has been detected at the heating element. Must be indicated by the hardware.

bOpenCircuit

1

[TRUE,FALSE]

TRUE indicates that an open circuit has been detected at the heating element. Must be indicated by the hardware.

sControllerParameter

none

Structure

General parameters (sampling time etc.) are passed to the function block in this structure.

sParaControllerExternal

none

Structure

An external controller parameter set is passed to the function block in this structure.

sLogData

none

Structure

This structure passes parameters for logging to the function block (filenames etc.).

Outputs

Name

Unit

Value range

Description

fYAnalog

none

LREAL

Analog control value.

bYPWM

none

[TRUE,FALSE]

Boolean output, pulse width modulated.

bYDig

none

[TRUE,FALSE]

Boolean output of an on-off controller (TRUE control value 100%, FALSE control value off)

bYDigPos

none

[TRUE,FALSE]

Boolean output of a three-step controller (TRUE control value 100%, FALSE control value off)

bYDigNeg

none

[TRUE,FALSE]

Boolean output of a three-step controller (TRUE control value -100%, FALSE control value off)

dwAlarm

none

DWORD

Alarm messages (see ENUM ...)

iState

none

INT

Current controller state (see ENUM ...)

sParaControllerInternal

none

Structure

In this structure the internal controller parameter set (determined by the tuning) is made available.

bError

none

[TRUE,FALSE]

If an error is present, then bError is TRUE.

iErrorId

none

INT

If bError is TRUE, then iErrorId provides an error code (see ENUM ...)