# No. 471 (Brown 1868): "Hotchkiss's atmospheric hammer; derives the force of its blow from compressed air. Hammer head, C, is attached to a piston fitted to a cylinder, B, which is connected by a rod, D, with a crank, A, on the rotary driving-shaft. As the cylinder ascends, air entering hole, e, is compressed below piston and lifts hammer. As cylinder descends, air entering hole, e, is compressed above and is stored up to produce the blow by its instant expansion after the crank and connecting-rod turn bottom center."
# Model (cm, gravity on, the cylinder cut away in half section, seen from in front). The crank A (5 cm) on the overhead shaft
# turns at 150 rpm (the only drive) and by the rod D works the cylinder B (6 cm bore, 18 cm long) up and down in
# its guides. The hammer head C (12 kg) hangs on its rod from the piston inside it and slides in its own guides over the work.
# The air over and under the piston are two lumped gas vessels (src/fluid/vessels.c, isothermal air) that the piston sweeps
# as it moves in the cylinder; each takes in or lets out air by the hole e in the cylinder's middle while the piston is past it
# on the other side. So as the cylinder rises the air under the piston is shut in and compressed and lifts the hammer; as it
# falls the air over the piston is shut in, compressed, and drives the hammer down on the work. Both airs are drawn in the
# cylinder (src/fluid/vdraw.ts), shaded by their pressures. Generator: opencode-runs/water/gen471.py.
number: 471
slug: hotchkiss-atmospheric-hammer
name: Hotchkiss's atmospheric hammer
brown: "Hotchkiss's atmospheric hammer; derives the force of its blow from compressed air. Hammer head, C, is attached to a piston fitted to a cylinder, B, which is connected by a rod, D, with a crank, A, on the rotary driving-shaft. As the cylinder ascends, air entering hole, e, is compressed below piston and lifts hammer. As cylinder descends, air entering hole, e, is compressed above and is stored up to produce the blow by its instant expansion after the crank and connecting-rod turn bottom center."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 60
  duration_s: 12
  floor: false
