General Information - FB_HeatingControl2

Overview

Type:

Structure

Available as of:

V1.2.3.0

Task

The function block FB_HeatingControl2 monitors and controls heating systems.

Description

The function block FB_HeatingControl2 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 reverse tangent method. With this method, the process is initiated by switching on the heating until a certain (system-dependent) temperature is reached. Based on the maximum temperature reached and the cooling curve, the auto-tuning calculates a set of PID parameters.

NOTE: The function block is working exclusively with the unit °C. If a different unit is used for the temperature within the application, this must be adjusted (converted) to degrees Celsius for the set point (i_rSetPoint) and the process value (i_rProcessValue). For this purpose, use one of the conversion functions, such as FC_DegreeCelsiusToFahrenheit.

Also refer to Auto-Tuning (Heating) - FB_HeatingControl2.

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. If both inputs are TRUE, manual mode is enabled.

Set the input i_xEnable to FALSE if an over-temperature is detected (for example, by setting an excessive value for i_lrManualValue when the 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.

i_rSetPoint

REAL

Temperature (in °C) to be maintained by the system.

Active in auto and auto-tuning mode.

Range: i_stTemperatureControl.rSetPointLowLimiti_rSetPointi_stTemperatureControl.rSetPointHighLimit

Default value: 0.0 °C

i_rProcessValue

REAL

Process temperature value [°C]

The process temperature value needs to be converted to the permissible value range in degrees Celsius outside the function block. If values outside the permissible value range are detected, the function block indicates that an error is detected, a diagnostic message is generated and the heating is switched off.

Active in auto and auto-tuning mode.

Range: -200…850

i_xManualMode

BOOL

TRUE: Enables manual mode

FALSE: Disables 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.0 %

i_xAutoTune

BOOL

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

A falling edge does not stop auto-tuning.

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_TemperatureControl2

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.
NOTE: New values for the input parameters (including elements of the structure i_stTemperatureControl) are taken over, verified and then activated for the function block as long as q_xActive = TRUE and q_xAutotuneActive = FALSE.

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).

iq_stParameterSetsPID

ST_ParameterSetsPID2

Structure providing 5 different PID parameter sets.

iq_HeatingSystemMonitoring

ST_HeatingSystemMonitoring

Structure providing various parameters for monitoring and controlling the heating system.

NOTE: After auto-tuning is executed successfully, the calculated parameters are available and iq_etSelectParameterSetPID is automatically set to ET_ParameterSetPID.Medium.
NOTE: If xAutomaticCalculation is TRUE, the parameters related to heating system monitoring are also updated (recalculated) with auto-tuning enabled.

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 the internal PID controller 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

Status of auto-tuning as an enumeration value.

Default value: ET_StatusAutoTune.Inactive

NOTE: New values for the input parameters (including elements of the structure i_stTemperatureControl) are taken over, verified and then activated for the function block as long as q_xActive = TRUE and q_xAutotuneActive = FALSE.
NOTE: If q_xAutotuneActive is TRUE, the internal PID controller and its parameters become inactive until auto-tuning is finished. The input i_rSetpoint can be modified as long as q_etStatusAutoTune = ET_StatusAutoTune.WaitingForStartConditions. Once heated, it is then used as valid set point for the auto-tuning. Modifications become valid once auto-tuning has been completed.

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

For FB_HeatingControl:

rSetPointLowLimit < -100000 user temperature unit

or

For rSetPointLowLimit > rSetPointHighLimit

FB_HeatingControl2:

rSetPointLowLimit < -100 °C

or

rSetPointLowLimit > rSetPointHighLimit

SetPointHighLimitOutOfRange

UDINT

302

For FB_HeatingControl:

rSetPointHighLimit > 100000 user temperature unit

or

For rSetPointHighLimit < rSetPointLowLimit

FB_HeatingControl2:

rSetPointHighLimit > 800 °C

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].

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

rPwmTimePeriod out of range

NOTE: The lower value of this time period depends on the determined cycle time multiplied by the factor uiPwmCycleTimeToTaskRatio. With uiPwmCycleTimeToTaskRatio = 1 the value of rPwmTimePeriod must be at least equal to the determined cycle time.

PidLowLimitOutOfRange

UDINT

310

rPidLowLimit < 0

or

rPidLowLimitrPidHighLimit

PidHighLimitOutOfRange

UDINT

311

rPidHighLimit > 100

or

rPidHighLimitrPidLowLimit

FilterTimeInvalid

UDINT

312

Invalid value for rDigitalFilterTime

PwmCycleTimeToTaskRatioInvalid

UDINT

314

The value for uiPwmCycleTimeToTaskRatio is out of range.

MonitoringTimeOutOfRange

UDINT

315

For FB_HeatingControl2:

The value for timShortCircuitMonitoring or the value for timNoHeatingPowerMonitoring is out of range.

ShortCircutThresholdOutOfRange

UDINT

316

For FB_HeatingControl2:

The value for rShortCircuitThreshold is out of range.

ShortCircuitSlopeLimitOutOfRange

UDINT

317

For FB_HeatingControl2:

The value for rShortCircuitSlopeLimit is out of range.

NoHeatingPowerSlopeLimitOutOfRange

UDINT

318

For FB_HeatingControl2:

The value for rNoHeatingPowerSlopeLimit is out of range.

ProcessValueOutOfRange

UDINT

319

For FB_HeatingControl2:

The process value is outside the valid range -200 °C… 850 °C.

Verify whether there is a cable break in the sensor or a short circuit.

HeatingShortCircuit

UDINT

320

For FB_HeatingControl2:

Heating of the system without active control.

Verify the heating control. For example, are the relay contacts opening?

NoHeatingPower

UDINT

321

For FB_HeatingControl2:

No temperature increases (slope) at maximum (rPidHighLimit) heating power.

Verify the function of the heating element or the heating control and its wiring.