PipelineStudio (LPS / TGNET & TLNET)
ModelScript provides first-class, polyglot support for Emerson / Energy Solutions PipelineStudio, including its dual simulation kernels:
- TGNET (Transient Gas Network): Compressible gas hydraulics, real-gas equations of state (AGA-8 Detailed Characterization & Peng-Robinson), line pack dynamics, compressor stations, gas heating value tracking, and hydrogen blending.
- TLNET (Transient Liquid Network): Incompressible/liquid hydraulics, multi-product batch tracking (gasoline/diesel/jet fuel interfaces), transmix dispersion, pump stations, drag-reducing agents (DRA), and water hammer / acoustic surge analysis.
Supported File Formats
| Format | Extension | Description |
|---|---|---|
| PipelineStudio Project | .lps, .xml | Complete graphical network model defining nodes, pipes, compressor stations, pump stations, regulators, and study scenarios. |
| TGNET Gas Study | .tgx, .psg | Dedicated compressible gas transmission network studies with gas composition and line pack profiles. |
| TLNET Liquid Study | .tlx, .psl | Dedicated liquid transmission network studies with batch injection schedules and fluid property libraries. |
| Legacy Keyword Decks | .tgn, .tln | Standard industrial keyword decks specifying network geometry, equipment ratings, and boundary conditions. |
3-Tier Execution Architecture
ModelScript implements a 3-tier operational execution framework for pipeline networks:
1. Tier 1: In-WASM DAE Solvers
- Zero Intermediate Allocations: Lowers directly into ModelScript's
DAEBuilderlinear memory arena. - High-Accuracy Thermodynamics:
- AGA-8 (ISO 20765-1): High-precision calculation of compressibility factor
, molar density, speed of sound, and Joule-Thomson cooling. - Hydrogen Blending: Native support for
blending in natural gas from 0% to 100%, capturing density drop, speed of sound increases, and compressor power shifts. - Peng-Robinson Cubic EOS: General flash calculation for heavy hydrocarbons and dense-phase supercritical
pipeline transport.
- AGA-8 (ISO 20765-1): High-precision calculation of compressibility factor
- Transient Compressible Gas Dynamics:
- Solves 1D staggered-grid continuity and momentum equations:
- Simulates dynamic line packing, demand drafting, and decompression acoustic waves.
- Solves 1D staggered-grid continuity and momentum equations:
- Water Hammer & Surge Analysis:
- Solves Joukowsky acoustic wave propagation (
) during rapid emergency shutdown (ESD) valve closures and pump trips. - Monitors transient pressure spikes against ASME B31.4 limits (
) and screens for liquid column separation / cavitation.
- Solves Joukowsky acoustic wave propagation (
- Multi-Product Liquid Batch Tracking:
- Tracks discrete fuel slugs (Diesel, Regular Gasoline, Jet-A) along transmission pipelines.
- Austin-Palfrey interface mixing length and transmix volume calculation at delivery manifold cut-points.
2. Tier 2: Gas-Power Sector Coupling & Co-Simulation
Enables cross-vector energy system co-simulation via FMI 2.0/3.0 and SSP:
- Coupled with
@modelscript/psse: Simulates how rapid ramp-up of gas-fired combined-cycle power plants (CCGTs) draws on pipeline line pack, ensuring minimum delivery pressures are sustained during electric grid peaks. - Coupled with
@modelscript/pscad: Evaluates fast sub-second electrical generator trips and their acoustic pressure waves on pipeline fuel supply manifolds. - Power-to-Gas: Simulates green hydrogen injection from wind/solar electrolyzers into regional gas grids.
3. Tier 3: Industrial Engine Orchestration
Automates invocation of local Emerson PipelineStudio CLI engines (tgnet.exe / tlnet.exe), dynamically ingesting results into ModelScript for unified verification.
Pre-Flight Pipeline Diagnostic Linter
12 rules6 error6 warning Run with msx lint
| Code | Rule | Severity | Message |
|---|---|---|---|
M8001 | maop-exceeded | error | Pipe '<pipeName>' operating pressure (<value> bar) exceeds Maximum Allowable Operating Pressure (<value> bar). |
M8002 | compressor-surge-hazard | error | Compressor '<compName>' operating flow (<value> m\xB3/h) is below the aerodynamic surge limit (<value> m\xB3/h). |
M8003 | compressor-stonewall-limit | warning | Compressor '<compName>' throughput (<value> m\xB3/h) approaches sonic choke/stonewall limit (<value> m\xB3/h). |
M8004 | unconnected-pipeline-node | error | Node '<nodeName>' is isolated and has no connecting pipes or equipment links. |
M8005 | delivery-pressure-deficit | error | Delivery node '<nodeName>' is hydraulically unreachable from any supply or storage cavern. |
M8006 | erosional-velocity-hazard | warning | Gas velocity in pipe '<pipeName>' (<value> m/s) exceeds API RP 14E erosional limit (<value> m/s). |
M8007 | liquid-column-separation | error | Transient pressure in pipe '<pipeName>' (<value> bar) drops below liquid vapor pressure (<value> bar), risking cavitation. |
M8008 | hydrogen-embrittlement-risk | warning | Hydrogen blend fraction in pipe '<pipeName>' (<value>%) exceeds 10% on steel without fracture toughness certification. |
M8009 | batch-transmix-excess | warning | Batch transmix interface on pipe '<pipeName>' exceeds allowable contamination threshold: <detail>. |
M8010 | joule-thomson-freezing | warning | Joule-Thomson throttling across regulator '<regName>' reduces outlet temperature to <value>\xB0C, risking ice/hydrate blockage. |
M8011 | pump-npsh-deficit | error | Pump '<pumpName>' net positive suction head available (<value> m) is below required NPSHr (<value> m). |
M8012 | line-pack-depletion-risk | warning | Network total line pack is depleting rapidly: <detail>. |
Generated from languages/lps/src/errors.ts. All languages →
Programmatic Usage
import {
parseLps,
lintLpsModel,
SteadyNetworkSolver,
LinePackEngine,
GasEulerDaeSolver,
lpsToSysml2,
PipelineVerifier,
} from "@modelscript/lps";
// 1. Ingest PipelineStudio XML or ASCII keyword deck
const model = parseLps(sourceText);
// 2. Run Pre-Flight Diagnostic Linter
const diagnostics = lintLpsModel(model);
// 3. Solve Steady-State Network Hydraulics
const steady = SteadyNetworkSolver.solve(model);
// 4. Evaluate Line Pack Storage & Deliverability Reserves
const linePack = LinePackEngine.analyze(model, steady);
console.log(`Total Line Pack: ${(linePack.totalLinePackSm3 / 1e6).toFixed(2)} MMSm3`);
console.log(`Energy Stored: ${linePack.totalEnergyStoredGWh.toFixed(1)} GWh`);
// 5. Verify Formal Safety & MAOP Compliance
const report = PipelineVerifier.verifySteady(model, steady);
console.log("Verification passed:", report.passed);
// 6. Simulate 1D Transient Dynamics
const trajectory = GasEulerDaeSolver.simulate(model, {
durationSeconds: 7200,
timeStep: 10,
});
// 7. Generate Formal SysML v2 Architecture
const sysmlCode = lpsToSysml2(model);Advanced Machinery, Thermodynamics & Physical Models
1. Multi-Wheel Compressor Maps & Anti-Surge Control
ModelScript supports non-dimensional head-flow parameterization (
- Affinity Scaling: Speed governor modulates
to maintain target discharge pressure setpoints. - Surge Line & Anti-Surge Recycle Valve: Parabolic surge locus detection with automatic recycle valve modulation maintaining a minimum
safety buffer. - Stonewall (Choke): Detects maximum volumetric throughput beyond which sonic shock waves restrict further flow.
2. Centrifugal Pump Station Curves & NPSH Verification
Centrifugal pipeline booster pumps are modeled via cubic polynomial head
- Computes Net Positive Suction Head Available (
) against liquid vapor pressure. - Triggers diagnostic
M8011if, preventing catastrophic impeller cavitation.
3. GERG-2008 Helmholtz Free-Energy EOS (ISO 20765-2)
Implements the multi-fluid Helmholtz free-energy formulation
- Covers gas, liquid, supercritical dense phase, LNG cryogenic, and hydrogen blending regimes.
- Computes speed of sound
, isobaric heat capacity , isochoric heat capacity , and Joule-Thomson coefficient .
4. Slack Line Open-Channel Gravity Flow in Steep Pipelines
For pipelines traversing mountain passes with steep downward slopes, liquid column separation occurs when pressure drops to liquid vapor pressure (
- Transitions from pressurized pipe flow to open-channel gravity flow governed by the Manning-Gauckler-Strickler equation (
). - Tracks dynamic void fraction
and calculates slack collapse re-pressurization surge spikes upon valley impact.
5. 1D Radial Cylindrical Soil Thermal Conduction Mesh
Discretizes the ground surrounding buried transmission pipelines into a 10-layer concentric radial cylindrical finite-difference mesh:
- Solves
. - Captures ground thermal inertia, depth-dependent seasonal phase lag, and pipeline cooldown following emergency station shutdowns.
6. Station Supervisory Multi-Variable PID Overrides
SCADA compressor and pump station automation with min/max auctioneering selector gates:
- Arbitrates between discharge pressure control, low-suction override, driver shaft power limits, and flow dispatch.
- Integrates velocity PID controllers with anti-windup tracking, synchronizing inactive integrator loops to prevent reset overshoot during control transfer.
7. Hot-Start State Checkpointing (.sav / .rst)
Zero-copy state snapshot serialization with SHA-256 integrity verification:
- Saves all nodal pressures, pipe mass flows, fluid temperatures, soil thermal layers, and controller integrator states.
- Enables instantaneous resumption of multi-day transient simulations and what-if contingency branching.
Command-Line Interface (msx lps)
# Pre-flight safety linting
msx lps lint network.lps
# Steady-state hydraulics with slack line & soil thermal analysis
msx lps solve network.lps --slack --soil --eos=GERG2008
# Line pack inventory & deliverability buffer
msx lps linepack network.lps
# Transient simulation with hot-start checkpointing
msx lps simulate network.lps --duration=7200 --step=10 --save-checkpoint=state.sav
# Resume simulation from intermediate snapshot
msx lps simulate network.lps --duration=3600 --restart=state.sav
# Export formal SysML v2 architectural model
msx lps sysml network.lps -o network.sysml
