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 follows ANSI/ISA-5.1-2024 for instrument identification and control conventions, with process-equipment symbols based on ISO 10628-2:2012 and its successor symbol library, ISO 14617-2:2025. The DSL is intentionally compact so an LLM can generate a control-loop P&ID from a process description in one shot.

That plain-language workflow is also available through CircuitMaker.ai's P&ID diagram maker, which is useful when the starting material is a process description rather than DSL.

schematexΒ§ source-defined
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
17 lines Β· 658 chars
βœ“ parsedΒ·0.0 msΒ·0 B
100%

1. Your first P&ID

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

schematexΒ§ source-defined
P&ID ISA-5.1 / ISO 10628 P&ID rendered by Schematex T-1 P-1 V-1
8 lines Β· 206 chars
βœ“ parsedΒ·0.0 msΒ·0 B
100%

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_generalCircle + general liquid-flow markGeneral liquid pump (ISO 2301)
pump_centrifugalCircle + right-side triangle outletCentrifugal pump
pump_diaphragmCircle + membrane profileDiaphragm / metering pump (ISO X8095)
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; supports .in, .out, .top, .backwash, and .drain
cycloneCylinder + cone bottomCyclone separator
flareTall stack + flameFlare stack
cooling_towerHourglassInduced-draft cooling tower
boilerFired enclosure + tube bankSteam / hot-water boiler
burnerFuel nozzle + flameFired-equipment burner
generatorCircle + GElectrical generator / genset

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 + composable actuatorControl valve; diaphragm, piston, motor, or solenoid
valve_psvBowtie + 45Β° outlet + spring stackPressure safety relief valve
equip V-101 : valve_control [tag: "V-101", actuator: "diaphragm", fail: "FC"]
equip XV-102 : valve_control [tag: "Outlet MOV", actuator: "motor", fail: "FL"]
equip V-303 : valve_psv     [tag: "V-303 Β· 150 psig"]

FC, FO, and FL mean fail closed, fail open, and fail in last position. Connect controller signals to .signal: use an electric line for motor/solenoid, and a pneumatic line for diaphragm/piston.


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-or-line-id>Associates the bubble with what it measures and anchors its placement
controls <equip-id>Associates a controller with its final control element and anchors its placement
inst FT-101 : field_discrete
  measures P-101
inst FIC-101 : cr_shared
  controls V-101
line s1 from FT-101 to FIC-101 [type: electric]
line s2 from FIC-101 to V-101.signal [type: pneumatic]

These clauses do not invent connections. Write every signal as an explicit line so the DSL remains the engineering source of truth.


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:

schematexΒ§ source-defined
P&ID β€” Distillation T-201 ISA-5.1 / ISO 10628 P&ID rendered by Schematex Distillation T-201 T-201 Overhead Cond Reboiler Reflux Drum Reflux Pump PT 201 LIC 201 TIC 201
20 lines Β· 815 chars
βœ“ parsedΒ·0.0 msΒ·0 B
100%

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_general" | "pump_centrifugal" | "pump_diaphragm" | "pump_pd"
               | "compressor" | "blower"
               | "reactor_cstr" | "reactor_pfr"
               | "filter" | "cyclone" | "flare" | "cooling_tower"
               | "boiler" | "burner" | "generator"
               | "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" | "backwash" | "drain" | "signal"

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):

  • βœ… 24 process-equipment symbols, including distinct general, centrifugal, diaphragm, and positive-displacement pumps
  • βœ… Media-filter service anchors for top injection, backwash, and bottom drain
  • βœ… 7 valve bodies, with diaphragm, piston, motor, and solenoid operators composed onto valve_control
  • βœ… 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)
  • βœ… Explicit signal lines checked against the selected actuator type
  • βœ… Line tags rendered as white-bg rectangles at line midpoint
  • βœ… Topology-ranked placement with parallel lanes, junctions, and recycle/return channels

Not yet implemented (see roadmap):

  • ⏳ Semantic package/scope boundaries
  • ⏳ 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).


Ready-to-use scenarios from the examples gallery:

pidΒ·Β§ ANSI/ISA-5.1-2009 + ISO 10628-1:2014
P&ID β€” Water Pump Flow Control ISA-5.1 / ISO 10628 P&ID rendered by Schematex Water Pump Flow Control Feed Tank Isolation Feed Pump FC V-101 FT 101 FIC 101
Pump with flow control loop (P&ID)
Classic centrifugal pump pulling from an atmospheric tank, with a flow transmitter (FT-101), flow indicating controller (FIC-101), and a fail-closed pneumatic control valve β€” the minimum viable P&ID that every process engineer recognises at a glance.
water-treatment
pidΒ·Β§ ANSI/ISA-5.1-2009 + ISO 10628-1:2014
P&ID β€” High-Pressure Reactor Feed ISA-5.1 / ISO 10628 P&ID rendered by Schematex High-Pressure Reactor Feed Raw Material Tank V-203 Feed Pump P-201A/B Feed Pre-heater FC V-201 Reactor R-201 FO V-202 FT 201 FIC 201 TT 201 TIC 201 PT 201 PSHH 201
Reactor feed with multi-loop control and pressure safety (P&ID)
CSTR reactor system with centrifugal pump, shell-and-tube pre-heater, flow control on the feed line, temperature control on the product outlet, and a PSHH pressure switch interlock β€” four instrument loops in one diagram, covering the core vocabulary of ISA-5.1 P&ID engineering.
chemical-processing

Interactive editing

The title is editable and movable. Equipment and instruments move freely; process and signal endpoints stay attached during the gesture and are recomputed from named ports after the drop.

Found this useful?

Schematex is free, fully open source, and zero-dependency. A star helps other developers discover it.