# Mud pump

The only multi-cylinder machine in the set. Each cylinder is its own slider-crank at its own throw angle, and the discharge readout is the sum of the solved piston velocities.

> For the complete index, see [llms.txt](https://robocn.dev/llms.txt). A Markdown version of any page is available by appending `.md` to its URL or by sending an `Accept: text/markdown` header.

## Install

```bash
bunx --bun shadcn@latest add https://robocn.dev/r/mud-pump.json
```

Registry item: `mud-pump` · [`https://robocn.dev/r/mud-pump.json`](https://robocn.dev/r/mud-pump.json)

## Notes

- The crossheads, rods and pistons are solved by `solveSliderCrank`; the discharge is those solved positions differenced and summed, which is geometry.
- No hydraulics: no pressure, flow rate, valve timing, slip, compressibility or fluid is modelled.

## Usage

```tsx
import { MudPump } from "@/components/ui/mud-pump"

<MudPump behavior="stroke" cylinders={3} />
<MudPump crankAngle={210} cylinders={2} interactive onCrankAngleChange={setAngle} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `crankAngle` | `number` | — | Controlled crankshaft angle in degrees. Supplying it stops the loop. |
| `behavior` | `"stroke" | "surge" | "static"` | `"stroke"` | A steady revolution, or the same revolution taken unevenly. |
| `cylinders` | `1 | 2 | 3` | `3` | Simplex, duplex or triplex. The throws stay evenly spaced, and the discharge gets smoother as you add them. |
| `showFlow` | `boolean` | `true` | The suction and discharge manifolds, the dampener, and the discharge the pistons add up to. |
| `interactive / onCrankAngleChange` | `boolean / (angle: number) => void` | — | Turn the crankshaft by hand. |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"iso"` | Where the camera stands. One mud pump, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `animate` | `boolean` | `true` | Off parks the machine at phase and stops rendering. A reduced-motion preference does the same. |
| `paused` | `boolean` | `false` | Freeze where it stands. |
| `phase` | `number` | `0` | Seconds of offset, so a row of machines breaks step. |
| `variant` | `"solid" | "outline" | "blueprint" | "wire"` | `"solid"` | How the machine is painted. Geometry never changes between variants. |
| `size` | `"xs" | "sm" | "md" | "lg" | "xl" | number` | `"md"` | Rendered width in pixels, or a step on the scale. |
| `color` | `string` | `var(--robot-shell)` | Body panels — the colour the machine reads as. |
| `accent` | `string` | `var(--robot-accent)` | Status colour: tip light, live tool, readouts. |
| `metal` | `string` | `var(--robot-metal)` | Bare machined parts: collars, bolts, tool bodies. |
| `dark` | `string` | `var(--robot-dark)` | Cast joints, base, shadow side. |
| `palette` | `Partial<RobotPalette>` | — | Override any subset of roles at once, including glow and grid. |

## Source

- `src/components/ui/mud-pump.tsx`
