NeqSim Process Extraction Skill
Convert unstructured engineering information into the canonical NeqSim JSON format
accepted by ProcessSystem.fromJson() and ProcessSystem.fromJsonAndRun().
Core Principle
Extract structured data into a constrained JSON schema. Do NOT write NeqSim Java/Python code.
The JSON schema is finite and well-defined. ProcessSystem.fromJson() handles all
NeqSim API calls deterministically. Errors come back as structured, actionable messages.
P&ID operational workflow: When the source is a P&ID and the user asks
about a valve action, active train, isolation boundary, bypass, drain, vent,
or control-loop behavior, load neqsim-pid-process-operations. Extract both
the steady-state topology and the model delta needed to simulate the action.
Exception for route hydraulics: When the source is a STID/E3D/P&ID/stress-isometric
line-list table with serial pipe segments, use
neqsim.process.equipment.pipeline.routing.PipingRouteBuilder rather than the generic
JSON process builder. The route builder preserves line-list segment metadata, K-value
minor losses, elevations, and explicit connection topology.
Architecture decision (MANDATORY): Before assembling JSON, classify the process
complexity. Small/medium processes (≤ ~15 units, single recycle loop) use a single
ProcessSystem. Large processes (multiple plant areas, cross-area recycles, different
fluids) must be split into multiple ProcessSystem objects composed inside a
ProcessModule, or use pre-built ProcessModuleBaseClass implementations.
See Section 16 for the decision guide.
1. Target JSON Schema
Every extraction must produce JSON matching this format:
{
"fluid": {
"model": "SRK",
"temperature": 323.15,
"pressure": 65.0,
"mixingRule": "classic",
"multiPhaseCheck": false,
"components": {
"methane": 0.80,
"ethane": 0.08,
"propane": 0.05,
"CO2": 0.03,
"n-butane": 0.02,
"nitrogen": 0.01,
"n-pentane": 0.005,
"n-hexane": 0.005
}
},
"process": [
{"type": "Stream", "name": "well stream", "properties": {"flowRate": [75000.0, "kg/hr"]}},
{"type": "ThreePhaseSeparator", "name": "inlet separator", "inlet": "well stream"},
{"type": "Compressor", "name": "export compressor", "inlet": "inlet separator.gasOut",
"properties": {"outletPressure": 120.0, "isentropicEfficiency": 0.78}},
{"type": "ThrottlingValve", "name": "letdown valve", "inlet": "inlet separator.oilOut",
"properties": {"outletPressure": 15.0}}
],
"autoRun": true
}
Field Reference
| Field |
Type |
Required |
Description |
fluid.model |
string |
Yes |
EOS model: SRK, PR, CPA, GERG2008, PCSAFT, UMRPRU |
fluid.temperature |
number |
Yes |
Temperature in Kelvin |
fluid.pressure |
number |
Yes |
Pressure in bara |
fluid.mixingRule |
string |
Yes |
Usually "classic" for SRK/PR, "CLASSIC_TX_CPA" for CPA |
fluid.multiPhaseCheck |
boolean |
No |
Set true for water+HC or 3-phase systems |
fluid.components |
object |
Yes |
Component name → mole fraction (must sum to ~1.0) |
process[].type |
string |
Yes |
Equipment type from the Equipment Type Table below |
process[].name |
string |
Yes |
Unique equipment tag / display name |
process[].inlet |
string |
Conditional |
Stream reference (dot-notation). Required for all except 1st Stream |
process[].properties |
object |
No |
Equipment-specific settings (see Properties Reference) |
autoRun |
boolean |
No |
Set true to auto-run after building |
Multiple Fluids (Named)
For processes with different feed compositions, use the fluids map:
{
"fluids": {
"gas_feed": { "model": "SRK", "temperature": 323.15, "pressure": 80.0, "mixingRule": "classic", "components": {"methane": 0.90, "ethane": 0.05, "propane": 0.03, "n-butane": 0.02} },
"water_feed": { "model": "CPA", "temperature": 293.15, "pressure": 80.0, "mixingRule": "CLASSIC_TX_CPA", "components": {"water": 0.999, "MEG": 0.001} }
},
"process": [
{"type": "Stream", "name": "gas inlet", "fluidRef": "gas_feed", "properties": {"flowRate": [50000.0, "kg/hr"]}},
{"type": "Stream", "name": "water inlet", "fluidRef": "water_feed", "properties": {"flowRate": [5000.0, "kg/hr"]}}
]
}
2. Equipment Type Mapping
Map natural language equipment names to NeqSim JSON type values.
Use the longest matching keyword to avoid false matches.
Separation
| Natural Language Synonyms |
NeqSim type |
| separator, 2-phase separator, two-phase separator, flash drum, flash vessel, KO drum, knock-out drum, knockout drum, scrubber, inlet scrubber, suction scrubber, slug catcher, production scrubber, gas scrubber |
Separator |
| 3-phase separator, three-phase separator, production separator, test separator, oil-water-gas separator, 3-phase test separator |
ThreePhaseSeparator |
Compression & Expansion
| Natural Language Synonyms |
NeqSim type |
| compressor, gas compressor, export compressor, recompressor, booster compressor, LP compressor, HP compressor, 1st stage compressor, 2nd stage compressor, 3rd stage compressor, centrifugal compressor, reciprocating compressor |
Compressor |
| expander, turbo-expander, turboexpander, power recovery turbine |
Expander |
Heat Transfer
| Natural Language Synonyms |
NeqSim type |
| cooler, gas cooler, aftercooler, after-cooler, intercooler, air cooler, fin fan cooler, air-fin cooler, trim cooler, export cooler, overhead condenser |
Cooler |
| heater, pre-heater, preheater, line heater, electric heater, fired heater, reboiler, trim heater |
Heater |
| heat exchanger, shell and tube, shell-and-tube, plate heat exchanger, plate-fin exchanger, FWHE, gas-gas exchanger, cross-exchanger, economizer |
HeatExchanger |
Valves
| Natural Language Synonyms |
NeqSim type |
| valve, throttling valve, choke valve, choke, JT valve, Joule-Thomson valve, letdown valve, control valve, pressure control valve, PCV, backpressure valve, production choke, wellhead choke |
ThrottlingValve |
Pumps
| Natural Language Synonyms |
NeqSim type |
| pump, centrifugal pump, export pump, booster pump, injection pump, feed pump, charge pump, transfer pump, multiphase pump |
Pump |
Piping Routes
| Natural Language Synonyms |
NeqSim target |
| line list, line-list, route table, STID route, E3D route, stress isometric, pipe run list, serial piping route, compressor suction route, compressor discharge route |
PipingRouteBuilder |
PipingRouteBuilder is not a JSON equipment type. It is a Java/Python-accessible
builder for serial route hydraulics. Use it when the input table has from/to
nodes, pipe lengths, sizes, elevations, fittings, valves, and K values. Extract
the route rows first, then build the route model and export route.toJson() for
traceability.
For P&ID valve-action studies, classify each valve before mapping it to NeqSim:
control valves become ThrottlingValve equipment, isolation and shutdown valves
become scenario switches or boundary states, check valves become directed route
constraints, and BDV/PSV/vent valves become relief or blowdown paths.
Mixing & Splitting
| Natural Language Synonyms |
NeqSim type |
| mixer, mixing tee, junction, merge, combine |
Mixer |
| splitter, tee, flow divider, bypass tee |
Splitter |
| manifold, production manifold, gathering manifold, commingling manifold, subsea manifold, inlet/export header |
Manifold |
Always model a manifold as Manifold, not Mixer/Splitter. Add all inlet
streams with addStream(...), then route downstream from a split stream, not
getMixedStream(). A single-destination gathering manifold sets one split
(setSplitFactors([1.0])) and routes getSplitStream(0); a distributing
manifold sets setSplitFactors([...]) (fractions summing to 1) and reads each
outlet with getSplitStream(i). getMixedStream() is the internal commingled
stream (before the split) — for inspection only. The Manifold also carries
header / branch diameters for hydraulics and mechanical design.
Streams
| Natural Language Synonyms |
NeqSim type |
| stream, feed, inlet, well stream, feed gas, feed stream, input, source |
Stream |
Other Equipment
| Natural Language Synonyms |
NeqSim type |
| tank, storage tank, atmospheric tank, settling tank, buffer tank |
Tank |
| flare, flare stack, flare header, HP flare, LP flare |
Flare |
| recycle, recirculation |
Recycle |
| ejector, jet pump, steam ejector, gas ejector |
Ejector |
| TEG absorber, glycol contactor, TEG contactor, dehydration absorber |
SimpleTEGAbsorber |
| reservoir, simple reservoir |
SimpleReservoir |
| electrolyzer, water electrolyzer, PEM electrolyzer |
Electrolyzer |
| CO2 electrolyzer |
CO2Electrolyzer |
| fuel cell |
FuelCell |
| wind turbine |
WindTurbine |
| solar panel, PV panel |
SolarPanel |
| battery storage, battery, BESS |
BatteryStorage |
| ammonia reactor, Haber-Bosch reactor, ammonia synthesis |
AmmoniaSynthesisReactor |
| distillation column, fractionation column, distillation tower, deethanizer, demethanizer, depropanizer, debutanizer, stripper column, stabilizer column |
DistillationColumn |
| pipe, pipe segment, pipeline, flowline, adiabatic pipe |
AdiabaticPipe |
| stream saturator, saturator, water saturator |
StreamSaturatorUtil |
3. Stream Wiring (Dot-Notation)
Equipment is connected via dot-notation references in the inlet field.
Port Reference Table
| Upstream Equipment Type |
Port Syntax |
Resolves To |
Stream |
"feed" (name only, no port) |
The stream directly |
Separator |
"HP Sep.gasOut" |
Gas outlet stream |
Separator |
"HP Sep.liquidOut" |
Liquid outlet stream |
ThreePhaseSeparator |
"Inlet Sep.gasOut" |
Gas outlet |
ThreePhaseSeparator |
"Inlet Sep.oilOut" |
Oil outlet |
ThreePhaseSeparator |
"Inlet Sep.waterOut" |
Water outlet |
ThreePhaseSeparator |
"Inlet Sep.liquidOut" |
Oil outlet (alias) |
Compressor |
"Comp.outlet" |
Outlet stream |
Cooler |
"Cooler.outlet" |
Outlet stream |
Heater |
"Heater.outlet" |
Outlet stream |
ThrottlingValve |
"Valve.outlet" |
Outlet stream |
Pump |
"Pump.outlet" |
Outlet stream |
Expander |
"Expander.outlet" |
Outlet stream |
Mixer |
"Mixer.outlet" |
Outlet stream |
Splitter |
"Splitter.outlet" |
Outlet stream (first split) |
Splitter |
"Splitter.split0" |
Split port 0 |
Splitter |
"Splitter.split1" |
Split port 1 |
Splitter |
"Splitter.splitN" |
Split port N (zero-indexed) |
HeatExchanger |
"HX.outlet" |
Outlet stream |
DistillationColumn |
"Column.gasOut" |
Gas (overhead) outlet |
DistillationColumn |
"Column.liquidOut" |
Liquid (bottoms) outlet |
Tank |
"Tank.outlet" |
Outlet stream |
Wiring Rules
- First equipment MUST be a
Stream — it gets the fluid from the fluid section
- Every subsequent equipment MUST have an
inlet reference pointing to a previously defined equipment
- For separators, specify the port —
gasOut, liquidOut, oilOut, waterOut
- For single-outlet equipment — use
"name.outlet" or just "name" (default resolves to outlet)
- Do NOT create circular references — the JSON builder does not support recycle loops directly (add
Recycle equipment for convergence)
- Branching is supported — multiple equipment can reference different ports of the same separator
- Mixer multi-inlet: use
"inlets" (plural) — Mixers require "inlets": ["stream1", "stream2"] (array). Do NOT use "inlet" with an array — it will fail with "Array must have size 1"
- Separator name without port returns null —
resolveStreamReference("HP Sep") returns null. Always use "HP Sep.gasOut" or "HP Sep.liquidOut"
Branching Example
{"type": "ThreePhaseSeparator", "name": "inlet sep", "inlet": "feed"},
{"type": "Compressor", "name": "gas comp", "inlet": "inlet sep.gasOut", ...},
{"type": "ThrottlingValve", "name": "oil valve", "inlet": "inlet sep.oilOut", ...},
{"type": "Pump", "name": "water pump", "inlet": "inlet sep.waterOut", ...}
Mixer Multi-Inlet Example
{"type": "Stream", "name": "gas 1", "properties": {"flowRate": [10000.0, "kg/hr"]}},
{"type": "Stream", "name": "gas 2", "properties": {"flowRate": [5000.0, "kg/hr"]}},
{"type": "Mixer", "name": "gas mixer", "inlets": ["gas 1", "gas 2"]},
{"type": "Cooler", "name": "mixed cooler", "inlet": "gas mixer", "properties": {"outletTemperature": [25.0, "C"]}}
CRITICAL: Use "inlets" (plural key, with array value) for Mixer/multi-inlet equipment. Using "inlet" with an array value will fail.
4. Equipment Properties Reference
Stream
| Property |
Type |
Unit |
Example |
flowRate |
[number, "unit"] |
kg/hr, MSm3/day, Am3/hr |
[75000.0, "kg/hr"] |
temperature |
number |
Kelvin |
353.15 (= 80°C) |
pressure |
number |
bara |
65.0 |
Compressor
| Property |
Type |
Default |
Description |
outletPressure |
number (bara) |
— |
Discharge pressure |
isentropicEfficiency |
number (0-1) |
0.75 |
Isentropic efficiency |
polytropicEfficiency |
number (0-1) |
— |
Polytropic efficiency (alternative) |
usePolytropicCalc |
boolean |
false |
Use polytropic head calculation |
Cooler / Heater
| Property |
Type |
Default |
Description |
outTemperature |
number (K) |
— |
Outlet temperature in Kelvin |
outletTemperature |
[number, "unit"] |
— |
Outlet temperature with unit (e.g., [25.0, "C"]) |
Property Unit Arrays: Equipment properties can be specified with units using the [value, "unit"] array format. This applies to any property that accepts a unit string, such as outletTemperature, flowRate, etc. The JSON builder uses Java reflection to find matching setter methods.
ThrottlingValve
| Property |
Type |
Default |
Description |
outletPressure |
number (bara) |
— |
Downstream pressure |
Pump
| Property |
Type |
Default |
Description |
outletPressure |
number (bara) |
— |
Discharge pressure |
isentropicEfficiency |
number (0-1) |
0.75 |
Isentropic efficiency |
Separator / ThreePhaseSeparator
No required properties. Operates at inlet conditions.
Splitter
| Property |
Type |
Default |
Description |
splitNumber |
integer |
— |
Number of outlet streams |
splitFactors |
[number, ...] |
— |
Split factors per outlet (e.g., [0.5, 0.5]) |
DistillationColumn
| Property |
Type |
Default |
Description |
numberOfTrays |
integer |
10 |
Number of theoretical trays |
hasReboiler |
boolean |
true |
Whether column has a reboiler |
hasCondenser |
boolean |
true |
Whether column has a condenser |
HeatExchanger (Multi-Inlet)
HeatExchanger supports two inlets (hot and cold side):
{"type": "HeatExchanger", "name": "gas-gas HX",
"inlets": ["hot stream", "cold stream"]}
The first inlet becomes the feed stream; the second is set via setFeedStream(1, stream).
AdiabaticPipe
| Property |
Type |
Default |
Description |
length |
number (m) |
— |
Pipe length in meters |
diameter |
number (m) |
— |
Pipe inner diameter in meters |
Route-Level Piping Line Lists
When the source has a line-list or stress-isometric table, extract these fields
before constructing the route:
| Extracted field |
Required |
Notes |
segment_id |
Yes |
Line number, row id, or generated S1, S2 |
from_node, to_node |
Yes |
Equipment tag, nozzle, tee, manifold, or route node |
length, length_unit |
Yes |
Straight pipe length, not equivalent length |
internal_diameter, diameter_unit |
Yes |
Convert NPS/schedule to internal diameter first |
wall_thickness, wall_thickness_unit |
No |
Store if schedule or stress iso gives it |
elevation_change, elevation_unit |
No |
Positive uphill, negative downhill |
roughness, roughness_unit |
No |
Use default roughness when only piping class is known |
minor_losses |
No |
Fittings/valves as {type, k_value} rows |
source_ref |
Yes |
Drawing/page/row reference for traceability |
Route extraction workflow:
- Sort rows in hydraulic flow order from upstream to downstream.
- Convert NPS/schedule to internal diameter before calling
addSegment(...).
- Convert every valve, bend, tee, reducer, strainer, and entry/exit loss to K.
- For a route-only study, build the route with
PipingRouteBuilder.build(feedStream)
and run the returned ProcessSystem.
- For a full plant model, call
route.addToProcessSystem(process, inletStream)
and pass the returned outlet stream to the downstream equipment. Use the overload
with source-equipment metadata when the inlet is an upstream equipment outlet stream.
- Save
route.toJson() and pressure-drop results in the task folder.
Reference guide: docs/process/piping_route_builder.md.
5. Component Name Mapping
Map common aliases to NeqSim database names. The NeqSim name is case-sensitive.
Hydrocarbon Components
| Common Aliases |
NeqSim Name |
| C1, CH4, methane |
methane |
| C2, C2H6, ethane |
ethane |
| C3, C3H8, propane |
propane |
| iC4, i-C4, isobutane |
i-butane |
| nC4, n-C4, butane, normal-butane |
n-butane |
| iC5, i-C5, isopentane |
i-pentane |
| nC5, n-C5, pentane, normal-pentane |
n-pentane |
| nC6, n-C6, hexane |
n-hexane |
| nC7, n-C7, heptane |
n-heptane |
| nC8, n-C8, octane |
n-octane |
| nC9, n-C9, nonane |
n-nonane |
| nC10, n-C10, decane |
nC10 |
| nC11 through nC24 |
nC11 through nC24 |
Non-Hydrocarbon Components
| Common Aliases |
NeqSim Name |
| CO2, carbon dioxide |
CO2 |
| H2S, hydrogen sulfide, hydrogen sulphide |
H2S |
| N2, nitrogen |
nitrogen |
| H2, hydrogen |
hydrogen |
| O2, oxygen |
oxygen |
| Ar, argon |
argon |
| He, helium |
helium |
| H2O, water |
water |
| Hg, mercury |
mercury |
| COS, carbonyl sulfide |
COS |
| SO2, sulfur dioxide |
SO2 |
Chemical Additives
| Common Aliases |
NeqSim Name |
| MEG, monoethylene glycol, ethylene glycol |
MEG |
| DEG, diethylene glycol |
DEG |
| TEG, triethylene glycol |
TEG |
| MeOH, methanol |
methanol |
| EtOH, ethanol |
ethanol |
| MDEA, methyldiethanolamine |
MDEA |
Aromatics
| Common Aliases |
NeqSim Name |
| benzene, C6H6 |
benzene |
| toluene, C7H8, methylbenzene |
toluene |
| cyclohexane, c-C6, cy-C6 |
c-hexane |
| cyclopentane, c-C5, cy-C5 |
c-C5 |
6. Unit Conversion Rules
All NeqSim JSON values must be in standard units. Convert before inserting into JSON.
Temperature
| Input Unit |
To Kelvin |
Formula |
| °C, degC, Celsius |
K |
T_K = T_C + 273.15 |
| °F, degF, Fahrenheit |
K |
T_K = (T_F - 32) × 5/9 + 273.15 |
| K, Kelvin |
K |
Identity |
| °R, Rankine |
K |
T_K = T_R × 5/9 |
Pressure
| Input Unit |
To bara |
Formula |
| barg, bar gauge |
bara |
P_bara = P_barg + 1.01325 |
| bara, bar absolute |
bara |
Identity |
| psia, psi absolute |
bara |
P_bara = P_psia × 0.0689476 |
| psig, psi gauge |
bara |
P_bara = (P_psig + 14.696) × 0.0689476 |
| kPa, kilopascal |
bara |
P_bara = P_kPa / 100.0 |
| MPa, megapascal |
bara |
P_bara = P_MPa × 10.0 |
| atm, atmosphere |
bara |
P_bara = P_atm × 1.01325 |
Flow Rate
Flow rate in JSON uses the [value, "unit"] array format. Supported unit strings:
| Unit String |
Description |
"kg/hr" |
Kilograms per hour (mass flow) |
"kg/min" |
Kilograms per minute |
"kg/sec" |
Kilograms per second |
"m3/hr" |
Cubic meters per hour (volume flow) |
"Am3/hr" |
Actual cubic meters per hour |
"Sm3/hr" |
Standard cubic meters per hour |
"MSm3/day" |
Million standard cubic meters per day |
"idSm3/day" |
Ideal standard cubic meters per day |
"mole/sec" |
Moles per second |
"mole/hr" |
Moles per hour |
Composition: Weight% to Mole Fraction Conversion
NeqSim uses mole fractions (summing to 1.0) in the JSON components field. If the source provides weight% (wt%), mass fractions, or ppm-by-weight, convert as follows:
Formula:
For each component $i$ with weight fraction $w_i$ and molar mass $M_i$:
$$x_i = \frac{w_i / M_i}{\sum_j (w_j / M_j)}$$
Common Molar Masses (g/mol):
| Component |
NeqSim Name |
$M$ (g/mol) |
| Methane |
methane |
16.04 |
| Ethane |
ethane |
30.07 |
| Propane |
propane |
44.10 |
| n-Butane |
n-butane |
58.12 |
| i-Butane |
i-butane |
58.12 |
| n-Pentane |
n-pentane |
72.15 |
| n-Hexane |
n-hexane |
86.18 |
| CO2 |
CO2 |
44.01 |
| H2S |
H2S |
34.08 |
| Nitrogen |
nitrogen |
28.01 |
| Water |
water |
18.02 |
| MEG |
MEG |
62.07 |
| TEG |
TEG |
150.17 |
| MDEA |
MDEA |
119.16 |
Worked Example:
Input: 70 wt% methane, 20 wt% ethane, 10 wt% propane
| Component |
$w_i$ |
$M_i$ |
$w_i / M_i$ |
$x_i$ (mole frac) |
| methane |
0.70 |
16.04 |
0.04364 |
0.8370 |
| ethane |
0.20 |
30.07 |
0.00665 |
0.1275 |
| propane |
0.10 |
44.10 |
0.00227 |
0.0355 |
| Total |
1.00 |
|
0.05216 |
1.0000 |
Result JSON: {"methane": 0.837, "ethane": 0.128, "propane": 0.035}
ppm-by-weight: Convert ppm_w to weight fraction first: $w_i = \text{ppm}_w \times 10^{-6}$
Volume% (gas at standard conditions): Volume% ≈ mole% for ideal gas behavior. Use directly as mole fractions.
7. EOS Model Selection
Choose the thermodynamic model based on the fluid system:
| Fluid System |
Recommended Model |
Mixing Rule |
| Dry gas, lean gas, simple hydrocarbons |
SRK |
"classic" |
| Oil systems, general hydrocarbons |
PR |
"classic" |
| Water + hydrocarbons, MEG/methanol, polar |
CPA |
"CLASSIC_TX_CPA" |
| Fiscal metering, custody transfer |
GERG2008 |
(none needed) |
| Polymer/associating fluids |
PCSAFT |
"classic" |
Decision Rules
- If water or glycol is present → use
CPA with mixing rule "CLASSIC_TX_CPA" and set multiPhaseCheck: true
- If accuracy for gas density/Z-factor is critical → use
GERG2008
- If heavy oil (C20+) → use
PR or SRK with "classic" mixing rule
- Default / unknown → use
SRK with "classic" mixing rule
8. Extraction Workflow
Follow this step-by-step process for every extraction:
Step 1: Identify the Source Type
- Text description — paragraph or bullet list describing a process
- Table / spreadsheet — heat & mass balance, operating data, well test
- PFD / sketch — process flow diagram (described or as image)
- Data sheet — equipment data sheet with design conditions
- Mixed — combination of above
Step 2: Extract Fluid Composition
- Look for: mole fractions, mol%, weight%, component tables
- Map component names to NeqSim names using the Component Name Mapping table
- Normalize to mole fractions summing to 1.0
- If weight% given, note it as an assumption (NeqSim uses mole fractions)
- If no composition given, flag as missing and use a placeholder
Step 3: Extract Equipment List
- Scan for equipment keywords using the Equipment Type Mapping table
- Match the longest keyword first (e.g., "three-phase separator" before "separator")
- Assign unique names/tags (use P&ID tags if provided, or generate descriptive names)
- Record the NeqSim
type for each
Step 4: Extract Stream Connectivity
- Look for phrases indicating flow direction: "enters", "goes to", "feeds", "is routed to", "flows to", "passes through"
- Identify which phase exits which equipment: "gas from the separator", "oil from the 3-phase separator", "compressed gas"
- Build dot-notation references:
"equipment_name.port"
- Verify no orphan streams (every equipment except feed has an inlet)
Step 5: Extract Operating Conditions
- Pressures: look for
bara, barg, bar, psi, MPa, kPa, atm
- Temperatures: look for
°C, °F, K, degC, degF
- Flow rates: look for
kg/hr, t/h, MMSCFD, MSm3/d, Am3/hr
- Convert all to NeqSim standard units (K, bara)
- Assign to the correct equipment property
Step 6: Assemble JSON
- Build the
fluid section with model, T, P, mixing rule, and components
- Build the
process array in topological order (upstream before downstream)
- First element MUST be a
Stream with the feed fluid
- Wire all equipment with
inlet references
- Set
autoRun: true
Step 7: Validate and Report
- Check composition sums to ~1.0 (within 0.01)
- Check all stream references point to existing equipment
- Check no circular references
- Compute confidence score (see Confidence Scoring below)
- List all assumptions made
- List all missing information detected
9. Confidence Scoring
Score the extraction confidence on a 0.0–1.0 scale:
| Criterion |
Points |
| Fluid composition explicitly provided |
+0.25 |
| Feed temperature specified |
+0.10 |
| Feed pressure specified |
+0.10 |
| Feed flow rate specified |
+0.10 |
| All equipment have explicit operating conditions |
+0.15 |
| Stream topology clearly described |
+0.15 |
| Equipment tags/names from source (not generated) |
+0.05 |
| EOS model specified or inferable from context |
+0.05 |
| No conflicting information in source |
+0.05 |
Confidence Bands
| Score |
Label |
Recommendation |
| 0.80–1.00 |
High |
Run directly, review results |
| 0.60–0.79 |
Medium |
Run but flag assumptions for user review |
| 0.40–0.59 |
Low |
More information needed — show what's missing |
| 0.00–0.39 |
Very Low |
Cannot produce reliable simulation — ask user |
10. Assumption Defaults
When information is not specified, use these engineering defaults and always track them:
| Parameter |
Default Value |
Assumption Text |
| EOS model |
SRK |
"Default SRK EOS (not specified in source)" |
| Mixing rule |
classic |
"Classic mixing rule assumed" |
| Feed temperature |
288.15 K (15°C) |
"Standard temperature assumed (15°C)" |
| Feed pressure |
1.01325 bara |
"Atmospheric pressure assumed" |
| Feed flow rate |
50000 kg/hr |
"Default flow rate 50000 kg/hr assumed" |
| Compressor efficiency |
0.75 (isentropic) |
"Default isentropic efficiency 0.75 assumed" |
| Cooler outlet temp |
308.15 K (35°C) |
"Default cooler outlet 35°C assumed" |
| Composition (no data) |
90% CH4, 5% C2, 3% C3, 2% nC4 |
"Placeholder lean gas composition used" |
11. Process Templates
When the extracted topology matches a known pattern, use a template for better reliability.
Template: Gas Dew Point Control
Pattern: cooler → separator → compressor
{
"fluid": { "model": "SRK", "temperature": "$FEED_T_K$", "pressure": "$FEED_P$", "mixingRule": "classic", "components": "$COMPOSITION$" },
"process": [
{"type": "Stream", "name": "feed", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},
{"type": "Cooler", "name": "dew point cooler", "inlet": "feed", "properties": {"outTemperature": "$COOLER_T_K$"}},
{"type": "Separator", "name": "cold separator", "inlet": "dew point cooler.outlet"},
{"type": "Compressor", "name": "export compressor", "inlet": "cold separator.gasOut", "properties": {"outletPressure": "$EXPORT_P$", "isentropicEfficiency": 0.78}}
],
"autoRun": true
}
Template: Two-Stage HP/LP Separation
Pattern: 3-phase sep → gas compression + oil letdown → LP sep → recompression
{
"fluid": { "model": "SRK", "temperature": "$FEED_T_K$", "pressure": "$HP_P$", "mixingRule": "classic", "components": "$COMPOSITION$" },
"process": [
{"type": "Stream", "name": "well stream", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},
{"type": "ThreePhaseSeparator", "name": "HP separator", "inlet": "well stream"},
{"type": "Cooler", "name": "gas cooler", "inlet": "HP separator.gasOut", "properties": {"outTemperature": 308.15}},
{"type": "Compressor", "name": "export compressor", "inlet": "gas cooler.outlet", "properties": {"outletPressure": "$EXPORT_P$", "isentropicEfficiency": 0.78}},
{"type": "ThrottlingValve", "name": "HP-LP valve", "inlet": "HP separator.oilOut", "properties": {"outletPressure": "$LP_P$"}},
{"type": "Separator", "name": "LP separator", "inlet": "HP-LP valve.outlet"},
{"type": "Compressor", "name": "LP recompressor", "inlet": "LP separator.gasOut", "properties": {"outletPressure": "$HP_P$", "isentropicEfficiency": 0.75}}
],
"autoRun": true
}
Template: Multi-Stage Compression with Intercooling
Pattern: compressor → cooler → scrubber → compressor → cooler → scrubber → ... (N stages)
Build dynamically with equal pressure ratio per stage:
ratio_per_stage = (P_out / P_in) ^ (1/N)
stage_P[i] = P_in × ratio_per_stage^i
- Each stage:
Compressor → Cooler (to intercooler temp) → Separator (scrub condensate)
- Last stage:
Compressor only (no aftercooler/scrubber, unless specified)
Template: Gas Cooling and JT Expansion
Pattern: cooler → separator → JT valve → cold separator
{
"fluid": { "model": "SRK", "temperature": "$FEED_T_K$", "pressure": "$FEED_P$", "mixingRule": "classic", "components": "$COMPOSITION$" },
"process": [
{"type": "Stream", "name": "feed", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},
{"type": "Cooler", "name": "pre-cooler", "inlet": "feed", "properties": {"outTemperature": "$PRECOOL_T_K$"}},
{"type": "Separator", "name": "inlet scrubber", "inlet": "pre-cooler.outlet"},
{"type": "ThrottlingValve", "name": "JT valve", "inlet": "inlet scrubber.gasOut", "properties": {"outletPressure": "$JT_P$"}},
{"type": "Separator", "name": "cold separator", "inlet": "JT valve.outlet"}
],
"autoRun": true
}
Template: Simple Oil Stabilization
Pattern: 3-phase sep → valve → flash drum → valve → atmospheric flash
{
"fluid": { "model": "SRK", "temperature": "$FEED_T_K$", "pressure": "$HP_P$", "mixingRule": "classic", "multiPhaseCheck": true, "components": "$COMPOSITION$" },
"process": [
{"type": "Stream", "name": "well fluid", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},
{"type": "ThreePhaseSeparator", "name": "production separator", "inlet": "well fluid"},
{"type": "ThrottlingValve", "name": "1st stage valve", "inlet": "production separator.oilOut", "properties": {"outletPressure": "$STAGE2_P$"}},
{"type": "Separator", "name": "2nd stage separator", "inlet": "1st stage valve.outlet"},
{"type": "ThrottlingValve", "name": "2nd stage valve", "inlet": "2nd stage separator.liquidOut", "properties": {"outletPressure": "$STAGE3_P$"}},
{"type": "Separator", "name": "stabilizer", "inlet": "2nd stage valve.outlet"}
],
"autoRun": true
}
Template: Subsea Tieback (Well → Pipeline → Platform)
Pattern: well stream → choke → pipeline → separator
{
"fluid": { "model": "SRK", "temperature": "$WELLHEAD_T_K$", "pressure": "$WELLHEAD_P$", "mixingRule": "classic", "multiPhaseCheck": true, "components": "$COMPOSITION$" },
"process": [
{"type": "Stream", "name": "well stream", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},
{"type": "ThrottlingValve", "name": "production choke", "inlet": "well stream", "properties": {"outletPressure": "$CHOKE_P$"}},
{"type": "Heater", "name": "pipeline heat loss", "inlet": "production choke.outlet", "properties": {"outTemperature": "$ARRIVAL_T_K$"}},
{"type": "ThreePhaseSeparator", "name": "inlet separator", "inlet": "pipeline heat loss.outlet"}
],
"autoRun": true
}
Template: TEG Dehydration
Pattern: wet gas → TEG absorber ← lean TEG; dry gas out, rich TEG out
Note: SimpleTEGAbsorber requires two input streams added via addGasInStream() and addSolventInStream(). The JSON builder currently wires via the inlet field, so for TEG dehydration, build the lean TEG stream as a separate feed with a TEG+water fluid.
{
"fluids": {
"wet_gas": {
"model": "SRK", "temperature": "$FEED_T_K$", "pressure": "$FEED_P$",
"mixingRule": "classic",
"components": "$GAS_COMPOSITION_WITH_WATER$"
},
"lean_teg": {
"model": "CPA", "temperature": "$TEG_T_K$", "pressure": "$FEED_P$",
"mixingRule": "CLASSIC_TX_CPA",
"components": {"TEG": 0.99, "water": 0.01}
}
},
"process": [
{"type": "Stream", "name": "wet gas feed", "fluidRef": "wet_gas", "properties": {"flowRate": ["$GAS_FLOW$", "kg/hr"]}},
{"type": "Stream", "name": "lean TEG", "fluidRef": "lean_teg", "properties": {"flowRate": ["$TEG_FLOW$", "kg/hr"]}},
{"type": "SimpleTEGAbsorber", "name": "TEG absorber", "inlet": "wet gas feed",
"properties": {"numberOfStages": "$STAGES$", "stageEfficiency": 0.5}},
{"type": "Heater", "name": "TEG reboiler sim", "inlet": "TEG absorber.liquidOut",
"properties": {"outTemperature": "$REBOILER_T_K$"}}
],
"autoRun": true
}
Typical defaults: 3–5 stages, stage efficiency 0.5, lean TEG flow 5–10× water to remove, reboiler at ~200°C (473 K). TEG purity: 99–99.5 wt%.
Template: NGL Recovery (Turbo-Expander + Demethanizer)
Pattern: gas inlet → cooler → expander → demethanizer column; overhead = sales gas, bottoms = NGL
{
"fluid": { "model": "SRK", "temperature": "$FEED_T_K$", "pressure": "$FEED_P$", "mixingRule": "classic", "components": "$COMPOSITION$" },
"process": [
{"type": "Stream", "name": "inlet gas", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},
{"type": "Cooler", "name": "gas chiller", "inlet": "inlet gas", "properties": {"outTemperature": "$CHILLER_T_K$"}},
{"type": "Separator", "name": "cold separator", "inlet": "gas chiller.outlet"},
{"type": "Expander", "name": "turbo-expander", "inlet": "cold separator.gasOut", "properties": {"outletPressure": "$EXPANDER_P$", "isentropicEfficiency": 0.85}},
{"type": "ThrottlingValve", "name": "liquid JT valve", "inlet": "cold separator.liquidOut", "properties": {"outletPressure": "$EXPANDER_P$"}},
{"type": "Mixer", "name": "column feed mixer", "inlets": ["turbo-expander.outlet", "liquid JT valve.outlet"]},
{"type": "Separator", "name": "demethanizer sim", "inlet": "column feed mixer.outlet"},
{"type": "Compressor", "name": "residue compressor", "inlet": "demethanizer sim.gasOut", "properties": {"outletPressure": "$SALES_P$", "isentropicEfficiency": 0.78}}
],
"autoRun": true
}
Note: For a rigorous demethanizer, replace the Separator with a Column (DistillationColumn). The simplified version uses a cold separator as a proxy. Typical expander outlet: 15–25 bara, efficiency 0.82–0.88, chiller to –30°C to –40°C.
Template: Acid Gas Removal (Amine Sweetening)
Pattern: sour gas → amine absorber ← lean amine; sweet gas out, rich amine to regenerator
Note: Uses SimpleTEGAbsorber which works for generic absorption. For amine-specific thermodynamics, the CPA EOS with MDEA is recommended.
{
"fluids": {
"sour_gas": {
"model": "CPA", "temperature": "$FEED_T_K$", "pressure": "$FEED_P$",
"mixingRule": "CLASSIC_TX_CPA",
"components": "$SOUR_GAS_COMPOSITION$"
},
"lean_amine": {
"model": "CPA", "temperature": "$AMINE_T_K$", "pressure": "$FEED_P$",
"mixingRule": "CLASSIC_TX_CPA",
"components": {"MDEA": 0.40, "water": 0.60}
}
},
"process": [
{"type": "Stream", "name": "sour gas feed", "fluidRef": "sour_gas", "properties": {"flowRate": ["$GAS_FLOW$", "kg/hr"]}},
{"type": "Stream", "name": "lean amine", "fluidRef": "lean_amine", "properties": {"flowRate": ["$AMINE_FLOW$", "kg/hr"]}},
{"type": "SimpleTEGAbsorber", "name": "amine absorber", "inlet": "sour gas feed",
"properties": {"numberOfStages": "$STAGES$", "stageEfficiency": 0.5}},
{"type": "Heater", "name": "amine regenerator sim", "inlet": "amine absorber.liquidOut",
"properties": {"outTemperature": "$REGEN_T_K$"}}
],
"autoRun": true
}
Typical defaults: 10–20 stages, MDEA 40–50 wt%, amine circulation rate 50–100 L/kg acid gas, regenerator at 120–130°C. Use CPA EOS with mixing rule "CLASSIC_TX_CPA" for polar systems.
Template: Produced Water Treatment (Degassing)
Pattern: produced water → heater → 3-phase separator → water stripper or flash drum
{
"fluid": { "model": "CPA", "temperature": "$FEED_T_K$", "pressure": "$FEED_P$", "mixingRule": "CLASSIC_TX_CPA", "multiPhaseCheck": true,
"components": "$WATER_OIL_GAS_COMPOSITION$" },
"process": [
{"type": "Stream", "name": "produced water", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},
{"type": "Heater", "name": "water heater", "inlet": "produced water", "properties": {"outTemperature": "$HEATER_T_K$"}},
{"type": "ThreePhaseSeparator", "name": "water degasser", "inlet": "water heater.outlet"},
{"type": "ThrottlingValve", "name": "flash valve", "inlet": "water degasser.waterOut", "properties": {"outletPressure": "$FLASH_P$"}},
{"type": "Separator", "name": "atmospheric flash", "inlet": "flash valve.outlet"}
],
"autoRun": true
}
Typical defaults: Produced water at 60–80°C, degassing at 1–3 bara. Use CPA EOS with mixing rule "CLASSIC_TX_CPA" when water is a major component. Composition: primarily water (>95 mol%) with dissolved methane, CO2, and trace hydrocarbons.
12. Worked Examples
Example 1: Simple Text Description
Input:
"Feed gas at 80 bara and 40°C enters a cooler to 15°C. The cooled stream goes to a separator. Gas from the separator is compressed to 120 bara."
Extraction:
| Step |
Extracted |
| Composition |
NOT PROVIDED → flag as missing, use placeholder |
| Feed T |
40°C → 313.15 K |
| Feed P |
80 bara → 80.0 |
| Cooler |
Target 15°C → outTemperature: 288.15 |
| Separator |
After cooler, takes gas port |
| Compressor |
120 bara → outletPressure: 120.0 |
Output JSON:
{
"fluid": {
"model": "SRK", "temperature": 313.15, "pressure": 80.0,
"mixingRule": "classic",
"components": {"methane": 0.90, "ethane": 0.05, "propane": 0.03, "n-butane": 0.02}
},
"process": [
{"type": "Stream", "name": "feed gas", "properties": {"flowRate": [50000.0, "kg/hr"]}},
{"type": "Cooler", "name": "gas cooler", "inlet": "feed gas", "properties": {"outTemperature": 288.15}},
{"type": "Separator", "name": "scrubber", "inlet": "gas cooler.outlet"},
{"type": "Compressor", "name": "export compressor", "inlet": "scrubber.gasOut", "properties": {"outletPressure": 120.0, "isentropicEfficiency": 0.75}}
],
"autoRun": true
}
Report:
…(truncated)
1---2name: neqsim-process-extraction3description: Extracts process simulation data from unstructured sources (text, tables, PFDs, data sheets, STID/E3D line lists) and converts it to NeqSim JSON builder format or PipingRouteBuilder route models. USE WHEN: a user provides a process description, PFD, operating data, line-list table, or design document and wants a running NeqSim simulation. Covers equipment mapping, stream wiring, route hydraulics, unit conversion, composition normalization, and confidence scoring.4---56# NeqSim Process Extraction Skill78Convert unstructured engineering information into the canonical NeqSim JSON format9accepted by `ProcessSystem.fromJson()` and `ProcessSystem.fromJsonAndRun()`.1011## Core Principle1213> **Extract structured data into a constrained JSON schema. Do NOT write NeqSim Java/Python code.**14>15> The JSON schema is finite and well-defined. `ProcessSystem.fromJson()` handles all16> NeqSim API calls deterministically. Errors come back as structured, actionable messages.17>18> **P&ID operational workflow:** When the source is a P&ID and the user asks19> about a valve action, active train, isolation boundary, bypass, drain, vent,20> or control-loop behavior, load `neqsim-pid-process-operations`. Extract both21> the steady-state topology and the model delta needed to simulate the action.22>23> **Exception for route hydraulics:** When the source is a STID/E3D/P&ID/stress-isometric24> line-list table with serial pipe segments, use25> `neqsim.process.equipment.pipeline.routing.PipingRouteBuilder` rather than the generic26> JSON process builder. The route builder preserves line-list segment metadata, K-value27> minor losses, elevations, and explicit connection topology.28>29> **Architecture decision (MANDATORY):** Before assembling JSON, classify the process30> complexity. Small/medium processes (≤ ~15 units, single recycle loop) use a single31> `ProcessSystem`. Large processes (multiple plant areas, cross-area recycles, different32> fluids) must be split into multiple `ProcessSystem` objects composed inside a33> `ProcessModule`, or use pre-built `ProcessModuleBaseClass` implementations.34> See **Section 16** for the decision guide.3536---3738## 1. Target JSON Schema3940Every extraction must produce JSON matching this format:4142```json43{44 "fluid": {45 "model": "SRK",46 "temperature": 323.15,47 "pressure": 65.0,48 "mixingRule": "classic",49 "multiPhaseCheck": false,50 "components": {51 "methane": 0.80,52 "ethane": 0.08,53 "propane": 0.05,54 "CO2": 0.03,55 "n-butane": 0.02,56 "nitrogen": 0.01,57 "n-pentane": 0.005,58 "n-hexane": 0.00559 }60 },61 "process": [62 {"type": "Stream", "name": "well stream", "properties": {"flowRate": [75000.0, "kg/hr"]}},63 {"type": "ThreePhaseSeparator", "name": "inlet separator", "inlet": "well stream"},64 {"type": "Compressor", "name": "export compressor", "inlet": "inlet separator.gasOut",65 "properties": {"outletPressure": 120.0, "isentropicEfficiency": 0.78}},66 {"type": "ThrottlingValve", "name": "letdown valve", "inlet": "inlet separator.oilOut",67 "properties": {"outletPressure": 15.0}}68 ],69 "autoRun": true70}71```7273### Field Reference7475| Field | Type | Required | Description |76|-------|------|----------|-------------|77| `fluid.model` | string | Yes | EOS model: `SRK`, `PR`, `CPA`, `GERG2008`, `PCSAFT`, `UMRPRU` |78| `fluid.temperature` | number | Yes | Temperature in **Kelvin** |79| `fluid.pressure` | number | Yes | Pressure in **bara** |80| `fluid.mixingRule` | string | Yes | Usually `"classic"` for SRK/PR, `"CLASSIC_TX_CPA"` for CPA |81| `fluid.multiPhaseCheck` | boolean | No | Set `true` for water+HC or 3-phase systems |82| `fluid.components` | object | Yes | Component name → mole fraction (must sum to ~1.0) |83| `process[].type` | string | Yes | Equipment type from the Equipment Type Table below |84| `process[].name` | string | Yes | Unique equipment tag / display name |85| `process[].inlet` | string | Conditional | Stream reference (dot-notation). Required for all except 1st Stream |86| `process[].properties` | object | No | Equipment-specific settings (see Properties Reference) |87| `autoRun` | boolean | No | Set `true` to auto-run after building |8889### Multiple Fluids (Named)9091For processes with different feed compositions, use the `fluids` map:9293```json94{95 "fluids": {96 "gas_feed": { "model": "SRK", "temperature": 323.15, "pressure": 80.0, "mixingRule": "classic", "components": {"methane": 0.90, "ethane": 0.05, "propane": 0.03, "n-butane": 0.02} },97 "water_feed": { "model": "CPA", "temperature": 293.15, "pressure": 80.0, "mixingRule": "CLASSIC_TX_CPA", "components": {"water": 0.999, "MEG": 0.001} }98 },99 "process": [100 {"type": "Stream", "name": "gas inlet", "fluidRef": "gas_feed", "properties": {"flowRate": [50000.0, "kg/hr"]}},101 {"type": "Stream", "name": "water inlet", "fluidRef": "water_feed", "properties": {"flowRate": [5000.0, "kg/hr"]}}102 ]103}104```105106---107108## 2. Equipment Type Mapping109110Map natural language equipment names to NeqSim JSON `type` values.111Use the **longest matching keyword** to avoid false matches.112113### Separation114115| Natural Language Synonyms | NeqSim `type` |116|---------------------------|---------------|117| separator, 2-phase separator, two-phase separator, flash drum, flash vessel, KO drum, knock-out drum, knockout drum, scrubber, inlet scrubber, suction scrubber, slug catcher, production scrubber, gas scrubber | `Separator` |118| 3-phase separator, three-phase separator, production separator, test separator, oil-water-gas separator, 3-phase test separator | `ThreePhaseSeparator` |119120### Compression & Expansion121122| Natural Language Synonyms | NeqSim `type` |123|---------------------------|---------------|124| compressor, gas compressor, export compressor, recompressor, booster compressor, LP compressor, HP compressor, 1st stage compressor, 2nd stage compressor, 3rd stage compressor, centrifugal compressor, reciprocating compressor | `Compressor` |125| expander, turbo-expander, turboexpander, power recovery turbine | `Expander` |126127### Heat Transfer128129| Natural Language Synonyms | NeqSim `type` |130|---------------------------|---------------|131| cooler, gas cooler, aftercooler, after-cooler, intercooler, air cooler, fin fan cooler, air-fin cooler, trim cooler, export cooler, overhead condenser | `Cooler` |132| heater, pre-heater, preheater, line heater, electric heater, fired heater, reboiler, trim heater | `Heater` |133| heat exchanger, shell and tube, shell-and-tube, plate heat exchanger, plate-fin exchanger, FWHE, gas-gas exchanger, cross-exchanger, economizer | `HeatExchanger` |134135### Valves136137| Natural Language Synonyms | NeqSim `type` |138|---------------------------|---------------|139| valve, throttling valve, choke valve, choke, JT valve, Joule-Thomson valve, letdown valve, control valve, pressure control valve, PCV, backpressure valve, production choke, wellhead choke | `ThrottlingValve` |140141### Pumps142143| Natural Language Synonyms | NeqSim `type` |144|---------------------------|---------------|145| pump, centrifugal pump, export pump, booster pump, injection pump, feed pump, charge pump, transfer pump, multiphase pump | `Pump` |146147### Piping Routes148149| Natural Language Synonyms | NeqSim target |150|---------------------------|---------------|151| line list, line-list, route table, STID route, E3D route, stress isometric, pipe run list, serial piping route, compressor suction route, compressor discharge route | `PipingRouteBuilder` |152153`PipingRouteBuilder` is not a JSON equipment type. It is a Java/Python-accessible154builder for serial route hydraulics. Use it when the input table has from/to155nodes, pipe lengths, sizes, elevations, fittings, valves, and K values. Extract156the route rows first, then build the route model and export `route.toJson()` for157traceability.158159For P&ID valve-action studies, classify each valve before mapping it to NeqSim:160control valves become `ThrottlingValve` equipment, isolation and shutdown valves161become scenario switches or boundary states, check valves become directed route162constraints, and BDV/PSV/vent valves become relief or blowdown paths.163164### Mixing & Splitting165166| Natural Language Synonyms | NeqSim `type` |167|---------------------------|---------------|168| mixer, mixing tee, junction, merge, combine | `Mixer` |169| splitter, tee, flow divider, bypass tee | `Splitter` |170| manifold, production manifold, gathering manifold, commingling manifold, subsea manifold, inlet/export header | `Manifold` |171172**Always model a manifold as `Manifold`, not `Mixer`/`Splitter`.** Add all inlet173streams with `addStream(...)`, then **route downstream from a split stream, not174`getMixedStream()`.** A single-destination gathering manifold sets one split175(`setSplitFactors([1.0])`) and routes `getSplitStream(0)`; a distributing176manifold sets `setSplitFactors([...])` (fractions summing to 1) and reads each177outlet with `getSplitStream(i)`. `getMixedStream()` is the internal commingled178stream (before the split) — for inspection only. The `Manifold` also carries179header / branch diameters for hydraulics and mechanical design.180181### Streams182183| Natural Language Synonyms | NeqSim `type` |184|---------------------------|---------------|185| stream, feed, inlet, well stream, feed gas, feed stream, input, source | `Stream` |186187### Other Equipment188189| Natural Language Synonyms | NeqSim `type` |190|---------------------------|---------------|191| tank, storage tank, atmospheric tank, settling tank, buffer tank | `Tank` |192| flare, flare stack, flare header, HP flare, LP flare | `Flare` |193| recycle, recirculation | `Recycle` |194| ejector, jet pump, steam ejector, gas ejector | `Ejector` |195| TEG absorber, glycol contactor, TEG contactor, dehydration absorber | `SimpleTEGAbsorber` |196| reservoir, simple reservoir | `SimpleReservoir` |197| electrolyzer, water electrolyzer, PEM electrolyzer | `Electrolyzer` |198| CO2 electrolyzer | `CO2Electrolyzer` |199| fuel cell | `FuelCell` |200| wind turbine | `WindTurbine` |201| solar panel, PV panel | `SolarPanel` |202| battery storage, battery, BESS | `BatteryStorage` |203| ammonia reactor, Haber-Bosch reactor, ammonia synthesis | `AmmoniaSynthesisReactor` |204| distillation column, fractionation column, distillation tower, deethanizer, demethanizer, depropanizer, debutanizer, stripper column, stabilizer column | `DistillationColumn` |205| pipe, pipe segment, pipeline, flowline, adiabatic pipe | `AdiabaticPipe` |206| stream saturator, saturator, water saturator | `StreamSaturatorUtil` |207208---209210## 3. Stream Wiring (Dot-Notation)211212Equipment is connected via dot-notation references in the `inlet` field.213214### Port Reference Table215216| Upstream Equipment Type | Port Syntax | Resolves To |217|-------------------------|-------------|-------------|218| `Stream` | `"feed"` (name only, no port) | The stream directly |219| `Separator` | `"HP Sep.gasOut"` | Gas outlet stream |220| `Separator` | `"HP Sep.liquidOut"` | Liquid outlet stream |221| `ThreePhaseSeparator` | `"Inlet Sep.gasOut"` | Gas outlet |222| `ThreePhaseSeparator` | `"Inlet Sep.oilOut"` | Oil outlet |223| `ThreePhaseSeparator` | `"Inlet Sep.waterOut"` | Water outlet |224| `ThreePhaseSeparator` | `"Inlet Sep.liquidOut"` | Oil outlet (alias) |225| `Compressor` | `"Comp.outlet"` | Outlet stream |226| `Cooler` | `"Cooler.outlet"` | Outlet stream |227| `Heater` | `"Heater.outlet"` | Outlet stream |228| `ThrottlingValve` | `"Valve.outlet"` | Outlet stream |229| `Pump` | `"Pump.outlet"` | Outlet stream |230| `Expander` | `"Expander.outlet"` | Outlet stream |231| `Mixer` | `"Mixer.outlet"` | Outlet stream |232| `Splitter` | `"Splitter.outlet"` | Outlet stream (first split) |233| `Splitter` | `"Splitter.split0"` | Split port 0 |234| `Splitter` | `"Splitter.split1"` | Split port 1 |235| `Splitter` | `"Splitter.splitN"` | Split port N (zero-indexed) |236| `HeatExchanger` | `"HX.outlet"` | Outlet stream |237| `DistillationColumn` | `"Column.gasOut"` | Gas (overhead) outlet |238| `DistillationColumn` | `"Column.liquidOut"` | Liquid (bottoms) outlet |239| `Tank` | `"Tank.outlet"` | Outlet stream |240241### Wiring Rules2422431. **First equipment MUST be a `Stream`** — it gets the fluid from the `fluid` section2442. **Every subsequent equipment MUST have an `inlet` reference** pointing to a previously defined equipment2453. **For separators, specify the port** — `gasOut`, `liquidOut`, `oilOut`, `waterOut`2464. **For single-outlet equipment** — use `"name.outlet"` or just `"name"` (default resolves to outlet)2475. **Do NOT create circular references** — the JSON builder does not support recycle loops directly (add `Recycle` equipment for convergence)2486. **Branching is supported** — multiple equipment can reference different ports of the same separator2497. **Mixer multi-inlet: use `"inlets"` (plural)** — Mixers require `"inlets": ["stream1", "stream2"]` (array). Do NOT use `"inlet"` with an array — it will fail with "Array must have size 1"2508. **Separator name without port returns null** — `resolveStreamReference("HP Sep")` returns `null`. Always use `"HP Sep.gasOut"` or `"HP Sep.liquidOut"`251252### Branching Example253254```json255{"type": "ThreePhaseSeparator", "name": "inlet sep", "inlet": "feed"},256{"type": "Compressor", "name": "gas comp", "inlet": "inlet sep.gasOut", ...},257{"type": "ThrottlingValve", "name": "oil valve", "inlet": "inlet sep.oilOut", ...},258{"type": "Pump", "name": "water pump", "inlet": "inlet sep.waterOut", ...}259```260261### Mixer Multi-Inlet Example262263```json264{"type": "Stream", "name": "gas 1", "properties": {"flowRate": [10000.0, "kg/hr"]}},265{"type": "Stream", "name": "gas 2", "properties": {"flowRate": [5000.0, "kg/hr"]}},266{"type": "Mixer", "name": "gas mixer", "inlets": ["gas 1", "gas 2"]},267{"type": "Cooler", "name": "mixed cooler", "inlet": "gas mixer", "properties": {"outletTemperature": [25.0, "C"]}}268```269270> **CRITICAL**: Use `"inlets"` (plural key, with array value) for Mixer/multi-inlet equipment. Using `"inlet"` with an array value will fail.271272---273274## 4. Equipment Properties Reference275276### Stream277278| Property | Type | Unit | Example |279|----------|------|------|---------|280| `flowRate` | `[number, "unit"]` | kg/hr, MSm3/day, Am3/hr | `[75000.0, "kg/hr"]` |281| `temperature` | number | Kelvin | `353.15` (= 80°C) |282| `pressure` | number | bara | `65.0` |283284### Compressor285286| Property | Type | Default | Description |287|----------|------|---------|-------------|288| `outletPressure` | number (bara) | — | Discharge pressure |289| `isentropicEfficiency` | number (0-1) | 0.75 | Isentropic efficiency |290| `polytropicEfficiency` | number (0-1) | — | Polytropic efficiency (alternative) |291| `usePolytropicCalc` | boolean | false | Use polytropic head calculation |292293### Cooler / Heater294295| Property | Type | Default | Description |296|----------|------|---------|-------------|297| `outTemperature` | number (K) | — | Outlet temperature in Kelvin |298| `outletTemperature` | `[number, "unit"]` | — | Outlet temperature with unit (e.g., `[25.0, "C"]`) |299300**Property Unit Arrays:** Equipment properties can be specified with units using the `[value, "unit"]` array format. This applies to any property that accepts a unit string, such as `outletTemperature`, `flowRate`, etc. The JSON builder uses Java reflection to find matching setter methods.301302### ThrottlingValve303304| Property | Type | Default | Description |305|----------|------|---------|-------------|306| `outletPressure` | number (bara) | — | Downstream pressure |307308### Pump309310| Property | Type | Default | Description |311|----------|------|---------|-------------|312| `outletPressure` | number (bara) | — | Discharge pressure |313| `isentropicEfficiency` | number (0-1) | 0.75 | Isentropic efficiency |314315### Separator / ThreePhaseSeparator316317No required properties. Operates at inlet conditions.318319### Splitter320321| Property | Type | Default | Description |322|----------|------|---------|-------------|323| `splitNumber` | integer | — | Number of outlet streams |324| `splitFactors` | `[number, ...]` | — | Split factors per outlet (e.g., `[0.5, 0.5]`) |325326### DistillationColumn327328| Property | Type | Default | Description |329|----------|------|---------|-------------|330| `numberOfTrays` | integer | 10 | Number of theoretical trays |331| `hasReboiler` | boolean | true | Whether column has a reboiler |332| `hasCondenser` | boolean | true | Whether column has a condenser |333334### HeatExchanger (Multi-Inlet)335336`HeatExchanger` supports two inlets (hot and cold side):337338```json339{"type": "HeatExchanger", "name": "gas-gas HX",340 "inlets": ["hot stream", "cold stream"]}341```342343The first inlet becomes the feed stream; the second is set via `setFeedStream(1, stream)`.344345### AdiabaticPipe346347| Property | Type | Default | Description |348|----------|------|---------|-------------|349| `length` | number (m) | — | Pipe length in meters |350| `diameter` | number (m) | — | Pipe inner diameter in meters |351352### Route-Level Piping Line Lists353354When the source has a line-list or stress-isometric table, extract these fields355before constructing the route:356357| Extracted field | Required | Notes |358|-----------------|----------|-------|359| `segment_id` | Yes | Line number, row id, or generated `S1`, `S2` |360| `from_node`, `to_node` | Yes | Equipment tag, nozzle, tee, manifold, or route node |361| `length`, `length_unit` | Yes | Straight pipe length, not equivalent length |362| `internal_diameter`, `diameter_unit` | Yes | Convert NPS/schedule to internal diameter first |363| `wall_thickness`, `wall_thickness_unit` | No | Store if schedule or stress iso gives it |364| `elevation_change`, `elevation_unit` | No | Positive uphill, negative downhill |365| `roughness`, `roughness_unit` | No | Use default roughness when only piping class is known |366| `minor_losses` | No | Fittings/valves as `{type, k_value}` rows |367| `source_ref` | Yes | Drawing/page/row reference for traceability |368369Route extraction workflow:3703711. Sort rows in hydraulic flow order from upstream to downstream.3722. Convert NPS/schedule to internal diameter before calling `addSegment(...)`.3733. Convert every valve, bend, tee, reducer, strainer, and entry/exit loss to K.3744. For a route-only study, build the route with `PipingRouteBuilder.build(feedStream)`375 and run the returned `ProcessSystem`.3765. For a full plant model, call `route.addToProcessSystem(process, inletStream)`377 and pass the returned outlet stream to the downstream equipment. Use the overload378 with source-equipment metadata when the inlet is an upstream equipment outlet stream.3796. Save `route.toJson()` and pressure-drop results in the task folder.380381Reference guide: `docs/process/piping_route_builder.md`.382383---384385## 5. Component Name Mapping386387Map common aliases to NeqSim database names. The NeqSim name is case-sensitive.388389### Hydrocarbon Components390391| Common Aliases | NeqSim Name |392|----------------|-------------|393| C1, CH4, methane | `methane` |394| C2, C2H6, ethane | `ethane` |395| C3, C3H8, propane | `propane` |396| iC4, i-C4, isobutane | `i-butane` |397| nC4, n-C4, butane, normal-butane | `n-butane` |398| iC5, i-C5, isopentane | `i-pentane` |399| nC5, n-C5, pentane, normal-pentane | `n-pentane` |400| nC6, n-C6, hexane | `n-hexane` |401| nC7, n-C7, heptane | `n-heptane` |402| nC8, n-C8, octane | `n-octane` |403| nC9, n-C9, nonane | `n-nonane` |404| nC10, n-C10, decane | `nC10` |405| nC11 through nC24 | `nC11` through `nC24` |406407### Non-Hydrocarbon Components408409| Common Aliases | NeqSim Name |410|----------------|-------------|411| CO2, carbon dioxide | `CO2` |412| H2S, hydrogen sulfide, hydrogen sulphide | `H2S` |413| N2, nitrogen | `nitrogen` |414| H2, hydrogen | `hydrogen` |415| O2, oxygen | `oxygen` |416| Ar, argon | `argon` |417| He, helium | `helium` |418| H2O, water | `water` |419| Hg, mercury | `mercury` |420| COS, carbonyl sulfide | `COS` |421| SO2, sulfur dioxide | `SO2` |422423### Chemical Additives424425| Common Aliases | NeqSim Name |426|----------------|-------------|427| MEG, monoethylene glycol, ethylene glycol | `MEG` |428| DEG, diethylene glycol | `DEG` |429| TEG, triethylene glycol | `TEG` |430| MeOH, methanol | `methanol` |431| EtOH, ethanol | `ethanol` |432| MDEA, methyldiethanolamine | `MDEA` |433434### Aromatics435436| Common Aliases | NeqSim Name |437|----------------|-------------|438| benzene, C6H6 | `benzene` |439| toluene, C7H8, methylbenzene | `toluene` |440| cyclohexane, c-C6, cy-C6 | `c-hexane` |441| cyclopentane, c-C5, cy-C5 | `c-C5` |442443---444445## 6. Unit Conversion Rules446447All NeqSim JSON values must be in standard units. Convert before inserting into JSON.448449### Temperature450451| Input Unit | To Kelvin | Formula |452|------------|-----------|---------|453| °C, degC, Celsius | K | `T_K = T_C + 273.15` |454| °F, degF, Fahrenheit | K | `T_K = (T_F - 32) × 5/9 + 273.15` |455| K, Kelvin | K | Identity |456| °R, Rankine | K | `T_K = T_R × 5/9` |457458### Pressure459460| Input Unit | To bara | Formula |461|------------|---------|---------|462| barg, bar gauge | bara | `P_bara = P_barg + 1.01325` |463| bara, bar absolute | bara | Identity |464| psia, psi absolute | bara | `P_bara = P_psia × 0.0689476` |465| psig, psi gauge | bara | `P_bara = (P_psig + 14.696) × 0.0689476` |466| kPa, kilopascal | bara | `P_bara = P_kPa / 100.0` |467| MPa, megapascal | bara | `P_bara = P_MPa × 10.0` |468| atm, atmosphere | bara | `P_bara = P_atm × 1.01325` |469470### Flow Rate471472Flow rate in JSON uses the `[value, "unit"]` array format. Supported unit strings:473474| Unit String | Description |475|-------------|-------------|476| `"kg/hr"` | Kilograms per hour (mass flow) |477| `"kg/min"` | Kilograms per minute |478| `"kg/sec"` | Kilograms per second |479| `"m3/hr"` | Cubic meters per hour (volume flow) |480| `"Am3/hr"` | Actual cubic meters per hour |481| `"Sm3/hr"` | Standard cubic meters per hour |482| `"MSm3/day"` | Million standard cubic meters per day |483| `"idSm3/day"` | Ideal standard cubic meters per day |484| `"mole/sec"` | Moles per second |485| `"mole/hr"` | Moles per hour |486487### Composition: Weight% to Mole Fraction Conversion488489NeqSim uses **mole fractions** (summing to 1.0) in the JSON `components` field. If the source provides weight% (wt%), mass fractions, or ppm-by-weight, convert as follows:490491**Formula:**492493For each component $i$ with weight fraction $w_i$ and molar mass $M_i$:494495$$x_i = \frac{w_i / M_i}{\sum_j (w_j / M_j)}$$496497**Common Molar Masses (g/mol):**498499| Component | NeqSim Name | $M$ (g/mol) |500|-----------|-------------|-------------|501| Methane | `methane` | 16.04 |502| Ethane | `ethane` | 30.07 |503| Propane | `propane` | 44.10 |504| n-Butane | `n-butane` | 58.12 |505| i-Butane | `i-butane` | 58.12 |506| n-Pentane | `n-pentane` | 72.15 |507| n-Hexane | `n-hexane` | 86.18 |508| CO2 | `CO2` | 44.01 |509| H2S | `H2S` | 34.08 |510| Nitrogen | `nitrogen` | 28.01 |511| Water | `water` | 18.02 |512| MEG | `MEG` | 62.07 |513| TEG | `TEG` | 150.17 |514| MDEA | `MDEA` | 119.16 |515516**Worked Example:**517518Input: 70 wt% methane, 20 wt% ethane, 10 wt% propane519520| Component | $w_i$ | $M_i$ | $w_i / M_i$ | $x_i$ (mole frac) |521|-----------|--------|--------|-------------|-------------------|522| methane | 0.70 | 16.04 | 0.04364 | 0.8370 |523| ethane | 0.20 | 30.07 | 0.00665 | 0.1275 |524| propane | 0.10 | 44.10 | 0.00227 | 0.0355 |525| **Total** | 1.00 | | 0.05216 | **1.0000** |526527Result JSON: `{"methane": 0.837, "ethane": 0.128, "propane": 0.035}`528529**ppm-by-weight:** Convert ppm_w to weight fraction first: $w_i = \text{ppm}_w \times 10^{-6}$530531**Volume% (gas at standard conditions):** Volume% ≈ mole% for ideal gas behavior. Use directly as mole fractions.532533---534535## 7. EOS Model Selection536537Choose the thermodynamic model based on the fluid system:538539| Fluid System | Recommended Model | Mixing Rule |540|-------------|-------------------|-------------|541| Dry gas, lean gas, simple hydrocarbons | `SRK` | `"classic"` |542| Oil systems, general hydrocarbons | `PR` | `"classic"` |543| Water + hydrocarbons, MEG/methanol, polar | `CPA` | `"CLASSIC_TX_CPA"` |544| Fiscal metering, custody transfer | `GERG2008` | (none needed) |545| Polymer/associating fluids | `PCSAFT` | `"classic"` |546547### Decision Rules5485491. **If water or glycol is present** → use `CPA` with mixing rule `"CLASSIC_TX_CPA"` and set `multiPhaseCheck: true`5502. **If accuracy for gas density/Z-factor is critical** → use `GERG2008`5513. **If heavy oil (C20+)** → use `PR` or `SRK` with `"classic"` mixing rule5524. **Default / unknown** → use `SRK` with `"classic"` mixing rule553554---555556## 8. Extraction Workflow557558Follow this step-by-step process for every extraction:559560### Step 1: Identify the Source Type561562- **Text description** — paragraph or bullet list describing a process563- **Table / spreadsheet** — heat & mass balance, operating data, well test564- **PFD / sketch** — process flow diagram (described or as image)565- **Data sheet** — equipment data sheet with design conditions566- **Mixed** — combination of above567568### Step 2: Extract Fluid Composition5695701. Look for: mole fractions, mol%, weight%, component tables5712. Map component names to NeqSim names using the Component Name Mapping table5723. Normalize to mole fractions summing to 1.05734. If weight% given, note it as an assumption (NeqSim uses mole fractions)5745. If no composition given, flag as missing and use a placeholder575576### Step 3: Extract Equipment List5775781. Scan for equipment keywords using the Equipment Type Mapping table5792. Match the **longest keyword first** (e.g., "three-phase separator" before "separator")5803. Assign unique names/tags (use P&ID tags if provided, or generate descriptive names)5814. Record the NeqSim `type` for each582583### Step 4: Extract Stream Connectivity5845851. Look for phrases indicating flow direction: "enters", "goes to", "feeds", "is routed to", "flows to", "passes through"5862. Identify which phase exits which equipment: "gas from the separator", "oil from the 3-phase separator", "compressed gas"5873. Build dot-notation references: `"equipment_name.port"`5884. Verify no orphan streams (every equipment except feed has an inlet)589590### Step 5: Extract Operating Conditions5915921. Pressures: look for `bara`, `barg`, `bar`, `psi`, `MPa`, `kPa`, `atm`5932. Temperatures: look for `°C`, `°F`, `K`, `degC`, `degF`5943. Flow rates: look for `kg/hr`, `t/h`, `MMSCFD`, `MSm3/d`, `Am3/hr`5954. Convert all to NeqSim standard units (K, bara)5965. Assign to the correct equipment property597598### Step 6: Assemble JSON5996001. Build the `fluid` section with model, T, P, mixing rule, and components6012. Build the `process` array in topological order (upstream before downstream)6023. First element MUST be a `Stream` with the feed fluid6034. Wire all equipment with `inlet` references6045. Set `autoRun: true`605606### Step 7: Validate and Report6076081. Check composition sums to ~1.0 (within 0.01)6092. Check all stream references point to existing equipment6103. Check no circular references6114. Compute confidence score (see Confidence Scoring below)6125. List all assumptions made6136. List all missing information detected614615---616617## 9. Confidence Scoring618619Score the extraction confidence on a 0.0–1.0 scale:620621| Criterion | Points |622|-----------|--------|623| Fluid composition explicitly provided | +0.25 |624| Feed temperature specified | +0.10 |625| Feed pressure specified | +0.10 |626| Feed flow rate specified | +0.10 |627| All equipment have explicit operating conditions | +0.15 |628| Stream topology clearly described | +0.15 |629| Equipment tags/names from source (not generated) | +0.05 |630| EOS model specified or inferable from context | +0.05 |631| No conflicting information in source | +0.05 |632633### Confidence Bands634635| Score | Label | Recommendation |636|-------|-------|----------------|637| 0.80–1.00 | **High** | Run directly, review results |638| 0.60–0.79 | **Medium** | Run but flag assumptions for user review |639| 0.40–0.59 | **Low** | More information needed — show what's missing |640| 0.00–0.39 | **Very Low** | Cannot produce reliable simulation — ask user |641642---643644## 10. Assumption Defaults645646When information is not specified, use these engineering defaults and **always track them**:647648| Parameter | Default Value | Assumption Text |649|-----------|---------------|-----------------|650| EOS model | SRK | "Default SRK EOS (not specified in source)" |651| Mixing rule | classic | "Classic mixing rule assumed" |652| Feed temperature | 288.15 K (15°C) | "Standard temperature assumed (15°C)" |653| Feed pressure | 1.01325 bara | "Atmospheric pressure assumed" |654| Feed flow rate | 50000 kg/hr | "Default flow rate 50000 kg/hr assumed" |655| Compressor efficiency | 0.75 (isentropic) | "Default isentropic efficiency 0.75 assumed" |656| Cooler outlet temp | 308.15 K (35°C) | "Default cooler outlet 35°C assumed" |657| Composition (no data) | 90% CH4, 5% C2, 3% C3, 2% nC4 | "Placeholder lean gas composition used" |658659---660661## 11. Process Templates662663When the extracted topology matches a known pattern, use a template for better reliability.664665### Template: Gas Dew Point Control666667**Pattern:** cooler → separator → compressor668669```json670{671 "fluid": { "model": "SRK", "temperature": "$FEED_T_K$", "pressure": "$FEED_P$", "mixingRule": "classic", "components": "$COMPOSITION$" },672 "process": [673 {"type": "Stream", "name": "feed", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},674 {"type": "Cooler", "name": "dew point cooler", "inlet": "feed", "properties": {"outTemperature": "$COOLER_T_K$"}},675 {"type": "Separator", "name": "cold separator", "inlet": "dew point cooler.outlet"},676 {"type": "Compressor", "name": "export compressor", "inlet": "cold separator.gasOut", "properties": {"outletPressure": "$EXPORT_P$", "isentropicEfficiency": 0.78}}677 ],678 "autoRun": true679}680```681682### Template: Two-Stage HP/LP Separation683684**Pattern:** 3-phase sep → gas compression + oil letdown → LP sep → recompression685686```json687{688 "fluid": { "model": "SRK", "temperature": "$FEED_T_K$", "pressure": "$HP_P$", "mixingRule": "classic", "components": "$COMPOSITION$" },689 "process": [690 {"type": "Stream", "name": "well stream", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},691 {"type": "ThreePhaseSeparator", "name": "HP separator", "inlet": "well stream"},692 {"type": "Cooler", "name": "gas cooler", "inlet": "HP separator.gasOut", "properties": {"outTemperature": 308.15}},693 {"type": "Compressor", "name": "export compressor", "inlet": "gas cooler.outlet", "properties": {"outletPressure": "$EXPORT_P$", "isentropicEfficiency": 0.78}},694 {"type": "ThrottlingValve", "name": "HP-LP valve", "inlet": "HP separator.oilOut", "properties": {"outletPressure": "$LP_P$"}},695 {"type": "Separator", "name": "LP separator", "inlet": "HP-LP valve.outlet"},696 {"type": "Compressor", "name": "LP recompressor", "inlet": "LP separator.gasOut", "properties": {"outletPressure": "$HP_P$", "isentropicEfficiency": 0.75}}697 ],698 "autoRun": true699}700```701702### Template: Multi-Stage Compression with Intercooling703704**Pattern:** compressor → cooler → scrubber → compressor → cooler → scrubber → ... (N stages)705706Build dynamically with equal pressure ratio per stage:707708- `ratio_per_stage = (P_out / P_in) ^ (1/N)`709- `stage_P[i] = P_in × ratio_per_stage^i`710- Each stage: `Compressor` → `Cooler` (to intercooler temp) → `Separator` (scrub condensate)711- Last stage: `Compressor` only (no aftercooler/scrubber, unless specified)712713### Template: Gas Cooling and JT Expansion714715**Pattern:** cooler → separator → JT valve → cold separator716717```json718{719 "fluid": { "model": "SRK", "temperature": "$FEED_T_K$", "pressure": "$FEED_P$", "mixingRule": "classic", "components": "$COMPOSITION$" },720 "process": [721 {"type": "Stream", "name": "feed", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},722 {"type": "Cooler", "name": "pre-cooler", "inlet": "feed", "properties": {"outTemperature": "$PRECOOL_T_K$"}},723 {"type": "Separator", "name": "inlet scrubber", "inlet": "pre-cooler.outlet"},724 {"type": "ThrottlingValve", "name": "JT valve", "inlet": "inlet scrubber.gasOut", "properties": {"outletPressure": "$JT_P$"}},725 {"type": "Separator", "name": "cold separator", "inlet": "JT valve.outlet"}726 ],727 "autoRun": true728}729```730731### Template: Simple Oil Stabilization732733**Pattern:** 3-phase sep → valve → flash drum → valve → atmospheric flash734735```json736{737 "fluid": { "model": "SRK", "temperature": "$FEED_T_K$", "pressure": "$HP_P$", "mixingRule": "classic", "multiPhaseCheck": true, "components": "$COMPOSITION$" },738 "process": [739 {"type": "Stream", "name": "well fluid", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},740 {"type": "ThreePhaseSeparator", "name": "production separator", "inlet": "well fluid"},741 {"type": "ThrottlingValve", "name": "1st stage valve", "inlet": "production separator.oilOut", "properties": {"outletPressure": "$STAGE2_P$"}},742 {"type": "Separator", "name": "2nd stage separator", "inlet": "1st stage valve.outlet"},743 {"type": "ThrottlingValve", "name": "2nd stage valve", "inlet": "2nd stage separator.liquidOut", "properties": {"outletPressure": "$STAGE3_P$"}},744 {"type": "Separator", "name": "stabilizer", "inlet": "2nd stage valve.outlet"}745 ],746 "autoRun": true747}748```749750### Template: Subsea Tieback (Well → Pipeline → Platform)751752**Pattern:** well stream → choke → pipeline → separator753754```json755{756 "fluid": { "model": "SRK", "temperature": "$WELLHEAD_T_K$", "pressure": "$WELLHEAD_P$", "mixingRule": "classic", "multiPhaseCheck": true, "components": "$COMPOSITION$" },757 "process": [758 {"type": "Stream", "name": "well stream", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},759 {"type": "ThrottlingValve", "name": "production choke", "inlet": "well stream", "properties": {"outletPressure": "$CHOKE_P$"}},760 {"type": "Heater", "name": "pipeline heat loss", "inlet": "production choke.outlet", "properties": {"outTemperature": "$ARRIVAL_T_K$"}},761 {"type": "ThreePhaseSeparator", "name": "inlet separator", "inlet": "pipeline heat loss.outlet"}762 ],763 "autoRun": true764}765```766767### Template: TEG Dehydration768769**Pattern:** wet gas → TEG absorber ← lean TEG; dry gas out, rich TEG out770771**Note:** `SimpleTEGAbsorber` requires two input streams added via `addGasInStream()` and `addSolventInStream()`. The JSON builder currently wires via the `inlet` field, so for TEG dehydration, build the lean TEG stream as a separate feed with a TEG+water fluid.772773```json774{775 "fluids": {776 "wet_gas": {777 "model": "SRK", "temperature": "$FEED_T_K$", "pressure": "$FEED_P$",778 "mixingRule": "classic",779 "components": "$GAS_COMPOSITION_WITH_WATER$"780 },781 "lean_teg": {782 "model": "CPA", "temperature": "$TEG_T_K$", "pressure": "$FEED_P$",783 "mixingRule": "CLASSIC_TX_CPA",784 "components": {"TEG": 0.99, "water": 0.01}785 }786 },787 "process": [788 {"type": "Stream", "name": "wet gas feed", "fluidRef": "wet_gas", "properties": {"flowRate": ["$GAS_FLOW$", "kg/hr"]}},789 {"type": "Stream", "name": "lean TEG", "fluidRef": "lean_teg", "properties": {"flowRate": ["$TEG_FLOW$", "kg/hr"]}},790 {"type": "SimpleTEGAbsorber", "name": "TEG absorber", "inlet": "wet gas feed",791 "properties": {"numberOfStages": "$STAGES$", "stageEfficiency": 0.5}},792 {"type": "Heater", "name": "TEG reboiler sim", "inlet": "TEG absorber.liquidOut",793 "properties": {"outTemperature": "$REBOILER_T_K$"}}794 ],795 "autoRun": true796}797```798799**Typical defaults:** 3–5 stages, stage efficiency 0.5, lean TEG flow 5–10× water to remove, reboiler at ~200°C (473 K). TEG purity: 99–99.5 wt%.800801### Template: NGL Recovery (Turbo-Expander + Demethanizer)802803**Pattern:** gas inlet → cooler → expander → demethanizer column; overhead = sales gas, bottoms = NGL804805```json806{807 "fluid": { "model": "SRK", "temperature": "$FEED_T_K$", "pressure": "$FEED_P$", "mixingRule": "classic", "components": "$COMPOSITION$" },808 "process": [809 {"type": "Stream", "name": "inlet gas", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},810 {"type": "Cooler", "name": "gas chiller", "inlet": "inlet gas", "properties": {"outTemperature": "$CHILLER_T_K$"}},811 {"type": "Separator", "name": "cold separator", "inlet": "gas chiller.outlet"},812 {"type": "Expander", "name": "turbo-expander", "inlet": "cold separator.gasOut", "properties": {"outletPressure": "$EXPANDER_P$", "isentropicEfficiency": 0.85}},813 {"type": "ThrottlingValve", "name": "liquid JT valve", "inlet": "cold separator.liquidOut", "properties": {"outletPressure": "$EXPANDER_P$"}},814 {"type": "Mixer", "name": "column feed mixer", "inlets": ["turbo-expander.outlet", "liquid JT valve.outlet"]},815 {"type": "Separator", "name": "demethanizer sim", "inlet": "column feed mixer.outlet"},816 {"type": "Compressor", "name": "residue compressor", "inlet": "demethanizer sim.gasOut", "properties": {"outletPressure": "$SALES_P$", "isentropicEfficiency": 0.78}}817 ],818 "autoRun": true819}820```821822**Note:** For a rigorous demethanizer, replace the Separator with a `Column` (DistillationColumn). The simplified version uses a cold separator as a proxy. Typical expander outlet: 15–25 bara, efficiency 0.82–0.88, chiller to –30°C to –40°C.823824### Template: Acid Gas Removal (Amine Sweetening)825826**Pattern:** sour gas → amine absorber ← lean amine; sweet gas out, rich amine to regenerator827828**Note:** Uses `SimpleTEGAbsorber` which works for generic absorption. For amine-specific thermodynamics, the CPA EOS with MDEA is recommended.829830```json831{832 "fluids": {833 "sour_gas": {834 "model": "CPA", "temperature": "$FEED_T_K$", "pressure": "$FEED_P$",835 "mixingRule": "CLASSIC_TX_CPA",836 "components": "$SOUR_GAS_COMPOSITION$"837 },838 "lean_amine": {839 "model": "CPA", "temperature": "$AMINE_T_K$", "pressure": "$FEED_P$",840 "mixingRule": "CLASSIC_TX_CPA",841 "components": {"MDEA": 0.40, "water": 0.60}842 }843 },844 "process": [845 {"type": "Stream", "name": "sour gas feed", "fluidRef": "sour_gas", "properties": {"flowRate": ["$GAS_FLOW$", "kg/hr"]}},846 {"type": "Stream", "name": "lean amine", "fluidRef": "lean_amine", "properties": {"flowRate": ["$AMINE_FLOW$", "kg/hr"]}},847 {"type": "SimpleTEGAbsorber", "name": "amine absorber", "inlet": "sour gas feed",848 "properties": {"numberOfStages": "$STAGES$", "stageEfficiency": 0.5}},849 {"type": "Heater", "name": "amine regenerator sim", "inlet": "amine absorber.liquidOut",850 "properties": {"outTemperature": "$REGEN_T_K$"}}851 ],852 "autoRun": true853}854```855856**Typical defaults:** 10–20 stages, MDEA 40–50 wt%, amine circulation rate 50–100 L/kg acid gas, regenerator at 120–130°C. Use CPA EOS with mixing rule "CLASSIC_TX_CPA" for polar systems.857858### Template: Produced Water Treatment (Degassing)859860**Pattern:** produced water → heater → 3-phase separator → water stripper or flash drum861862```json863{864 "fluid": { "model": "CPA", "temperature": "$FEED_T_K$", "pressure": "$FEED_P$", "mixingRule": "CLASSIC_TX_CPA", "multiPhaseCheck": true,865 "components": "$WATER_OIL_GAS_COMPOSITION$" },866 "process": [867 {"type": "Stream", "name": "produced water", "properties": {"flowRate": ["$FLOW$", "kg/hr"]}},868 {"type": "Heater", "name": "water heater", "inlet": "produced water", "properties": {"outTemperature": "$HEATER_T_K$"}},869 {"type": "ThreePhaseSeparator", "name": "water degasser", "inlet": "water heater.outlet"},870 {"type": "ThrottlingValve", "name": "flash valve", "inlet": "water degasser.waterOut", "properties": {"outletPressure": "$FLASH_P$"}},871 {"type": "Separator", "name": "atmospheric flash", "inlet": "flash valve.outlet"}872 ],873 "autoRun": true874}875```876877**Typical defaults:** Produced water at 60–80°C, degassing at 1–3 bara. Use CPA EOS with mixing rule "CLASSIC_TX_CPA" when water is a major component. Composition: primarily water (>95 mol%) with dissolved methane, CO2, and trace hydrocarbons.878879---880881## 12. Worked Examples882883### Example 1: Simple Text Description884885**Input:**886> "Feed gas at 80 bara and 40°C enters a cooler to 15°C. The cooled stream goes to a separator. Gas from the separator is compressed to 120 bara."887888**Extraction:**889890| Step | Extracted |891|------|-----------|892| Composition | NOT PROVIDED → flag as missing, use placeholder |893| Feed T | 40°C → `313.15` K |894| Feed P | 80 bara → `80.0` |895| Cooler | Target 15°C → `outTemperature: 288.15` |896| Separator | After cooler, takes gas port |897| Compressor | 120 bara → `outletPressure: 120.0` |898899**Output JSON:**900```json901{902 "fluid": {903 "model": "SRK", "temperature": 313.15, "pressure": 80.0,904 "mixingRule": "classic",905 "components": {"methane": 0.90, "ethane": 0.05, "propane": 0.03, "n-butane": 0.02}906 },907 "process": [908 {"type": "Stream", "name": "feed gas", "properties": {"flowRate": [50000.0, "kg/hr"]}},909 {"type": "Cooler", "name": "gas cooler", "inlet": "feed gas", "properties": {"outTemperature": 288.15}},910 {"type": "Separator", "name": "scrubber", "inlet": "gas cooler.outlet"},911 {"type": "Compressor", "name": "export compressor", "inlet": "scrubber.gasOut", "properties": {"outletPressure": 120.0, "isentropicEfficiency": 0.75}}912 ],913 "autoRun": true914}915```916917**Report:**918- Confidence: 0.50 (temper919920…(truncated)