# No. 498 (Brown 1868): "Siphon pressure gauge. Lower part of bent tube contains mercury. The leg of the tube, against which the scale is marked,
# is open at top, the other leg connected with the steam-boiler or other apparatus on which the pressure is to be indicated."
# Model (cm, gravity on, Brown's front view). The mercury is lumped vessels (src/fluid/vessels.c, liquid rho 13560): the closed leg A
# (air over the mercury, joined to the boiler by the pipe and cock), the open leg B against the scale, and the bend between them, each
# a chamber joined by orifices at the bend's tops; every surface drawn is the vessels' own. The boiler is a stand-in that Brown does not
# draw: a closed air vessel under a pump barrel whose plunger the hand works by a lever (the only drive), so the pressure on leg A rises
# and falls; the mercury finds its own level. Generator: opencode-runs/fluidgen/gen498.py.
number: 498
slug: siphon-pressure-gauge
name: Siphon pressure gauge
brown: "Siphon pressure gauge. Lower part of bent tube contains mercury. The leg of the tube, against which the scale is marked, is open at top, the other leg connected with the steam-boiler or other apparatus on which the pressure is to be indicated. The pressure on the mercury in the one leg causes it to be depressed in that and raised in the other until there is an equilibrium established between the weight of mercury and pressure of steam in one leg, and the weight of mercury and pressure of atmosphere in the other. This is the most accurate gauge known; but as high pressure requires so long a tube, it has given place to those which are practically accurate enough, and of more convenient form."
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 50, duration_s: 10, floor: false}
bodies:
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#d6cdb8"
    pieces:
      - {kind: rod, from: [-3.82, 0.0, 1.0], to: [-3.82, 0.0, 50.0], radius: 0.1, collide: 0, color: "#9fb4bf"}
      - {kind: rod, from: [-2.18, 0.0, 1.0], to: [-2.18, 0.0, 50.0], radius: 0.1, collide: 0, color: "#9fb4bf"}
      - {kind: rod, from: [2.18, 0.0, 1.0], to: [2.18, 0.0, 62.0], radius: 0.1, collide: 0, color: "#9fb4bf"}
      - {kind: rod, from: [3.82, 0.0, 1.0], to: [3.82, 0.0, 62.0], radius: 0.1, collide: 0, color: "#9fb4bf"}
      - {kind: rod, from: [-2.18, 0.0, 1.0], to: [-2.1057, 0.0, 0.43577], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [-2.1057, 0.0, 0.43577], to: [-1.8879, 0.0, -0.09], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [-1.8879, 0.0, -0.09], to: [-1.5415, 0.0, -0.54149], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [-1.5415, 0.0, -0.54149], to: [-1.09, 0.0, -0.88794], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [-1.09, 0.0, -0.88794], to: [-0.56423, 0.0, -1.1057], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [-0.56423, 0.0, -1.1057], to: [-4.0046e-16, 0.0, -1.18], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [-4.0046e-16, 0.0, -1.18], to: [0.56423, 0.0, -1.1057], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [0.56423, 0.0, -1.1057], to: [1.09, 0.0, -0.88794], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [1.09, 0.0, -0.88794], to: [1.5415, 0.0, -0.54149], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [1.5415, 0.0, -0.54149], to: [1.8879, 0.0, -0.09], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [1.8879, 0.0, -0.09], to: [2.1057, 0.0, 0.43577], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [2.1057, 0.0, 0.43577], to: [2.18, 0.0, 1.0], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [-3.82, 0.0, 1.0], to: [-3.6898, 0.0, 0.011311], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [-3.6898, 0.0, 0.011311], to: [-3.3082, 0.0, -0.91], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [-3.3082, 0.0, -0.91], to: [-2.7011, 0.0, -1.7011], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [-2.7011, 0.0, -1.7011], to: [-1.91, 0.0, -2.3082], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [-1.91, 0.0, -2.3082], to: [-0.98869, 0.0, -2.6898], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [-0.98869, 0.0, -2.6898], to: [-7.0172e-16, 0.0, -2.82], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [-7.0172e-16, 0.0, -2.82], to: [0.98869, 0.0, -2.6898], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [0.98869, 0.0, -2.6898], to: [1.91, 0.0, -2.3082], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [1.91, 0.0, -2.3082], to: [2.7011, 0.0, -1.7011], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [2.7011, 0.0, -1.7011], to: [3.3082, 0.0, -0.91], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [3.3082, 0.0, -0.91], to: [3.6898, 0.0, 0.011311], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: rod, from: [3.6898, 0.0, 0.011311], to: [3.82, 0.0, 1.0], radius: 0.1, collide: 0, capsule: true, color: "#9fb4bf"}
      - {kind: poly, points: [[4.3, 5.0], [9.5, 5.0], [9.5, 62.0], [4.3, 62.0]], y: [0.7, 1.1], collide: 0, color: "#b9a27a"}
      - {kind: rod, from: [4.3, 0.6, 30.0], to: [6.3, 0.6, 30.0], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 32.5], to: [5.2, 0.6, 32.5], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 35.0], to: [5.2, 0.6, 35.0], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 37.5], to: [5.2, 0.6, 37.5], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 40.0], to: [6.3, 0.6, 40.0], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 42.5], to: [5.2, 0.6, 42.5], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 45.0], to: [5.2, 0.6, 45.0], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 47.5], to: [5.2, 0.6, 47.5], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 50.0], to: [6.3, 0.6, 50.0], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 52.5], to: [5.2, 0.6, 52.5], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 55.0], to: [5.2, 0.6, 55.0], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 57.5], to: [5.2, 0.6, 57.5], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 60.0], to: [6.3, 0.6, 60.0], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 27.5], to: [5.2, 0.6, 27.5], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 25.0], to: [5.2, 0.6, 25.0], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 22.5], to: [5.2, 0.6, 22.5], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 20.0], to: [5.2, 0.6, 20.0], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 17.5], to: [5.2, 0.6, 17.5], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 15.0], to: [5.2, 0.6, 15.0], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 12.5], to: [5.2, 0.6, 12.5], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [4.3, 0.6, 10.0], to: [5.2, 0.6, 10.0], radius: 0.08, collide: 0, color: "#2b2620"}
      - {kind: rod, from: [-21.9, 0.0, 3.0], to: [-12.0, 0.0, 3.0], radius: 0.35, collide: 0, capsule: true, color: "#6d675c"}
      - {kind: rod, from: [-12.0, 0.0, 3.0], to: [-12.0, 0.0, 52.0], radius: 0.35, collide: 0, capsule: true, color: "#6d675c"}
      - {kind: rod, from: [-12.0, 0.0, 52.0], to: [-3.0, 0.0, 52.0], radius: 0.35, collide: 0, capsule: true, color: "#6d675c"}
      - {kind: rod, from: [-3.0, 0.0, 52.0], to: [-3.0, 0.0, 50.0], radius: 0.35, collide: 0, capsule: true, color: "#6d675c"}
      - {kind: disc, center: [-7.5, 52.0], radius: 0.9, y: [-0.8, 0.8], collide: 0, color: "#6d675c"}
      - {kind: rod, from: [-7.5, -1.4, 52.0], to: [-7.5, -1.4, 55.0], radius: 0.25, collide: 0, color: "#6d675c"}
      - {kind: poly, points: [[-28.09, 0.0], [-21.91, 0.0], [-21.91, 5.0], [-28.09, 5.0]], y: [3.0902, 3.3902], collide: 0, color: "#8b7d66"}
      - {kind: poly, points: [[-26.2, 5.0], [-23.8, 5.0], [-23.8, 32.0], [-26.2, 32.0]], y: [1.2, 1.5], collide: 0, color: "#8b7d66"}
      - {kind: poly, points: [[-28.39, -0.3], [-28.09, -0.3], [-28.09, 5.3], [-28.39, 5.3]], y: [-3.0902, 3.0902], collide: 0, color: "#6d675c"}
      - {kind: poly, points: [[-21.91, -0.3], [-21.61, -0.3], [-21.61, 5.3], [-21.91, 5.3]], y: [-3.0902, 3.0902], collide: 0, color: "#6d675c"}
      - {kind: poly, points: [[-28.39, -0.6], [-21.61, -0.6], [-21.61, 0.0], [-28.39, 0.0]], y: [-3.0902, 3.0902], collide: 0, color: "#6d675c"}
      - {kind: poly, points: [[-28.39, 5.0], [-26.2, 5.0], [-26.2, 5.3], [-28.39, 5.3]], y: [-3.0902, 3.0902], collide: 0, color: "#6d675c"}
      - {kind: poly, points: [[-23.8, 5.0], [-21.61, 5.0], [-21.61, 5.3], [-23.8, 5.3]], y: [-3.0902, 3.0902], collide: 0, color: "#6d675c"}
      - {kind: poly, points: [[-26.5, 5.0], [-26.2, 5.0], [-26.2, 32.0], [-26.5, 32.0]], y: [-3.0902, 3.0902], collide: 0, color: "#6d675c"}
      - {kind: poly, points: [[-23.8, 5.0], [-23.5, 5.0], [-23.5, 32.0], [-23.8, 32.0]], y: [-3.0902, 3.0902], collide: 0, color: "#6d675c"}
      - {kind: rod, from: [-45.0, 0.9, -3.0], to: [-45.0, 0.9, 48.0], radius: 0.45, collide: 0, color: "#6d675c"}
      - {kind: poly, points: [[-50.0, -3.5], [12.0, -3.5], [12.0, -2.5], [-50.0, -2.5]], y: [-4.0, 4.0], collide: 0, color: "#8b7d66"}
      - {kind: poly, points: [[-1.2, -2.5], [1.2, -2.5], [1.2, -2.0], [-1.2, -2.0]], y: [-1.0, 1.0], collide: 0, color: "#6d675c"}
  - id: lever
    shape: part
    pos: [-45, 0, 48]
    mass: 0.12
    color: "#5f5a52"
    pieces:
      - {kind: rod, from: [-58.0, -0.6, 48.6], to: [-45.0, -0.6, 48.0], radius: 0.42, collide: 0, capsule: true}
      - {kind: rod, from: [-45.0, -0.6, 48.0], to: [-25.0, -0.6, 48.0], radius: 0.42, collide: 0, capsule: true}
      - {kind: rod, from: [-45.0, -1.2, 48.0], to: [-45.0, 0.2, 48.0], radius: 0.6, collide: 0}
      - {kind: rod, from: [-25.0, -1.2, 48.0], to: [-25.0, 0.2, 48.0], radius: 0.45, collide: 0}
  - id: plunger
    shape: part
    pos: [-25, 0, 15.0]
    mass: 0.05
    color: "#8a8478"
    pieces:
      - {kind: disc, center: [-25.0, 15.5], radius: 1.17, y: [-1.2, 1.2], collide: 0, color: "#4f3b28"}
      - {kind: rod, from: [-25.0, 0.0, 16.0], to: [-25.0, 0.0, 40.0], radius: 0.3, collide: 0}
  - id: crod
    shape: part
    mount: plunger
    pos: [-25, 0, 40]
    mass: 0.01
    color: "#6d675c"
    pieces:
      - {kind: rod, from: [-25.0, -0.6, 40.0], to: [-25.0, -0.6, 48.0], radius: 0.3, collide: 0, capsule: true}
