# No. 375 (Brown 1868): "Pair of edge runners or chasers for crushing or grinding. The axles are connected with vertical shaft, and the wheels or chasers run in an annular pan or trough."
#
# Reading of the figure (cm, gravity on; Brown's front elevation): the driving shaft comes in at the top right and is the one driven
# joint (40 rev/min). Its vertical bevel-gear (4 cm pitch radius, 20 teeth) turns the large horizontal one (8 cm, 40 teeth) on
# the upright shaft, which stands in the middle of the frame. Low on the upright a crosshead carries the two axles, each hinged so that
# its chaser can rise over the stuff in the pan; the chasers (6 cm radius, 4 cm broad, stone) stand on the pan's floor 9 cm
# out from the upright and are rolled round by it, turning on their axles by the friction of the floor. The pan's sloping rim and the
# frame are drawn only.
# Generator: opencode-runs/batch12/gen375.py.
number: 375
slug: edge-runners
name: Edge runners
brown: "Pair of edge runners or chasers for crushing or grinding. The axles are connected with vertical shaft, and the wheels or chasers run in an annular pan or trough."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 80
  solver: PGS
  multiccd: true
  duration_s: 9
  floor: false
bodies:
  - id: upright
    shape: part
    pos: [0, 0, 0]
    mass: 1.0
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [0, 0, 0.4], to: [0, 0, 27.0], radius: 0.8, collide: 0}   # the upright shaft
      - {kind: loft, a: [[-1.5, -1.5, 4.5], [1.5, -1.5, 4.5], [1.5, 1.5, 4.5], [-1.5, 1.5, 4.5]], b: [[-1.5, -1.5, 7.5], [1.5, -1.5, 7.5], [1.5, 1.5, 7.5], [-1.5, 1.5, 7.5]], collide: 0, color: "#a39d90"}   # the crosshead
  - id: arm_r
    shape: part
    mount: upright
    pos: [0, 0, 6.0]
    mass: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [1.5, 0, 6.0], to: [11.6, 0, 6.0], radius: 0.7, collide: 0}   # the axle, hinged in the crosshead
  - id: run_r
    shape: part
    mount: arm_r
    pos: [9.0, 0, 6.0]
    density: 2600
    friction: 0.6
    color: "#d8ceba"
    pieces:
      - {kind: loft, a: [[7.0, 6.0, 6.0], [7.0, 5.8847, 7.1705], [7.0, 5.5433, 8.2961], [7.0, 4.9888, 9.3334], [7.0, 4.2426, 10.2426], [7.0, 3.3334, 10.9888], [7.0, 2.2961, 11.5433], [7.0, 1.1705, 11.8847], [7.0, 0.0, 12.0], [7.0, -1.1705, 11.8847], [7.0, -2.2961, 11.5433], [7.0, -3.3334, 10.9888], [7.0, -4.2426, 10.2426], [7.0, -4.9888, 9.3334], [7.0, -5.5433, 8.2961], [7.0, -5.8847, 7.1705], [7.0, -6.0, 6.0], [7.0, -5.8847, 4.8295], [7.0, -5.5433, 3.7039], [7.0, -4.9888, 2.6666], [7.0, -4.2426, 1.7574], [7.0, -3.3334, 1.0112], [7.0, -2.2961, 0.4567], [7.0, -1.1705, 0.1153], [7.0, -0.0, 0.0], [7.0, 1.1705, 0.1153], [7.0, 2.2961, 0.4567], [7.0, 3.3334, 1.0112], [7.0, 4.2426, 1.7574], [7.0, 4.9888, 2.6666], [7.0, 5.5433, 3.7039], [7.0, 5.8847, 4.8295]], b: [[11.0, 6.0, 6.0], [11.0, 5.8847, 7.1705], [11.0, 5.5433, 8.2961], [11.0, 4.9888, 9.3334], [11.0, 4.2426, 10.2426], [11.0, 3.3334, 10.9888], [11.0, 2.2961, 11.5433], [11.0, 1.1705, 11.8847], [11.0, 0.0, 12.0], [11.0, -1.1705, 11.8847], [11.0, -2.2961, 11.5433], [11.0, -3.3334, 10.9888], [11.0, -4.2426, 10.2426], [11.0, -4.9888, 9.3334], [11.0, -5.5433, 8.2961], [11.0, -5.8847, 7.1705], [11.0, -6.0, 6.0], [11.0, -5.8847, 4.8295], [11.0, -5.5433, 3.7039], [11.0, -4.9888, 2.6666], [11.0, -4.2426, 1.7574], [11.0, -3.3334, 1.0112], [11.0, -2.2961, 0.4567], [11.0, -1.1705, 0.1153], [11.0, -0.0, 0.0], [11.0, 1.1705, 0.1153], [11.0, 2.2961, 0.4567], [11.0, 3.3334, 1.0112], [11.0, 4.2426, 1.7574], [11.0, 4.9888, 2.6666], [11.0, 5.5433, 3.7039], [11.0, 5.8847, 4.8295]], collide: 1}   # the chaser, a stone wheel
      - {kind: loft, a: [[6.2, 1.6, 6.0], [6.2, 1.4782, 6.6123], [6.2, 1.1314, 7.1314], [6.2, 0.6123, 7.4782], [6.2, 0.0, 7.6], [6.2, -0.6123, 7.4782], [6.2, -1.1314, 7.1314], [6.2, -1.4782, 6.6123], [6.2, -1.6, 6.0], [6.2, -1.4782, 5.3877], [6.2, -1.1314, 4.8686], [6.2, -0.6123, 4.5218], [6.2, -0.0, 4.4], [6.2, 0.6123, 4.5218], [6.2, 1.1314, 4.8686], [6.2, 1.4782, 5.3877]], b: [[7.0, 1.6, 6.0], [7.0, 1.4782, 6.6123], [7.0, 1.1314, 7.1314], [7.0, 0.6123, 7.4782], [7.0, 0.0, 7.6], [7.0, -0.6123, 7.4782], [7.0, -1.1314, 7.1314], [7.0, -1.4782, 6.6123], [7.0, -1.6, 6.0], [7.0, -1.4782, 5.3877], [7.0, -1.1314, 4.8686], [7.0, -0.6123, 4.5218], [7.0, -0.0, 4.4], [7.0, 0.6123, 4.5218], [7.0, 1.1314, 4.8686], [7.0, 1.4782, 5.3877]], collide: 0, color: "#a39d90"}   # its hub
  - id: arm_l
    shape: part
    mount: upright
    pos: [0, 0, 6.0]
    mass: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [-1.5, 0, 6.0], to: [-11.6, 0, 6.0], radius: 0.7, collide: 0}   # the axle, hinged in the crosshead
  - id: run_l
    shape: part
    mount: arm_l
    pos: [-9.0, 0, 6.0]
    density: 2600
    friction: 0.6
    color: "#d8ceba"
    pieces:
      - {kind: loft, a: [[-7.0, 6.0, 6.0], [-7.0, 5.8847, 7.1705], [-7.0, 5.5433, 8.2961], [-7.0, 4.9888, 9.3334], [-7.0, 4.2426, 10.2426], [-7.0, 3.3334, 10.9888], [-7.0, 2.2961, 11.5433], [-7.0, 1.1705, 11.8847], [-7.0, 0.0, 12.0], [-7.0, -1.1705, 11.8847], [-7.0, -2.2961, 11.5433], [-7.0, -3.3334, 10.9888], [-7.0, -4.2426, 10.2426], [-7.0, -4.9888, 9.3334], [-7.0, -5.5433, 8.2961], [-7.0, -5.8847, 7.1705], [-7.0, -6.0, 6.0], [-7.0, -5.8847, 4.8295], [-7.0, -5.5433, 3.7039], [-7.0, -4.9888, 2.6666], [-7.0, -4.2426, 1.7574], [-7.0, -3.3334, 1.0112], [-7.0, -2.2961, 0.4567], [-7.0, -1.1705, 0.1153], [-7.0, -0.0, 0.0], [-7.0, 1.1705, 0.1153], [-7.0, 2.2961, 0.4567], [-7.0, 3.3334, 1.0112], [-7.0, 4.2426, 1.7574], [-7.0, 4.9888, 2.6666], [-7.0, 5.5433, 3.7039], [-7.0, 5.8847, 4.8295]], b: [[-11.0, 6.0, 6.0], [-11.0, 5.8847, 7.1705], [-11.0, 5.5433, 8.2961], [-11.0, 4.9888, 9.3334], [-11.0, 4.2426, 10.2426], [-11.0, 3.3334, 10.9888], [-11.0, 2.2961, 11.5433], [-11.0, 1.1705, 11.8847], [-11.0, 0.0, 12.0], [-11.0, -1.1705, 11.8847], [-11.0, -2.2961, 11.5433], [-11.0, -3.3334, 10.9888], [-11.0, -4.2426, 10.2426], [-11.0, -4.9888, 9.3334], [-11.0, -5.5433, 8.2961], [-11.0, -5.8847, 7.1705], [-11.0, -6.0, 6.0], [-11.0, -5.8847, 4.8295], [-11.0, -5.5433, 3.7039], [-11.0, -4.9888, 2.6666], [-11.0, -4.2426, 1.7574], [-11.0, -3.3334, 1.0112], [-11.0, -2.2961, 0.4567], [-11.0, -1.1705, 0.1153], [-11.0, -0.0, 0.0], [-11.0, 1.1705, 0.1153], [-11.0, 2.2961, 0.4567], [-11.0, 3.3334, 1.0112], [-11.0, 4.2426, 1.7574], [-11.0, 4.9888, 2.6666], [-11.0, 5.5433, 3.7039], [-11.0, 5.8847, 4.8295]], collide: 1}   # the chaser, a stone wheel
      - {kind: loft, a: [[-6.2, 1.6, 6.0], [-6.2, 1.4782, 6.6123], [-6.2, 1.1314, 7.1314], [-6.2, 0.6123, 7.4782], [-6.2, 0.0, 7.6], [-6.2, -0.6123, 7.4782], [-6.2, -1.1314, 7.1314], [-6.2, -1.4782, 6.6123], [-6.2, -1.6, 6.0], [-6.2, -1.4782, 5.3877], [-6.2, -1.1314, 4.8686], [-6.2, -0.6123, 4.5218], [-6.2, -0.0, 4.4], [-6.2, 0.6123, 4.5218], [-6.2, 1.1314, 4.8686], [-6.2, 1.4782, 5.3877]], b: [[-7.0, 1.6, 6.0], [-7.0, 1.4782, 6.6123], [-7.0, 1.1314, 7.1314], [-7.0, 0.6123, 7.4782], [-7.0, 0.0, 7.6], [-7.0, -0.6123, 7.4782], [-7.0, -1.1314, 7.1314], [-7.0, -1.4782, 6.6123], [-7.0, -1.6, 6.0], [-7.0, -1.4782, 5.3877], [-7.0, -1.1314, 4.8686], [-7.0, -0.6123, 4.5218], [-7.0, -0.0, 4.4], [-7.0, 0.6123, 4.5218], [-7.0, 1.1314, 4.8686], [-7.0, 1.4782, 5.3877]], collide: 0, color: "#a39d90"}   # its hub
  - id: driving
    shape: part
    pos: [0, 0, 30.0]
    mass: 0.4
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [8.5, 0, 30.0], to: [24, 0, 30.0], radius: 0.7, collide: 0}   # the driving shaft
      - {kind: disc, center: [9.2, 30.0], radius: 1.6, y: [-1.6, 1.6], collide: 0, color: "#a39d90"}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: poly, points: [[-17, -1.0], [17, -1.0], [17, 0], [-17, 0]], y: [-17, 17], collide: 2}   # the pan's floor
      - {kind: loft, a: [[15.0, 0.0, 0.0], [14.8717, 1.9579, 0.0], [14.4889, 3.8823, 0.0], [13.8582, 5.7403, 0.0], [12.9904, 7.5, 0.0], [11.9003, 9.1314, 0.0], [10.6066, 10.6066, 0.0], [9.1314, 11.9003, 0.0], [7.5, 12.9904, 0.0], [5.7403, 13.8582, 0.0], [3.8823, 14.4889, 0.0], [1.9579, 14.8717, 0.0], [0.0, 15.0, 0.0], [-1.9579, 14.8717, 0.0], [-3.8823, 14.4889, 0.0], [-5.7403, 13.8582, 0.0], [-7.5, 12.9904, 0.0], [-9.1314, 11.9003, 0.0], [-10.6066, 10.6066, 0.0], [-11.9003, 9.1314, 0.0], [-12.9904, 7.5, 0.0], [-13.8582, 5.7403, 0.0], [-14.4889, 3.8823, 0.0], [-14.8717, 1.9579, 0.0], [-15.0, 0.0, 0.0], [-14.8717, -1.9579, 0.0], [-14.4889, -3.8823, 0.0], [-13.8582, -5.7403, 0.0], [-12.9904, -7.5, 0.0], [-11.9003, -9.1314, 0.0], [-10.6066, -10.6066, 0.0], [-9.1314, -11.9003, 0.0], [-7.5, -12.9904, 0.0], [-5.7403, -13.8582, 0.0], [-3.8823, -14.4889, 0.0], [-1.9579, -14.8717, 0.0], [-0.0, -15.0, 0.0], [1.9579, -14.8717, 0.0], [3.8823, -14.4889, 0.0], [5.7403, -13.8582, 0.0], [7.5, -12.9904, 0.0], [9.1314, -11.9003, 0.0], [10.6066, -10.6066, 0.0], [11.9003, -9.1314, 0.0], [12.9904, -7.5, 0.0], [13.8582, -5.7403, 0.0], [14.4889, -3.8823, 0.0], [14.8717, -1.9579, 0.0]], b: [[16.6, 0.0, 3.6], [16.458, 2.1667, 3.6], [16.0344, 4.2964, 3.6], [15.3364, 6.3525, 3.6], [14.376, 8.3, 3.6], [13.1697, 10.1054, 3.6], [11.738, 11.738, 3.6], [10.1054, 13.1697, 3.6], [8.3, 14.376, 3.6], [6.3525, 15.3364, 3.6], [4.2964, 16.0344, 3.6], [2.1667, 16.458, 3.6], [0.0, 16.6, 3.6], [-2.1667, 16.458, 3.6], [-4.2964, 16.0344, 3.6], [-6.3525, 15.3364, 3.6], [-8.3, 14.376, 3.6], [-10.1054, 13.1697, 3.6], [-11.738, 11.738, 3.6], [-13.1697, 10.1054, 3.6], [-14.376, 8.3, 3.6], [-15.3364, 6.3525, 3.6], [-16.0344, 4.2964, 3.6], [-16.458, 2.1667, 3.6], [-16.6, 0.0, 3.6], [-16.458, -2.1667, 3.6], [-16.0344, -4.2964, 3.6], [-15.3364, -6.3525, 3.6], [-14.376, -8.3, 3.6], [-13.1697, -10.1054, 3.6], [-11.738, -11.738, 3.6], [-10.1054, -13.1697, 3.6], [-8.3, -14.376, 3.6], [-6.3525, -15.3364, 3.6], [-4.2964, -16.0344, 3.6], [-2.1667, -16.458, 3.6], [-0.0, -16.6, 3.6], [2.1667, -16.458, 3.6], [4.2964, -16.0344, 3.6], [6.3525, -15.3364, 3.6], [8.3, -14.376, 3.6], [10.1054, -13.1697, 3.6], [11.738, -11.738, 3.6], [13.1697, -10.1054, 3.6], [14.376, -8.3, 3.6], [15.3364, -6.3525, 3.6], [16.0344, -4.2964, 3.6], [16.458, -2.1667, 3.6]], collide: 0, color: "#bfb39b"}   # the pan's sloping rim (drawn)
      - {kind: poly, points: [[-22, -2.4], [24, -2.4], [24, -1.0], [-22, -1.0]], y: [-3, 3], collide: 0, color: "#8f8a80"}   # the ground sill
      - {kind: poly, points: [[-20.5, -1.0], [-18.5, -1.0], [-18.5, 23.0], [-20.5, 23.0]], y: [-1.5, 1.5], collide: 0}   # the frame's posts
      - {kind: poly, points: [[18.5, -1.0], [20.5, -1.0], [20.5, 23.0], [18.5, 23.0]], y: [-1.5, 1.5], collide: 0}
      - {kind: poly, points: [[-20.5, 23.0], [20.5, 23.0], [20.5, 25.0], [-20.5, 25.0]], y: [-1.5, 1.5], collide: 0}   # its head, the upright's bearing
      - {kind: poly, points: [[19.0, 25.0], [20.5, 25.0], [20.5, 32.0], [19.0, 32.0]], y: [-1.0, 1.0], collide: 0}   # the driving shaft's bearing
      - {kind: disc, center: [19.75, 30.0], radius: 1.4, y: [-1.2, 1.2], collide: 0, color: "#8f8a80"}
