Correcting Totalizer and Flow Integration Discrepancies in SIMATIC PCS 7 (TotalL)

Correcting Totalizer and Flow Integration Discrepancies in SIMATIC PCS 7 (TotalL)

In SIMATIC PCS 7, when an APL totalizer block (TotalL) outputs inaccurate flow totals (such as accumulating 9.6 m³ instead of the expected 10.0 m³ from a 600 m³/h flow over one minute), the discrepancy is caused by a mismatch in the TimeFactor parameter, numerical truncation from un-synchronized execution cycles, or asynchronous reset timing. Totalizer blocks perform discrete mathematical integration based on their execution cycle (SampleTime). To achieve exact totals, set TimeFactor = 2 (Hours) for flow rates measured in units per hour, ensure SampleTime matches the cyclic interrupt task via s7_sampletime = 'true', and synchronize totalizer reset pulses to exact clock boundaries.

Table of Contents

The Mathematics of Digital Integration in APL TotalL

In process automation plants, measuring accumulated liquid volume, steam consumption, and mass transfer requires integrating continuous analog flow measurements over time. In SIMATIC PCS 7, this function is performed by the Advanced Process Library (APL) TotalL block (FB 1906).

A common engineering problem arises during factory testing or loop simulation:
* An engineer inputs a constant simulated flow rate:
$$ ext{Flow Rate} = 600.0 ext{ m}^3 ext{/h}$$
* The totalizer is configured to reset every 1 minute ($60 ext{ seconds}$).
* Mathematically, the expected volume accumulated in 1 minute is:
$$ ext{Expected Total} = rac{600.0 ext{ m}^3 ext{/h}}{60 ext{ min/h}} = 10.0 ext{ m}^3$$
* However, upon inspecting the output Out, the block displays 9.6 m³—a substantial 4% calculation error!

This discrepancy is not a software bug in the Siemens library; it is the mathematical consequence of misaligned parameter time bases, execution jitter, and reset timing in digital systems.

Root Causes of Integration Undershoot and Discrepancies

