Schematex

P&ID (Piping & Instrumentation Diagram)

About P&IDs

A piping & instrumentation diagram (P&ID) is the engineering "wiring diagram" of a process plant — every vessel, pump, heat exchanger, valve, and instrument loop, drawn with standardized symbols and connected by piping and signal lines. Process engineers, control engineers, and HSE auditors all read the same P&ID to specify the plant, commission it, run hazard reviews (HAZOP), and operate it in production. They are the legally-required engineering deliverable for chemical, petrochemical, pharmaceutical, water-treatment, and power generation projects under OSHA PSM and EPA RMP.

Schematex implements the ANSI/ISA-5.1-2009 symbol catalog (instrument bubbles, tag letter codes, signal-line types) plus equipment symbols from ISO 10628-1:2014 (vessels, columns, pumps, heat exchangers). The DSL is intentionally compact so an LLM can generate a control-loop P&ID from a process description in one shot.

P&ID·§ ISA-5.1 / ISO 10628
↘ preview
100%
P&ID — Pump with Flow Control ISA-5.1 / ISO 10628 P&ID rendered by Schematex Pump with Flow Control Feed Tank P-101 V-101 Filter V-201 FT 101 FIC 101
UTF-8 · LF · 17 lines · 658 chars✓ parsed·4.9 ms·5.6 KB SVG

1. Your first P&ID

A minimal P&ID has at least one piece of equipment and one process line.

P&ID·§ ISA-5.1 / ISO 10628
↘ preview
100%
P&ID ISA-5.1 / ISO 10628 P&ID rendered by Schematex T-1 P-1 V-1
UTF-8 · LF · 8 lines · 206 chars✓ parsed·0.8 ms·3.3 KB SVG

Three rules cover 80% of usage:

  1. Start the document with pid (optional title and [direction: LR] attrs).
  2. Declare each piece of equipment: equip <ID> : <type> [tag: "label"].
  3. Connect them with line <ID> from <equip>.<port> to <equip>.<port> [type: "process", size: "4\""].

Instrumentation is added separately with inst <TAG> : <category> plus indented measures / controls clauses.

Comments use # at the start of a line.


2. Equipment

The equip statement declares process equipment. The catalog follows ISO 10628 / ISA-5.1 conventions.

equip T-101 : tank_atm [tag: "Feed Tank"]
equip P-101 : pump_centrifugal
equip E-201 : hx_shell_tube [tag: "Overhead Cond"]
equip T-201 : column_tray [tag: "Stripper"]

2.1 Equipment catalog

TypeSymbolPurpose
tank_atmCylinder + dome topAtmospheric storage tank
tank_cone_roofCylinder + cone roofCone-roof storage tank
vessel_vVertical capsuleVertical pressure vessel
vessel_hHorizontal capsuleHorizontal pressure vessel
sphereFilled circleLPG / ammonia sphere
column_trayTall capsule + horizontal tray linesDistillation tray column
column_packedTall capsule + cross-hatchPacked absorption column
hx_shell_tubeHorizontal capsule + tube bundleShell-and-tube heat exchanger
hx_air_cooledRectangle + fan circleAir-cooled (fin-fan) cooler
reboilerCapsule + parallel tube linesKettle reboiler
condenserHorizontal capsule + tubesOverhead condenser
pump_centrifugalCircle + right-side triangle outletCentrifugal pump
pump_pdCircle + internal gearsPositive-displacement pump
compressorTrapezoid (narrow on right)Centrifugal compressor
blowerCircle + 3-blade fanBlower / fan
reactor_cstrVertical capsule + agitatorStirred tank reactor (CSTR)
reactor_pfrHorizontal capsule + packed bed dotsPlug-flow / fixed-bed reactor
filterRectangle + diagonal hatchFilter
cycloneCylinder + cone bottomCyclone separator
flareTall stack + flameFlare stack
cooling_towerHourglassInduced-draft cooling tower

2.2 Valve catalog

Valves are equipment that sit on the piping line. Render in bowtie style with type-specific actuator decoration.

TypeDecorationPurpose
valve_gatePlain bowtieManual on/off (full-port)
valve_ballBowtie + filled center circleManual on/off (quarter-turn)
valve_globeBowtie + small top circleManual flow control
valve_butterflyBowtie + center vertical lineQuarter-turn throttle
valve_checkBowtie + arcNon-return check valve
valve_controlBowtie + diaphragm actuatorPneumatic control valve (paired with FIC)
valve_psvBowtie + 45° outlet + spring stackPressure safety relief valve
equip V-101 : valve_control [tag: "V-101 (FC)"]
equip V-303 : valve_psv     [tag: "V-303 · 150 psig"]

3. Piping & signal lines

The line statement connects two anchor points (equipment ports or instrument tags).

