Midstream Pipeline Pigging, Inline Inspection (ILI) Smart Pig Anomaly & Cathodic Protection (ICCP) ERP: MFL/UT Wall-Loss Alignment, ASME B31G Burst Pressure & CIPS Telemetry

How to architect a Midstream Pipeline Pigging, Inline Inspection (ILI) Smart Pig & Impressed-Current Cathodic Protection (ICCP) Integrity ERP: MFL/UT odometer girth-weld alignment, ASME B31G burst pressure & remaining life calculation, Transformer-Rectifier (-850 mV CSE) telemetry, and dig sheets.

Midstream petroleum product, crude oil, natural gas, and bulk water transmission pipeline operators across Kenya, Uganda, Tanzania, and the broader East African corridor manage hundreds of kilometers of buried high-pressure carbon-steel line pipe under API 1160, ASME B31.4 / B31.8, and EPRA pipeline integrity mandates. Storing cleaning-pig run logs, Inline Inspection (ILI) Magnetic Flux Leakage (MFL) and Ultrasonic (UT) smart-pig anomaly spreadsheets, Impressed-Current Cathodic Protection (ICCP) transformer-rectifier readings, and Close-Interval Potential Survey (CIPS) voltage logs in disconnected files leads to odometer drift misaligning excavation dig crews by 15–40 meters in the field, unaddressed external corrosion pits breaching Maximum Allowable Operating Pressure (MAOP), undetected rectifier anode-bed failures, and catastrophic environmental spills.

At devManue, we engineer custom Midstream Pipeline Pigging, Smart-Pig ILI Anomaly & Cathodic Protection Integrity Management System (PIMS) ERP platforms. Our architecture aligns multi-generation ILI runs to master girth-weld tallies, computes ASME B31G / Modified B31G Safe Working Pressure and corrosion growth rates, streams remote ICCP rectifier telemetry, and dispatches GPS-referenced Integrity Dig Sheets.

Stage 01→
Pig Launcher/Receiver & Wax Runs
Scraper trap pressure-equalization interlocks, bi-directional cleaning/gauging pig runs, and recovered wax/scale debris mass logging.
Stage 02→
MFL/UT Smart Pig & Weld Alignment
Ingestion of 100,000+ ILI sensor anomalies, odometer distance normalization against reference girth welds and AGM surface markers.
Stage 03→
ASME B31G Burst & Growth Engine
Automated Folias bulging factor calculation, Estimated Repair Factor (ERF = MAOP / P_safe), and run-to-run corrosion rate (mm/yr).
Stage 04→
ICCP Rectifier & CIPS Telemetry
SCADA/cellular polling of Transformer-Rectifier DC volts/amps and CIPS ON/Instant-OFF pipe-to-soil potentials (-850 mV to -1200 mV CSE).
Stage 05✓
Integrity Dig Sheet & Sleeve Repair
Automated excavation work order generation, ultrasonic phase-array field verification, Type-B steel sleeve or clock-spring composite wrap sign-off.

1. Girth-Weld Odometer Normalization & Multi-Run ILI Corrosion Growth

When an MFL or ultrasonic smart pig travels $450\text{ km}$ through a buried $14\text{-inch}$ or $20\text{-inch}$ pipeline, wheel slip in paraffin wax or gas surges causes raw odometer chainage to drift relative to true geodetic coordinates. Our ERP anchors every ILI anomaly to the nearest upstream Master Girth Weld and Above-Ground Marker (AGM), linearly scaling the inter-weld pipe joint length ($11.8\text{–}12.2\text{ m}$) and clock orientation ($01{:}00\text{ to }12{:}00$) so field excavation teams uncover the exact corrosion pit within $\pm 10\text{ cm}$.

Our PostgreSQL schema links pipeline segments, master girth-weld tallies, ILI metal-loss anomalies, and ICCP cathodic protection test stations:

-- PostgreSQL Schema for Pipeline Girth Welds, ILI Anomalies & ICCP Cathodic Protection
CREATE TABLE pipeline_girth_weld_tallies (
    weld_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    line_code VARCHAR(32) NOT NULL, -- e.g. LINE-MSA-NBI-20IN
    weld_number INTEGER NOT NULL,
    chainage_m NUMERIC(12, 3) NOT NULL,
    joint_length_m NUMERIC(6, 3) NOT NULL,
    nominal_wall_mm NUMERIC(5, 2) NOT NULL, -- e.g. 9.53 mm (API 5L X65)
    smys_mpa NUMERIC(6, 1) NOT NULL, -- Specified Minimum Yield Strength (448 MPa for X65)
    maop_bar NUMERIC(6, 2) NOT NULL,
    gps_lat NUMERIC(10, 7) NOT NULL,
    gps_lng NUMERIC(10, 7) NOT NULL,
    UNIQUE(line_code, weld_number)
);

