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
- Root Causes of Integration Undershoot and Discrepancies
- Comparison Table - TotalL TimeFactor Modes and Formulas
- Step-by-Step Configuration for Precision Flow Integration
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
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.
TimeFactor Value0122Step-by-Step Configuration for Precision Flow Integration
Follow this procedure to configure TotalL for precision flow accumulation in SIMATIC PCS 7:
-
Verify Task Placement and Sample Time in CFC:
* Open the CFC chart containingTotalL(FB 1906).
* Verify that the block is scheduled in OB35 (100 ms) or OB34 (200 ms).
* Confirm that parameterSampleTimehas the attributes7_sampletime = 'true'and displays the exact OB cycle time (e.g.,0.1). -
Configure
TimeFactorfor Hourly Flow:
* Locate the input parameterTimeFactor.
* For flow transmitters reporting in $ ext{m}^3 ext{/h}$, set:
TimeFactor = 2(Hours). -
Select Integration Algorithm (
Mode):
*TotalLsupports different integration algorithms via theModeparameter: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.
-
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/TimeTrigblock) to exact clock boundaries (e.g., minute00, second00).
* When the minute transition occurs, apply a single-scan pulse toRstLi.ValuewithRstLi.ST = 16#80. -
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:
- Simulate Static Flow Rate:
* In CFC Test Mode, apply a constant600.0to inputIn.Value(In.ST = 16#80). - 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 readOut.Value.
* Confirm thatOut.Valueequals exactly 10.00 m³ ($\pm 0.05\%$). - Verify WinCC Faceplate Display:
* Open the@PG_TotalL_Standard.pdlfaceplate 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. ConfigureLowLimCut(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 = FALSEto 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
- SIMATIC Process Control System PCS 7 Advanced Process Library (V8.1) Function Manual
- SIMATIC S7-400 Automation System System Software for S7-300/400 System and Standard Functions
- Siemens Industry Online Support Entry ID 109780813 (APL Signal Processing)
Related Articles
- Troubleshooting Timer Blocks Running Fast or Slow - S7_sampletime and Task Execution Cycles
- Managing Time Synchronization and Timestamping Batch Events in SIMATIC PCS 7
- Troubleshooting Spurious BAD Quality Values on Pcs7AnIn Channel Drivers Caused by MOD_D1
Related Tags
- TotalL
- Totalizer
- Flow-Integration
- TimeFactor
- APL
- CFC