PeristalticFlow Class

Overview

The PeristalticFlow class implements a comprehensive peristaltic pump model for precise fluid metering and transport applications. This model is essential for applications requiring accurate, pulsation-free fluid delivery with excellent chemical compatibility.

PeristalticFlow Analysis Plots

Class Description

The PeristalticFlow class provides accurate modeling of peristaltic pump performance, including flow rate prediction, pulsation analysis, and backpressure effects. The model accounts for tube compression mechanics, pump speed relationships, and pulsation damping characteristics.

Key Features

  • Precise Flow Control: Linear relationship between pump speed and flow rate

  • Pulsation Analysis: Modeling of flow pulsation and damping effects

  • Backpressure Compensation: Pressure-dependent flow rate corrections

  • Tube Wear Modeling: Degradation effects on occlusion and performance

  • Chemical Compatibility: No contact between fluid and pump mechanism

Mathematical Model

The peristaltic pump model is based on positive displacement principles:

Theoretical Flow Rate:

\[Q_{th} = \frac{N}{60} \cdot A_{tube} \cdot \varepsilon_{occ} \cdot \varepsilon_{level}\]

Where: - \(Q_{th}\) = theoretical flow rate (m³/s) - \(N\) = pump speed (RPM) - \(A_{tube}\) = tube cross-sectional area (m²) - \(\varepsilon_{occ}\) = occlusion factor (-) - \(\varepsilon_{level}\) = occlusion level (-)

Backpressure Correction:

\[f_{pressure} = \max(0.1, 1.0 - \frac{P_{in}}{10^6})\]

Actual Flow Rate:

\[Q_{actual} = Q_{th} \cdot f_{pressure}\]

Pulsation Dynamics:

\[\frac{d\psi}{dt} = \frac{\psi_{target} - \psi}{\tau_{pulsation}}\]

Where \(\psi\) is the pulsation amplitude and \(\tau_{pulsation}\) is the damping time constant.

Constructor Parameters

PeristalticFlow(
    tube_diameter=0.01,          # Tube inner diameter [m]
    tube_length=1.0,             # Tube length [m]
    pump_speed=100.0,            # Pump speed [rpm]
    occlusion_factor=0.9,        # Tube occlusion factor [-]
    fluid_density=1000.0,        # Fluid density [kg/m³]
    fluid_viscosity=1e-3,        # Fluid viscosity [Pa·s]
    pulsation_damping=0.8,       # Pulsation damping factor [-]
    name="PeristalticFlow"
)

Methods

steady_state(u)

Calculate steady-state flow rate and pressure for given pump conditions.

Input: u = [P_inlet, pump_speed_setpoint, occlusion_level]

Output: [flow_rate, P_outlet]

dynamics(t, x, u)

Calculate dynamic derivatives for flow rate and pulsation amplitude.

Input: - t: time (s) - x: state vector [flow_rate, pulsation_amplitude] - u: input vector [P_inlet, pump_speed_setpoint, occlusion_level]

Output: [dflow_rate/dt, dpulsation/dt]

describe()

Returns comprehensive metadata about the peristaltic pump model including performance characteristics and applications.

Usage Examples

Pharmaceutical Dosing System

#!/usr/bin/env python3
"""
PeristalticFlow Example Usage - Comprehensive Demonstration

This example demonstrates the capabilities of the PeristalticFlow class for modeling
peristaltic pump systems. It covers dosing accuracy, pulsation analysis, calibration,
and control system applications.

Based on: PeristalticFlow_documentation.md
"""

import numpy as np
import matplotlib.pyplot as plt
import sys
import os

# Add the directory to Python path for imports
sys.path.append(os.path.dirname(os.path.abspath(__file__)))

try:
    from PeristalticFlow import PeristalticFlow
except ImportError:
    print("Error: Could not import PeristalticFlow. Make sure PeristalticFlow.py is in the current directory.")
    sys.exit(1)

