# No. 85 (Brown 1868): "Intermittent alternating rectilinear motion is given to the rod, A, by the continuous
# rotation of the shaft carrying the two cams or wipers, which act upon the projection, B, of the rod, and
# thereby lift it. The rod drops by its own weight. Used for ore-stampers or pulverizers, and for hammers."
#
# Model (cm): the shaft (the one driven joint, 30 turns a minute, clockwise in the view) carries two wipers,
# half a turn apart, whose lifting faces are involutes of a 3.0 cm base circle: each meets the flat underside of
# the tappet B where the vertical tangent to that circle crosses it, and so lifts B and the stamp-rod A 3.0 cm a
# radian, 3.4 cm in all, while the wiper turns 66 deg. Past its tip, the wiper lets B go and A
# drops by its own weight onto the die, twice a turn. A slides in guides (its joint; the guides are drawn).
# Generator: opencode-runs/batch8/gen085.py.
number: 85
slug: stamper-two-wipers
name: A stamp-rod lifted by two wipers and dropped by its weight
brown: "Intermittent alternating rectilinear motion is given to the rod, A, by the continuous rotation of the shaft carrying the two cams or wipers, which act upon the projection, B, of the rod, and thereby lift it. The rod drops by its own weight. Used for ore-stampers or pulverizers, and for hammers."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 100
  solver: PGS
  multiccd: true
  duration_s: 10
  floor: false
bodies:
  - id: shaft
    shape: part
    pos: [0, 0, 0]
    mass: 1.0
    friction: 0.1
    color: "#d9cfb6"
    pieces:
      - {kind: disc, center: [0, 0], radius: 1.3, inner: 0.5, y: [-0.9, 0.9]}
      - {kind: poly, points: [[-2.8181, -1.0287], [-2.8307, -1.0342], [-2.867, -1.054], [-2.9241, -1.0925], [-2.9986, -1.1537], [-3.0864, -1.2411], [-3.1831, -1.3577], [-3.2837, -1.5058], [-3.3829, -1.687], [-3.4752, -1.9021], [-3.5549, -2.1513], [-3.6163, -2.4339], [-3.6536, -2.7484], [-0.935, -0.7034], [-1.0991, -0.4012]], y: [-0.9, 0.9], collide: 1}   # the wipers
      - {kind: poly, points: [[2.8181, 1.0287], [2.8307, 1.0342], [2.867, 1.054], [2.9241, 1.0925], [2.9986, 1.1537], [3.0864, 1.2411], [3.1831, 1.3577], [3.2837, 1.5058], [3.3829, 1.687], [3.4752, 1.9021], [3.5549, 2.1513], [3.6163, 2.4339], [3.6536, 2.7484], [0.935, 0.7034], [1.0991, 0.4012]], y: [-0.9, 0.9], collide: 1}
  - id: rod_a
    shape: part
    pos: [-7.0, 0, -12.0]
    mass: 1.5
    friction: 0.1
    color: "#b8ad97"
    pieces:
      - {kind: rod, from: [-7.0, 0, -9.5], to: [-7.0, 0, 10], radius: 0.6}   # the stamp-rod
      - {kind: poly, points: [[-8.6, -12.0], [-5.4, -12.0], [-5.4, -9.5], [-8.6, -9.5]], y: [-1.6, 1.6], collide: 2}   # the stamp's shoe
      - {kind: poly, points: [[-7.8, 0.1], [-2.55, 0.1], [-2.55, 1.3], [-7.8, 1.3]], y: [-0.9, 0.9], collide: 2}   # the tappet B
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: rod, from: [0, -1.2, 0], to: [0, 2.8, 0], radius: 0.5, color: "#8f8a80"}   # the shaft's journal
      - {kind: poly, points: [[-1.4, -13.0], [1.4, -13.0], [0.9, 0], [-0.9, 0]], y: [1.8, 2.8]}   # its standard, behind
      - {kind: poly, points: [[-9.4, -13.5], [-4.6, -13.5], [-4.6, -12.0], [-9.4, -12.0]], y: [-2.2, 2.2], collide: 1, color: "#8f8a80"}   # the die
      - {kind: poly, points: [[-8.8, 6], [-7.62, 6], [-7.62, 8], [-8.8, 8]], y: [-1.2, 1.2]}   # A's guide
      - {kind: poly, points: [[-6.38, 6], [-5.2, 6], [-5.2, 8], [-6.38, 8]], y: [-1.2, 1.2]}
      - {kind: poly, points: [[-8.8, 8], [-8.0, 8], [-8.0, -13.0], [-8.8, -13.0]], y: [1.3, 2.3]}   # the guide's post, behind
      - {kind: poly, points: [[-14, -14.5], [8, -14.5], [8, -13.5], [-14, -13.5]], y: [-3, 3], color: "#b9b09c"}
joints:
  - {id: j_s, type: hinge, body: shaft, axis: [0, 1, 0], damping: 0.002}   # the one driven joint; + : clockwise
  - {id: j_a, type: slide, body: rod_a, axis: [0, 0, 1], range: [-0.5, 5.45], damping: 0.05}   # + : up
contact: {solref: [0.002, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_s, kind: velocity, rpm: 30.0, kv: 2.0, max_torque: 20}
checks:
  - {type: follow, out: j_a, in: j_s, expect: 0.03, tol: 0.0006, min_r2: 0.995, settle_s: 2.25, window_s: 0.3}   # B on the wiper's involute: rb a radian
  - {type: position, joint: j_a, min: -0.1, max: 4.05, settle_s: 0.5, window_s: 9}
  - {type: penetration, max: 0.001, settle_s: 0.5}
camera: {target: [-3, 0, -2], position: [-3, -70, 2], fov: 34}
display:
  output: j_a
  labels: {j_s: "Wiper shaft (driver)", j_a: "Stamp-rod A"}
  proof: {label: "Wipers out of contact", sub: "the shaft turns but the stamp lies on the die"}