bodies:
  - id: cylinder
    shape: part
    pos: [0, 0, 29.02]
    mass: 1.5
    color: "#5d584f"
    pieces:
      - {kind: loft, a: [[3, 0, 28.52], [2.7716, 1.1481, 28.52], [3.4184, 1.4159, 28.52], [3.7, 0, 28.52]], b: [[3, 0, 20.02], [2.7716, 1.1481, 20.02], [3.4184, 1.4159, 20.02], [3.7, 0, 20.02]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[2.7716, 1.1481, 28.52], [2.1213, 2.1213, 28.52], [2.6163, 2.6163, 28.52], [3.4184, 1.4159, 28.52]], b: [[2.7716, 1.1481, 20.02], [2.1213, 2.1213, 20.02], [2.6163, 2.6163, 20.02], [3.4184, 1.4159, 20.02]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[2.1213, 2.1213, 28.52], [1.1481, 2.7716, 28.52], [1.4159, 3.4184, 28.52], [2.6163, 2.6163, 28.52]], b: [[2.1213, 2.1213, 20.02], [1.1481, 2.7716, 20.02], [1.4159, 3.4184, 20.02], [2.6163, 2.6163, 20.02]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[1.1481, 2.7716, 28.52], [0, 3, 28.52], [0, 3.7, 28.52], [1.4159, 3.4184, 28.52]], b: [[1.1481, 2.7716, 20.02], [0, 3, 20.02], [0, 3.7, 20.02], [1.4159, 3.4184, 20.02]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[0, 3, 28.52], [-1.1481, 2.7716, 28.52], [-1.4159, 3.4184, 28.52], [0, 3.7, 28.52]], b: [[0, 3, 20.02], [-1.1481, 2.7716, 20.02], [-1.4159, 3.4184, 20.02], [0, 3.7, 20.02]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[-1.1481, 2.7716, 28.52], [-2.1213, 2.1213, 28.52], [-2.6163, 2.6163, 28.52], [-1.4159, 3.4184, 28.52]], b: [[-1.1481, 2.7716, 20.02], [-2.1213, 2.1213, 20.02], [-2.6163, 2.6163, 20.02], [-1.4159, 3.4184, 20.02]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[-2.1213, 2.1213, 28.52], [-2.7716, 1.1481, 28.52], [-3.4184, 1.4159, 28.52], [-2.6163, 2.6163, 28.52]], b: [[-2.1213, 2.1213, 20.02], [-2.7716, 1.1481, 20.02], [-3.4184, 1.4159, 20.02], [-2.6163, 2.6163, 20.02]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[-2.7716, 1.1481, 28.52], [-3, 0, 28.52], [-3.7, 0, 28.52], [-3.4184, 1.4159, 28.52]], b: [[-2.7716, 1.1481, 20.02], [-3, 0, 20.02], [-3.7, 0, 20.02], [-3.4184, 1.4159, 20.02]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[3, 0, 38.02], [2.7716, 1.1481, 38.02], [3.4184, 1.4159, 38.02], [3.7, 0, 38.02]], b: [[3, 0, 29.52], [2.7716, 1.1481, 29.52], [3.4184, 1.4159, 29.52], [3.7, 0, 29.52]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[2.7716, 1.1481, 38.02], [2.1213, 2.1213, 38.02], [2.6163, 2.6163, 38.02], [3.4184, 1.4159, 38.02]], b: [[2.7716, 1.1481, 29.52], [2.1213, 2.1213, 29.52], [2.6163, 2.6163, 29.52], [3.4184, 1.4159, 29.52]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[2.1213, 2.1213, 38.02], [1.1481, 2.7716, 38.02], [1.4159, 3.4184, 38.02], [2.6163, 2.6163, 38.02]], b: [[2.1213, 2.1213, 29.52], [1.1481, 2.7716, 29.52], [1.4159, 3.4184, 29.52], [2.6163, 2.6163, 29.52]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[1.1481, 2.7716, 38.02], [0, 3, 38.02], [0, 3.7, 38.02], [1.4159, 3.4184, 38.02]], b: [[1.1481, 2.7716, 29.52], [0, 3, 29.52], [0, 3.7, 29.52], [1.4159, 3.4184, 29.52]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[0, 3, 38.02], [-1.1481, 2.7716, 38.02], [-1.4159, 3.4184, 38.02], [0, 3.7, 38.02]], b: [[0, 3, 29.52], [-1.1481, 2.7716, 29.52], [-1.4159, 3.4184, 29.52], [0, 3.7, 29.52]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[-1.1481, 2.7716, 38.02], [-2.1213, 2.1213, 38.02], [-2.6163, 2.6163, 38.02], [-1.4159, 3.4184, 38.02]], b: [[-1.1481, 2.7716, 29.52], [-2.1213, 2.1213, 29.52], [-2.6163, 2.6163, 29.52], [-1.4159, 3.4184, 29.52]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[-2.1213, 2.1213, 38.02], [-2.7716, 1.1481, 38.02], [-3.4184, 1.4159, 38.02], [-2.6163, 2.6163, 38.02]], b: [[-2.1213, 2.1213, 29.52], [-2.7716, 1.1481, 29.52], [-3.4184, 1.4159, 29.52], [-2.6163, 2.6163, 29.52]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[-2.7716, 1.1481, 38.02], [-3, 0, 38.02], [-3.7, 0, 38.02], [-3.4184, 1.4159, 38.02]], b: [[-2.7716, 1.1481, 29.52], [-3, 0, 29.52], [-3.7, 0, 29.52], [-3.4184, 1.4159, 29.52]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[-3.7, 0, 20.02], [3.7, 0, 20.02], [3.7, 3.7, 20.02], [-3.7, 3.7, 20.02]], b: [[-3.7, 0, 19.32], [3.7, 0, 19.32], [3.7, 3.7, 19.32], [-3.7, 3.7, 19.32]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[-3.7, 0, 38.72], [3.7, 0, 38.72], [3.7, 3.7, 38.72], [-3.7, 3.7, 38.72]], b: [[-3.7, 0, 38.02], [3.7, 0, 38.02], [3.7, 3.7, 38.02], [-3.7, 3.7, 38.02]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[0.7, 0, 19.32], [0.495, 0.495, 19.32], [0.9899, 0.9899, 19.32], [1.4, 0, 19.32]], b: [[0.7, 0, 17.82], [0.495, 0.495, 17.82], [0.9899, 0.9899, 17.82], [1.4, 0, 17.82]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[0.495, 0.495, 19.32], [0, 0.7, 19.32], [0, 1.4, 19.32], [0.9899, 0.9899, 19.32]], b: [[0.495, 0.495, 17.82], [0, 0.7, 17.82], [0, 1.4, 17.82], [0.9899, 0.9899, 17.82]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[0, 0.7, 19.32], [-0.495, 0.495, 19.32], [-0.9899, 0.9899, 19.32], [0, 1.4, 19.32]], b: [[0, 0.7, 17.82], [-0.495, 0.495, 17.82], [-0.9899, 0.9899, 17.82], [0, 1.4, 17.82]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[-0.495, 0.495, 19.32], [-0.7, 0, 19.32], [-1.4, 0, 19.32], [-0.9899, 0.9899, 19.32]], b: [[-0.495, 0.495, 17.82], [-0.7, 0, 17.82], [-1.4, 0, 17.82], [-0.9899, 0.9899, 17.82]], collide: 0, color: "#5d584f"}
      - {kind: loft, a: [[-0.8, -0.6, 40.22], [0.8, -0.6, 40.22], [0.8, 0.6, 40.22], [-0.8, 0.6, 40.22]], b: [[-0.8, -0.6, 38.72], [0.8, -0.6, 38.72], [0.8, 0.6, 38.72], [-0.8, 0.6, 38.72]], collide: 0, color: "#5d584f"}
      - {kind: rod, from: [0, -0.9, 39.92], to: [0, 0.9, 39.92], radius: 0.45, collide: 0, color: "#3d3933"}
      - {kind: loft, a: [[-3.68, -0.4, 29.52], [-3.85, -0.4, 29.52], [-3.85, 0.4, 29.52], [-3.68, 0.4, 29.52]], b: [[-3.68, -0.4, 28.52], [-3.85, -0.4, 28.52], [-3.85, 0.4, 28.52], [-3.68, 0.4, 28.52]], collide: 0, color: "#1d1a17"}
      - {kind: loft, a: [[3.68, -0.4, 29.52], [3.85, -0.4, 29.52], [3.85, 0.4, 29.52], [3.68, 0.4, 29.52]], b: [[3.68, -0.4, 28.52], [3.85, -0.4, 28.52], [3.85, 0.4, 28.52], [3.68, 0.4, 28.52]], collide: 0, color: "#1d1a17"}
  - id: hammer
    shape: part
    mount: cylinder
    pos: [0, 0, 29.02]
    mass: 12
    color: "#4f4a43"
    pieces:
      - {kind: loft, a: [[-4, -3, 17.02], [4, -3, 17.02], [4, 3, 17.02], [-4, 3, 17.02]], b: [[-4, -3, 10.02], [4, -3, 10.02], [4, 3, 10.02], [-4, 3, 10.02]], collide: 1, color: "#4f4a43"}
      - {kind: rod, from: [0, 0, 17.02], to: [0, 0, 29.02], radius: 0.6, collide: 0}
      - {kind: loft, a: [[2.95, 0, 30.02], [2.7254, 1.1289, 30.02], [2.086, 2.086, 30.02], [1.1289, 2.7254, 30.02], [0, 2.95, 30.02], [-1.1289, 2.7254, 30.02], [-2.086, 2.086, 30.02], [-2.7254, 1.1289, 30.02], [-2.95, 0, 30.02], [-2.7254, -1.1289, 30.02], [-2.086, -2.086, 30.02], [-1.1289, -2.7254, 30.02], [-0, -2.95, 30.02], [1.1289, -2.7254, 30.02], [2.086, -2.086, 30.02], [2.7254, -1.1289, 30.02]], b: [[2.95, 0, 28.02], [2.7254, 1.1289, 28.02], [2.086, 2.086, 28.02], [1.1289, 2.7254, 28.02], [0, 2.95, 28.02], [-1.1289, 2.7254, 28.02], [-2.086, 2.086, 28.02], [-2.7254, 1.1289, 28.02], [-2.95, 0, 28.02], [-2.7254, -1.1289, 28.02], [-2.086, -2.086, 28.02], [-1.1289, -2.7254, 28.02], [-0, -2.95, 28.02], [1.1289, -2.7254, 28.02], [2.086, -2.086, 28.02], [2.7254, -1.1289, 28.02]], collide: 0, color: "#8a8478"}
  - id: conrod
    shape: part
    mount: cylinder
    pos: [0, 0, 39.92]
    mass: 0.2
    color: "#6d675c"
    pieces:
      - {kind: rod, from: [0, 0, 39.92], to: [0, 0, 57.92], radius: 0.45, capsule: true, collide: 0}
      - {kind: rod, from: [0, -0.8, 57.92], to: [0, 0.8, 57.92], radius: 0.6, collide: 0}
  - id: crank
    shape: part
    pos: [0, 0, 62.92]
    mass: 0.6
    color: "#7a6a4f"
    pieces:
      - {kind: rod, from: [0, -0.4, 62.92], to: [0, -0.4, 57.92], radius: 0.7, capsule: true, collide: 0}
      - {kind: loft, a: [[2.2, -0.2, 62.92], [2.0325, -0.2, 63.7619], [1.5556, -0.2, 64.4756], [0.8419, -0.2, 64.9525], [0, -0.2, 65.12], [-0.8419, -0.2, 64.9525], [-1.5556, -0.2, 64.4756], [-2.0325, -0.2, 63.7619], [-2.2, -0.2, 62.92], [-2.0325, -0.2, 62.0781], [-1.5556, -0.2, 61.3644], [-0.8419, -0.2, 60.8875], [-0, -0.2, 60.72], [0.8419, -0.2, 60.8875], [1.5556, -0.2, 61.3644], [2.0325, -0.2, 62.0781]], b: [[2.2, -0.9, 62.92], [2.0325, -0.9, 63.7619], [1.5556, -0.9, 64.4756], [0.8419, -0.9, 64.9525], [0, -0.9, 65.12], [-0.8419, -0.9, 64.9525], [-1.5556, -0.9, 64.4756], [-2.0325, -0.9, 63.7619], [-2.2, -0.9, 62.92], [-2.0325, -0.9, 62.0781], [-1.5556, -0.9, 61.3644], [-0.8419, -0.9, 60.8875], [-0, -0.9, 60.72], [0.8419, -0.9, 60.8875], [1.5556, -0.9, 61.3644], [2.0325, -0.9, 62.0781]], collide: 0, color: "#7a6a4f"}
      - {kind: rod, from: [0, -0.9, 62.92], to: [0, 1.2, 62.92], radius: 0.8, collide: 0}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#d6cdb8"
    pieces:
      - {kind: loft, a: [[-26, -6, 0], [26, -6, 0], [26, 10, 0], [-26, 10, 0]], b: [[-26, -6, -1.5], [26, -6, -1.5], [26, 10, -1.5], [-26, 10, -1.5]], collide: 0, color: "#8b7d66"}
      - {kind: loft, a: [[-8, -5, 3], [8, -5, 3], [8, 5, 3], [-8, 5, 3]], b: [[-8, -5, 0], [8, -5, 0], [8, 5, 0], [-8, 5, 0]], collide: 0, color: "#6d675c"}
      - {kind: loft, a: [[-5.5, -4, 7], [5.5, -4, 7], [5.5, 4, 7], [-5.5, 4, 7]], b: [[-5.5, -4, 3], [5.5, -4, 3], [5.5, 4, 3], [-5.5, 4, 3]], collide: 0, color: "#6d675c"}
      - {kind: loft, a: [[-6, -2.5, 10], [6, -2.5, 10], [6, 2.5, 10], [-6, 2.5, 10]], b: [[-6, -2.5, 7], [6, -2.5, 7], [6, 2.5, 7], [-6, 2.5, 7]], collide: 2, color: "#c0582c"}
      - {kind: loft, a: [[-13.2, -2, 65.42], [-10.8, -2, 65.42], [-10.8, 2, 65.42], [-13.2, 2, 65.42]], b: [[-13.2, -2, 0], [-10.8, -2, 0], [-10.8, 2, 0], [-13.2, 2, 0]], collide: 0, color: "#6d675c"}
      - {kind: loft, a: [[-14.5, -3, 1.5], [-9.5, -3, 1.5], [-9.5, 3, 1.5], [-14.5, 3, 1.5]], b: [[-14.5, -3, 0], [-9.5, -3, 0], [-9.5, 3, 0], [-14.5, 3, 0]], collide: 0, color: "#6d675c"}
      - {kind: loft, a: [[-3.9, -1, 44.92], [-4.7, -1, 44.92], [-4.7, 1, 44.92], [-3.9, 1, 44.92]], b: [[-3.9, -1, 9.52], [-4.7, -1, 9.52], [-4.7, 1, 9.52], [-3.9, 1, 9.52]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-4.3, -1, 9.02], [-5.1, -1, 9.02], [-5.1, 1, 9.02], [-4.3, 1, 9.02]], b: [[-4.3, -1, 11.5], [-5.1, -1, 11.5], [-5.1, 1, 11.5], [-4.3, 1, 11.5]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[10.8, -2, 65.42], [13.2, -2, 65.42], [13.2, 2, 65.42], [10.8, 2, 65.42]], b: [[10.8, -2, 0], [13.2, -2, 0], [13.2, 2, 0], [10.8, 2, 0]], collide: 0, color: "#6d675c"}
      - {kind: loft, a: [[9.5, -3, 1.5], [14.5, -3, 1.5], [14.5, 3, 1.5], [9.5, 3, 1.5]], b: [[9.5, -3, 0], [14.5, -3, 0], [14.5, 3, 0], [9.5, 3, 0]], collide: 0, color: "#6d675c"}
      - {kind: loft, a: [[3.9, -1, 44.92], [4.7, -1, 44.92], [4.7, 1, 44.92], [3.9, 1, 44.92]], b: [[3.9, -1, 9.52], [4.7, -1, 9.52], [4.7, 1, 9.52], [3.9, 1, 9.52]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[4.3, -1, 9.02], [5.1, -1, 9.02], [5.1, 1, 9.02], [4.3, 1, 9.02]], b: [[4.3, -1, 11.5], [5.1, -1, 11.5], [5.1, 1, 11.5], [4.3, 1, 11.5]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-13.2, 2.2, 66.92], [13.2, 2.2, 66.92], [13.2, 4, 66.92], [-13.2, 4, 66.92]], b: [[-13.2, 2.2, 65.42], [13.2, 2.2, 65.42], [13.2, 4, 65.42], [-13.2, 4, 65.42]], collide: 0, color: "#6d675c"}
      - {kind: rod, from: [0, 1, 62.92], to: [0, 4, 62.92], radius: 1.2, collide: 0, color: "#6d675c"}