CREATE TABLE pipeline_ili_anomalies (
    anomaly_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    ili_run_code VARCHAR(40) NOT NULL,
    upstream_weld_id UUID NOT NULL REFERENCES pipeline_girth_weld_tallies(weld_id),
    distance_from_weld_m NUMERIC(6, 3) NOT NULL,
    clock_orientation VARCHAR(8) NOT NULL, -- e.g. 05:30
    orientation_location VARCHAR(16) NOT NULL, -- INTERNAL, EXTERNAL
    peak_depth_pct NUMERIC(5, 2) NOT NULL, -- % of nominal wall thickness
    axial_length_mm NUMERIC(7, 1) NOT NULL,
    circumferential_width_mm NUMERIC(7, 1) NOT NULL,
    asme_b31g_safe_pressure_bar NUMERIC(6, 2) NOT NULL,
    estimated_repair_factor_erf NUMERIC(5, 3) NOT NULL, -- ERF = MAOP / P_safe
    remediation_priority VARCHAR(24) NOT NULL -- IMMEDIATE_RUPTURE_RISK, 60_DAY_DIG, 180_DAY_DIG, MONITOR
);

CREATE TABLE pipeline_iccp_potentials (
    reading_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    line_code VARCHAR(32) NOT NULL,
    test_post_km NUMERIC(8, 3) NOT NULL,
    on_potential_mv_cse NUMERIC(7, 1) NOT NULL,
    instant_off_potential_mv_cse NUMERIC(7, 1) NOT NULL, -- Target: -850 mV to -1200 mV
    ac_induced_voltage_v NUMERIC(5, 2) NOT NULL DEFAULT 0.00,
    recorded_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

2. ASME B31G Corrosion Burst-Pressure & ERF Prioritization Engine in Python

Under ASME B31G (Modified 0.85 dL method), a deep but short pit behaves differently under hoop stress than a long axial corrosion groove. Furthermore, any defect exceeding $80\%$ wall loss or having an Estimated Repair Factor ($\text{ERF} = \text{MAOP} / P_{\text{safe}} \ge 1.00$) requires immediate pressure derating and emergency excavation. Below is our Python integrity engine that computes the Folias bulging factor $M$, safe operating pressure $P_{\text{safe}}$, and NACE SP0169 cathodic protection compliance at that exact chainage:

import math
from dataclasses import dataclass
from decimal import Decimal, ROUND_HALF_UP

@dataclass
class AsmeB31GAssessment:
    folias_factor_m: Decimal
    failure_stress_mpa: Decimal
    safe_operating_pressure_bar: Decimal
    erf_ratio: Decimal
    cp_status: str
    dig_priority: str

def evaluate_asme_b31g_anomaly(
    outer_diameter_mm: float,
    wall_thickness_mm: float,
    smys_mpa: float,
    design_factor_f: float,
    maop_bar: float,
    defect_depth_pct: float,
    defect_axial_length_mm: float,
    instant_off_potential_mv: float,
) -> AsmeB31GAssessment:
    """
    Computes Modified ASME B31G (0.85 dL) safe working pressure, ERF (MAOP / P_safe),
    and cross-references NACE SP0169 instant-OFF cathodic protection potential.
    """
    d_over_t = defect_depth_pct / 100.0
    z_param = (defect_axial_length_mm ** 2) / (outer_diameter_mm * wall_thickness_mm)

    if z_param <= 50.0:
        m_factor = math.sqrt(1.0 + 0.6275 * z_param - 0.003375 * (z_param ** 2))
    else:
        m_factor = 0.032 * z_param + 3.3

    s_flow_mpa = smys_mpa + 68.95  # Modified B31G flow stress = SMYS + 10,000 psi (68.95 MPa)
    s_fail_mpa = s_flow_mpa * ((1.0 - 0.85 * d_over_t) / (1.0 - (0.85 * d_over_t / m_factor)))

    # Barlow formula with design factor F (e.g. 0.72), convert MPa to bar (* 10)
    p_safe_bar = ((2.0 * s_fail_mpa * wall_thickness_mm) / outer_diameter_mm) * design_factor_f * 10.0
    erf = maop_bar / p_safe_bar if p_safe_bar > 0 else 99.9

    if instant_off_potential_mv > -850.0:
        cp_state = "UNDER_PROTECTED_ACTIVE_CORROSION_RISK"
    elif instant_off_potential_mv < -1200.0:
        cp_state = "OVER_PROTECTED_CATHODIC_DISBONDMENT_RISK"
    else:
        cp_state = "NACE_SP0169_COMPLIANT"

    if defect_depth_pct >= 80.0 or erf >= 1.00:
        priority = "IMMEDIATE_PRESSURE_REDUCTION_AND_DIG"
    elif erf >= 0.90 or (defect_depth_pct >= 50.0 and cp_state != "NACE_SP0169_COMPLIANT"):
        priority = "60_DAY_SCHEDULED_EXCAVATION"
    elif defect_depth_pct >= 40.0:
        priority = "180_DAY_MONITORED_DIG"
    else:
        priority = "NEXT_ILI_CYCLE_MONITOR"

    return AsmeB31GAssessment(
        folias_factor_m=Decimal(str(round(m_factor, 3))),
        failure_stress_mpa=Decimal(str(round(s_fail_mpa, 2))),
        safe_operating_pressure_bar=Decimal(str(round(p_safe_bar, 2))),
        erf_ratio=Decimal(str(round(erf, 3))),
        cp_status=cp_state,
        dig_priority=priority,
    )

3. ICCP Rectifier Telemetry & Field Ultrasonic Verification Loop

Why do external corrosion clusters form at specific pipeline chainages? By overlaying Close-Interval Potential Survey (CIPS) and Direct Current Voltage Gradient (DCVG) coating-holiday logs directly onto the ILI anomaly profile, our ERP automatically elevates the dig priority of any metal-loss feature located inside an under-protected cathodic zone (instant-OFF potential less negative than $-850\text{ mV CSE}$). When the field integrity crew excavates the pipe and measures actual pit morphology with a phased-array ultrasonic scanner, the field reading feeds back into the ERP to recalibrate MFL velocity/sizing bias across the entire pipeline segment.

Pipeline Integrity & CP MetricLegacy Spreadsheets & Manual TallyingdevManue Custom Enterprise ERP
Smart-Pig ILI Odometer AlignmentRaw vendor CSV chainages drift 15–40m in the field, causing dry holes during excavation.Master Girth-Weld & AGM normalization pinning every anomaly to exact joint distance and clock position.
ASME B31G Burst Pressure SizingStatic vendor PDF reports; no dynamic recalculation when corrosion growth or MAOP changes.Live Modified B31G / RSTReng engine computing Folias factor, ERF, and remaining wall life.
Cathodic Protection (ICCP) MonitoringQuarterly manual multimeter readings at test posts; rectifier fuse blowouts go unnoticed for months.Remote cellular TR telemetry plus CIPS instant-OFF (-850 mV to -1200 mV CSE) overlay on ILI pits.
Excavation & Sleeve Repair CloseoutPaper dig sheets and unindexed ultrasonic verification photos.GPS-guided digital Dig Packs recording actual UT pit depth, Type-B sleeve weld NDT, and coating Holiday test.

Interactive PostgreSQL Memory & Tuning Calculator

// Real-Time Production Memory Allocator
PostgreSQL 14 / 15 / 16 / 17

Adjust server resources below to calculate optimized postgresql.conf memory thresholds, autovacuum scale factors, and planner cost weights.

16 GB
2 GB 64 GB 256 GB
8 Cores
2 16 64
100
20 200 1,000
generated-postgresql.conf
INI
# Memory Allocations
shared_buffers = 4GB
work_mem = 41MB
maintenance_work_mem = 983MB
effective_cache_size = 12GB

# Concurrency & Background Workers
max_connections = 100
max_worker_processes = 8
max_parallel_workers_per_gather = 4
max_parallel_workers = 8

# Autovacuum Tuning (Prevent Bloat)
autovacuum_max_workers = 4
autovacuum_vacuum_scale_factor = 0.05
autovacuum_analyze_scale_factor = 0.02
autovacuum_vacuum_cost_limit = 1000

# Planner Cost Constants (NVME)
random_page_cost = 1.1
effective_io_concurrency = 200
Need hands-on database profiling? Our engineering team analyzes query execution plans, resolves lock trees, and eliminates replication lag.
Book Database Audit (30m)
// Production Systems Architecture • Database Diagnostic Audit

Diagnosing Production PostgreSQL Bloat, Lock Contention, or Replication Lag?

Theoretical tuning only goes so far. Our engineering team conducts hands-on architectural reviews of query execution plans, autovacuum parameters, connection pools, and read-replica lag for high-concurrency systems.

All Insights
Chat on WhatsApp