joints:
  - {id: j_d, type: hinge, body: driving, axis: [1, 0, 0], damping: 0.002}   # the one driven joint: the driving shaft
  - {id: j_u, type: hinge, body: upright, axis: [0, 0, 1], damping: 0.002}   # the upright, with the crosshead
  - {id: j_hr, type: hinge, body: arm_r, axis: [0, 1, 0], range: [-0.25, 0.25], damping: 0.02}   # the axles' hinges: a chaser may rise
  - {id: j_hl, type: hinge, body: arm_l, axis: [0, 1, 0], range: [-0.25, 0.25], damping: 0.02}
  - {id: j_rr, type: hinge, body: run_r, axis: [1, 0, 0], damping: 0.001}   # the chasers, on their axles
  - {id: j_rl, type: hinge, body: run_l, axis: [1, 0, 0], damping: 0.001}
bevels:
  - {id: gU, body: upright, pos: [0, 0, 30.0], teeth: 40, pitch_radius: 8.0, cone_angle: 1.1071, face_width: 2.6, backlash: 0.04, phase: 0, quat: [0.7071068, -0.7071068, 0, 0]}
  - {id: gD, body: driving, pos: [0, 0, 0], teeth: 20, pitch_radius: 4.0, cone_angle: 0.4636, face_width: 2.6, backlash: 0.04, phase: 0, quat: [0.7071068, 0, 0, -0.7071068]}
contact: {solref: [0.001, 1], solimp: [0.95, 0.99, 0.001], margin: 0}
driver: {joint: j_d, kind: velocity, rpm: 40, kv: 3, max_torque: 10}
checks:
  - {type: ratio, out: j_u, in: j_d, expect: 0.5, tol: 0.03, settle_s: 2, window_s: 6}   # the bevels: the upright at half the driving shaft's speed
  - {type: ratio, out: j_rr, in: j_u, expect: -1.81, tol: 0.1, settle_s: 2, window_s: 6}   # a chaser rolled round the pan
  - {type: ratio, out: j_rl, in: j_u, expect: 1.81, tol: 0.1, settle_s: 2, window_s: 6}
  - {type: penetration, max: 0.0015, settle_s: 0.5}
camera: {target: [2.0, 0, 7.0], position: [2.0, -150.0, 28.0], fov: 34}
display:
  output: j_u
  labels: {j_d: "Driving shaft (driver)", j_u: "Upright shaft", j_rr: "Right chaser", j_rl: "Left chaser"}

