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.
1. Your first P&ID
A minimal P&ID has at least one piece of equipment and one process line.
Three rules cover 80% of usage:
- Start the document with
pid(optional title and[direction: LR]attrs). - Declare each piece of equipment:
equip <ID> : <type> [tag: "label"]. - 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
| Type | Symbol | Purpose |
|---|---|---|
tank_atm | Cylinder + dome top | Atmospheric storage tank |
tank_cone_roof | Cylinder + cone roof | Cone-roof storage tank |
vessel_v | Vertical capsule | Vertical pressure vessel |
vessel_h | Horizontal capsule | Horizontal pressure vessel |
sphere | Filled circle | LPG / ammonia sphere |
column_tray | Tall capsule + horizontal tray lines | Distillation tray column |
column_packed | Tall capsule + cross-hatch | Packed absorption column |
hx_shell_tube | Horizontal capsule + tube bundle | Shell-and-tube heat exchanger |
hx_air_cooled | Rectangle + fan circle | Air-cooled (fin-fan) cooler |
reboiler | Capsule + parallel tube lines | Kettle reboiler |
condenser | Horizontal capsule + tubes | Overhead condenser |
pump_general | Circle + general liquid-flow mark | General liquid pump (ISO 2301) |
pump_centrifugal | Circle + right-side triangle outlet | Centrifugal pump |
pump_diaphragm | Circle + membrane profile | Diaphragm / metering pump (ISO X8095) |
pump_pd | Circle + internal gears | Positive-displacement pump |
compressor | Trapezoid (narrow on right) | Centrifugal compressor |
blower | Circle + 3-blade fan | Blower / fan |
reactor_cstr | Vertical capsule + agitator | Stirred tank reactor (CSTR) |
reactor_pfr | Horizontal capsule + packed bed dots | Plug-flow / fixed-bed reactor |
filter | Rectangle + diagonal hatch | Filter; supports .in, .out, .top, .backwash, and .drain |
cyclone | Cylinder + cone bottom | Cyclone separator |
flare | Tall stack + flame | Flare stack |
cooling_tower | Hourglass | Induced-draft cooling tower |
boiler | Fired enclosure + tube bank | Steam / hot-water boiler |
burner | Fuel nozzle + flame | Fired-equipment burner |
generator | Circle + G | Electrical generator / genset |
2.2 Valve catalog
Valves are equipment that sit on the piping line. Render in bowtie style with type-specific actuator decoration.
| Type | Decoration | Purpose |
|---|---|---|
valve_gate | Plain bowtie | Manual on/off (full-port) |
valve_ball | Bowtie + filled center circle | Manual on/off (quarter-turn) |
valve_globe | Bowtie + small top circle | Manual flow control |
valve_butterfly | Bowtie + center vertical line | Quarter-turn throttle |
valve_check | Bowtie + arc | Non-return check valve |
valve_control | Bowtie + composable actuator | Control valve; diaphragm, piston, motor, or solenoid |
valve_psv | Bowtie + 45Β° outlet + spring stack | Pressure 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 toin(target) /out(source) per equipment family<inst-tag>β instrument bubble center (signal lines)
3.2 Line types (ISA-5.1 Β§5)
type: | Stroke | Use |
|---|---|---|
process | Solid, thick | Major process line (default) |
process_minor | Solid, thin | Auxiliary / utility |
pneumatic | Solid + diagonal tick marks | Air-actuator signal |
electric | Long-dash | Electric / 4β20 mA signal |
hydraulic | Long-dash + pause | Hydraulic actuator |
capillary | Dotted (round caps) | Filled-system temperature |
software | Short-dash, light | DCS / PLC internal data link |
mechanical | Mixed dash | Mechanical 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-2024.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:
| Category | Bubble shape | Use |
|---|---|---|
field_discrete | Plain circle | Field-mounted analog instrument (FT, PT) |
cr_shared | Circle + horizontal line + inscribed hexagon | DCS-controlled HMI display |
cr_computer | Circle + horizontal line + inscribed diamond | Computer function (FY, calculation) |
cr_plc | Circle + horizontal line + inscribed square | PLC-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:
| Clause | Effect |
|---|---|
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:
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 teeprimitive:tee T1 on L1to express a 3-way branch on a process linejunctionprimitive: ISA junction dot for piping connection- Crossing detection: when two pipes cross, render the lower one with a small arc bump
- Function blocks:
Ξ£summer,PIDcontroller,LS/HSlow/high selector - Interlock symbols:
interlock I-301diamond,permissive P-202circle - 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).
Related examples
Ready-to-use scenarios from the examples gallery:
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.