# No. 286 (Brown 1868): "Toe and lifter for working puppet valves in steam engines. The curved toe on the rock-shaft operates on the lifter attached to the lifting-rod to raise the valve."
#
# Model (cm, gravity on): the rock-shaft (the one driven joint) is rocked 0.28 rad either way at 0.4 Hz. Its curved toe works, by real contact, under the flat of the lifter, which is fast on
# the upright lifting-rod of a puppet valve. The toe's face is an involute of a circle of radius 11.0 about the shaft, so while it bears the flat rises 11.0 cm to the radian of rocking (the contact
# staying 11.0 cm to the left of the shaft), lifting the valve 3.1 cm off its seat at the top of the stroke. On the back stroke the valve's weight lets it follow the toe down, and the toe falls
# clear of the flat while the valve sits on its seat (the rod's lower stop). Generator: opencode-runs/batch12/gen286.py.
number: 286
slug: toe-lifter-puppet-valve
name: Toe and lifter for working puppet valves in steam engines
brown: "Toe and lifter for working puppet valves in steam engines. The curved toe on the rock-shaft operates on the lifter attached to the lifting-rod to raise the valve."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 100
  solver: PGS
  multiccd: true
  duration_s: 10.0
  floor: false
bodies:
  - id: toe
    shape: part
    pos: [0, 0, 0]
    mass: 0.4
    friction: 0.1
    color: "#d9cfb6"
    pieces:
      - {kind: disc, center: [0, 0], radius: 2.4, inner: 1.4, y: [-1.2, 1.2], collide: 0}   # the toe's boss on the rock-shaft
      - {kind: poly, points: [[-10.7198, 2.9848], [-10.7588, 2.989], [-10.8656, 1.8942], [-10.8393, 1.8913]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-10.7588, 2.989], [-10.8032, 2.9929], [-10.8862, 1.896], [-10.8656, 1.8942]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-10.8032, 2.9929], [-10.8528, 2.9961], [-10.912, 1.8977], [-10.8862, 1.896]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-10.8528, 2.9961], [-10.9077, 2.9985], [-10.943, 1.8991], [-10.912, 1.8977]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-10.9077, 2.9985], [-10.9679, 2.9998], [-10.9793, 1.8999], [-10.943, 1.8991]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-10.9679, 2.9998], [-11.0334, 2.9998], [-11.0208, 1.8999], [-10.9793, 1.8999]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-11.0334, 2.9998], [-11.1041, 2.9983], [-11.0675, 1.8989], [-11.0208, 1.8999]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-11.1041, 2.9983], [-11.1799, 2.9949], [-11.1194, 1.8966], [-11.0675, 1.8989]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-11.1799, 2.9949], [-11.2609, 2.9896], [-11.1765, 1.8929], [-11.1194, 1.8966]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-11.2609, 2.9896], [-11.347, 2.9821], [-11.2387, 1.8874], [-11.1765, 1.8929]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-11.347, 2.9821], [-11.4381, 2.9721], [-11.3059, 1.8801], [-11.2387, 1.8874]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-11.4381, 2.9721], [-11.5341, 2.9594], [-11.3782, 1.8705], [-11.3059, 1.8801]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-11.5341, 2.9594], [-11.635, 2.9439], [-11.4554, 1.8587], [-11.3782, 1.8705]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-11.635, 2.9439], [-11.7407, 2.9253], [-11.5375, 1.8442], [-11.4554, 1.8587]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-11.7407, 2.9253], [-11.8511, 2.9033], [-11.6244, 1.8269], [-11.5375, 1.8442]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-11.8511, 2.9033], [-11.9662, 2.8778], [-11.716, 1.8066], [-11.6244, 1.8269]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-11.9662, 2.8778], [-12.0857, 2.8485], [-11.8122, 1.783], [-11.716, 1.8066]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-12.0857, 2.8485], [-12.2096, 2.8153], [-11.913, 1.756], [-11.8122, 1.783]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-12.2096, 2.8153], [-12.3378, 2.7779], [-12.0181, 1.7254], [-11.913, 1.756]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-12.3378, 2.7779], [-12.4701, 2.7362], [-12.1276, 1.6909], [-12.0181, 1.7254]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-12.4701, 2.7362], [-12.6065, 2.6899], [-12.2412, 1.6523], [-12.1276, 1.6909]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-12.6065, 2.6899], [-12.7467, 2.6388], [-12.3704, 1.6052], [-12.2412, 1.6523]], y: [-1.0, 1.0], collide: 1}
      - {kind: poly, points: [[-10.7198, 2.9848], [-10.8393, 1.8913], [0.6, -2.3], [0.6, 2.3]], y: [-0.9, 0.9], collide: 0}   # the toe's root, to the boss
      - {kind: poly, points: [[-12.3704, 1.6052], [-10.8393, 1.8913], [0.0, -2.3], [-13.3467, 1.7052]], y: [-0.9, 0.9], collide: 0}   # its underside
      - {kind: poly, points: [[-12.7467, 2.6388], [-13.4467, 2.2388], [-12.3704, 1.6052]], y: [-1.0, 1.0], collide: 0}   # its tip
  - id: lifter
    shape: part
    pos: [3.2, 0, 0]
    mass: 0.5
    friction: 0.1
    color: "#b8ad97"
    pieces:
      - {kind: rod, from: [3.2, 0, -12.6], to: [3.2, 0, 12.0], radius: 0.6, collide: 0, color: "#a39d90"}   # the lifting-rod
      - {kind: poly, points: [[2.1, 3.0], [4.5, 3.0], [4.5, 6.0], [2.1, 6.0]], y: [-1.4, 1.4], collide: 0}   # the lifter's boss, keyed on the rod
      - {kind: poly, points: [[-17.0, 3.0], [2.1, 3.0], [2.1, 5.6], [-17.0, 3.5]], y: [-1.2, 1.2], collide: 0}   # the lifter
      - {kind: poly, points: [[-16.0, 3.0], [1.9, 3.0], [1.9, 3.4], [-16.0, 3.4]], y: [-1.2, 1.2], collide: 2}   # its flat, on which the toe works
      - {kind: poly, points: [[0.6, -13.0], [5.8, -13.0], [4.4, -11.8], [2.0, -11.8]], y: [-2.6, 2.6], collide: 0, color: "#8f8a80"}   # the puppet valve
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: rod, from: [0, -1.6, 0], to: [0, 3.0, 0], radius: 1.4, color: "#8f8a80"}   # the rock-shaft
      - {kind: poly, points: [[1.6, 9.5], [4.8, 9.5], [4.8, 10.5], [1.6, 10.5]], y: [-1.8, 1.8]}   # the rod's upper guide
      - {kind: poly, points: [[1.6, -6.5], [4.8, -6.5], [4.8, -5.5], [1.6, -5.5]], y: [-1.8, 1.8]}   # its lower guide (the stuffing-box)
      - {kind: poly, points: [[-3.8, -6.5], [10.2, -6.5], [10.2, -5.7], [-3.8, -5.7]], y: [-4, 4], color: "#b9b09c"}   # the valve-chest's cover
      - {kind: poly, points: [[-3.8, -17.0], [-3.0, -17.0], [-3.0, -6.5], [-3.8, -6.5]], y: [-4, 4], color: "#b9b09c"}   # its sides
      - {kind: poly, points: [[9.4, -17.0], [10.2, -17.0], [10.2, -6.5], [9.4, -6.5]], y: [-4, 4], color: "#b9b09c"}
      - {kind: poly, points: [[-3.8, -17.0], [10.2, -17.0], [10.2, -17.0], [-3.8, -17.0]], y: [3.2, 4], color: "#b9b09c"}
      - {kind: poly, points: [[-3.0, -13.8], [1.2, -13.8], [0.8, -13.0], [-3.0, -13.0]], y: [-3.2, 3.2]}   # the valve's seat
      - {kind: poly, points: [[5.2, -13.8], [9.4, -13.8], [9.4, -13.0], [5.6, -13.0]], y: [-3.2, 3.2]}
      - {kind: poly, points: [[-3.8, -17.0], [10.2, -17.0], [10.2, -16.2], [-3.8, -16.2]], y: [-4, 4], color: "#b9b09c"}   # the chest's bottom
      - {kind: poly, points: [[-2.2, -17.0], [2.2, -17.0], [1.4, 0], [-1.4, 0]], y: [3.0, 3.8]}   # the rock-shaft's bracket