Digital totalizers do not calculate continuous calculus integrals; they compute discrete Riemann sum approximations:
$$ ext{Out}{k} = ext{Out} } + \left( ext{In} imes rac{T_s}{T_{ ext{basis}}
ight)$$

Evaluating the 4% error reveals three key contributing factors:

1. The TimeFactor Parameter Configuration

The parameter TimeFactor informs the block of the physical time unit associated with the input flow rate:
* TimeFactor = 0: Flow rate in Units / Second ($T_{ ext{basis}} = 1.0 ext{ s}$).
* TimeFactor = 1: Flow rate in Units / Minute ($T_{ ext{basis}} = 60.0 ext{ s}$).
* TimeFactor = 2: Flow rate in Units / Hour ($T_{ ext{basis}} = 3600.0 ext{ s}$).
If an engineer leaves TimeFactor at default or misinterprets the scaling, the divisor produces incorrect totals.

2. Execution Jitter and SampleTime Mismatch

The variable $T_s$ (SampleTime) represents the execution period of the block (e.g., 0.1 s in OB35). If TotalL is placed in an organization block whose actual execution interval does not match SampleTime (e.g., due to missing s7_sampletime attributes or task scheduling delays), each integration step accumulates an erroneous slice of time.

3. Asynchronous Reset Pulse Timing

In the engineer's test, an external timer or CFC timer block was used to trigger the reset input (RstOp or RstLi) every minute.
* If the reset pulse triggers at 57.6 seconds instead of exactly 60.0 seconds (due to timer drift or scan time accumulation):
$$ ext{Accumulated Volume} = 600.0 imes rac{57.6}{3600} = 9.6 ext{ m}^3$$
The totalizer accurately measured the volume for 57.6 seconds; it was the reset timer that was running 4% fast!

Comparison Table - TotalL TimeFactor Modes and Formulas

The following table details the operational modes of TotalL based on input engineering units.

Input Flow Rate Engineering UnitsRequired TimeFactor ValueInternal Time Base ($T_{ ext{basis}}$)Integration Formula per ScanLiters / Second (l/s)01.0 second$ ext{Out} = ext{Out} + ( ext{In} imes T_s)$Gallons / Minute (GPM)160.0 seconds$ ext{Out} = ext{Out} + \left( ext{In} imes rac{T_s}{60}ight)$Cubic Meters / Hour (m³/h)23600.0 seconds$ ext{Out} = ext{Out} + \left( ext{In} imes rac{T_s}{3600}ight)$Kilograms / Hour (kg/h)23600.0 seconds$ ext{Out} = ext{Out} + \left( ext{In} imes rac{T_s}{3600}ight)$

Step-by-Step Configuration for Precision Flow Integration

Follow this procedure to configure TotalL for precision flow accumulation in SIMATIC PCS 7:

  1. Verify Task Placement and Sample Time in CFC:
    * Open the CFC chart containing TotalL (FB 1906).
    * Verify that the block is scheduled in OB35 (100 ms) or OB34 (200 ms).
    * Confirm that parameter SampleTime has the attribute s7_sampletime = 'true' and displays the exact OB cycle time (e.g., 0.1).

  2. Configure TimeFactor for Hourly Flow:
    * Locate the input parameter TimeFactor.
    * For flow transmitters reporting in $ ext{m}^3 ext{/h}$, set:
    TimeFactor = 2 (Hours).

  3. Select Integration Algorithm (Mode):
    * TotalL supports different integration algorithms via the Mode parameter:

    • Mode = 1: Rectangular integration (Euler backward).
    • Mode = 2: Trapezoidal integration (Tustin / Bilinear).
    • For fluctuating flows, set Mode = 2 (Trapezoidal), which averages the current and previous flow samples, significantly reducing discretization error.
  4. Synchronize Reset Pulses to CPU Real-Time Clock:
    * Never use a free-running CFC timer to trigger periodic totalizer resets, as software timers accumulate scan jitter.
    * To trigger hourly or daily resets, compare the CPU system clock (SFC 1 / TimeTrig block) to exact clock boundaries (e.g., minute 00, second 00).
    * When the minute transition occurs, apply a single-scan pulse to RstLi.Value with RstLi.ST = 16#80.

  5. Compile and Download:
    * Compile CFC charts with Scope: Changes only and download to the CPU in RUN mode.

Verification

Confirm mathematical precision using simulated test flow:

  1. Simulate Static Flow Rate:
    * In CFC Test Mode, apply a constant 600.0 to input In.Value (In.ST = 16#80).
  2. Execute 60-Second Timed Test:
    * Reset the totalizer (RstOp = 1).
    * Start a calibrated stopwatch at the exact moment reset releases.
    * At exactly 60.0 seconds, freeze the totalizer or read Out.Value.
    * Confirm that Out.Value equals exactly 10.00 m³ ($\pm 0.05\%$).
  3. Verify WinCC Faceplate Display:
    * Open the @PG_TotalL_Standard.pdl faceplate in WinCC.
    * Confirm that current batch totals and totalized historical values display with correct engineering units and decimal precision.

Limitations and Operational Precautions

  • Low Flow Cutoff (LowLimCut): When pumps stop, physical flow transmitters often flutter around zero (e.g., $0.05 ext{ m}^3 ext{/h}$), causing the totalizer to slowly creep upward over days. Configure LowLimCut (e.g., $1.0 ext{ m}^3 ext{/h}$) so that any measurement below this threshold is treated as absolute zero.
  • Negative Flow Rejection: For unidirectional lines, set NegFlowEn = FALSE to prevent reverse flow or sensor noise from subtracting from cumulative production totals.
  • Floating-Point Mantissa Truncation: Over months of continuous accumulation, adding tiny numbers ($0.001$) to an enormous total ($100,000.0$) in a standard 32-bit REAL variable causes truncation. Use periodic resets or dual-word double-precision totalizers for multi-year tracking.

Engineer FAQ

Why did my simulation output 9.6 instead of 10.0?

The 4% error ($9.6 / 10.0$) corresponds exactly to a 2.4-second timing error ($57.6 ext{ s} / 60.0 ext{ s}$). Your reset timer was triggering prematurely, or the block's SampleTime was calculating based on an inaccurate scan cycle.

Can TotalL store separate totals for Daily, Monthly, and Annual production?

Yes. In CFC, multiple TotalL blocks can be fed from the same flow transmitter, with each block assigned an independent reset schedule (e.g., Block 1 reset hourly, Block 2 reset daily at midnight, Block 3 reset on the 1st of each month).

Does TotalL support mass flow integration?

Yes. TotalL integrates any physical engineering quantity over time (volume, mass, kilowatt-hours, heat energy) as long as TimeFactor matches the time base of the flow rate.

What happens to the totalizer during CPU power loss?

In S7-400 and CPU 410-5H controllers, the accumulated value in the instance data block is retained in battery-backed non-volatile RAM, resuming from the exact pre-outage value upon warm restart.

Technical References

Related Articles

Related Tags

  • TotalL
  • Totalizer
  • Flow-Integration
  • TimeFactor
  • APL
  • CFC
6 respuestas