Gas Pipeline — A mass balance as a leak detector
![]() | ![]() | ![]() | App Exercises |
|---|
Model and Control Exercise 33 of 40. BYU class 35 · PDC class 41. 15 minutes.

Open the Gas Pipeline App
Learning Outcomes
- Write the inventory balance of a pipe from the measurements a SCADA system has.
- Tell a meter bias from a leak by the shape of the imbalance.
- Compute the time a balance needs to detect a leak of a given size.
Book Chapter
Control in Upstream and Midstream Oil and Gas (Volume 10), Chapter 12, A Gas Transmission Line Simulator for Line Pack, Forecast Feedforward and Leak Detection. Read online · Chapter PDF · Lecture slides
Theory in Brief
P-bar is absolute mean pressure, M_w is molar mass and Z is the compressibility factor. The detector compares integrated measured flow to an inventory estimate.
$$\dot M=w_{in}-w_{out}$$
$$M=\bar PVM_w/(ZRT)$$
$$r(t)=\int_0^t(w_{in}-w_{out})\,dt-\Delta M$$
Model to Controller
A mass balance supplies a residual for supervision. Independent measurement or corroborating pressure evidence helps distinguish bias from loss.
Exercise
Read (2 min). Review the model and identify which signals you will compare.
Predict (1 min). Predict how the imbalance differs for a meter that reads low and for a real leak.
Run (8 min).
- Open the app and select the following cases in order.
- 1 · Step the compressor, time the outlet (MANUAL).
- 8 · A meter that reads low, and a false leak alarm.
- 9 · A real leak, and how long the balance takes.
- Follow the case instructions, using the same measurement window for comparable trials.
- Record travel time, the slope of the imbalance in each and the time to the alarm.
Explain (2 min). Which observation supports or changes your prediction? Which assumption or limit explains the gap between calculation and observation?
Generative AI Learning (2 min)
Verify the suggested claim using a second point on your trend or an independent calculation from the equations. Cite the signal, units and case that support your conclusion.
What to Turn In
Submit a screenshot of the relevant trend or scorecard and three sentences covering your prediction, the measured result with units, and the model's explanation. Course guidelines for AI use.
Both a meter bias and a real leak can generate a growing residual. Use the sign and magnitude plus independent pressure or meter evidence. A fixed threshold divided by residual slope approximates detection delay.
Which part of the model connects the measured signal to the exercise?
A mass balance supplies a residual for supervision. Independent measurement or corroborating pressure evidence helps distinguish bias from loss.
How should the observations be interpreted?
Both a meter bias and a real leak can generate a growing residual. Use the sign and magnitude plus independent pressure or meter evidence. A fixed threshold divided by residual slope approximates detection delay.
How could you check that a result is comparable across cases?
Use the same signal, units and reference point. When comparing integrated quantities, use the same interval.
Related
EE 5: SCADA and Industrial Control Systems · Control Project


