Automating Lead-Lag Pump Rotation Based on Lowest Operating Hours with CountOh and MinMaxAvg in PCS 7
To automate the rotation of multiple pumps (e.g. selecting the lead pump from a bank of 5) based on lowest operating hours in SIMATIC PCS 7, engineers combine the runtime tracking of CountOh with the mathematical selection power of the APL MinMaxAvg block. Each pump's running hours are converted to REAL format using the DW_R block or read directly from CountOh.Hours1. The five runtime signals are connected to inputs In01 through In05 of the MinMaxAvg block. MinMaxAvg automatically evaluates the lowest accumulated runtime, outputting the minimum value on pin Min and the specific pump number (1 to 5) on pin MinIdx. The MinIdx integer is fed into sequential start logic (or an SFC Type) to automatically start the pump with the fewest operating hours.
Table of Contents
- Executive Summary
- Architecture and Fundamental Mechanics
- Step-by-Step Implementation Procedure
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Executive Summary
In continuous process facilities, wastewater lift stations, and industrial cooling water circuits, multiple redundant pumps are installed in parallel to ensure process availability and balance equipment wear. Automation engineers frequently need to design an automated lead-lag rotation strategy where the controller evaluates five parallel pumps and automatically selects and starts the pump that has accumulated the least operational wear. Without specialized blocks, comparing five analog runtime values requires complex, error-prone cascades of binary comparators. This article outlines the optimal PCS 7 APL architecture combining CountOh runtime counters with the MinMaxAvg multi-channel analog selection block to achieve elegant, deterministic pump rotation.
Architecture and Fundamental Mechanics
APL Pump Wear Balancing Architecture: CountOh and MinMaxAvg Interface:
- Individual Pump Runtime Tracking via CountOh:
- Each pump motor block (e.g.
MotL) provides operational feedback (FbkRun) to an associatedCountOhblock. -
CountOhoutputs runtime in two primary formats:TotalTim(DWORD): Accumulated runtime in seconds (integer).Hours1(STRUCT: REAL + Byte): Accumulated runtime in hours with floating-point precision, including APL signal quality code (ST).
-
Multi-Channel Selection Mechanics via MinMaxAvg (FB1871):
- The
MinMaxAvgblock from the PCS 7 Advanced Process Library is engineered specifically for multi-channel analog evaluation, supporting up to 16 analog structural inputs (In01throughIn16). -
For every execution cycle,
MinMaxAvgevaluates all active, healthy inputs (filtering out bad quality codes perFeaturesettings) and computes:Min(STRUCT REAL): The absolute lowest value among active inputs.MinIdx(INT): The 1-based index number (1 to 16) corresponding to the input channel that possesses the lowest value.Max/MaxIdx: The highest runtime value and corresponding pump index.Avg: The mean operating hours across the active pump bank.
-
Equipment Availability Filtering:
- A critical operational requirement is ignoring pumps that are out of service, in maintenance, or faulted.
- If Pump 3 is locked out in Local mode or tripped on overload, its input to
MinMaxAvgmust be suppressed. This is accomplished by setting input connection parameterIn03En := FALSEonMinMaxAvg, ensuring the algorithm evaluates only available pumps.
Step-by-Step Implementation Procedure
-
Instantiate CountOh Counters for Each Pump:
* In your CFC charts, verify that each of the 5 pumps (Pump1toPump5) has a dedicatedCountOhinstance.
* ConnectMotL.FbkRunOut.Valueof each motor toCountOh.Tracking(orIn).
* Confirm that eachCountOhblock accumulates running hours inHours1. -
Instantiate and Configure MinMaxAvg in CFC:
* From the PCS 7 AP Library, drag and dropMinMaxAvg(FB1871) into your coordination chart.
* Name the block descriptively (e.g.Pump_Lead_Selector).
* Connect the runtime hours outputs from the 5 pumps toMinMaxAvg:Pump1_CountOh.Hours1->MinMaxAvg.In01Pump2_CountOh.Hours1->MinMaxAvg.In02Pump3_CountOh.Hours1->MinMaxAvg.In03Pump4_CountOh.Hours1->MinMaxAvg.In04Pump5_CountOh.Hours1->MinMaxAvg.In05
-
Implement Pump Availability Interlocks:
* For each pump, combine operational availability conditions: (Not Faulted AND Remote/Auto Mode AND Not E-Stopped).
* Connect the availability boolean to the corresponding channel enable pin onMinMaxAvg(In01EntoIn05En).
* When a pump is disabled,MinMaxAvgexcludes it from the comparison, preventing the system from attempting to start an unavailable pump. -
Decode MinIdx to Command Pump Start:
* Output pinMinMaxAvg.MinIdxoutputs an integer from 1 to 5 indicating which pump has the lowest runtime.
* RouteMinIdxinto a demultiplexer block (e.g.DemuxIntor custom SFC Type branching logic).
* When process conditions call for an additional pump (e.g. high sump level), the controller triggers the start command specifically toPump[MinIdx]. -
Compile and Test Dynamic Rotation:
* Compile CFC and download to the AS in RUN mode.
* In CFC test mode, simulate different running hours onPump1throughPump5.
* Verify thatMinIdxdynamically tracks the pump with the lowest hours, and updates immediately when a pump is marked unavailable.
Verification
Verify Lead Pump Selection and Runtime Balancing:
1. In CFC test mode, inspect MinMaxAvg.Min: verify that it matches the lowest numeric value among active pumps.
2. Confirm that MinMaxAvg.MinIdx correctly identifies the channel index of the lead pump.
3. Disable In01En (simulating Pump 1 tripping); verify that MinIdx immediately shifts to the next-lowest available pump.
4. In WinCC Runtime, observe automated pump staging; confirm that pumps rotate evenly over multi-day operational cycles.
Limitations and Operational Precautions
Operational Precautions and Chattering Prevention:
- Implement anti-hunting logic: Do not switch lead pump assignments dynamically while a pump is actively running; sample MinIdx only at the moment a start sequence is triggered, latching the selected pump until shutdown.
- Ensure that pumps have minimum run time and minimum rest time timers configured in MotL to prevent rapid cycling when running hours across pumps are nearly identical.
Engineer FAQ
What block finds the lowest running hours among multiple pumps in PCS 7?
The APL MinMaxAvg block (FB1871) compares up to 16 analog inputs, outputting the minimum value on Min and the channel index of that pump on MinIdx.
How do I exclude a pump that is in maintenance from selection?
De-energize the channel enable pin (e.g. setting In03En := FALSE) on MinMaxAvg. The block automatically excludes disabled channels from the minimum calculation.
Can I connect CountOh.TotalTim directly to MinMaxAvg?
TotalTim is a DWORD. It must be converted to REAL using DW_R, or you can directly connect CountOh.Hours1, which is already a structural REAL with quality code.
What happens if two pumps have identical running hours?
MinMaxAvg selects the first input channel encountered (e.g. selecting Channel 1 over Channel 2 if both have identical runtimes).
Can MinMaxAvg be used for lag pump stopping (stopping the highest hours pump)?
Yes. Pin MaxIdx identifies the pump with the highest accumulated runtime, allowing automated shedding of the most worn pump first during capacity reductions.
Technical References
- SIMATIC PCS 7 Advanced Process Library (APL) V9.0 Manual
- SIMATIC PCS 7 Compendium Part A - Configuration Guidelines
- Siemens Technical Support Entry ID: 109754967 - MinMaxAvg Block Functions
Related Articles
- Resetting Pump Operating Hours on CountOh via WinCC Faceplate - Preset Workaround and Logic Triggers
- Tracking Motor Operating Hours with CountOh and Exporting Shift Reports to Excel in PCS 7
- Implementing Complex Mathematical Algorithms in SIMATIC PCS 7 vs S7-1500 C++ and TIA ODK
- Configuring Operator Step Transitions and Step Control Modes in PCS 7 SFC Types (Auto vs Manual Constraints)
Related Tags
- CountOh
- MinMaxAvg
- Pump Rotation
- Lead-Lag
- Operating Hours
- APL
- CFC Logic
- PCS 7 V9.0