Resolving S7-1200 PID_Compact Output Zero at 100% Input

David Krause17 min read
PID ControlSiemensTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Resolving S7-1200 PID_Compact Output Zero at 100% Input

Problem Overview

The PID_Compact instruction (FB 1130 / FB 1131 / FB 1132 depending on TIA Portal version) on the S7-1200 platform can enter a permanent "inactive" or "stopped" operating mode in which the manipulated variable collapses to 0% and the controller refuses to restart. The four most common triggering conditions observed in the field are:

  1. The process value (Input) reaches 100% of the configured measuring range while the manipulated variable is also at 100%.
  2. The PLC is power-cycled while the process is far from setpoint, especially with a temperature loop where PV has cooled to ambient.
  3. Output saturation persists beyond the configured watchdog time, with no path for integral recovery.
  4. The analog input or scaled PV leaves the configured InputScaling limits, triggering the safety transition.

The reported symptom is identical in all four cases: Retain.CtrlInactive = TRUE, Output = 0.0, and the controller cannot be brought back online without a CPU restart or a project re-download. The root cause is a combination of integral wind-up and the safety logic built into PID_Compact.

Safety implication: When the controller drops to 0% on a heating or pressure loop, the controlled actuator closes fully. Always verify the process can tolerate a 0% output for the duration of the diagnostic and fix. For critical processes, add a hardwired backup controller or interlock.

Affected Versions and Instruction Revisions

TIA Portal Version PID_Compact Version DB Family Key Behavior Change
V13 SP1 / V14 V1.x FB 1130 Basic anti-windup, hard saturation trip at 100%
V15 / V15.1 V2.0 FB 1131 Configurable InputScaling and OutputScaling
V16 / V17 V2.1 / V2.2 FB 1131 Improved restart handling, scaled PV monitoring
V18 / V19 V3.x FB 1132 Multi-instance, enhanced diagnostics, instance-specific Retain
S7-1200 G2 V4.x FB 1132 New PID_Compact V4 with separate warm/cold restart state machine

For S7-1200 G2 CPUs (6ES7 214-1xxxx-0SB0 and 6ES7 215-1xxxx-0SB0), the official PID functionality documentation in the TIA Portal Cloud describes the extended state machine that the V4.x instruction implements, including the explicit handling of the inactive-mode conditions described in this article.

Root Cause: Integral Wind-Up and the Inactive Safety State

The phenomenon of "controller wind-up" predates the S7-1200 and was first documented on pneumatic and electro-mechanical controllers. It occurs when the integral component of the PID algorithm continues to accumulate the control error while the physical actuator has already reached its travel limit. The integrator grows without bound, and when the process value finally changes, the accumulated integral term is so large that no realistic change in the error can reduce it in a reasonable time. The controller effectively becomes a fixed-output device, ignoring the process.

In PID_Compact the failure is amplified by a second mechanism: when the instruction detects that the input and the output are both at 100% (a "coincident saturation" condition), the safety logic transitions the controller to the Inactive state. The output collapses to 0%, the controller holds the integral term at its last value, and the only way out is a mode change or a CPU restart.

Mathematical Model

The discrete PID_Compact integrator maintains the following state across scans:

I_sum(n) = I_sum(n-1) + (Kp / Ti) * e(n) * Ts

Where:

  • I_sum = internal integrator state (tag sRetain.fIItVal)
  • Kp = proportional gain (sBackUp.r_Gain)
  • Ti = integral action time in seconds (sBackUp.r_Ti)
  • e(n) = error (setpoint minus process value) at scan n
  • Ts = sampling time of the PID_Compact instance

When the output is clamped at 100% for many scans, I_sum grows linearly with the error. If the loop has been at setpoint 180 °C with PV at 30 °C (a typical heating scenario), the integrator is fed 150 °C of error on every scan. Even with a modest Kp/Ti = 0.05 and a one-second Ts, the integrator can accumulate 7.5 units per second, requiring tens of minutes to "unwind" once the process finally overshoots the setpoint.

PID_Compact Mode State Machine

The instruction moves through the following operating states. The transitions that lead to the Inactive state are the ones that lock the output at 0%.

Inactive Manual (bSetPointValue=FALSE) Automatic (bumpless transfer) Inactive (trip) (Output = 0%) Saturation Condition Input=100% AND Output=100% eMode=Manual Set On Input/Output at 100% Output=0 Restart / mode change only path out of tripped Inactive state

Diagnostic Indicators

When the controller is locked in the inactive state, monitor the following tags in the PID_Compact instance DB (right-click the DB in TIA Portal and select "Monitor / Modify" with all instance tags visible):