def example_1_pharmaceutical_dosing():
    """
    Example 1: Pharmaceutical dosing system for drug manufacturing
    
    Scenario: Precise dosing of active pharmaceutical ingredient (API)
    - High accuracy requirement (±1%)
    - Low flow rates (mL/min range)
    - Sterile fluid path
    """
    print("=" * 60)
    print("EXAMPLE 1: Pharmaceutical API Dosing System")
    print("=" * 60)
    
    # Create peristaltic pump for pharmaceutical dosing
    api_pump = PeristalticFlow(
        tube_diameter=0.003,        # 3 mm ID tubing (small for precision)
        tube_length=0.25,           # 25 cm in pump head
        pump_speed=50.0,            # 50 RPM (moderate speed)
        occlusion_factor=0.95,      # 95% compression (excellent seal)
        fluid_density=1050.0,       # API solution density
        fluid_viscosity=1.5e-3,     # Slightly viscous solution
        pulsation_damping=0.9,      # High damping (compliance chamber)
        name="PharmaceuticalDosingPump"
    )
    
    # Display model information
    print("\nPump Configuration:")
    info = api_pump.describe()
    print(f"Application: {info['typical_applications'][0]}")
    print(f"Tube Diameter: {api_pump.tube_diameter*1000:.1f} mm")
    print(f"Occlusion Factor: {api_pump.occlusion_factor*100:.1f}%")
    print(f"Pulsation Damping: {api_pump.pulsation_damping*100:.1f}%")
    
    # Calibration curve generation
    speeds = np.array([10, 20, 30, 50, 80, 100, 150, 200])  # RPM
    
    print("\nCalibration Curve:")
    print("Speed | Flow Rate | Accuracy | Pulsation | Chamber")
    print("(RPM) | (mL/min)  | (%)      | (%)       | Vol(uL)")
    print("-" * 55)
    
    calibration_data = []
    for speed in speeds:
        # steady_state expects [P_inlet, pump_speed, occlusion_level]
        inputs = np.array([101325.0, speed, 1.0])  # Atmospheric pressure, speed, full occlusion
        result = api_pump.steady_state(inputs)
        
        flow_rate = result[0]  # m³/s
        p_outlet = result[1]   # Pa
        
        flow_ml_min = flow_rate * 60 * 1e6  # Convert to mL/min
        # Calculate simple metrics for display
        efficiency = min(95.0, 90.0 + speed/100.0)  # Simple efficiency model
        pulsation = max(1.0, 10.0 - api_pump.pulsation_damping * 10)  # Pulsation based on damping
        chamber_ul = (flow_rate / speed) * 1e9 if speed > 0 else 0  # Stroke volume estimate
        
        print(f"{speed:5.0f} | {flow_ml_min:8.2f}  | {efficiency:7.1f}  | {pulsation:8.1f}  | {chamber_ul:6.1f}")
        
        calibration_data.append({
            'speed': speed,
            'flow_rate': flow_rate,
            'flow_ml_min': flow_ml_min,
            'efficiency': efficiency,
            'pulsation': pulsation
        })
    
    # Dosing precision analysis
    target_dose = 5.0  # mL/min target
    best_match = min(calibration_data, key=lambda x: abs(x['flow_ml_min'] - target_dose))
    
    print(f"\nDosing Analysis for {target_dose} mL/min:")
    print(f"Optimal Speed: {best_match['speed']:.0f} RPM")
    print(f"Actual Flow: {best_match['flow_ml_min']:.3f} mL/min")
    print(f"Dosing Error: {abs(best_match['flow_ml_min'] - target_dose)/target_dose*100:.2f}%")
    print(f"Pulsation: ±{best_match['pulsation']:.1f}%")

The comprehensive example suite demonstrates:

  • Pharmaceutical API Dosing: Precision dosing for drug manufacturing

  • HPLC Mobile Phase Delivery: Analytical instrument applications

  • Pulsation Analysis: Time-domain flow pulsation characterization

  • Tube Wear Prediction: Maintenance scheduling and replacement analysis

Example Output

Key output sections include:

  • Calibration curves for speed vs flow rate relationships

  • Dosing precision analysis with accuracy calculations

  • HPLC stability assessment for analytical applications

  • Pulsation frequency spectrum analysis

  • Tube degradation modeling and maintenance scheduling

Applications

The PeristalticFlow class is extensively used in:

  • Pharmaceutical Manufacturing: API dosing and drug formulation

  • Analytical Instrumentation: HPLC, GC, and spectroscopy applications

  • Medical Devices: Dialysis machines and infusion pumps

  • Chemical Dosing: Water treatment and chemical injection systems

  • Food & Beverage: Flavor dosing and additive injection

Performance Characteristics

  • Flow Accuracy: Typically ±1-3% of full scale

  • Pressure Capability: Up to 1 MPa (10 bar) backpressure

  • Turndown Ratio: 1000:1 (excellent low-flow capability)

  • Repeatability: ±0.5% for dosing applications

  • Chemical Compatibility: PTFE, silicone, and specialty tube materials

Visualization

The example generates comprehensive visualization including:

  1. Speed-Flow Calibration: Linear relationship validation

  2. Pulsation Analysis: Frequency domain characterization

  3. Tube Wear Progression: Performance degradation over time

  4. Application Comparison: Different tube sizes and configurations

  5. Operating Envelope: Safe operating limits and guidelines

Comprehensive PeristalticFlow Analysis Detailed Pulsation and Maintenance Analysis

Advantages and Limitations

Advantages:

  • No valves or seals in contact with fluid

  • Self-priming operation

  • Excellent chemical compatibility

  • Precise flow control

  • Easy maintenance (tube replacement only)

Limitations:

  • Inherent flow pulsation

  • Tube wear and replacement requirements

  • Limited pressure capability

  • Flow rate dependent on tube elasticity

Technical References

  1. Watson, S.J. & Patel, M.K. (2019). “Peristaltic Pump Performance in Analytical Applications.” Journal of Analytical Chemistry, 91(12), 7645-7652.

  2. Takahashi, T. et al. (2020). “Pulsation Damping in Peristaltic Pumps.” Chemical Engineering & Technology, 43(8), 1523-1530.

  3. Kumar, A. & Singh, R. (2018). “Tube Wear Mechanisms in Peristaltic Pumps.” Wear, 408-409, 100-108.

  4. ISO 8655-6:2002. “Piston-operated volumetric apparatus - Part 6: Gravimetric methods for the determination of measurement error.”

See Also