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.
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.
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 | |
---|---|
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 | |
---|---|
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).
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.rSetPointLowLimit ≤ i_rSetPoint ≤ i_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.PidLowLimit ≤ i_rManualValue ≤ i_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 |
Includes various parameters needed for temperature control. |
In-/Output |
Data type |
Description |
---|---|---|
iq_etSelectParameterSetPID |
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 |
Structure providing 5 different PID parameter sets. |
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 |
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.rPidLowLimit ≤ q_rAnalogOutput ≤ i_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 |
Current status of auto-tuning as an enumeration value. Default value: ET_StatusAutoTune.Inactive |
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 rPidLowLimit ≥rPidHighLimit |
PidHighLimitOutOfRange |
UDINT |
311 |
rPidHighLimit > 100 or rPidHighLimit ≤rPidLowLimit |
FilterTimeInvalid |
UDINT |
312 |
Invalid value for rDigitalFilterTime |
AutoTuneHysteresisInvalid |
UDINT |
313 |
Invalid value for rAutoTuneHysteresis |