joints:
  - {id: j_t, type: hinge, body: toe, axis: [0, 1, 0], damping: 0.001}   # the one driven joint: + : clockwise, the toe's tip rising
  - {id: j_r, type: slide, body: lifter, axis: [0, 0, 1], range: [0, 4.58], damping: 0.2}   # the lifting-rod; 0: the valve on its seat
contact: {solref: [0.002, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_t, kind: velocity, rpm: 0, swing: {amplitude: 0.28, hz: 0.4}, kv: 20.0, max_torque: 10}
checks:
  - {type: follow, out: j_r, in: j_t, expect: 0.11, tol: 0.0055, min_r2: 0.995, settle_s: 2.65, window_s: 0.9}   # rising: B a radian
  - {type: follow, out: j_r, in: j_t, expect: 0.11, tol: 0.0055, min_r2: 0.995, settle_s: 5.15, window_s: 0.9}
  - {type: position, joint: j_r, min: -0.05, max: 3.3264, settle_s: 0.5, window_s: 9}   # the lift
  - {type: position, joint: j_r, min: -0.05, max: 0.05, settle_s: 4.0, window_s: 0.8}   # the toe below: the valve on its seat
  - {type: penetration, max: 0.001, settle_s: 0.5}
camera: {target: [-6.0, 0, -4.5], position: [-6.0, -66.0, -4.5], fov: 34}
display:
  output: j_r
  labels: {j_t: "Rock-shaft and toe (driver)", j_r: "Lifter and valve"}
  proof: {label: "Toe out of contact", sub: "the shaft rocks but the valve stays shut"}

