# No. 32, Friction-wheels (Brown 1868).
#
# Laid out as the plate (1 unit = 1 cm): two plain wheels side by side, rims in contact, on shafts
# square to the page; the left one the smaller, about three quarters of the right's diameter.
# Round numbers: the driver r 6 at the left, the driven wheel r 8 at the right, centres 14 apart.
# Both rims are faced with india-rubber (friction 0.8, Brown's "better" facing).
# The plate draws them as plain discs; they are drawn spoked here only so their turning shows.
#
# Fully physical: only the left wheel is motor-driven. The right wheel turns on its own axle in a
# bearing that slides along the line of centres; a spring on that slide presses it against the
# driver with 20 N (2000 N/m, set 1 cm past the touching position). Nothing else joins the two:
# the right wheel turns by rim friction alone, against a 0.2 N·m bearing load (2.5 N at its rim,
# an eighth of what 20 N of pressure and rubber can carry).
#
# Ratio: rims rolling without slip, ω2/ω1 = -r1/r2 = -6/8 = -0.75 (opposite senses).
number: 32
slug: friction-wheels
name: Friction-wheels
brown: "The surfaces of these wheels are made rough, so as to bite as much as possible; one is sometimes faced with leather, or, better, with vulcanized india-rubber."
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 50, duration_s: 4, floor: false}
bodies:
  - {id: w1, shape: pulley, radius: 6, width: 3, pos: [0, 0, 10], mass: 1.5, flange: 0, spokes: 4, web: false, hub: 1.6, touch: {side: 1, friction: 0.8}}
  - {id: w2, shape: pulley, radius: 8, width: 3, pos: [14, 0, 10], mass: 2.6, flange: 0, spokes: 4, web: false, hub: 1.8,
     spin: {damping: 0.002, frictionloss: 0.2}, touch: {side: 2, friction: 0.8}, color: "#e9dfc9"}
joints:
  - {id: j_w1, type: hinge, body: w1, axis: [0, 1, 0], damping: 0.002}
  # the driven wheel's bearing: a slide along the line of centres, sprung towards the driver
  - {id: j_press, type: slide, body: w2, axis: [1, 0, 0], range: [-2, 2], stiffness: 2000, springref: -1, damping: 20}
contact: {solref: [0.002, 1], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_w1, kind: velocity, rpm: 30, kv: 2, max_torque: 5}
checks:
  # rolling rims: -r1/r2 = -0.75; the 20 N press makes a few hundredths of a mm of flat, so tight
  - {type: ratio, out: w2_spin, in: j_w1, expect: -0.75, tol: 0.01, settle_s: 1, window_s: 2}
  # the spring keeps the driven wheel against the driver: its bearing sits at the touching position
  - {type: position, joint: j_press, min: -0.05, max: 0.02, settle_s: 1, window_s: 2}
  - {type: penetration, max: 0.0005, settle_s: 1}
camera: {target: [7, 0, 10], position: [7, -62, 12], fov: 30}
display:
  output: w2_spin
  labels: {j_w1: "Driver (r 6)", w2_spin: "Driven wheel (r 8)", j_press: "Sprung bearing"}
  expect: {default: -0.75}
  proof: {label: "Rims made smooth", sub: "no friction between the rims: the driver spins, the right wheel stands"}
