Resolving Siemens FB41 CONT_C Oscillation in Flow Control PID

David Krause15 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

1. Problem Overview

Engineers integrating the Siemens FB41 CONT_C continuous PID controller into flow control applications on SIMATIC S7-300 and S7-400 systems frequently encounter a closed-loop behavior where the manipulated variable LMN overshoots the setpoint, oscillates, and produces visible valve hunting. The process variable (PV) climbs past the setpoint (SP), LMN reverses sharply, and the loop never stabilizes. This article documents the field-proven resolution path: synchronize the FB41 CYCLE parameter to the OB35 scan time, retune the loop with a structured method, and stabilize step setpoint changes with a ramp function generator.

The pattern reported in field cases is consistent: a slow CYCLE parameter (for example 10 s) declared against an OB35 interrupt of 100 ms, an oversized derivative component, and step setpoint transitions. Each condition amplifies the others, producing the characteristic sawtooth on LMN shown below.

Affected firmware/platform: SIMATIC Manager STEP 7 V5.5 with FB41 (CONT_C) from the Standard Library, "PID Control" blockset. Symptoms are platform-independent and apply equally to S7-300 (CPU 315/317/319) and S7-400 (CPU 412/414/416/417) deployments using the legacy blockset.

2. Affected System Configuration

The reported reference configuration illustrates the failure mode:

Parameter Reported Value Recommended Range
CPU platform S7-300 / S7-400 S7-300 CPU 31x, S7-400 CPU 41x
Engineering tool SIMATIC Manager STEP 7 V5.5 STEP 7 V5.5 or V5.6
PID block FB41 CONT_C FB41 from "Standard Library > PID Control Blocks"
Block call location FC called from OB1 Direct call in OB35 (preferred)
OB35 cycle time 100 ms 100 ms – 1 s (process-dependent)
FB41 CYCLE parameter 10 s Must equal OB35 interval
GAIN 0.001 Re-derive from open-loop step test
TI (integral time) 20 s Per Ziegler-Nichols or Lambda tuning
TD (derivative time) 10 s Often 0 for flow loops (PI only)
TM_LAG 2 s TD/5 to TD/10 typical
Process Flow control valve Self-regulating, fast

The single largest defect is the 10 s value assigned to the FB41 CYCLE input while OB35 runs at 100 ms. This 100× mismatch causes FB41 to internally integrate error and re-compute LMN on a 10 s cadence even though the I/O update happens 100× faster. The result is a controller that reacts 10 seconds late to every disturbance, then applies a correction sized for a 10 s interval — producing classic limit-cycle oscillation.

3. Root Cause Analysis

Three root causes typically compound in this scenario. Each must be addressed to obtain a stable loop.

3.1 CYCLE / OB35 Mismatch

FB41 uses the CYCLE input as its internal sample time for the discrete-time approximation of the PID transfer function. The Siemens documentation in the STEP 7 Standard Library specifies that CYCLE must equal the time between successive calls of FB41. When OB35 runs at 100 ms but CYCLE is loaded with 10 s, the block applies a digital filter (the TM_LAG PT1 element) tuned for a 10 s horizon. Every 100 ms, new PV_IN samples arrive but only every 10th sample produces a meaningful LMN change — and that change is sized for a 10 s plant update, not a 100 ms one. The loop oscillates at roughly the closed-loop time constant of the plant.

3.2 Improper Gain for Flow Process

A flow control valve with associated piping has a fast, self-regulating response — typically 1 to 5 seconds from LMN step to PV steady-state. A GAIN of 0.001 is more appropriate for a slow integrating process (level, temperature) than for flow. Combined with a 10 s CYCLE, the controller cannot deliver proportional authority fast enough; it tries to compensate by oscillating.

3.3 Step Setpoint and Aggressive Derivative

Step setpoint changes excite the D-channel. With TD = 10 s applied to a step error, FB41 produces a derivative kick on every SP transition. If TM_LAG is too small relative to TD, the D-channel passes high-frequency noise directly to LMN. The reported TM_LAG/TD = 0.2 ratio is below the conservative guideline of TM_LAG = TD/5 to TD/10.

Closed-loop response: SP, PV, LMN vs. time (qualitative) LMN% time LMN PV SP

The diagram above shows the qualitative behavior of the reported fault: SP step, LMN riding at one boundary then the other while PV swings past SP and back — characteristic hunting.

4. PID Cycle Time Parameter and OB35 Synchronization

The CYCLE input of FB41 is declared as TIME (S5TIME-compatible). The STEP 7 Standard Library documentation for FB41 specifies that CYCLE must be identical to the time between two successive calls of FB41. The block internally uses it to advance the discrete-time integrator and the D-channel low-pass filter.