Symptom Tag Location Interpretation
Output collapses to 0% Output / OutputPER Safety default state
Controller inactive flag Retain.CtrlInactive = TRUE State machine holds here
Specific error code sRetain.i_wError = 16#8xxx See error code table below
Pre-fault warning sRetain.i_wWarning = 16#4xxx Approaching fault condition
Raw input saturated Input_PER = 0 or 27648 Wiring or sensor issue
Setpoint equals PV SetpointInput Steady-state, controller should be off

PID_Compact Error Code Reference

Hex Code Decimal Bit Position Meaning
16#0000 0 - No error, controller operating normally
16#0001 1 Bit 0 Input PER is outside high limit
16#0002 2 Bit 1 Input PER is outside low limit
16#0004 4 Bit 2 Invalid setpoint (NaN or out of range)
16#0008 8 Bit 3 Invalid input value (NaN)
16#0010 16 Bit 4 Output tracking error / watchdog expired
16#0020 32 Bit 5 Sample time violation (OB1 cycle > configured Ts)
16#0040 64 Bit 6 Tuning in progress (pretuning or fine tuning active)
16#0080 128 Bit 7 Output substitution active (sustained fault)
16#4000 16384 Bit 14 Input PER warning - approaching limit
16#8000 32768 Bit 15 Error class high - controller has entered inactive

Solution 1: Configure Output Limits Below 100%

The most direct fix reported in the field is to limit the maximum output to 99% (or any value just below 100%) so the safety logic never sees the coincident-saturation condition. This is the approach Siemens documents in their PID_Compact configuration guidance.

  1. Open TIA Portal and load the S7-1200 project containing the affected PID_Compact instance.
  2. Navigate to Project Tree → PLC_x → Program blocks → System blocks → PID_Compact instances → [Instance DB].
  3. Open the instance DB and switch to the Configuration tab.
  4. Expand Basic settings → Output settings.
  5. Set Output upper limit to 99.0 (or 99.5 if 99% still causes the trip in your process).
  6. Set Output lower limit to 0.0 unless the actuator has a non-zero minimum (e.g., a 4-20 mA valve with a 4 mA minimum).
  7. Compile (Project → Compile → Software) and download the project to the CPU.
  8. Either power-cycle the CPU or trigger a PID_Compact re-initialization (set Retain.CtrlInActive = FALSE and re-assert bSetPointValue).
Why 99% works: PID_Compact checks the "InvalidOutputValue" condition when the manipulated variable reaches the configured upper limit AND the input is at 100% for the duration of the watchdog. The 1% margin prevents the safety transition while still allowing the actuator to be commanded to its physical maximum (the output stage of the S7-1200 analog output saturates to 10 V / 20 mA regardless of the PID_Compact output value above 99%).

Solution 2: Match InputScaling to the Real Process Range

Configure the input scaling so that the scaled PV cannot exceed 100% under any realistic process condition. Mismatched scaling is the second most common cause of the inactive state.

Parameter Path in PID_Compact Configuration Recommended Setting
InputScaling.UpperPointIn Input scaling Process engineering units (e.g., 200.0 °C)
InputScaling.LowerPointIn Input scaling 0.0 °C or process low end
InputScaling.UpperPointOut Input scaling 27648 (matches analog input raw max)
InputScaling.LowerPointOut Input scaling 0 (matches analog input raw min)
InputScaling.InputScaling Configuration toggle TRUE (enable scaling)
Config.InputScalingUpperLimit Static tag 100.0
Config.InputScalingLowerLimit Static tag 0.0

If the configured UpperPointIn exceeds the real sensor maximum, the scaled PV will rise above 100% on overrange conditions and trip the safety logic even though the physical sensor is still in spec. Always scale to the worst-case realistic PV plus a 5% engineering margin.

Solution 3: Mode Switching for Manual Unwind

When the controller has wound up, switching to Manual mode allows the integral term to drain to the value that matches the current output. The PID_Compact supports bumpless transfer: when you switch from Manual back to Automatic, the integral term is initialized to the manual output value, eliminating the bump on transition.

Structured Text Example for Manual Unwind