line L1 from T-101.bottom to P-101.in  [size: "4\"", service: "water", type: "process"]
line s1 from FT-101 to FIC-101         [type: "electric"]
line s2 from FIC-101 to V-101          [type: "pneumatic"]

3.1 Anchor syntax

Each end of a line is either:

  • <equip-id>.<port> — port name from §2.2 (in, out, top, bottom, feed, shell_in, tube_out, reflux, etc.)
  • <equip-id> — port omitted; defaults to in (target) / out (source) per equipment family
  • <inst-tag> — instrument bubble center (signal lines)

3.2 Line types (ISA-5.1 §5)

type:StrokeUse
processSolid, thickMajor process line (default)
process_minorSolid, thinAuxiliary / utility
pneumaticSolid + diagonal tick marksAir-actuator signal
electricLong-dashElectric / 4–20 mA signal
hydraulicLong-dash + pauseHydraulic actuator
capillaryDotted (round caps)Filled-system temperature
softwareShort-dash, lightDCS / PLC internal data link
mechanicalMixed dashMechanical linkage

3.3 Line tags

The standard PIP PIC001 tag format is <size>"-<service>-<sequence>-<spec>. Pass it via the tag: attribute and the renderer places a small white tag rectangle at the line midpoint.

line L1 from T-101.bottom to P-101.in [size: "4\"", service: "PG", tag: "4\"-PG-101-A1B"]

4. Instrumentation (ISA-5.1 §4)

The inst statement declares an instrument bubble. The tag uses the ISA letter-code convention: first letter is the measured variable, subsequent letters are modifiers and function.

inst FT-101  : field_discrete         %% Flow Transmitter, loop 101
inst FIC-101 : cr_shared              %% Flow Indicating Controller (DCS)
inst PSHH-301: cr_plc                 %% Pressure Switch High-High (PLC)
inst LIC-201 : cr_shared
  measures D-201
  controls V-202

4.1 Letter codes (first letter)

Most-used: F flow · L level · P pressure · T temperature · A analysis · S speed · H hand · Y event/state. Full list in ISA-5.1 Table 1.

4.2 Function modifiers

I indicator · R recorder · C controller · T transmitter · E element · V valve · S switch · A alarm · H/L high/low. Combine into the multi-letter tag: FIC = Flow Indicating Controller; PSHH = Pressure Switch High-High.

4.3 Bubble categories

ISA-5.1 distinguishes location (where the instrument lives) and type (analog vs. shared vs. computer vs. PLC). Schematex implements the four most common combinations:

CategoryBubble shapeUse
field_discretePlain circleField-mounted analog instrument (FT, PT)
cr_sharedCircle + horizontal line + inscribed hexagonDCS-controlled HMI display
cr_computerCircle + horizontal line + inscribed diamondComputer function (FY, calculation)
cr_plcCircle + horizontal line + inscribed squarePLC-driven logic

field_* variants omit the horizontal centerline; local_* variants use a dashed centerline; cr_* variants use a solid centerline indicating "main control panel — front."

4.4 measures / controls

Indented under an inst declaration:

ClauseEffect
measures <equip-id>Auto-routed dashed-electric signal line from the equipment to the bubble
controls <equip-id>Auto-routed pneumatic signal line from the bubble to the equipment (typically a valve_control)
inst FT-101 : field_discrete
  measures P-101
inst FIC-101 : cr_shared
  controls V-101

These auto-signals are independent of the explicit line statements — they get rendered with the appropriate signal-line style based on the relation type.


5. Layout direction

The default direction is LR (left-to-right) — process feed enters on the left, product exits on the right. Override on the header:

pid "Distillation Tower" [direction: TB]

equip T-201 : column_tray

The MVP layout places equipment in declaration order along the primary direction with Manhattan signal-line routing. Multi-row / parallel-flow layouts and tee junctions are roadmap items — see §9.


6. Worked example: Distillation column

A real overhead-condenser loop with reboiler, reflux drum, and instrumentation:

P&ID·§ ISA-5.1 / ISO 10628
↘ preview
100%
P&ID — Distillation T-201 ISA-5.1 / ISO 10628 P&ID rendered by Schematex Distillation T-201 T-201 Overhead Cond Reflux Drum Reflux Pump Reboiler PT 201 LIC 201 TIC 201
UTF-8 · LF · 20 lines · 815 chars✓ parsed·2.1 ms·7.6 KB SVG

7. Grammar (EBNF)

document    = header statement*
header      = "pid" ( title )? ( "[" attrs "]" )? NEWLINE
attrs       = attr ("," attr)*
attr        = "direction:" ("LR" | "TB")
            | "units:" ("imperial" | "metric")

statement   = comment
            | equipment-decl
            | line-decl
            | instrument-decl