Recommended implementation:

  1. Call FB41 directly in OB35 (cyclic interrupt), not in an FC called from OB1.
  2. Configure OB35 with a cycle time appropriate to the process dynamics. For flow control on a fast actuator, 100 ms is a defensible default.
  3. Pass the OB35 interval symbolically to FB41 using the same tag — for example, a constant or a shared data block tag — so that a future OB35 retiming automatically propagates to CYCLE.

Example call wiring in OB35:

CALL FB41, DB41
SP_INT  := MD100        // internal setpoint 0–100%
PV_IN   := MD104        // process value 0–100% (scaled from flow)
MAN     := 0.0          // manual value (set to 0 in auto)
GAIN    := 0.4          // proportional gain (retune)
TI      := T#5s         // integral time
TD      := T#0s         // derivative disabled for flow
TM_LAG  := T#1s         // D-channel lag filter
DEADB_W := 0.0          // dead band width
LMN_HLM := 100.0        // output high limit
LMN_LLM := 0.0          // output low limit
PV_FAC  := 1.0
PV_OFF  := 0.0
LMN_FAC := 1.0
LMN_OFF := 0.0
I_ITL_ON:= FALSE
I_ITLVAL:= 0.0
DISV    := 0.0
LMN     := MD110        // manipulated variable output
LMN_PER := PQW272       // analog output to valve positioner
Note on I_ITL_ON: Setting this to TRUE on first scan forces LMN to I_ITLVAL and resets the integrator — useful for bumpless startup when the valve was held in manual. Avoid using this to mask an oscillating loop; it will reset on every download, masking the issue during commissioning only.

5. FB41 CONT_C Parameter Reference

FB41 exposes the following primary inputs. Engineers should review each against the actual process, not leave defaults.

Parameter Type Meaning Flow-loop Guidance
SP_INT REAL Internal setpoint (% of PV scale) 0–100
PV_IN REAL Process value input (% of PV scale) From analog input or scaled INT
MAN REAL Manual value in manual mode Set last good LMN before switching
GAIN REAL Proportional gain 0.1 – 2.0 typical for flow
TI TIME Integral (reset) time 2 – 20 s typical
TD TIME Derivative time T#0s (PI) for most flow loops
TM_LAG TIME Time lag of derivative channel TD/5 to TD/10; irrelevant if TD=0
DEADB_W REAL Dead band width on error 1–2% of PV span for noisy flow
LMN_HLM / LMN_LLM REAL Output limits 0 / 100 (% to positioner)
CYCLE TIME Block sample time Must equal OB35 interval
I_ITL_ON / I_ITLVAL BOOL/REAL Initialization on/off and value TRUE / last LMN for bumpless start

The full parameter set is documented in the STEP 7 Standard Library reference "PID Control Blocks" — see the Siemens Industry Online Support portal for FB41 manual pages.

6. Tuning Procedure for Flow Loops

Flow loops are fast, self-regulating, and low-order — typically first-order plus dead time. They respond well to PI control without derivative. Two structured methods are appropriate.

6.1 Open-Loop Step Test (Recommended)

  1. Place the controller in manual mode.
  2. Drive the valve to a steady operating point and record PV.
  3. Apply a step change in MAN (typically 5–10% of span) and record PV over time until it stabilizes.
  4. Compute process gain Kp = ΔPV / ΔLMN, dead time L, and time constant T from the recorded curve.
  5. Apply Lambda tuning rules for self-regulating processes:
GAIN = T / (Kp * (L + T_lambda))
TI   = T
TD   = 0

where T_lambda is the desired closed-loop time constant — typically set to 1–3× L for a robust flow loop.

6.2 Ziegler-Nichols Ultimate Gain Method

When the open-loop test is impractical:

  1. With TI = T#0s and TD = T#0s, increase GAIN until the loop sustains a stable oscillation.
  2. Record ultimate gain Ku and ultimate period Tu.
  3. Apply PI tuning values:
GAIN = 0.45 * Ku
TI   = Tu / 1.2
TD   = 0
Process safety: Use the ultimate-gain method only when the controlled variable can be allowed to oscillate without exceeding safe limits. In flow control on a closed loop, a sustained oscillation is typically acceptable; in level or temperature control it may not be.

6.3 Empirical Starting Point

For a fast flow loop on a properly tuned positioner, a defensible starting point is GAIN = 0.3–0.6, TI = 3–8 s, TD = 0. Iterate by halving TI if recovery is sluggish, or doubling it if the loop oscillates after a setpoint change.

7. Implementing a Setpoint Ramp Generator

Step setpoint changes excite the integrator and D-channel unnecessarily. A ramp function generator placed between the operator's SP and FB41's SP_INT removes the high-frequency component and dramatically reduces overshoot.

A minimal ramp generator inside a STEP 7 FB or FC, called every OB35 tick:

FUNCTION_BLOCK FB_RampGen
VAR
    SP_target  : REAL;
    SP_current : REAL;
    ramp_rate  : REAL;  // %/s
    t_last     : TIME;
END_VAR
BEGIN
    IF t_last = T#0s THEN
        SP_current := SP_target;
    ELSE
        IF SP_target > SP_current THEN
            SP_current := MIN(SP_current + ramp_rate * DINT_TO_REAL(TIME_TO_DINT(t_now - t_last)) / 1000.0, SP_target);
        ELSIF SP_target < SP_current THEN
            SP_current := MAX(SP_current - ramp_rate * DINT_TO_REAL(TIME_TO_DINT(t_now - t_last)) / 1000.0, SP_target);
        END_IF;
    END_IF;
    t_last := t_now;
END_FUNCTION_BLOCK

For a flow control valve, a typical ramp rate is 5–10% of span per second. Slower rates (1–2%/s) are appropriate for level or temperature loops.

8. D-Component Strategy: Feedback vs. Error

FB41's D-channel acts on the error (SP − PV). On a setpoint step, the derivative of the error includes a Dirac pulse at the step instant — the "derivative kick." In many practical flow loops this is the dominant source of LMN overshoot.

The recommended countermeasure is one of the following, in order of preference:

  1. Disable D-action (TD = T#0s) — appropriate for the majority of flow control loops. Flow loops are typically dominated by TM_LAG and noise; D-action rarely helps and frequently hurts.
  2. Apply D-action to PV only. FB41 does not provide this directly, but the same effect is achieved by routing the error through a low-pass filter that suppresses step transitions. A common implementation is to clamp SP_INT rate of change (Section 7) — without a step SP there is no derivative kick.
  3. Increase TM_LAG. With TM_LAG = TD/5 or larger, the D-channel behaves more like a first-order lag and suppresses high-frequency content including the step-induced kick.

The general principle, supported by industry tuning guidance: flow loops do not benefit from derivative action. The process is fast enough that proportional and integral terms alone produce stable regulation.

9. Step-by-Step Resolution Procedure

Use the following procedure to resolve the reported oscillation. The procedure assumes STEP 7 V5.5 and FB41 CONT_C, but the same logic applies to the S7-1200/1500 PID_Compact block with minor parameter renaming.

9.1 Prerequisites

  • Online connection to the CPU.
  • Operator authorization to place the loop in manual.
  • Trend recording capability (variable table / VAT or HMI archive) for SP, PV, LMN.

9.2 Procedure

  1. Record the current behavior. Open a VAT with SP, PV, and LMN. Trigger a setpoint step change of 10% and record for at least five minutes. Confirm the oscillation.
  2. Place the loop in manual. This isolates tuning from process response and prevents the controller from chasing itself.
  3. Fix the CYCLE parameter. Modify the call of FB41 so that CYCLE equals OB35's configured interval. If OB35 = 100 ms, set CYCLE := T#100ms. If OB35 = 1 s, set CYCLE := T#1s. Recompile and download.
  4. Move the FB41 call directly into OB35. Avoid FC in OB1 wrappers that execute at OB1 priority. The cyclic interrupt must be the sole execution path for FB41.
  5. Disable derivative action initially. Set TD := T#0s.
  6. Set conservative PI gains. Use GAIN := 0.3, TI := T#5s, TM_LAG := T#1s as the starting point.
  7. Switch to auto and apply a small step. Bring SP from current value to current value + 5%.
  8. Evaluate response. Goal: one overshoot of ≤ 10%, settling within 3–5 time constants, no sustained oscillation.
  9. Iterate. If sluggish: reduce TI by half. If oscillating: double TI; if oscillation persists, halve GAIN.
  10. Tune formally. Run the open-loop step test or Ziegler-Nichols procedure (Section 6) once the loop is roughly stable.
  11. Add setpoint ramp. Implement FB_RampGen or equivalent between operator SP and FB41 SP_INT. Configure ramp rate to 5–10%/s for flow.
  12. Consider D-action only if required. If the response shows residual high-frequency oscillation, add a small TD (≤ 1 s) with TM_LAG = TD/5.

10. Verification and Commissioning Checks

After applying the resolution, perform these checks before handing the loop back to operations:

Check Pass Criterion Method
OB35 cycle consistency CYCLE input equals OB35 configured time Cross-check OB35 properties vs FB41 instance DB
Single execution path FB41 is called only from OB35 Cross-reference in STEP 7 program structure
Setpoint step response Overshoot ≤ 10%, settling within 3 τ Trend VAT for 10 minutes after a 5% SP step
Disturbance rejection PV returns to SP within acceptable time after process upset Apply a downstream load change, observe recovery
Manual-to-auto transition No LMN bump on transition Switch modes with same SP and PV; record LMN
Valve actuator activity Valve position changes are within positioner specs Monitor positioner feedback vs LMN_PER
Process variable noise PV noise below DEADB_W threshold Trend PV at high resolution

Document the final tuned values, the open-loop step test results, and the commissioning observations in the project documentation. These values become the baseline for future maintenance.

11. Diagnostic and Troubleshooting Matrix

Use this matrix to diagnose oscillation behavior once the basic resolution is applied:

Symptom Likely Cause Remediation
Slow oscillation period (10–30 s) Integral action too aggressive (TI too small) Double TI
Fast oscillation period (0.5–2 s) Gain too high, valve/positioner bandwidth exceeded Halve GAIN
One-shot overshoot on SP step Setpoint rate too high, or D-kick Add setpoint ramp; set TD=0
LMN saturates at LMN_HLM / LMN_LLM Plant cannot deliver SP, integral windup Verify output limits match actuator; reduce TI
Oscillation grows over time Integral windup after sustained saturation Implement anti-windup; limit output
Valve chatters around steady state PV noise above dead band threshold; D-action amplifying noise Increase DEADB_W; disable D; filter PV
Loop stable in manual, oscillates in auto CYCLE mismatch or call rate wrong Verify FB41 is called only from OB35; CYCLE = OB35 interval
Response correct on slow SP change, oscillates on fast change D-kick on step; high GAIN Add setpoint ramp; reduce GAIN

12. Field Notes and Edge Cases

Several issues appear repeatedly in field reports that are worth documenting here:

12.1 Call Path Conflicts

FB41 must not be called from multiple OBs. A common mistake is to call FB41 from OB1 (each scan cycle) and from OB35 (each interrupt). The block's internal integrators advance at each call, producing unpredictable behavior. Use the CROSS_REF tool in STEP 7 to confirm FB41 is referenced exactly once.

12.2 I/O Update Synchronization

For S7-300, ensure the analog input module is configured to update faster than OB35. For S7-400, the same applies to the analog I/O. If the analog input update is 1 s and OB35 is 100 ms, FB41 will read the same PV sample 10 times. The PID still functions, but the effective sample time is 1 s, not 100 ms. Set CYCLE to match the analog I/O update, not the OB35 priority.

12.3 Bumpless Transfer from Manual to Auto

Set MAN := LMN (the last output) before switching to auto. Without this, the integrator initializes from the prior I_ITLVAL (default 0) and produces a step on transition. FB41 provides internal bumpless logic if MAN is wired to the prior LMN tag.

12.4 Positioner Stroke Time

If the valve positioner stroke time (full close to full open) is longer than 2× the closed-loop time constant, even a perfect PID will be unable to follow SP steps. In that case, the setpoint ramp rate must be sized to the positioner, not to the controller. A 5-second stroke on a 100 ms OB35 loop will still oscillate if SP changes faster than the actuator can follow.

12.5 Migration to S7-1200/1500

If migrating from S7-300/400 to S7-1200 (PID_Compact) or S7-1500 (PID_Compact / PID_3Step), the conceptual parameters map directly: GAIN → Gain, TI → Ti, TD → Td, TM_LAG → Tf (filter time constant), CYCLE → Sampling time of the OB (typically the cyclic interrupt that calls the block). The diagnosis logic in this article applies without modification.

13. References to Official Documentation

Engineers performing this work should consult the following official references:

Why does my FB41 oscillate even though OB35 runs every 100 ms?

The FB41 CYCLE input must equal the OB35 interval. A common error is configuring CYCLE = 10 s while OB35 = 100 ms — the block integrates error 100× slower than the I/O updates, producing late, oversized corrections and limit-cycle oscillation. Set CYCLE := T#100ms and call FB41 directly from OB35.

Is derivative action needed for flow control valves?

Rarely. Flow loops are fast and self-regulating, typically well-served by PI alone. Set TD := T#0s initially; only add a small derivative (≤ 1 s) with TM_LAG = TD/5 if a structured tuning procedure indicates it improves stability without amplifying PV noise.

What is the right starting GAIN and TI for a flow loop?

Without an open-loop step test, start at GAIN = 0.3–0.6, TI = 3–8 s, TD = 0. If response is sluggish, halve TI. If oscillation persists after a setpoint step, double TI then halve GAIN. Run a formal Ziegler-Nichols or Lambda tuning once the loop is roughly stable.

Should I use a setpoint ramp generator?

Yes for most flow applications. A ramp of 5–10%/s removes the derivative kick and integrator windup triggered by step SP changes, reducing overshoot substantially. The ramp rate must be slower than the positioner stroke time divided by the SP span.

How do I perform bumpless transfer from manual to auto on FB41?

Wire the MAN input to the last LMN value before switching, and let FB41's internal logic carry the integrator state. For first-scan initialization, set I_ITL_ON := TRUE on the first OB1 scan with I_ITLVAL := last good LMN to avoid an output bump on restart.

Back to blog