// Manual unwind when PV reaches the upper limit
IF "PID_DB".Input >= 99.0 AND "PID_DB".Output >= 99.0 THEN
    // Force manual mode to let integral drain
    "PID_DB".eMode := ePIDModeManual;
    "PID_DB".bSetPointValue := FALSE;
    "PID_DB".ManualEnable := TRUE;
    "PID_DB".ManualValue := "PID_DB".Output;  // Hold current output
    
    // Wait for unwind (or use a process-specific timer)
    IF "unwind_timer".Q THEN
        // Switch back to automatic with bumpless transfer
        "PID_DB".ManualValue := "PID_DB".Output;
        "PID_DB".eMode := ePIDModeAutomatic;
        "PID_DB".bSetPointValue := TRUE;
        "PID_DB".ManualEnable := FALSE;
        "unwind_timer".IN := FALSE;
    END_IF;
END_IF;

Ladder Logic Equivalent

|   Input >= 99.0   Output >= 99.0   unwind_done   |
|---|----[/]----[/]----[/]------------( S )---|
|   "PID_DB".eMode = ePIDModeManual            |
|                                               |
|   unwind_done   unwind_timer.Q                |
|---|----[/]------|------[/]----------( )---|
|   "PID_DB".eMode = ePIDModeAutomatic          |

Solution 4: Power Cycle Recovery Configuration

When the PLC loses power with the process far from setpoint, PID_Compact can enter the inactive state on the next startup. The fix depends on the desired restart behavior.

Option A: Configure Restart Mode

  1. Open the PID_Compact instance DB Configuration tab.
  2. Navigate to Basic settings → Behavior at CPU restart.
  3. Set Mode at restart to one of: Inactive (operator must bring online), Last active mode (resume where left off), or Automatic (force automatic on restart).
  4. For temperature loops that cool at restart, choose Inactive and let the operator verify the process before going automatic.

Option B: Initialize Setpoint from Process Value in OB100

For loops where the process is always allowed to be at PV on startup, pre-load the setpoint to the current PV in the warm restart OB. This prevents the controller from trying to drive a 150 °C delta immediately after a power cycle.

// OB100 - Warm restart
// On power-up, set setpoint equal to current process value
IF "PV_Scaling_OK" THEN
    "PID_DB".Setpoint := "PID_DB".Input;
    "PID_DB".eMode := ePIDModeAutomatic;
    "PID_DB".bSetPointValue := TRUE;
END_IF;

Option C: Configure Retain Settings

Mark the critical state tags as Retain in the instance DB properties so the integral state survives the power cycle. The S7-1200 classic supports up to 10 kB of retain data; the G2 supports more. Verify the retain budget on your CPU before enabling.

Tag Retain Setting Purpose
sRetain.fIItVal Retain Preserve integrator state across cycle
sRetain.bRestart Retain Preserve restart state machine
sBackUp.r_Gain Retain Preserve tuned Kp
sBackUp.r_Ti Retain Preserve tuned Ti
sBackUp.r_Td Retain Preserve tuned Td
Config No retain Reload from project on cycle

Solution 5: Anti-Windup Implementation

PID_Compact includes built-in back-calculation anti-windup that activates when the output reaches the configured limits. The behavior is governed by these parameters:

Parameter Tag Default Effect
Proportional gain Config.Retain.Ctrl_Gain 1.0 Scales P-term contribution
Integral time Config.Retain.Ctrl_Ti 20.0 s Integrator time constant
Derivative time Config.Retain.Ctrl_Td 0.0 s Derivative action
Derivative filter Config.Retain.Ctrl_TdFilt 0.0 s First-order filter on D-term
Output upper limit Config.OutputScaling.UpperPointOut 100.0 Saturation upper bound
Output lower limit Config.OutputScaling.LowerPointOut 0.0 Saturation lower bound

The built-in anti-windup is passive (back-calculation with gain = 1.0). It only works if the output limits are properly configured. If the limits are 0-100% and the process regularly hits them, the integrator will still wind up.

Explicit Anti-Windup in Structured Text

For critical applications where the built-in anti-windup is insufficient, add explicit clamping logic in the OB that calls the PID_Compact block:

// Explicit anti-windup clamp on the integrator state
IF "PID_DB".sRetain.fIItVal > "PID_DB".Config.OutputScaling.UpperPointOut THEN
    "PID_DB".sRetain.fIItVal := "PID_DB".Config.OutputScaling.UpperPointOut;
END_IF;

IF "PID_DB".sRetain.fIItVal < "PID_DB".Config.OutputScaling.LowerPointOut THEN
    "PID_DB".sRetain.fIItVal := "PID_DB".Config.OutputScaling.LowerPointOut;
END_IF;

Verification and Commissioning Tests

After applying any of the above fixes, run the following test sequence in TIA Portal with the CPU in RUN and the PID_Compact instance online:

Test 1: Step Response

  1. Set setpoint to 50% of measuring range.
  2. Confirm controller is in Automatic mode (eMode = ePIDModeAutomatic).
  3. Apply a process disturbance (load change, setpoint step, or actuator pulse).
  4. Observe: Output responds within 2-3 sample times.
  5. Pass criterion: Output settles within ±5% of steady-state value within 10 × Ti.

Test 2: Saturation Recovery

  1. Drive the output to 99% (raise setpoint above PV).
  2. Hold for 60 seconds at saturation.
  3. Lower setpoint below PV to force the output down.
  4. Observe: Output responds within 5 sample times, no transition to inactive state.

Test 3: Power Cycle

  1. Set setpoint far from process value (e.g., setpoint 180 °C, PV 30 °C).
  2. Power cycle the S7-1200 (STOP / RUN or power removal).
  3. Observe: PID_Compact resumes in the configured restart mode.
  4. Pass criterion: Output drives toward setpoint without entering inactive state.

Test 4: Bumpless Manual-to-Auto Transfer

  1. Start in Automatic mode with output at 50%.
  2. Switch to Manual mode (eMode = ePIDModeManual).
  3. Change ManualValue to 30%.
  4. Switch back to Automatic mode.
  5. Pass criterion: Output remains near 30% during transition, no bump > 2%.

Troubleshooting Matrix

Observed Symptom Primary Cause Verification Fix
Output = 0%, Input = 100% Output limit = 100% triggers trip Check Config.OutputScaling.UpperPointOut Set upper limit to 99%
Output = 0% after power cycle Invalid PV at startup Check sRetain.i_wError bit 4 Initialize setpoint from PV in OB100
Output = 0%, Input = 0% Input out of range (low) Check sensor wiring and raw value Verify InputScaling, check sensor
Controller stuck in manual bSetPointValue = FALSE Monitor bSetPointValue tag Set bSetPointValue = TRUE
Output oscillates Derivative gain too high Check Ctrl_Td value Reduce Td or increase Ts
Output bumps on mode switch ManualValue not initialized Check ManualValue at transition Pre-load ManualValue = current Output
Retain data lost on cycle Retain not enabled Check DB properties → Retain Enable Retain on integral state tags
Setpoint ignored Setpoint in wrong units Check Setpoint vs Input range Verify InputScaling parameters
i_wError = 16#0001 Input out of range (high) Check Input_PER value Check process value range and scaling
i_wError = 16#0010 Watchdog timeout Check OB1 scan time Verify SampleTime setting
i_wError = 16#0020 Sample time too small Check OB1 cycle vs SampleTime Increase SampleTime or reduce OB1 cycle

Platform-Specific Considerations

S7-1200 Classic (CPU 1211C / 1212C / 1214C / 1215C / 1217C)

  • CPU firmware V4.0 or later required for PID_Compact V2.x with the configurable InputScaling.
  • Use TIA Portal V15.1 or later for the full feature set including scaled input monitoring.
  • Maximum number of PID_Compact instances per CPU is firmware-dependent: 1211C supports 6, 1212C supports 8, 1214C supports 16, 1215C supports 16, 1217C supports 16.
  • Minimum recommended SampleTime = 0.1 s for reliable operation with PID_Compact V1.x and V2.x. V3.x on newer CPUs can run at 0.05 s.

S7-1200 G2 (CPU 1212G / 1214G / 1215G / 1217G)

  • New CPU firmware supports PID_Compact V4.x with the extended state machine described in the TIA Portal Cloud PID functionality documentation.
  • Improved restart behavior with separate warm and cold restart handling.
  • Extended diagnostic information in the instance DB including per-transition state flags.
  • Multi-instance support for code reuse across multiple PID loops.

Comparison with Other S7-1200 PID Instructions

Instruction Use Case Output Type Anti-Windup Inactive State Risk
PID_Compact Continuous process (T, P, flow) Analog % Built-in back-calc Medium (this article)
PID_3Step Motorized valve Digital up/down Position feedback Low (uses position tracking)
PID_Temp Temperature only Analog % or PWM Built-in back-calc Medium (same root cause)

PID_3Step uses position feedback from the valve and does not exhibit the wind-up failure mode described in this article. If your process is compatible with PID_3Step (i.e., you have a motorized valve with position feedback), it is the more robust choice for applications that experience long saturation periods.

Field Examples

Example 1: Injection Molding Barrel Heating

A plastic injection molder used PID_Compact to control barrel zone temperature with setpoint 230 °C and ambient start temperature 25 °C. The integrator accumulated over 4 hours of operation per shift. On overnight cool-down, the PV dropped to 25 °C while the integrator remained at its wound-up value. The next morning, the controller immediately went to 100% output, the PV overshot to 245 °C, and the controller tripped to inactive.

