# No. 60 (Brown 1868): "For transmitting two speeds by means of belts."
#
# As drawn (cm; the shafts run along y): on the upper shaft, the one motor-driven shaft, a large drum
# (r 7.0) at the left and a small one (r 3.5) at the right, each wide enough for two bands' stations.
# On the lower shaft, 30.0 below, four equal pulleys (r 5.0): the two outer ones loose on the shaft, the
# two inner ones fast. Each drum carries its own band. As drawn, the left band runs on its loose
# pulley and the right band on its fast one: the small drum drives and the lower shaft turns slowly
# (3.5/5.0 of the upper). With the right band moved onto its loose pulley and the left onto its fast
# one, the large drum drives and the motion is quicker (7.0/5.0). The bands are elastic chains of
# links driving by friction alone. Generator: opencode-runs/batch7/gen060.py.
number: 60
slug: two-speeds-by-belts
name: Two speeds by belts
brown: "For transmitting two speeds by means of belts. There are four pulleys on the lower shaft, the two outer ones being loose and the two inner ones fast. The band to the left is shown on its loose pulley, the one to the right on its fast one; a slow motion is consequently transmitted to lower shaft. When band to the right is moved on to its loose pulley, and left-hand one on to its fast pulley, a quicker motion is transmitted."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 50
  duration_s: 6
  floor: false
bodies:
  - {id: upper, shape: assembly, pos: [0, 0, 30.0], color: "#d9cfb6"}
  - {id: lower, shape: assembly, pos: [0, 0, 0], color: "#cfc4a8"}
  - {id: p_loose_L, shape: pulley, radius: 5.0, width: 2.6, pos: [0, -9.0, 0], mass: 0.8, spokes: 4, hub: 1.0, flange: 0.3}
  - {id: p_loose_R, shape: pulley, radius: 5.0, width: 2.6, pos: [0, 9.0, 0], mass: 0.8, spokes: 4, hub: 1.0, flange: 0.3}
joints:
  - {id: j_upper, type: hinge, body: upper, axis: [0, 1, 0], damping: 0.002}
  - {id: j_lower, type: hinge, body: lower, axis: [0, 1, 0], damping: 0.02}   # the load
  - {id: j_loose_L, type: hinge, body: p_loose_L, axis: [0, 1, 0], damping: 0.01}
  - {id: j_loose_R, type: hinge, body: p_loose_R, axis: [0, 1, 0], damping: 0.01}
wheels:
  - {id: drum_L, body: upper, pos: [0, -7.5, 0], radius: 7.0, width: 6.2, rim_width: 2.8, grooves: [[0, -1.5, 0], [0, 1.5, 0]], mass: 1.5, spokes: 4, hub: 1.0, flange: 0.3}
  - {id: drum_R, body: upper, pos: [0, 7.5, 0], radius: 3.5, width: 6.2, rim_width: 2.8, grooves: [[0, -1.5, 0], [0, 1.5, 0]], mass: 0.8, spokes: 0, hub: 1.0, flange: 0.3}
  - {id: p_fast_L, body: lower, pos: [0, -6.0, 0], radius: 5.0, width: 2.6, mass: 0.8, spokes: 4, hub: 1.0, flange: 0.3}
  - {id: p_fast_R, body: lower, pos: [0, 6.0, 0], radius: 5.0, width: 2.6, mass: 0.8, spokes: 4, hub: 1.0, flange: 0.3}
shafts:
  - {id: sh_upper, body: upper, from: [0, -12, 0], to: [0, 12, 0], radius: 0.6}
  - {id: sh_lower, body: lower, from: [0, -12, 0], to: [0, 12, 0], radius: 0.6}
belts:
  - id: left
    around: [p_loose_L, drum_L]
    links: 64
    thickness: 0.4
    width: 2.0
    density: 7800
    stiffness: 24000
    damping: 2
    pretension: 40
    friction: 0.7
  - id: right
    around: [p_fast_R, drum_R]
    links: 64
    thickness: 0.4
    width: 2.0
    density: 7800
    stiffness: 24000
    damping: 2
    pretension: 40
    friction: 0.7
contact: {solref: [0.0008, 1], solimp: [0.95, 0.99, 0.001], margin: 0}
driver: {joint: j_upper, kind: velocity, rpm: 30, kv: 2, max_torque: 5}
variants:
  - {id: slow60, note: "as drawn: left band on its loose pulley, right band (small drum) on its fast one: 3.5/5.0", belt_around: {left: [p_loose_L, drum_L], right: [p_fast_R, drum_R]}}
  - {id: quick60, note: "left band (large drum) on its fast pulley, right band on its loose one: 7.0/5.0", belt_around: {left: [p_fast_L, drum_L], right: [p_loose_R, drum_R]}}
variant: slow60
checks:
  - {type: ratio, out: j_lower, in: j_upper, expect: 0.7, tol: 0.03, settle_s: 1.5, window_s: 4}
  - {type: ratio, out: j_loose_L, in: j_upper, expect: 1.4, tol: 0.05, settle_s: 1.5, window_s: 4}
  - {type: belt_on, belt: left, max_radial_dev: 1.2, max_lateral: 0.6, duration_s: 2.5}
  - {type: belt_on, belt: right, max_radial_dev: 1.2, max_lateral: 0.6, duration_s: 2.5}
camera: {target: [0, 0, 15], position: [95, -75, 35], fov: 34}
display:
  tiers:
    - {id: full, label: Full, ms: 1.2841}
    - {id: friction, label: Friction model, timestep: 0.001, integrator: implicitfast, model: capstan, ms: 0.0113}
  output: j_lower
  labels: {j_upper: "Upper shaft (driver)", j_lower: "Lower shaft", j_loose_L: "Left loose pulley", j_loose_R: "Right loose pulley"}
  expect: {default: 0.7}
  proof: {label: "Right fast pulley unkeyed", sub: "the band turns the pulley, loose on the shaft: the lower shaft stands"}