joints:
  - {id: j_lever, type: hinge, body: lever, axis: [0, 1, 0], damping: 0.002}   # the hand's lever (the only drive)
  - {id: j_p, type: slide, body: plunger, axis: [0, 0, 1], range: [-12, 12], damping: 0.01, frictionloss: 25}   # the plunger in its packing
  - {id: j_c, type: hinge, body: crod, axis: [0, 1, 0], damping: 0.0005}
pins:
  - {id: p_L, a: lever, b: crod, at: [-25, 0, 48]}
vessels:
  substeps: 8
  liquid: {rho: 13560, color: "#7e858c"}
  nodes:
    - {id: boiler, kind: chamber, fixed: 0, sections: [[0, 30.0], [5, 4.5239]], volume: 195.24, water: 0, p: 20000}   # air only, its top the plunger's face
    - {id: legA, kind: chamber, fixed: 5, sections: [[5, 1.5394]], volume: 69.272, water: 26.912, p: 20000, K: 2000000,
       draw: {sections: [[[-3.7, 5], [-2.3, 5], [-2.3, 50.0], [-3.7, 50.0]]], y: [-0.7, 0.7]}}
    - {id: bend, kind: chamber, fixed: -2, sections: [[-2, 3.8319]], volume: 26.823, water: 26.823, K: 2000000,
       draw: {sections: [[[-3.7, 1.0], [-2.3, 1.0], [-2.3, 5.0], [-3.7, 5.0]], [[2.3, 1.0], [3.7, 1.0], [3.7, 5.0], [2.3, 5.0]], [[-2.3, 1.0], [-3.7, 1.0], [-3.2043, -0.85], [-1.9919, -0.15]], [[-1.9919, -0.15], [-3.2043, -0.85], [-1.85, -2.2043], [-1.15, -0.99186]], [[-1.15, -0.99186], [-1.85, -2.2043], [-6.7968e-16, -2.7], [-4.225e-16, -1.3]], [[-4.225e-16, -1.3], [-6.7968e-16, -2.7], [1.85, -2.2043], [1.15, -0.99186]], [[1.15, -0.99186], [1.85, -2.2043], [3.2043, -0.85], [1.9919, -0.15]], [[1.9919, -0.15], [3.2043, -0.85], [3.7, 1.0], [2.3, 1.0]]], y: [-0.7, 0.7]}}   # always full: drawn to its own surface all the same
    - {id: legB, kind: chamber, open: true, fixed: 5, sections: [[5, 1.5394]], volume: 87.745, water: 50.057,
       draw: {sections: [[[2.3, 5], [3.7, 5], [3.7, 62.0], [2.3, 62.0]]], y: [-0.7, 0.7]}}
  links:
    - {id: pipe, from: boiler, to: legA, area: 0.2, cd: 0.62, z: 2, zTo: 49.5}   # air from the boiler over leg A's mercury
    - {id: bendA, from: bend, to: legA, area: 1.5394, cd: 0.8, z: 5, zTo: 5}
    - {id: bendB, from: bend, to: legB, area: 1.5394, cd: 0.8, z: 5, zTo: 5}
  pistons:
    - {node: boiler, joint: j_p, area: 4.5239, sign: 1}
driver: {joint: j_lever, kind: velocity, rpm: 0, swing: {amplitude: 0.35, hz: 0.2}, kv: 2000, max_torque: 40}
checks:
  - {type: amplitude, joint: j_p, min: 0.04, max: 0.09, settle_s: 1.0, window_s: 8}
  - {type: penetration, max: 0.003}
camera: {target: [-20, 0, 10], position: [-20, -300, 13], fov: 21}
display:
  output: j_p
  labels: {j_lever: "Pump lever (driver)", j_p: "Plunger", j_c: "Connecting rod"}
