# Pressure gauge

Bottom-connected Bourdon tube pressure gauge on a 1/2" weld-neck flange, through a bar-stock block-and-bleed gauge valve and an optional pigtail siphon. Solid-front stainless case with bayonet ring, glass and blow-out back. Dial size and range are props.

**Standards:** EN 837-1, ASME B40.100, ASME B16.5

## Installation

```bash
npx -y https://decktwin.com/cli/deck-twin-0.2.2.tgz add pressure-gauge
```

Copies `instruments/pressure-gauge.tsx`, any helper files it imports and the shared `lib/` into `src/components/deck-twin/`. Needs `three`, `@react-three/fiber` and `@react-three/drei`.

## Usage

```tsx
import { Canvas } from '@react-three/fiber'
import { OrbitControls } from '@react-three/drei'
import { Stage } from './components/deck-twin/lib/stage'
import { PressureGauge } from './components/deck-twin/instruments/pressure-gauge'

export default function Scene() {
  return (
    <Canvas shadows camera={{ position: [8, 5, 9], fov: 35 }}>
      <Stage>
        <PressureGauge />
      </Stage>
      <OrbitControls makeDefault />
    </Canvas>
  )
}
```

## Props

| Prop | Type | Default | Range |
| --- | --- | --- | --- |
| `rating` | `150 \| 300 \| 600 \| 900 \| 1500 \| 2500` | `600` |  |
| `dial` | `0.063 \| 0.1 \| 0.15` | `0.1` |  |
| `max` | `10 \| 16 \| 25 \| 40 \| 60 \| 100 \| 160 \| 250 \| 400` | `100` |  |
| `siphon` | `boolean` | `false` |  |
| `tag` | `string` | `"PI-1101"` |  |
| `...group` | position, rotation, scale… |  |  |

## Ports

Flange faces in the component's local frame, metres. Origin: pipe centreline, flow along X.

| Id | Label | Position | Direction | Size | Class |
| --- | --- | --- | --- | --- | --- |
| `process` | Process connection | 0.000, 0.000, 0.000 | 0, -1, 0 | 1/2" | 600 |

## P&ID

Field bubble marked PI (or PG on some legends) joined to the pipe by a short process line; no signal line leaves it, because it is a local dial.

tag PG · ISA PI · ISA PG · ISA 5.1 (field-mounted instrument bubble)

Same bubble as a transmitter but with PI / PG and no signal line. A bubble with a bar through it reading PI is a console indication, not a gauge. PDI / PDG across a filter is a differential gauge.

Pressure gauge specification form (ISA-TR20.00.01; EN 837-1 / ASME B40.100) fields and the props they set:

| Field | Prop |
| --- | --- |
| Flange rating | `rating` |
| Dial size | `dial` |
| Range (max) | `max` |
| Siphon | `siphon` |
| Tag number | `tag` |

## Typical suppliers

WIKA. The geometry is generic and sized from public standards. It is not vendor CAD.

## Source

`instruments/pressure-gauge.tsx`. This is the component file only: it imports shared code, so install it with the command above rather than pasting it alone. https://decktwin.com/r/pressure-gauge.json has every file.

```tsx
// Bourdon tube pressure gauge: 1/2" flanged connection, block-and-bleed gauge valve, optional siphon, solid-front safety case with blow-out back. EN 837-1 / ASME B40.100, ASME B16.5.
import { Kit, type V3 } from '../lib/kit'
import { KitMesh, useKit, type GroupProps } from '../lib/mesh'
import { gauge } from '../lib/parts'
import { port, type Port } from '../lib/ports'
import type { Rating } from '../lib/standards'
import { SS, tag as tagPlate, valveHandle, flange } from './_parts'

export interface PressureGaugeProps {
  rating?: Rating
  /** dial size, m */
  dial?: number
  /** full-scale, bar */
  max?: number
  /** pigtail siphon for steam / hot service */
  siphon?: boolean
  tag?: string
}

export const defaults = { rating: 600 as Rating, dial: 0.1, max: 100, siphon: false, tag: 'PI-1101' }

export function ports(p: PressureGaugeProps = {}): Port[] {
  const { rating } = { ...defaults, ...p }
  return [port('process', 'Process connection', [0, 0, 0], [0, -1, 0], 0.5, rating, 'instrument')]
}

export function PressureGauge({ rating = defaults.rating, dial = defaults.dial, max = defaults.max, siphon = defaults.siphon, tag = defaults.tag, ...group }: PressureGaugeProps & GroupProps) {
  const data = useKit((k) => build(k, rating, dial, max, siphon, tag), [rating, dial, max, siphon, tag])
  return (
    <group {...group}>
      <KitMesh data={data} />
    </group>
  )
}

export default PressureGauge

function build(k: Kit, rating: Rating, dial: number, max: number, siphon: boolean, tag: string) {
  let y = flange(k, 0.5, rating, [0, 0, 0], '-y')
  const yTag = y + 0.02
  const r = 0.0107
  k.cyl(SS, r, 0.04, [0, y + 0.02, 0], 'y', 14)
  y += 0.04
  // block-and-bleed gauge valve: bar-stock body, block handle on +Z, bleed screw on -X
  k.box(SS, [0.04, 0.05, 0.036], [0, y + 0.025, 0])
  valveHandle(k, [0, y + 0.03, 0.018], [0, 0, 1], 'handwheel')
  k.cyl(SS, 0.005, 0.016, [-0.028, y + 0.014, 0], 'x', 8)
  k.hex(SS, 0.012, 0.008, [-0.038, y + 0.014, 0], 'x')
  y += 0.05
  if (siphon) {
    const R = 0.026
    k.cyl(SS, 0.007, 0.02, [0, y + 0.01, 0], 'y', 10)
    k.torus(SS, R, 0.006, [R, y + 0.02 + R, 0], 'z', 8, 32)
    k.cyl(SS, 0.007, 0.024, [0, y + 0.02 + 2 * R + 0.012, 0], 'y', 10)
    y += 0.02 + 2 * R + 0.024
  }
  k.hex(SS, 0.026, 0.018, [0, y + 0.009, 0])
  k.cyl(SS, 0.008, 0.016, [0, y + 0.026, 0], 'y', 10)
  const c: V3 = [0, y + 0.034 + dial / 2, 0]
  k.hex('brass', 0.022, 0.014, [0, y + 0.03, 0])
  gauge(k, c, 'z', dial, 'bar', max)
  k.cyl('rubberBlack', dial * 0.2, 0.004, [0, c[1], -dial * 0.16 - 0.002], 'z', 16)
  tagPlate(k, tag, [0, yTag, 0.0116], 'z', 0.045)
}
```
