Fine-Tuning PID_Compact on S7-1200: Procedure, Timing, and Limits

David Krause14 min read
PID ControlSiemensTutorial / How-to
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

Fine-Tuning PID_Compact on S7-1200: Procedure, Timing, and Limits

Fine tuning of the PID_Compact technology object on a SIMATIC S7-1200 CPU is the recommended method for tightening loop response after pretuning has established initial parameters. The process is slow by design: the controller intentionally drives a controlled, limited oscillation around the setpoint to extract amplitude, period, and dead time information from the actual process. A 20-minute run with little visible output change is the expected steady-state behavior of this phase, not a fault condition.

This reference covers the S7-1200/S7-1500 PID control function manual conventions, the PID_Compact V2 technology object as used in TIA Portal V14 and later, the parameter set that governs fine tuning, and field-proven steps to verify the resulting Gain, TI, and TD before going into production.

1. Scope and Applicable Firmware

The procedure described here applies to the following hardware and software combinations:

  • CPU families: S7-1200 (all variants), S7-1200 G2, and S7-1500 when the same PID_Compact block is used.
  • TIA Portal: V14 SP1 or higher. V14 is the minimum release that introduced PID_Compact V2; V15, V16, V17, V18, V19, V20, and V21 retain the same configuration dialogs with minor additions for PID_Temp compatibility.
  • Technology object: PID_Compact V2 (current as of the V21 documentation set). The legacy V1 block is still selectable for migration but is not the target of fine tuning in new projects.

The official entry point for the underlying documentation is the SIMATIC S7-1200, S7-1500 PID control function manual. The fine tuning semantics are defined in chapter 2.6 (commissioning), chapter 2.8 (optimization), and chapter 4.2 (PID_Compact V2) of that manual.

2. Why Fine Tuning Takes 20 Minutes

Fine tuning is fundamentally different from pretuning. Pretuning injects a step disturbance at the operating point and fits a first-order-plus-dead-time model to the open-loop step response. Fine tuning then closes the loop, commands the controller to a new setpoint, and waits for a constant, limited oscillation of the process value to develop. The amplitude and period of that oscillation are the data the algorithm uses to refine Gain, TI, and TD for the actual closed-loop operating point.

The mechanical reasons a single fine tuning run takes 15 to 30 minutes are:

  1. Multiple oscillation cycles are required. The tuner needs at least 3 to 5 full periods of oscillation to reject noise and bias. If the loop time constant is several minutes (thermal, level, or slow pressure processes), each period is long, and 5 periods compound quickly.
  2. Output limits clamp the excitation. The output is intentionally limited to a small band around the steady-state value (the tuning range). Because the manipulated variable cannot move far, the loop may take a long time to push the process value across the noise band and begin oscillating.
  3. The output appears frozen for most of the run. The controller holds the manipulated variable at one rail of the tuning range while waiting for the process to integrate enough to cross the setpoint band. To an operator watching the HMI, the output looks stuck; the process value, however, is changing slowly. This is normal.
  4. No early termination. The PID_Compact V2 tuner will not declare the result valid until the oscillation meets amplitude, symmetry, and period stability criteria over the full window. Aborting the run discards the partial result and forces a fresh start.
If the process is so fast that pretuning completed in seconds, fine tuning typically completes in 2 to 5 minutes. The 20-minute figure is characteristic of processes with a dominant time constant of 1 to 4 minutes, which covers most HVAC, building, and thermal applications.

3. Prerequisites Before Starting Fine Tuning