Applied fix: Output upper limit reduced from 100% to 99%, setpoint initialized from PV in OB100, and integrator clamped to output limits in the user program.

Example 2: HVAC Supply Air Temperature

An AHU supply air loop with setpoint 13 °C and outdoor air at 35 °C saw 100% cooling valve demand in summer. After a power outage, the controller would not restart and displayed Retain.CtrlInactive = TRUE.

Applied fix: InputScaling adjusted so the scaled PV cannot exceed 100% on overrange, and the restart mode was set to "Last active mode" with the integrator state marked as Retain.

Example 3: Pump Discharge Pressure

A booster pump station with PID_Compact controlling VFD speed on a centrifugal pump. Demand spikes during peak hours drove the output to 100% for several minutes. After each spike the controller went inactive.

Applied fix: Output upper limit set to 95% to leave headroom for the VFD ramp-down, and the integral time was increased from 5 s to 20 s to reduce integrator accumulation rate.

Best Practices Summary

  1. Always set output upper limit to 99% (or 99.5%) instead of 100% on critical control loops.
  2. Match InputScaling to the real process range plus a small engineering margin; never let the scaled PV exceed 100% under any realistic condition.
  3. Mark integrator state tags as Retain so the controller resumes cleanly after a power cycle.
  4. Initialize the setpoint to the current PV in OB100 for loops that start far from setpoint.
  5. Use bumpless transfer (set ManualValue = current Output) when switching from Manual to Automatic.
  6. Monitor sRetain.i_wError and sRetain.i_wWarning in the HMI for early warning of the inactive condition.
  7. For processes with frequent or long saturation, consider PID_3Step for motorized valves or implement external anti-windup clamps.
  8. Run the four commissioning tests (step response, saturation recovery, power cycle, bumpless transfer) before handing the loop over to operations.

FAQ

Why does my S7-1200 PID_Compact output drop to 0% when the input reaches 100%?

The PID_Compact safety logic interprets coincident saturation (output at 100% AND input at 100%) as a fault condition and transitions the controller to inactive mode. Set the output upper limit to 99% in the PID_Compact OutputScaling configuration. The 1% margin avoids the safety trip while still allowing the actuator to be commanded to its physical maximum, because the S7-1200 analog output saturates to 10 V / 20 mA regardless of the PID_Compact output value above 99%.

How do I prevent PID_Compact from entering inactive mode after a power cycle?

Three steps in combination: first, mark sRetain.fIItVal and sRetain.bRestart as Retain tags in the instance DB properties so the integrator state survives the power cycle. Second, configure the "Mode at restart" parameter in the PID_Compact Configuration tab to match your startup sequence (typically "Inactive" for temperature loops that need operator verification). Third, initialize the setpoint to the current process value in OB100 (warm restart) so the controller does not see a huge delta immediately after power-up.

What is integral wind-up in PID_Compact and how do I fix it?

Integral wind-up occurs when the integral term accumulates error while the output is saturated, making recovery slow when the process finally changes. PID_Compact includes built-in back-calculation anti-windup that activates when the output reaches the configured limits. The anti-windup only works correctly if the output limits are properly configured in the OutputScaling settings. For loops that hit 0% and 100% regularly, set the upper limit to 99% and the lower limit to 1% to keep the safety logic out of the saturation trip while still allowing effective control across nearly the full actuator range.

Can I switch PID_Compact between manual and automatic without bumping the output?

Yes. PID_Compact supports bumpless transfer when switching from Manual to Automatic mode. Set the ManualValue to the current output value before switching, and the integral term is automatically initialized to that value. The bSetPointValue tag controls when the new setpoint takes effect: set it FALSE during the mode transition and TRUE after the controller has stabilized. In ladder logic, the transition is typically implemented as a one-shot on eMode change with the ManualValue assignment in the same network.

What do the PID_Compact error codes 16#0001 and 16#0002 mean?

Error code 16#0001 (bit 0 of sRetain.i_wError) indicates the input process value is above the configured upper limit. Error code 16#0002 (bit 1) indicates the input is below the configured lower limit. Both cause the controller to enter the inactive state. Verify your InputScaling parameters match the actual process value range and check the sensor for out-of-range conditions. The scaled PV should never exceed 100% under realistic process conditions; add a 5% engineering margin to the InputScaling upper bound and reduce the upper limit from 100% to 99% on the output side to break the coincident-saturation path.

Back to blog