# No. 480 (Brown 1868): "Another kind of gasometer. The vessel, A, has permanently secured within it a central tube, a, which slides on a fixed tube, b, in the center of the tank."
# Model (cm, gravity on, the tank and the gasometer cut away in half section, seen from in front). The gasometer A (34 cm inside,
# 2 kg) stands open below in the tank of water; the tube a, fast inside its crown, slides on the fixed tube b in the middle of
# the tank, which keeps A upright (its slide joint). A's whole weight presses the gas, at about 216 Pa. Gas comes from the works
# (600 Pa) up the left pipe through the tank's floor and goes out by the right pipe to the burners through a cock, which a hand
# turns open and shut (swung +-0.7 rad at 0.125 Hz, the only drive). A's inside is a lumped chamber (src/fluid/vessels.c) of
# water under gas, joined to the tank's water (an open chamber) under A's rim: the gas let in lifts A by its pressure, and the
# water inside stands lower than outside by that pressure. While the cock is shut A rises on b as the gas comes in; open, more
# goes out than comes in and A sinks. Both waters are drawn from their levels. Generator: opencode-runs/water/gen480.py.
number: 480
slug: another-gasometer
name: Another kind of gasometer
brown: "Another kind of gasometer. The vessel, A, has permanently secured within it a central tube, a, which slides on a fixed tube, b, in the center of the tank."
units: cm
sim:
  timestep: 0.0005
  integrator: implicitfast
  iterations: 60
  duration_s: 18
  floor: false