Fine tuning cannot rescue a loop that pretuning could not identify. Confirm the following before launching the run:

  • Successful pretuning. The PID_Compact block must have valid Retain.CtrlParams.Gain, Retain.CtrlParams.TI, and Retain.CtrlParams.TD populated. If Config.StartupMode was used to skip pretuning, fine tuning has no starting point and the run will abort or produce unusable parameters.
  • Stable operating point. The process value must be within the configured setpoint range, with no active disturbance. For processes with large dead time (dead time > 0.3 × time constant), pretuning must be rerun from a fresh steady state.
  • Output wiring verified. The analog output module or PWM output driving the actuator is scaled correctly. The Output and Output_PWM tags from PID_Compact must be connected to the real I/O or to a tracing block, not to a constant.
  • Sampling time aligned. Config.CycleTime of the technology object should match the OB cycle (typically OB1 or a configured cyclic interrupt OB) in which the FB is called. A mismatch causes the tuner to misread the response rate.
  • Setpoint step prepared. Fine tuning is invoked with a setpoint step. Plan a step of 5 to 15 percent of the setpoint span, or move the setpoint to a representative production value before starting.

4. PID_Compact V2 Configuration Parameters That Affect Tuning

The following parameters on the technology object configuration dialog directly influence the fine tuning run. They are read from the configuration view in TIA Portal under PID_Compact > Configuration > Controller Settings and I/O Options.

Parameter Path Effect on fine tuning
Config.InputScaling.UpperPointIn / LowerPointIn I/O Options > Input scaling Defines the engineering-unit span of the process value. Wrong scaling makes the tuner under- or over-react.
Config.InputScaling.UpperPointOut / LowerPointOut I/O Options > Input scaling Defines the percent span for the input. Must match the physical transducer range.
Config.OutputScaling.UpperPointOut / LowerPointOut I/O Options > Output scaling Clamps the manipulated variable. Fine tuning will not exceed these limits.
Retain.CtrlParams.Gain Controller Settings > Gain Starting proportional gain. Fine tuning will adjust this value.
Retain.CtrlParams.TI Controller Settings > Integral time Starting integral time. Set to 0.0 if the pretuning result is not trusted.
Retain.CtrlParams.TD Controller Settings > Derivative time Starting derivative time. Set to 0.0 for a PI-only loop.
Config.SetpointLimit.High / Low Setpoint limits The setpoint step used by the tuner must lie within these limits.
Config.OutputWarningLimit.High / Low Output warning limits Fine tuning will not push the output past these values; tighter limits slow the run.

5. Step-by-Step Fine Tuning Procedure

  1. Open the technology object in TIA Portal. In the project tree, expand PLC > Technology objects > PID_Compact_x and double-click Configuration.
  2. Verify the input and output scaling. Confirm Input scaling and Output scaling match the transducer and actuator. A common field error is leaving the default 0..100 scaling on a 4 to 20 mA transducer; the tuner will still run but the resulting Gain will be wrong by the scaling factor.
  3. Go online with the CPU. Establish a live connection to the S7-1200. Fine tuning is only available in online mode; the button is greyed out offline.
  4. Open the Commissioning dialog. From the toolbar, click Start commissioning (the green play icon with the loop). The commissioning panel opens with mode, setpoint, and current value readouts.
  5. Select Fine tuning as the mode. Do not select Pretuning; this run is the second-pass optimization. Confirm the radio button shows Fine tuning.
  6. Enter the target setpoint. Type the production setpoint the loop will track after commissioning. Fine tuning needs a meaningful step away from the current value (typically 5 to 15 percent of span).
  7. Click Start. The Retain.CtrlParams.TuningState transitions to 2 (fine tuning in progress). The status word in the technology object tag table reflects this transition.
  8. Monitor Input, Output, and Setpoint. Watch the process value drift toward the new setpoint, overshoot, and oscillate. The Output tag will hold near a clamp for most of the run; that is normal. The commissioning chart in TIA Portal plots both curves and is the preferred visualization.
  9. Wait for completion. Retain.CtrlParams.TuningState returns to 0 (inactive) and the new Gain, TI, TD are written into the retain area. Do not power-cycle the CPU during the run; the parameters are not persisted until the run finishes.
  10. Download the project to the CPU. After successful fine tuning, download the project to make the new parameters the startup values for the next cold start.
If the commissioning dialog reports Fine tuning was not successful, do not accept the partial parameters. Re-run pretuning from a known steady state, then re-launch fine tuning. The PID_Compact V2 documentation explicitly states that partial results may be loaded into the retain area but are not guaranteed to be stable.

