# No. 10, Variable Speed Nonlinear Cone Pulleys (Brown 1868, p. 1).
#
# "10. Is a modification of 9, the pulleys being of different shape."
#
# Layout, from the plate (1 unit = 1 cm = 6.25 px of the engraving): two horizontal shafting, the
# lower one on the right (Brown draws it slightly the other way round from the upper). The band hangs
# between them at one axial station, right of the upper pulley's middle and left of the lower's, and
# is traversed up and down the pulleys by hand to vary the speed. The pulleys are not cones but
# curved shapes, which is the whole point of the figure:
#   * the upper one is concave, flaring like a trumpet towards its left (-y) end, 8.8 → 3.4;
#   * the lower one is convex, swelling like a cask towards its right (+y) end, 4.7 → 9.7 (its
#     shafting is 6 to the right of the upper's, as Brown draws it).
# The profile samples below are read off the engraving (upper: y −12.8..+12.8 px 180..340, r 55→21.5
# px about the axis at 109.5; lower: y −8.3..+20.2 px 208..386 about the axis at 297, 423.5 — the
# shafting is at px 260), fitted
# with r(y) = 3.4 + 5.4(1−u)^1.6 above and r(y) = 4.7 + 5.0(2u − u²) below (u = 0..1 along each).
#
# Fully physical: only the upper pulley is motor-driven. The band is the flat band Brown draws, of 120
# elastic links, pretensioned, which turns the lower pulley by friction alone. A planar band cannot
# follow the taper: it rests where the cone comes up to its face, near the edge of its width, which is
# the radius the ratio check is computed from (a round cord would roll on the taper and spiral off).
# Each pulley is collided as a stack of eight convex frustum
# hulls, one per pair of neighbouring profile samples, because a concave profile is not convex. As in
# the plate there is no fork: the taut band keeps its station by itself (lateral drift under 2 cm).
# Which station the band sits at is the passive configuration: the three stations in
# `variants` are all compiled and tested, and the belt position is the only thing that differs.
number: 10
slug: variable-speed-nonlinear-cone-pulleys
name: Variable Speed Nonlinear Cone Pulleys
brown: "Is a modification of 9, the pulleys being of different shape."
units: cm
sim: {floor: false, timestep: 0.0001, integrator: implicitfast, iterations: 60, duration_s: 4}
bodies:
  - {id: p_top, shape: pulley, radius: 8.8, width: 26, pos: [0, 0, 50], mass: 1.6, spokes: 0, hub: 1.3,
     profile: [[-13, 7.5], [-9.75, 6.75], [-6.5, 6.0], [-3.25, 5.4], [0, 4.75], [3.25, 4.24], [6.5, 3.89], [9.75, 3.64], [13, 3.4]]}
  - {id: p_bot, shape: pulley, radius: 9.7, width: 28, pos: [0, 6, 0], mass: 2.4, spokes: 0, hub: 1.3,
     profile: [[-14, 4.7], [-10.5, 5.87], [-7, 6.89], [-3.5, 7.75], [0, 8.45], [3.5, 8.99], [7, 9.39], [10.5, 9.62], [14, 9.7]]}
joints:
  - {id: j_top, type: hinge, body: p_top, axis: [0, 1, 0], damping: 0.002}
  - {id: j_bot, type: hinge, body: p_bot, axis: [0, 1, 0], damping: 0.05}   # the load
belts:
  - id: belt
    around: [p_top, p_bot]
    station: 1.5              # the band, as drawn in the plate (world y)
    section: flat
    links: 120
    segments: 8
    joint_armature: 0.002
    thickness: 0.8            # a flat band, as drawn
    width: 2.0
    density: 4000            # a heavy iron-and-canvas band, as on a cone-pulley drive
    stiffness: 300000        # a taut band: little give, so it cannot walk down the cones
    damping: 2
    pretension: 30
    bend_damping: 0.02
    friction: 0.6             # the band on iron
contact: {solref: [0.006, 1], solimp: [0.9, 0.95, 0.001], margin: 0}
driver: {joint: j_top, kind: velocity, rpm: 30, kv: 2, max_torque: 5}
# Passive configurations: the same machine with the band traversed along the pulleys, which is the whole point of the movement. −7 = on the upper pulley's flare against
# the lower pulley's small end (the lower pulley fastest, 6.38/5.64 = 1.13); +1.5 = the plate (4.82/8.05 = 0.60);
# +12 = on the upper pulley's small end and the lower's large end (the lower pulley slowest, 3.83/9.74 = 0.39).
variants:
  - id: wide
    note: "band at the far left: on the upper pulley's large end and the lower's small end, so the lower pulley turns fastest (1.17)"
    belt_station: {belt: -7.0}
  - id: plate
    note: "the band where the plate has it, right of the upper pulley's middle and left of the lower's"
    belt_station: {belt: 1.5}
  - id: narrow
    note: "band at the far right: on the upper pulley's small end and the lower's large end, so the lower pulley turns slowest (0.39)"
    belt_station: {belt: 12}
variant: plate
checks:
  # Open band between curved pulleys, at the station of the plate. The band is planar, so it rests on
  # the cone where the taper comes up to its face: R = r + k(w/2 − t/2) + t/2, which gives 4.82 cm on
  # the upper pulley and 8.05 on the lower, a ratio of 0.60, less belt creep and a little give.
  - {type: ratio, out: j_bot, in: j_top, expect: 0.60, tol: 0.05, settle_s: 1.2, window_s: 1}
  - {type: belt_on, belt: belt, max_radial_dev: 1.2, max_lateral: 2.0, duration_s: 2.2}
  - {type: penetration, max: 0.0025, settle_s: 1.2}
camera: {target: [0, 4, 22], position: [180, 11, 30], fov: 30}   # side view as in the plate, the shafting horizontal
display:
  output: j_bot
  labels: {j_top: Upper pulley (driver), j_bot: Lower pulley}
  expect: {default: 0.60, plate: 0.60, wide: 1.13, narrow: 0.39}