joints:
  - {id: j_c, type: slide, body: cylinder, axis: [0, 0, 1], range: [-2, 12], damping: 0.5}   # the cylinder in its guides
  - {id: j_p, type: slide, body: hammer, axis: [0, 0, 1], range: [-7.8, 7.8], damping: 0.5}   # the piston in the cylinder
  - {id: j_r, type: hinge, body: conrod, axis: [0, 1, 0], damping: 0.001}
  - {id: j_k, type: hinge, body: crank, axis: [0, 1, 0], damping: 0.01}   # the crank shaft (the drive)
pins:
  - {id: p_k, a: crank, b: conrod, at: [0, 0, 57.92]}
vessels:
  substeps: 4
  nodes:
    - {id: air, kind: source, p: 0, gas: true}
    - {id: under, kind: gas, volume: 221.147, p: 0,
       draw: {body: cylinder, sections: [[[-2.95, 20.02], [2.95, 20.02], [2.95, 29.02], [-2.95, 29.02]]], y: [0, 2.7], face: {body: hammer, z: 28.02, side: below}, pref: 100000}}   # the air under the piston
    - {id: over, kind: gas, volume: 230.195, p: 0,
       draw: {body: cylinder, sections: [[[-2.95, 29.02], [2.95, 29.02], [2.95, 38.02], [-2.95, 38.02]]], y: [0, 2.7], face: {body: hammer, z: 30.02, side: above}, pref: 100000}}   # the air over it
  links:
    - {id: e_under, from: air, to: under, area: 0.8, cd: 0.62, open: {joint: j_p, q: [0.5, 2], frac: [0, 1]}}
    - {id: e_over, from: air, to: over, area: 0.8, cd: 0.62, open: {joint: j_p, q: [-2, -0.5], frac: [1, 0]}}
  pistons:
    - {node: under, joint: j_p, area: 27.1434, sign: 1}
    - {node: over, joint: j_p, area: 28.2743, sign: -1}
driver: {joint: j_k, kind: velocity, rpm: 150, kv: 3000, max_torque: 200}
checks:
  - {type: amplitude, joint: j_p, min: 0.025, max: 0.06, settle_s: 1.5, window_s: 10}
  - {type: penetration, max: 0.01}
camera: {target: [0, 0, 20], position: [0, -260, 24], fov: 25}
display:
  output: j_p
  labels: {j_c: "Cylinder B", j_p: "Piston and hammer C (in the cylinder)", j_r: "Rod D", j_k: "Crank A (driver)"}