6. Verifying the Tuned Parameters

After fine tuning completes, validate the result with the following checks before releasing the loop to production:

  • Read the resulting parameters. From the technology object under Commissioning > Controller parameters, record the final Gain, TI, and TD. For reference, well-tuned thermal loops on S7-1200 typically land at Gain = 0.3 to 3.0 (dimensionless, depending on scaling), TI = 30 to 300 seconds, and TD = 0 seconds (PI-only) for processes with little noise.
  • Issue a setpoint step and observe. Force the controller to automatic (Config.ActivateManualMode = FALSE) and apply a 10 percent setpoint step in the opposite direction of the tuning step. The closed-loop response should rise with one small overshoot (5 to 15 percent) and settle within 3 to 5 time constants.
  • Check the integral component for windup. If the loop saturates the output for long periods, verify that Config.IntegralActionMode is set to 1 (anti-windup active) and that the output warning limits match the actuator stroke.
  • Confirm the derivative component is useful. For noisy processes (flow, certain pressures), TD is often left at 0.0. The PID_Compact V2 block exposes the P, I, and D contributions individually on the Retain.CtrlParams structure; compare the D contribution to the noise floor of the process value.
  • Back up the project. A fine tuning result represents hours of work; commit the project to the TIA Portal source archive and, if used, to the team server.

7. When to Skip Fine Tuning and Tune Manually

There are three situations in which the automatic fine tuner cannot be relied on and a manual approach is faster:

  1. Process has multiple time constants separated by an order of magnitude. The PID_Compact tuner assumes a single dominant pole; cascades or strongly interacting loops will be misidentified.
  2. Loop has hard nonlinearities. Valve dead band, pH titration, and on/off heating stages violate the linear assumption the tuner relies on. Apply gain scheduling via PID_Compact in three-step mode or switch to PID_Temp with the autotuner variant.
  3. Process cannot tolerate the tuning oscillation. Some product-quality or safety constraints prohibit the controlled oscillation that fine tuning requires. In that case, run pretuning only, halve the resulting Gain, and tune TI manually from the step response.

For manual tuning, the field-proven sequence is:

  1. Set TI to its maximum value (99999 seconds) and TD to 0.0; this gives a P-only controller.
  2. Increase Gain from 0.1 in steps of 0.2 until the loop reaches the boundary of sustained oscillation.
  3. Reduce Gain by half (this is the Ziegler-Nichols ultimate-gain value).
  4. Set TI to roughly 0.8 × the measured oscillation period.
  5. Set TD to 0.1 to 0.2 × TI if derivative action is required.

8. Troubleshooting Matrix for Fine Tuning

Symptom Likely cause Corrective action
Tuning runs for > 30 minutes with no output change Loop is at steady state and the output is on a clamp; process integrates too slowly Reduce OutputWarningLimit band to free the output to move; or accept that the process is too slow for the default tuning window
Tuning aborts with Process value out of range Setpoint step pushed the input above InputScaling.UpperPointIn Reduce step size or expand input scaling to cover the new operating point
Tuning aborts with Oscillation amplitude too small Output limits are too tight, or process is overdamped Widen OutputWarningLimit by 10 to 20 percent; rerun pretuning first
Resulting Gain is extremely high (> 10) Input scaling inverted or output scaling inverted relative to process Verify Input scaling and Output scaling match physical signal direction (e.g., 4 mA = 0 percent, 20 mA = 100 percent)
Resulting TI is 0 or near 0 Tuner treated the loop as integrating; need to constrain Force Retain.CtrlParams.TI to a minimum of 20 seconds before fine tuning, then re-run
Parameters loaded but loop oscillates continuously TD too high relative to noise, or Gain still too aggressive Halve Gain; set TD to 0; rerun pretuning if process conditions changed
Tuning button greyed out Not online, or technology object not downloaded to CPU Go online and download the project to the CPU; restart the commissioning dialog

9. PID_Compact Block Interface Reference

The most relevant tags on the PID_Compact FB instance for monitoring and verifying fine tuning are listed below. All tags are accessible from the technology object tag table or by dragging the FB into a watch table.

