# Emergency shutdown valve (ESDV)

Full-bore trunnion ball valve with a spring-return scotch-yoke actuator (pneumatic cylinder, spring cartridge, jackscrew override) in safety yellow. Fail-close. Carries a limit switch box with a turning open/closed indicator, solenoid valve, quick-exhaust valve, air filter-regulator with gauge and stainless tubing. `open` turns the ball and the indicator.

**Standards:** API 6D, ISO 14313, IEC 61508 / 61511, ASME B16.10, ASME B16.5, ISO 5211

## Installation

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

Copies `valves/esd-valve.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 { EsdValve } from './components/deck-twin/valves/esd-valve'

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

## Props

| Prop | Type | Default | Range |
| --- | --- | --- | --- |
| `nps` | `number (NPS, in)` | `6` |  |
| `rating` | `150 \| 300 \| 600 \| 900 \| 1500 \| 2500` | `600` |  |
| `open` | `number` | `1` | 0 – 1 |
| `tag` | `string` | `""` |  |
| `...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 |
| --- | --- | --- | --- | --- | --- |
| `A` | End A | -0.279, 0.000, 0.000 | -1, 0, 0 | 6" | 600 |
| `B` | End B | 0.279, 0.000, 0.000 | 1, 0, 0 | 6" | 600 |

## P&ID

Ball-valve bow-tie (circle at the centre) under a rectangular spring-return piston actuator, usually with a small box marked S (solenoid) on the actuator and "FC" beside the body. The tag bubble reads ESDV, SDV or XV.

tag ESDV · tag SDV · tag XV · tag SSV · ISA ESDV · ISA SDV · ISA XV · ISA ZSO · ISA ZSC · ISA 5.1 (actuator) on an ISO 10628-2 ball valve body; IEC 61511 SIS final element

Same symbol with FO and tag BDV is a blowdown valve. A dome actuator means a control valve; a circle with M means an MOV. Limit switches (ZSO / ZSC) and the SOV are accessories of this valve, not separate items. Some legends draw a gate body instead of a ball; the ESDV tag decides.

Actuated on/off valve datasheet (API 6D / ISO 14313 + actuator sheet, IEC 61508 SIL data) fields and the props they set:

| Field | Prop |
| --- | --- |
| Size | `nps` |
| Pressure class | `rating` |
| Tag number | `tag` |

## Typical suppliers

Emerson Bettis · Cameron (SLB). The geometry is generic and sized from public standards. It is not vendor CAD.

## Source

`valves/esd-valve.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/esd-valve.json has every file.

```tsx
// Emergency shutdown valve (ESDV): full-bore trunnion ball valve, spring-return fail-close scotch-yoke actuator, solenoid, QEV, limit switches. API 6D, IEC 61508/61511 final element.
import { KitMesh, type GroupProps } from '../lib/mesh'
import type { MatKey } from '../lib/kit'
import { port, type Port } from '../lib/ports'
import type { Rating } from '../lib/standards'
import { clamp, useKit2 } from './_body'
import { buildEsd, esdLength } from './_esd'

export interface EsdValveProps {
  /** nominal pipe size, inches */
  nps?: number
  rating?: Rating
  /** 0 closed … 1 open (quarter turn); fails closed */
  open?: number
  body?: MatKey
  actuator?: MatKey
  tag?: string
}

export const defaults = { nps: 6, rating: 600 as Rating, open: 1, body: 'valveBody' as MatKey, actuator: 'actuatorYellow' as MatKey, tag: '' }

export function ports(p: EsdValveProps = {}): Port[] {
  const { nps, rating } = { ...defaults, ...p }
  const L = esdLength(nps, rating)
  return [port('A', 'End A', [-L / 2, 0, 0], [-1, 0, 0], nps, rating), port('B', 'End B', [L / 2, 0, 0], [1, 0, 0], nps, rating)]
}

export function EsdValve(props: EsdValveProps & GroupProps) {
  const { nps, rating, open, body, actuator, tag, ...group } = { ...defaults, ...props }
  const [fixed, moving] = useKit2((k, mv) => buildEsd(k, mv, { nps, rating, body, actuator, failOpen: false, tag }), [nps, rating, body, actuator, tag])
  return (
    <group {...group}>
      <KitMesh data={fixed} />
      <KitMesh data={moving} rotation-y={-(1 - clamp(open, 0, 1)) * (Math.PI / 2)} />
    </group>
  )
}

export default EsdValve
```