equipment-decl = "equip" ID ":" equip-type ( "[" attr-list "]" )? NEWLINE
equip-type     = "tank_atm" | "tank_cone_roof"
               | "vessel_v" | "vessel_h" | "sphere"
               | "column_tray" | "column_packed"
               | "hx_shell_tube" | "hx_air_cooled" | "reboiler" | "condenser"
               | "pump_centrifugal" | "pump_pd"
               | "compressor" | "blower"
               | "reactor_cstr" | "reactor_pfr"
               | "filter" | "cyclone" | "flare" | "cooling_tower"
               | "valve_gate" | "valve_ball" | "valve_globe" | "valve_butterfly"
               | "valve_check" | "valve_control" | "valve_psv"

line-decl   = "line" ID "from" anchor "to" anchor ( "[" attr-list "]" )? NEWLINE
anchor      = ID ( "." port )?
port        = "in" | "out" | "top" | "bottom" | "left" | "right"
            | "feed" | "reflux" | "shell_in" | "shell_out"
            | "tube_in" | "tube_out" | "vapor_out" | "liquid_out"
            | "bottom_return"

instrument-decl = "inst" tag ":" inst-category ( "[" attr-list "]" )? NEWLINE
                  ( indented "measures" anchor NEWLINE )*
                  ( indented "controls" ID NEWLINE )*
tag             = letter-code "-" loop-num     %% e.g., "FIC-101"
inst-category   = "field_discrete" | "field_shared" | "field_computer" | "field_plc"
                | "cr_discrete"    | "cr_shared"    | "cr_computer"    | "cr_plc"
                | "local_discrete" | "local_shared"

attr-list   = attr ("," attr)*
attr        = key ":" value
key         = "tag" | "size" | "service" | "type" | "set_pressure"
            | "actuator" | "fail" | "trays" | …
value       = quoted-string | bare-word

ID          = [A-Za-z] [A-Za-z0-9_-]*

Authoritative source: src/diagrams/pid/parser.ts. If this diverges from the parser, the parser wins — please open an issue.


8. Standard compliance

What is implemented today (P0 MVP):

  • ✅ 22 process-equipment symbols (vessels, columns, pumps, exchangers, reactors, separators, flare, cooling tower)
  • ✅ 7 valve symbols (gate, ball, globe, butterfly, check, control with diaphragm actuator, PSV with diagonal outlet + spring)
  • ✅ 4 instrument-bubble categories × 2 location classes = 8 ISA-5.1 bubble variants (field/CR × discrete/shared/computer/PLC)
  • ✅ ISA letter-code tag parsing (FT-101, LIC-203, PSHH-301)
  • ✅ 8 line-type styles (process / process_minor / pneumatic / electric / hydraulic / capillary / software / mechanical)
  • ✅ Auto-routed measures and controls signal lines
  • ✅ Line tags rendered as white-bg rectangles at line midpoint
  • ✅ Manhattan routing, single-row equipment layout

Not yet implemented (see roadmap):

  • ⏳ Multi-row / parallel-flow placement (e.g. two pumps merging into a mixer)
  • ⏳ Tee junctions and branch piping
  • ⏳ Crossing detection (jumper hops at pipe crossings)
  • ⏳ Function block overlays (Σ summer, PID, selectors)
  • ⏳ Interlock diamond and permissive circle (ISA-5.06)
  • ⏳ Heat-traced / jacketed line decoration
  • ⏳ Reducer (concentric / eccentric) in-line
  • ⏳ Nozzle annotations on vessels

References:

  • ANSI/ISA-5.1-2009 — Instrumentation Symbols and Identification (US standard)
  • ISO 10628-1:2014 — Diagrams for the chemical and petrochemical industry (international)
  • ISA-5.06.01-2007 — Functional Requirements Documentation for Control Software
  • PIP PIC001 — Piping & Instrumentation Diagram Documentation Criteria (industry supplement)

9. Roadmap

The MVP P&ID covers a single linear control loop (tank → pump → control valve → instrumentation). Real plants need 2D placement and tee junctions. Planned for v0.4:

  • DSL extension: equip ... [row: 0, col: 2] lane / grid hints for multi-flow layouts
  • tee primitive: tee T1 on L1 to express a 3-way branch on a process line
  • junction primitive: ISA junction dot for piping connection
  • Crossing detection: when two pipes cross, render the lower one with a small arc bump
  • Function blocks: Σ summer, PID controller, LS/HS low/high selector
  • Interlock symbols: interlock I-301 diamond, permissive P-202 circle
  • Reducer in-line: concentric / eccentric reducers as line decorations
  • Nozzle list: side-port annotations on vessel symbols (N1, N2, …)

For now, single-loop control schemes render cleanly out of the box; complex multi-stream P&IDs need manual position hints (deferred).