Tag Direction Data type Meaning during fine tuning
Input Input REAL Process value from transducer; watch this for the oscillation
Setpoint Input REAL Current setpoint; step is commanded via commissioning dialog
Output Output REAL Manipulated variable (percent); expected to hold near a clamp
Output_PWM Output BOOL PWM output for digital actuators; check duty cycle range
Retain.CtrlParams.Gain Static (retain) REAL Resulting proportional gain
Retain.CtrlParams.TI Static (retain) REAL Resulting integral time in seconds
Retain.CtrlParams.TD Static (retain) REAL Resulting derivative time in seconds
Retain.CtrlParams.TuningState Static (retain) INT 0 = idle, 1 = pretuning, 2 = fine tuning
Config.ActivateManualMode Input BOOL Set to FALSE to release automatic control
ManualEnable Input BOOL Permits operator to drive ManualValue during commissioning
ManualValue Input REAL Manual output value, percent

10. Related Documentation and Tools

For deeper context, the following Siemens resources are the primary references for S7-1200 and S7-1500 PID commissioning:

11. Field-Proven Caveats

  • Always commission in automatic, never manual. Manual mode disables the tuner. The ManualEnable bit is held low during fine tuning even if the operator requests it.
  • Output limits and warning limits are different. The Output clamp at OutputScaling.UpperPointOut / LowerPointOut is hardware-final; the OutputWarningLimit is a tuning constraint. Tightening the warning limit slows tuning, not speeds it up.
  • Fine tuning assumes the actuator is reversible. For a heating-only or cooling-only process, set the unused output range to the active range (e.g., heating-only sets 0 to 100 percent to correspond to the heating stroke). The PID_Compact V2 block has no integral-dead-band logic; if the actuator is not reversible, retune manually.
  • Reset behavior on CPU restart. The tuned parameters live in Retain and survive a power cycle. The project parameters, however, are loaded only on a project download. A re-download of an older project after a successful tuning will overwrite the tuned values.
  • V14 specifics. In TIA Portal V14, the commissioning dialog has a slightly different layout than V17+. The labels are Mode, Setpoint, and Start; selecting Fine tuning in V14 launches the same V2 algorithm as later releases.

FAQ

Why does fine tuning on my S7-1200 take about 20 minutes and the output barely changes?

Fine tuning intentionally drives a small, limited oscillation around the setpoint to measure amplitude and period; the output sits near a clamp for most of the run waiting for the process value to integrate across the noise band. For processes with a dominant time constant of 1 to 4 minutes, 3 to 5 oscillation periods add up to roughly 15 to 30 minutes. This is normal, not a fault.

Can I speed up the fine tuning process on PID_Compact?

No. The PID_Compact V2 tuner requires multiple full periods of stable oscillation before it accepts the result. Aborting the run discards the partial parameters. To reduce the time, use a process with a faster natural period, or accept pretuning only and perform a manual Ziegler-Nichols final pass.

What is the difference between pretuning and fine tuning on the S7-1200 PID_Compact block?

Pretuning injects an open-loop step at the operating point and fits a first-order-plus-dead-time model from the step response. Fine tuning closes the loop, applies a setpoint step, and refines Gain, TI, and TD for the actual closed-loop operating point using a controlled oscillation. Always run pretuning first; fine tuning is the second-pass optimization.

Which TIA Portal version do I need to fine tune PID_Compact on the S7-1200?

TIA Portal V14 SP1 or higher supports PID_Compact V2 and the fine tuning dialog. The same dialog and behavior are retained through V15, V16, V17, V18, V19, V20, and V21. Online mode with the project downloaded to the CPU is required.

What should I do if fine tuning aborts with an error in the commissioning dialog?

Do not accept any partial parameters. Re-run pretuning from a confirmed steady state, expand the input and output scaling if the setpoint step was rejected, and re-launch fine tuning. The PID_Compact V2 documentation explicitly states that aborted runs may leave inconsistent values in the retain area and the loop should not be released to production until a clean completion is recorded.

Back to blog