FB_HeatingControl - General Information

Overview

Type:

Function block

Available as of:

V1.0.1.0

Task

The function block FB_HeatingControl monitors and controls heating systems.

This function block is the successor of the TemperatureControl_Easy function block which was available in the Packaging Library of SoMachine.

Description

The function block FB_HeatingControl is designed to monitor and control heating systems. This means that the output q_rAnalogOutput can only have values greater than or equal to zero.

The auto-tuning algorithm is based on the so-called relay method. With this method, the process is induced by oscillations. After the completion of three oscillations, the auto-tuning calculates a set of PID parameters.

NOTE: The function block is working independent from the user-defined units, for example, ° C, ° F, Kelvin, mA, or mV. The application must use the same definition and resolution for the set point (i_rSetPoint) and the process value (i_rProcessValue).

Also refer to chapter Auto-Tuning (Heating).

It is important to ensure that the parameters are rational. There is no plausibility verification done by the function block.

 WARNING
UNINTENDED EQUIPMENT OPERATION
Verify the validity of the process values.
Failure to follow these instructions can result in death, serious injury, or equipment damage.

Set the input i_xEnable to FALSE if an invalid process value is detected (for example if a temperature sensor is no longer connected).

Process temperatures must also be validated.

 WARNING
UNINTENDED EQUIPMENT OPERATION
Verify that the maximum allowed process temperature is not exceeded through a second independent temperature monitoring.
Failure to follow these instructions can result in death, serious injury, or equipment damage.

The process temperature is not taken into account in open loop operation. This is the case with i_xHold = TRUE or i_xManualMode = TRUE, and i_lrManualValue > 0.

Set the input i_xEnable to FALSE if an over-temperature is detected (for example, by setting an excessive value for i_lrManualValue during manual mode is active).

Interface

Input

Data type

Description

i_xEnable

BOOL

TRUE: Enables function block and parameters are validated.

FALSE: Disables function block and all outputs are set to 0 or FALSE.

Active in all modes.

i_rSetPoint

REAL

Temperature (in user-defined units) to be maintained by the system.

Active in auto and auto-tuning mode.

Range: i_stTemperatureControl.rSetPointLowLimiti_rSetPointi_stTemperatureControl.rSetPointHighLimit

Default value: 0 [user-defined temperature unit]

i_rProcessValue

REAL

Process temperature value [user-defined temperature unit.]

The process temperature value must be scaled outside the function block (for example, with the FB_Scaling of the Toolbox library).

Active in auto and auto-tuning mode.

i_xManualMode

BOOL

TRUE: Enables manual mode

FALSE: Disables manual mode

Active in manual mode.

Only takes effect if q_etStatusAutoTune = ET_StatusAutoTune.Inactive.

i_rManualValue

REAL

Manual mode PID output

Active in manual mode.

Range: i_stTemperatureControlr.PidLowLimiti_rManualValuei_stTemperatureControl.rPidHighLimit

Default value: 0

i_xAutoTune

BOOL

Enables auto-tuning with a rising edge from FALSE to TRUE.

A falling edge does not stop auto-tuning.

Active in auto-tuning mode.

Default value: FALSE

i_xHold

BOOL

TRUE: Stops the internal PID calculation and holds the output q_rAnalogOutput at the present value.

FALSE: Resumes the internal PID calculation.

Default value: FALSE

Only takes effect if q_etStatusAutoTune = ET_StatusAutoTune.Inactive AND i_xManualMode = FALSE.

i_xReset

BOOL

Certain diagnostic messages can be reset using the input i_xReset. If a diagnostic message cannot be reset by a rising edge of i_xReset, verify and modify the parameter which causes the issue.

Active in all modes.

i_stTemperatureControl

ST_TemperatureControl

Includes various parameters needed for temperature control.

NOTE: Executing a reset (rising edge of i_xReset) in case of a PID parameter issue resets the selected PID parameter set to ET_ParameterSetPID.Default (also refer to iq_etSelectParameterSetPID). This means that the PID default parameter set is used.

In-/Output

Data type

Description

iq_etSelectParameterSetPID

ET_ParameterSetPID

It is possible to select one of the 5 PID parameter sets to influence the PID controller behavior.

Each set includes different values for the PID parameters (rKp, rTn, rTv, rTd).

iq_stParameterSetsPID

ST_ParameterSetsPID

Structure providing 5 different PID parameter sets.

NOTE: After auto-tuning is executed successfully, the calculated parameters are available and iq_etSelectParameterSetPID is automatically set to ET_ParameterSetPID.Medium.

Output

Data type

Description

q_xActive

BOOL

Indicates with TRUE that the program code is executing and that it must be executed in each cycle.

q_xReady

BOOL

Indicates with TRUE that the POU is ready and can be controlled via its inputs according to its functionality.

After the function block has been activated via a rising edge of i_xEnable, the output q_xReady is only set to TRUE if the function block can process instructions from the inputs.

q_xError

BOOL

Indicates with TRUE that an error has been detected. For details, refer to q_etResult and q_etResultMsg.

q_etResult

ET_Result

Provides diagnostic and status information as an enumeration value.

q_sResultMsg

STRING [80]

Provides additional diagnostic and status information as a text message.

q_rAnalogOutput

REAL

Analog form (signal) of output or manual value (in manual mode).

Range: i_stTemperatureControl.rPidLowLimitq_rAnalogOutputi_stTemperatureControl.rPidHighLimit

q_xPwmOutput

BOOL

PWM signal according to the output q_rAnalogOutput.

TRUE: Heating on

FALSE: Heating off

q_xAutoTuneActive

BOOL

TRUE: Auto-tuning active

FALSE: Auto-tuning inactive

q_etStatusAutoTune

ET_StatusAutoTune

Current status of auto-tuning as an enumeration value.

Default value: ET_StatusAutoTune.Inactive

Diagnostic Messages

The following elements of ET_Result are used for q_etResult.

Name

Data type

Value

Description

Ok

UDINT

0

Operation completed successfully.

SetPointOutOfRange

UDINT

300

i_rSetPoint < rSetPointLowLimit

or

i_rSetPoint > rSetPointHighLimit

SetPointLowLimitOutOfRange

UDINT

301

rSetPointLowLimit < -100000

or

rSetPointLowLimit > rSetPointHighLimit

SetPointHighLimitOutOfRange

UDINT

302

rSetPointHighLimit > 100000

or

rSetPointHighLimit < rSetPointLowLimit

ControlModeOutOfRange

UDINT

303

Accepted control mode range: Refer to ET_ParameterSetPID.

ManualValueInvalid

UDINT

304

i_rManualValue < rPidLowLimit

or

i_rManualValue > rPidHighLimit

CycleTimeInvalid

UDINT

305

Calculated task cycle time must be greater than 0 and less than or equal to 10000 [ms].

DeadBandInvalid

UDINT

306

rDeadBand < 0

or

rDeadBand > 100

PidParametersOutOfRange

UDINT

307

One or more PID parameters are out of range

PidControllerIssue

UDINT

308

General issue from the internal PID controller

PwmTimePeriodOutOfRange

UDINT

309

Value rPwmTimePeriod out of range or the value is less than the determined task cycle time.

PidLowLimitOutOfRange

UDINT

310

rPidLowLimit < 0

or

rPidLowLimitrPidHighLimit

PidHighLimitOutOfRange

UDINT

311

rPidHighLimit > 100

or

rPidHighLimitrPidLowLimit

FilterTimeInvalid

UDINT

312

Invalid value for rDigitalFilterTime

AutoTuneHysteresisInvalid

UDINT

313

Invalid value for rAutoTuneHysteresis