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.
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 Metric | Legacy Spreadsheets & Manual Tallying | devManue Custom Enterprise ERP |
|---|---|---|
| Smart-Pig ILI Odometer Alignment | Raw 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 Sizing | Static 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) Monitoring | Quarterly 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 Closeout | Paper 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. |
Related Enterprise ERP & Engineering Guides
- Aviation Fuel (Jet A-1) Depot & Hydrant Pipeline ERP — Downstream hydrant pipeline receipt, floating-suction tank farm QC, and JIG filtration.
- ASME Pressure Vessel, Piping Welding WPS/PQR & NDT ERP — Managing ASME IX welder qualifications and radiographic/ultrasonic NDT on pipeline sleeve repairs.
- LPG Bulk Terminal & Petroleum Depot Custody-Transfer ERP — Integrating midstream pipeline batch interface tracking with bulk terminal tank receipt.
- Custom Midstream Pipeline Integrity (PIMS) & SCADA ERP — Partner with devManue to unify your ILI smart-pig analytics, ICCP telemetry, and integrity dig workflows.