Overview
The PID_Temp V1.1 block in TIA Portal V16 for the SIMATIC S7-1200 1212 DC/DC/DC platform implements a temperature controller that combines PID regulation with a configurable control zone. When the process variable (PV) lies outside this control zone, the controller saturates its heating output to 100% and bypasses normal PID calculation. While the output is saturated, the integrator continues to track error, and by the time PV re-enters the control zone, the integrator can hold enough stored energy to drive a 20-60% overshoot.
The reference scenario is: SP = 90 °C, PV = 15 °C, control zone width = 10 °C, water bath with a single-phase electric heater. Engineers observing large overshoot at setpoint crossing are typically looking at integrator windup, not at incorrect P or D terms. The remedy is to apply anti-windup logic, configure the integrator hold correctly, and run the block's pre-tuning and fine-tuning sequences rather than hand-tuning P, I, and D by trial and error.
This document walks through the underlying PID_Temp operating principle, the mathematical root cause, the supported anti-windup features, the recommended auto-tuning procedure, manual tuning alternatives, and the verification steps for a robust temperature loop. Engineers new to PID fundamentals should review the ISA fundamentals of PID control and the National Instruments PID theory references first.
System Context and Hardware
The platform in scope:
- CPU: SIMATIC S7-1200, CPU 1212 DC/DC/DC, order number 6ES7212-1AE40-0XB0 (or successor 6ES7212-1AE40-0XB4).
- Firmware: V4.2 minimum for PID_Temp V1.1; V4.4 recommended for current auto-tuning reliability.
- Engineering: TIA Portal V16 Update 6 or V16 Update 7.
- Library block: PID_Temp V1.1, located under Instructions → Compact PID → PID_Temp in the project tree.
- Analog input: SM 1231 RTD (6ES7231-5PD32-0XB0) for Pt100/Pt1000, or SM 1231 TC (6ES7231-5QD32-0XB0) for thermocouples.
- Output: SB 1232 AO (6ES7232-4HA30-0XB0) for 4-20 mA SCR/SSR control, or a digital output to a solid-state relay.
The PID_Temp function manual and related firmware release notes are available on the Siemens Industry Online Support portal: Siemens Industry Online Support. The same manual documents all block parameters, modes, the auto-tuning algorithm, and the integrator behavior in detail. For PID theory background, the ScienceDirect PID topic page provides a more academic treatment.
PID_Temp Control Zone Operating Principle
The control zone in PID_Temp is a configurable temperature band centered on Setpoint. Its width is configured in engineering units (typically °C). The block internally calculates:
UpperZoneLimit = Setpoint + (ControlZoneWidth / 2)
LowerZoneLimit = Setpoint - (ControlZoneWidth / 2)
The operating modes for a heating-only configuration:
| PV position | Heat output | Integral state | PID action |
|---|---|---|---|
| PV > UpperZoneLimit | 0% (no heating) | Continues to integrate | Frozen |
| LowerZoneLimit ≤ PV ≤ UpperZoneLimit | PID calculated | Continues to integrate | Active |
| PV < LowerZoneLimit | 100% heating | Continues to integrate | Frozen |
The control zone exists because thermal systems are slow. While PV is far from SP, the engineer wants full power delivery rather than waiting for a small proportional output to do the work. When PV is close to SP, the full PID action takes over to land smoothly on the setpoint.
The hidden behavior operators see is that during the "100% heating" phase, the integrator is not halted. It calculates:
I_accumulated = I_previous + (Error_k / Ti) * dT
where Error_k = Setpoint - PV_k and dT is the controller cycle time. With Error = 90 - 15 = 75 °C and a typical Ti = 100 s, the integrator gains 0.75 °C of stored output action per second. Over a 5-minute (300 s) heat-up, the integrator holds the equivalent of 225 °C of stored action. When PV enters the zone, the controller switches to active PID, and that 225 °C of stored integral value drives the output to saturation on its own, well past the setpoint.
Integrator Windup: Root Cause and Mathematical Analysis
Integrator windup is a classical control problem documented in every PID textbook. The ISA InTech reference describes it succinctly: when the control variable reaches an actuator limit, the integral term continues to accumulate error that the actuator cannot affect; when the setpoint becomes reachable again, the integrator must "unwind" before the controller can stabilize.
In a thermal process, three factors amplify the windup magnitude:
- Large initial error: Cold-start conditions produce 50-100 °C of error in a typical 90 °C water bath. The integrator accumulates this error continuously.
- Slow process: A water bath can take 5-20 minutes to reach setpoint from cold. The integrator has ample time to accumulate.
- 100% saturation duration: With a 100% heating output, the actuator is at its limit for the entire heat-up phase, so the integrator has nothing to "unwind" against.
The discrete-time PID_Temp equation for heating, executed every cycle dT:
e_k = Setpoint - PV_k
P_k = Gain * e_k
I_k = I_{k-1} + (Gain * dT / Ti) * e_k
D_k = Gain * Td * (PV_{k-1} - PV_k) / dT
Output_k = P_k + I_k + D_k
Output_clamped = MIN(MAX(Output_k, PidLowerLimit), PidUpperLimit)
Note that the derivative term acts on PV (not on error) in PID_Temp. This is a deliberate design choice that prevents derivative kick on setpoint changes.
When Output_k > PidUpperLimit (saturated at 100% heating), PID_Temp's internal back-calculation forces:
I_k = PidUpperLimit - P_k - D_k
This prevents unlimited windup by recomputing the integrator to be consistent with the saturated output. However, when the heater is sized such that P_k + D_k < PidUpperLimit (the typical case during heat-up from cold), the recomputed I_k still grows as a function of P_k:
I_k = 100% - Gain * 75°C - small_D
If Gain = 1.0 and e = 75 °C, then I_k = 100% - 75% = 25% after one cycle. With Ti = 100 s and dT = 1 s, the integrator ramps up at 0.75% per cycle, reaching 25% (the back-calculated limit) in about 33 cycles. It then holds at 25%.
When PV enters the control zone, the back-calculation no longer clamps, and the integrator holds its 25% value. Combined with a fresh proportional kick of Gain * (SP - PV_zone_entry), the output stays at 100% for some time, driving the overshoot.
The overshoot magnitude for a first-order thermal system with a saturated integrator can be approximated by:
Overshoot_% ≈ 100 * (I_stored / Gain) / (T_process / Ti)
where T_process is the dominant thermal time constant. For I_stored = 25, Gain = 1, T_process = 600 s, Ti = 100 s:
Overshoot_% ≈ 100 * 25 / 600 * 100 = 41.7%
This matches the overshoot magnitude observed in the field. For a different process, plug in the actual Ti, Gain, and dominant T_process to predict the overshoot before the loop is even started.
Anti-Windup Configuration in PID_Temp V1.1
Three classical anti-windup techniques apply to PID_Temp:
| Method | Description | PID_Temp V1.1 support |
|---|---|---|
| Integrator clamping | Stop integration when output saturates | Supported via IntegratorHold input |
| Back-calculation | Recompute integrator based on saturated output | Internal, automatic with proper config |
| Conditional integration | Only integrate when error is small | Not directly exposed; achieved via tuning |
PID_Temp V1.1 implements a back-calculation variant internally when Config.Heat.PidUpperLimit and Config.Heat.PidLowerLimit are properly configured. The IntegratorHold input provides the integrator-clamping technique for external control.
The following parameters and inputs directly affect integrator behavior:
| Parameter / Input | Purpose | Recommended value |
|---|---|---|
Config.Heat.PidUpperLimit |
Upper clamp on heating output | 100.0 (default) |
Config.Heat.PidLowerLimit |
Lower clamp on heating output | 0.0 (default) |
IntegratorHold (Bool input) |
When TRUE, integrator stops accumulating | Driven by external logic |
Mode |
Operating mode | 3 (Automatic) for production, 4 for commissioning |
ActivateAutoTuning |
Starts pre-tuning | Pulse TRUE to start |
ActivateFineTuning |
Starts fine-tuning | Pulse TRUE to start |
The IntegratorHold input is the key external anti-windup lever. The recommended external logic in Structured Text (ST), placed in OB1 or a cyclic OB:
// ST code in OB1 or a cyclic OB
IF (HeatOutput >= Config.Heat.PidUpperLimit - 0.5) AND (Setpoint - Input > 0.0) THEN
IntegratorHold := TRUE; // Heating saturated, hold integrator
ELSIF (HeatOutput <= Config.Heat.PidLowerLimit + 0.5) AND (Setpoint - Input < 0.0) THEN
IntegratorHold := TRUE; // Cooling saturated, hold integrator
ELSE
IntegratorHold := FALSE; // Active regulation, allow integration
END_IF;
In PID_Temp V1.1, the back-calculation is automatic when Config.Heat.PidUpperLimit and Config.Heat.PidLowerLimit are configured. The IntegratorHold input adds a second layer of protection, useful when external constraints (valve limits, SCR firing angle limits, soft-start ramps) further restrict the output range.
Pre-Tuning Procedure
PID_Temp's pre-tuning algorithm finds the process gain, integral time, and derivative time by injecting a controlled step change in the heating output and observing the PV response. The algorithm expects:
- PV must be stable at the start (no active disturbances).
- The actuator must respond (heater must actually heat).
- PV must move by a configurable
TuneDistanceamount during the test.
Steps in TIA Portal V16:
- Open the watch table associated with the PID_Temp instance DB.
- Verify
Config.Heat.Setpointmatches the desired operating setpoint. - Set
ActivateAutoTuningto TRUE via the watch table (force the tag). - Wait. Pre-tuning takes 1-4 cycles of the dominant time constant. For a water bath with
T_process ≈ 600 s, expect 10-40 minutes. - Monitor
Retain.CtrlParams.Heat.Gain,Retain.CtrlParams.Heat.Ti,Retain.CtrlParams.Heat.Td. These tags update when the algorithm converges. - The block sets
AutoTuningDoneto TRUE on completion. - Reset
ActivateAutoTuningto FALSE.
If pre-tuning fails, the block sets AutoTuningState to a non-zero error code. Common causes:
| Error code | Meaning | Action |
|---|---|---|
| 1 | PV did not move (no actuator response) | Verify heater wiring, output signal |
| 2 | PV moved in the wrong direction | Check heating/cooling polarity |
| 3 | Process too noisy | Increase Config.InputScaling.Smoothing
|
| 4 | Setpoint too close to current PV | Increase TuneDistance in the instance DB |
The pre-tuning algorithm is robust enough that it sets the integrator to a value consistent with the eventual steady state, eliminating the manual tuning pitfall of leaving a saturated integrator in the background. As a general rule, manual P-I-D adjustment is the slower path to a worse result; on under-powered processes, pre-tuning plus fine-tuning saves hours of trial-and-error. Field experience has shown that manual tuning without auto-tune on a low-power bath can take a full working day and still under-perform a 30-minute pre-tune.
Fine-Tuning Procedure
After pre-tuning, run fine-tuning during normal production to refine the parameters. Fine-tuning makes small setpoint steps and watches the closed-loop response. Procedure:
- Confirm
Retain.CtrlParams.Heat.Gain,Ti, andTdare populated from pre-tuning. - Set
ActivateFineTuningto TRUE. - Trigger a small setpoint step (5-10 °C) and observe the PV response.
- Fine-tuning runs for several cycles, then settles. Duration is similar to pre-tuning.
- The block updates
Retain.CtrlParams.Heat.*incrementally.
Fine-tuning is critical for systems with nonlinear thermal dynamics (water evaporation, ambient coupling, varying mass). On an under-powered water bath, fine-tuning may take 24-48 hours to converge fully, as noted in commissioning logs for low-power test beds. Both pre-tuning and fine-tuning may be re-run as process conditions change (e.g., seasonal ambient shifts, batch mass variation). The block retains the last successful Retain.CtrlParams values across CPU restarts.
Manual Tuning and Integrator Hold
If auto-tuning is not available (the process is not safe to perturb, or the actuator cannot be modulated), manual tuning is possible. The classical approach is Ziegler-Nichols closed-loop tuning:
- Set
Ti = ∞(disable integral) andTd = 0(disable derivative). In PID_Temp, setRetain.CtrlParams.Heat.Tito a very large value (e.g., 99999.0) andTdto 0. - Increase
Retain.CtrlParams.Heat.Gainuntil the closed loop oscillates with constant amplitude. Record the critical gainK_uand the oscillation periodT_u. - Apply Ziegler-Nichols tuning rules:
| Controller type | Kp | Ti (s) | Td (s) |
|---|---|---|---|
| P | 0.50 * K_u | — | — |
| PI | 0.45 * K_u | T_u / 1.2 | — |
| PID | 0.60 * K_u | T_u / 2 | T_u / 8 |
For a water bath, the Tyreus-Luyben variant gives a more conservative, less oscillatory response:
| Controller type | Kp | Ti (s) | Td (s) |
|---|---|---|---|
| PI | 0.31 * K_u | 2.2 * T_u | — |
| PID | 0.45 * K_u | 2.2 * T_u | T_u / 6.3 |
After manual tuning, the integrator windup problem remains. The IntegratorHold workaround described in the anti-windup section must be applied. Manual tuning is more art than science for thermal systems; the conservative engineer will always use auto-tuning when the process allows. An additional manual fine-tune pass is appropriate only after auto-tuning has produced a baseline.
Output Limit Strategy
Config.Heat.PidUpperLimit and PidLowerLimit are deceptively simple. They clamp the output but do not, on their own, prevent integrator windup. In PID_Temp V1.1, the back-calculation is internal and uses these limits as the saturation reference. Setting them tighter than the actuator's physical limits reduces windup by giving the integrator a smaller ceiling to back-calculate against.
For processes where windup is severe (large SP changes, long time constants):
- Set
PidUpperLimitto the maximum continuous output the actuator can sustain (e.g., 80% for a heater that loses efficiency at full power, or 90% to leave headroom for soft-start ramps). - Set
PidLowerLimitto 0% (no negative heating in heating-only mode). - Enable
IntegratorHoldon external logic when the output is at the limit. - Consider a feed-forward disturbance term if load disturbances are predictable (e.g., opening an oven door, adding cold material).
For a heating-only water bath with an electric heater that can run continuously at 100%, the default PidUpperLimit = 100.0 and PidLowerLimit = 0.0 are appropriate. The windup risk then comes from the integrator's accumulation during the 100% phase, not from a too-loose clamp.
Commissioning Verification
After configuration and tuning, verify the loop with the following tests:
-
Cold-start test: Bring the bath to ambient. Apply
Setpoint = 90 °C. Record the PV curve. -
Setpoint step test: From
SP = 90 °C, step toSP = 70 °C. Record PV undershoot and recovery. - Disturbance test: Inject a known cold-water slug. Record PV deviation and recovery time.
- Trending: Use TIA Portal's trace function or a WinCC Comfort trend view to capture PV, SP, HeatOutput, and the integrator value (if exposed) over 30-60 minutes.
Acceptance criteria for a well-tuned PID_Temp loop on a water bath:
| Metric | Target | Acceptable | Investigate if |
|---|---|---|---|
| Overshoot on cold start | < 2 °C | < 5 °C | > 5 °C |
| Settling time (5% band) | < 10 min | < 20 min | > 30 min |
| Steady-state error | < 0.2 °C | < 0.5 °C | > 1 °C |
| IAE (integral of absolute error) | baseline | < 2× baseline | > 3× baseline |
If overshoot exceeds 5 °C, the most likely cause is residual integrator windup. Revisit the IntegratorHold logic and confirm Config.Heat.PidUpperLimit / PidLowerLimit are not over-restrictive (which would also cause sluggish response). If settling time is acceptable but overshoot is still present, reduce Ti (longer integral time) by 30-50% to slow the integrator's response.
Safety, Alarms, and Edge Cases
Beyond tuning, the engineer must handle several edge cases that interact with the control zone behavior:
-
Sensor break (wire break on RTD): PID_Temp can be configured to enter a safe output state on input out-of-range. Set
Config.Heat.SetpointLimit.UpperLimitslightly above the maximum expected PV to force a high-impedance condition on sensor break. The controller'sErroroutput word will indicate0x0001for input out-of-range,0x0002for input invalid. -
Overshoot protection: PID_Temp can be configured with
Config.Heat.AlarmUpperLimitto trigger an HMI alarm at a threshold slightly above the setpoint (typically SP + 3 °C). This catches residual overshoot and alerts the operator. -
Process noise: A noisy PV (e.g., from an unshielded thermocouple near a VFD) drives the integrator erratically. Increase
Config.InputScaling.Smoothing(a first-order low-pass filter on PV) to reduce noise injection. Typical values are 1-5 seconds for an electrically clean plant, 5-20 seconds for a noisy plant. -
Dead-time dominant processes: Some thermal processes (heat exchangers across long pipe runs, sterilization loops) have transport delay. PID_Temp's auto-tuning handles moderate dead time, but excessive dead time (> 30% of T_process) requires a Smith predictor or a model-predictive controller. For PID_Temp, limit
Gainto roughly 0.3 / (DeadTime / T_process) to avoid oscillation. - Multiple heating elements: For a bath with two heaters, use one PID_Temp with the output scaled to 0-200% (if the analog output supports it) or two cascaded PID_Temp blocks. Avoid running two independent PID_Temp instances on the same PV; they fight each other.
- PID_Temp vs PID_Compact: PID_Temp is the temperature-specific variant with built-in control zone, heating/cooling output handling, and a tuned auto-tuning algorithm. PID_Compact is the general-purpose block and lacks the temperature-specific signal conditioning. For thermal loops, always choose PID_Temp.
For thermal-runaway protection (the critical safety case), implement an independent hard-wired high-temperature cutout in the heater power path, separate from the PLC. Software interlocks cannot replace hardware safety, and a PLC scan-time stall during a commissioning accident must not allow the heater to run away.
Field Best Practices
- Run pre-tuning, then fine-tuning, on every new loop. Manual tuning is the slower path to a worse result; treat manual tuning as a last resort, not a default.
- Tune at production setpoint, not at room temperature. A water bath has different thermal characteristics at 25 °C vs 85 °C (radiation losses, convection regimes).
- Capture traces during tuning. Visual inspection of PV and output is faster than calculating metrics; trend PV, Setpoint, and HeatOutput together on a 30-minute window.
-
Use
Mode = 3(Automatic) for production,Mode = 4(Automatic with backup) only during commissioning. Mode 4 freezes the last output on CPU restart, which is the wrong default for unattended operation. -
Avoid the temptation to set
ControlZoneWidthto 0. A zero-width zone disables the regulation band and the controller never transitions out of "100% heating" mode, eliminating the smooth regulation phase. -
For multi-zone processes (e.g., reactor with jacket and internal coil), use one PID_Temp per zone with appropriate
Config.Heat.Setpointper zone. Do not cascade zones through a single controller. -
Document the
Retain.CtrlParamsvalues after a successful tuning pass. Spare-parts replacement of the CPU requires a backup of the project, or the tuning must be re-run from scratch. -
Monitor
AutoTuningStatein the HMI. A non-zero state indicates a tuning failure that must be cleared before resuming production. -
Always enable
IntegratorHoldon saturation for safety-critical thermal loops, even if the internal back-calculation is sufficient for normal operation. The redundant hold protects against tuning-induced windup spikes and during setpoint step transitions. - Re-tune after mechanical changes: replacing the heater element, changing the impeller, adding insulation, or changing the fluid mass all shift the process dynamics. Pre-tune again if any of these change by more than 20%.
FAQ
What is the control zone in PID_Temp and why does it matter?
The control zone is a configurable temperature band centered on Setpoint. When PV lies within the band, PID_Temp regulates normally. When PV lies outside the band, the controller forces the heating output to 100% (or the configured limit) and bypasses the proportional/derivative term. The band is set in °C via the ControlZoneWidth parameter; typical values are 5-20 °C for water baths and 10-30 °C for ovens.
Why does the integrator accumulate when PV is outside the control zone?
The integrator in PID_Temp calculates the running sum of (Setpoint − PV) / Ti. When PV is far below Setpoint, this error is large (e.g., 75 °C for a cold bath with SP = 90 °C). The integrator accumulates this error every cycle, even though the heating output is saturated at 100%. When PV enters the control zone, the integrator holds the stored value and drives the output beyond what the proportional action alone would demand, causing overshoot. This is the classical integrator windup problem.
Should I use pre-tuning or fine-tuning for a water bath?
Use both, in sequence. Pre-tuning handles the cold-start tuning, finding approximate Kp, Ti, and Td from a controlled heat-up. Fine-tuning refines the parameters during normal production setpoint steps. For an under-powered water bath, fine-tuning may take 24-48 hours to converge fully. Skipping auto-tuning in favor of manual trial-and-error is much slower and produces inferior results.
How do I enable anti-windup in PID_Temp V1.1?
PID_Temp V1.1 has internal back-calculation that activates when Config.Heat.PidUpperLimit and PidLowerLimit are configured. For additional protection, drive the IntegratorHold input TRUE when the output reaches the configured limit and the error is still non-zero. The recommended external logic checks (HeatOutput ≥ PidUpperLimit − 0.5%) AND (Error > 0), or symmetrically for cooling.
Can I disable the control zone entirely?
Yes, set ControlZoneWidth to a very large value (e.g., 1000 °C) so that the band always contains PV. The controller then operates in pure PID mode from any starting PV. This is rarely desirable for thermal systems because it forces PID damping during cold start, resulting in very slow heat-up. The control zone is a deliberate design choice for fast cold start plus smooth regulation.
What firmware and TIA Portal version do I need for PID_Temp V1.1?
PID_Temp V1.1 requires SIMATIC S7-1200 firmware V4.0 or later (V4.4 recommended) and TIA Portal V14 SP1 through V16. The block is part of the standard "Compact PID" library included with the TIA Portal installation; no additional license is required.