bodies:
  - id: bell
    shape: part
    pos: [0, 0, 56]
    mass: 2
    color: "#7d7a72"
    pieces:
      - {kind: loft, a: [[17, 0, 56], [16.4207, 4.3999, 56], [16.9037, 4.5293, 56], [17.5, 0, 56]], b: [[17, 0, 26], [16.4207, 4.3999, 26], [16.9037, 4.5293, 26], [17.5, 0, 26]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[16.4207, 4.3999, 56], [14.7224, 8.5, 56], [15.1554, 8.75, 56], [16.9037, 4.5293, 56]], b: [[16.4207, 4.3999, 26], [14.7224, 8.5, 26], [15.1554, 8.75, 26], [16.9037, 4.5293, 26]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[14.7224, 8.5, 56], [12.0208, 12.0208, 56], [12.3744, 12.3744, 56], [15.1554, 8.75, 56]], b: [[14.7224, 8.5, 26], [12.0208, 12.0208, 26], [12.3744, 12.3744, 26], [15.1554, 8.75, 26]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[12.0208, 12.0208, 56], [8.5, 14.7224, 56], [8.75, 15.1554, 56], [12.3744, 12.3744, 56]], b: [[12.0208, 12.0208, 26], [8.5, 14.7224, 26], [8.75, 15.1554, 26], [12.3744, 12.3744, 26]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[8.5, 14.7224, 56], [4.3999, 16.4207, 56], [4.5293, 16.9037, 56], [8.75, 15.1554, 56]], b: [[8.5, 14.7224, 26], [4.3999, 16.4207, 26], [4.5293, 16.9037, 26], [8.75, 15.1554, 26]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[4.3999, 16.4207, 56], [0, 17, 56], [0, 17.5, 56], [4.5293, 16.9037, 56]], b: [[4.3999, 16.4207, 26], [0, 17, 26], [0, 17.5, 26], [4.5293, 16.9037, 26]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[0, 17, 56], [-4.3999, 16.4207, 56], [-4.5293, 16.9037, 56], [0, 17.5, 56]], b: [[0, 17, 26], [-4.3999, 16.4207, 26], [-4.5293, 16.9037, 26], [0, 17.5, 26]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[-4.3999, 16.4207, 56], [-8.5, 14.7224, 56], [-8.75, 15.1554, 56], [-4.5293, 16.9037, 56]], b: [[-4.3999, 16.4207, 26], [-8.5, 14.7224, 26], [-8.75, 15.1554, 26], [-4.5293, 16.9037, 26]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[-8.5, 14.7224, 56], [-12.0208, 12.0208, 56], [-12.3744, 12.3744, 56], [-8.75, 15.1554, 56]], b: [[-8.5, 14.7224, 26], [-12.0208, 12.0208, 26], [-12.3744, 12.3744, 26], [-8.75, 15.1554, 26]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[-12.0208, 12.0208, 56], [-14.7224, 8.5, 56], [-15.1554, 8.75, 56], [-12.3744, 12.3744, 56]], b: [[-12.0208, 12.0208, 26], [-14.7224, 8.5, 26], [-15.1554, 8.75, 26], [-12.3744, 12.3744, 26]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[-14.7224, 8.5, 56], [-16.4207, 4.3999, 56], [-16.9037, 4.5293, 56], [-15.1554, 8.75, 56]], b: [[-14.7224, 8.5, 26], [-16.4207, 4.3999, 26], [-16.9037, 4.5293, 26], [-15.1554, 8.75, 26]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[-16.4207, 4.3999, 56], [-17, 0, 56], [-17.5, 0, 56], [-16.9037, 4.5293, 56]], b: [[-16.4207, 4.3999, 26], [-17, 0, 26], [-17.5, 0, 26], [-16.9037, 4.5293, 26]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[-17.5, 0, 56.6], [17.5, 0, 56.6], [17.5, 17.5, 56.6], [-17.5, 17.5, 56.6]], b: [[-17.5, 0, 56], [17.5, 0, 56], [17.5, 17.5, 56], [-17.5, 17.5, 56]], collide: 0, color: "#7d7a72"}
      - {kind: rod, from: [0, 0, 56], to: [0, 0, 30], radius: 1.7, collide: 0, color: "#5f5a52"}
  - id: cock
    shape: part
    pos: [34, 0, 5.5]
    mass: 0.3
    color: "#6d675c"
    pieces:
      - {kind: rod, from: [34, -2.2, 5.5], to: [34, -0.6, 5.5], radius: 0.8, collide: 0}
      - {kind: rod, from: [34, -2, 5.5], to: [34, -2, 13.5], radius: 0.45, capsule: true, collide: 0}
      - {kind: loft, a: [[33.2, -2.6, 15], [34.8, -2.6, 15], [34.8, -1.4, 15], [33.2, -1.4, 15]], b: [[33.2, -2.6, 13], [34.8, -2.6, 13], [34.8, -1.4, 13], [33.2, -1.4, 13]], collide: 0, color: "#6d675c"}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#d6cdb8"
    pieces:
      - {kind: loft, a: [[-42, -10, 0], [42, -10, 0], [42, 24, 0], [-42, 24, 0]], b: [[-42, -10, -1.5], [42, -10, -1.5], [42, 24, -1.5], [-42, 24, -1.5]], collide: 0, color: "#8b7d66"}
      - {kind: loft, a: [[-21, 0, 3], [21, 0, 3], [21, 21, 3], [-21, 21, 3]], b: [[-21, 0, 0], [21, 0, 0], [21, 21, 0], [-21, 21, 0]], collide: 0, color: "#9a6a4f"}
      - {kind: loft, a: [[-21, 0, 9], [-15, 0, 9], [-15, 21, 9], [-21, 21, 9]], b: [[-21, 0, 3], [-15, 0, 3], [-15, 21, 3], [-21, 21, 3]], collide: 0, color: "#9a6a4f"}
      - {kind: loft, a: [[15, 0, 9], [21, 0, 9], [21, 21, 9], [15, 21, 9]], b: [[15, 0, 3], [21, 0, 3], [21, 21, 3], [15, 21, 3]], collide: 0, color: "#9a6a4f"}
      - {kind: loft, a: [[20, 0, 44], [19.3185, 5.1764, 44], [20.0913, 5.3834, 44], [20.8, 0, 44]], b: [[20, 0, 9], [19.3185, 5.1764, 9], [20.0913, 5.3834, 9], [20.8, 0, 9]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[19.3185, 5.1764, 44], [17.3205, 10, 44], [18.0133, 10.4, 44], [20.0913, 5.3834, 44]], b: [[19.3185, 5.1764, 9], [17.3205, 10, 9], [18.0133, 10.4, 9], [20.0913, 5.3834, 9]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[17.3205, 10, 44], [14.1421, 14.1421, 44], [14.7078, 14.7078, 44], [18.0133, 10.4, 44]], b: [[17.3205, 10, 9], [14.1421, 14.1421, 9], [14.7078, 14.7078, 9], [18.0133, 10.4, 9]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[14.1421, 14.1421, 44], [10, 17.3205, 44], [10.4, 18.0133, 44], [14.7078, 14.7078, 44]], b: [[14.1421, 14.1421, 9], [10, 17.3205, 9], [10.4, 18.0133, 9], [14.7078, 14.7078, 9]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[10, 17.3205, 44], [5.1764, 19.3185, 44], [5.3834, 20.0913, 44], [10.4, 18.0133, 44]], b: [[10, 17.3205, 9], [5.1764, 19.3185, 9], [5.3834, 20.0913, 9], [10.4, 18.0133, 9]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[5.1764, 19.3185, 44], [0, 20, 44], [0, 20.8, 44], [5.3834, 20.0913, 44]], b: [[5.1764, 19.3185, 9], [0, 20, 9], [0, 20.8, 9], [5.3834, 20.0913, 9]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[0, 20, 44], [-5.1764, 19.3185, 44], [-5.3834, 20.0913, 44], [0, 20.8, 44]], b: [[0, 20, 9], [-5.1764, 19.3185, 9], [-5.3834, 20.0913, 9], [0, 20.8, 9]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[-5.1764, 19.3185, 44], [-10, 17.3205, 44], [-10.4, 18.0133, 44], [-5.3834, 20.0913, 44]], b: [[-5.1764, 19.3185, 9], [-10, 17.3205, 9], [-10.4, 18.0133, 9], [-5.3834, 20.0913, 9]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[-10, 17.3205, 44], [-14.1421, 14.1421, 44], [-14.7078, 14.7078, 44], [-10.4, 18.0133, 44]], b: [[-10, 17.3205, 9], [-14.1421, 14.1421, 9], [-14.7078, 14.7078, 9], [-10.4, 18.0133, 9]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[-14.1421, 14.1421, 44], [-17.3205, 10, 44], [-18.0133, 10.4, 44], [-14.7078, 14.7078, 44]], b: [[-14.1421, 14.1421, 9], [-17.3205, 10, 9], [-18.0133, 10.4, 9], [-14.7078, 14.7078, 9]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[-17.3205, 10, 44], [-19.3185, 5.1764, 44], [-20.0913, 5.3834, 44], [-18.0133, 10.4, 44]], b: [[-17.3205, 10, 9], [-19.3185, 5.1764, 9], [-20.0913, 5.3834, 9], [-18.0133, 10.4, 9]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[-19.3185, 5.1764, 44], [-20, 0, 44], [-20.8, 0, 44], [-20.0913, 5.3834, 44]], b: [[-19.3185, 5.1764, 9], [-20, 0, 9], [-20.8, 0, 9], [-20.0913, 5.3834, 9]], collide: 0, color: "#7d7a72"}
      - {kind: loft, a: [[-20.8, 0, 10], [20.8, 0, 10], [20.8, 20.8, 10], [-20.8, 20.8, 10]], b: [[-20.8, 0, 9], [20.8, 0, 9], [20.8, 20.8, 9], [-20.8, 20.8, 9]], collide: 0, color: "#7d7a72"}
      - {kind: rod, from: [-7, 1.2, 5.5], to: [-7, 1.2, 41], radius: 1, collide: 0, color: "#5f5a52"}
      - {kind: rod, from: [-7, 1.2, 5.5], to: [-42, 1.2, 5.5], radius: 1, collide: 0, color: "#5f5a52"}
      - {kind: rod, from: [7, 1.2, 5.5], to: [7, 1.2, 41], radius: 1, collide: 0, color: "#5f5a52"}
      - {kind: rod, from: [7, 1.2, 5.5], to: [42, 1.2, 5.5], radius: 1, collide: 0, color: "#5f5a52"}
      - {kind: rod, from: [0, 0, 10], to: [0, 0, 42], radius: 1, collide: 0, color: "#6d675c"}
      - {kind: loft, a: [[-2.5, -2.5, 11], [2.5, -2.5, 11], [2.5, 2.5, 11], [-2.5, 2.5, 11]], b: [[-2.5, -2.5, 10], [2.5, -2.5, 10], [2.5, 2.5, 10], [-2.5, 2.5, 10]], collide: 0, color: "#6d675c"}
      - {kind: loft, a: [[32.4, -0.6, 7.4], [35.6, -0.6, 7.4], [35.6, 3, 7.4], [32.4, 3, 7.4]], b: [[32.4, -0.6, 3.6], [35.6, -0.6, 3.6], [35.6, 3, 3.6], [32.4, 3, 3.6]], collide: 0, color: "#6d675c"}
joints:
  - {id: j_a, type: slide, body: bell, axis: [0, 0, 1], range: [-12, 10], damping: 20}   # the gasometer A
  - {id: j_k, type: hinge, body: cock, axis: [0, 1, 0], damping: 0.01}   # the cock (the drive)
vessels:
  substeps: 8
  nodes:
    - {id: works, kind: source, p: 600, gas: true, RT: 84100}
    - {id: burners, kind: source, p: 0, gas: true, RT: 84100}
    - {id: tank, kind: chamber, fixed: 10, moving: top, open: true, sections: [[10, 294.524]], volume: 10013.8, water: 8246.68, p: 0,
       draw: {sections: [[[-19.95, 10], [-17.6, 10], [-17.6, 44], [-19.95, 44]], [[17.6, 10], [19.95, 10], [19.95, 44], [17.6, 44]]], y: [0.1, 5]}}   # the tank's water outside A
    - {id: gasometer, kind: chamber, fixed: 10, moving: top, sections: [[10, 907.92]], volume: 41764.3, water: 25421.8, p: 0,
       draw: {sections: [[[-16.95, 10], [16.95, 10], [16.95, 76], [-16.95, 76]]], y: [0.1, 16.7]}}   # the water and gas under A
  links:
    - {id: rim, from: tank, to: gasometer, area: 40, cd: 0.62, z: 11, zTo: 11}   # the water under A's rim
    - {id: inlet, from: works, to: gasometer, area: 0.7, cd: 0.62, z: 0, zTo: 41}
    - {id: outlet, from: gasometer, to: burners, area: 1.6, cd: 0.62, z: 41, zTo: 0, open: {joint: j_k, q: [0.3, 0.8], frac: [0, 1]}}
  pistons:
    - {node: gasometer, joint: j_a, area: 907.92, sign: 1}
driver: {joint: j_k, kind: velocity, rpm: 0, swing: {amplitude: 0.7, hz: 0.125}, kv: 300, max_torque: 20}
checks:
  - {type: amplitude, joint: j_a, min: 0.012, max: 0.08, settle_s: 2, window_s: 16}
  - {type: penetration, max: 0.01}
camera: {target: [0, 0, 27], position: [0, -330, 33], fov: 18}
display:
  output: j_a
  labels: {j_a: "Gasometer A", j_k: "Cock (driver)"}
