# No. 21, Different arrangements of pulleys (Brown 1868, p. 2; plate 19-22).
#
# "19, 20, 21 and 22. Are different arrangements of pulleys. The following rule applies to these
# pulleys:—In a system of pulleys where each pulley is embraced by a cord attached at one end to a
# fixed point and at the other to the center of the movable pulley, the effect of the whole will be =
# the number 2, multiplied by itself as many times as there are movable pulleys in the system."
#
# The plate, measured (1 unit = 1 cm, the ceiling 19 cm above the top sheave's centre, as drawn):
# a hook and strap hang the big fixed sheave from the ceiling. TWO cords, as the figure shows:
#
#   * the STANDING cord: its lower end is made fast in an eye at the centre of the lower, movable
#     sheave; it runs plumb up out of that sheave (through its rim, as the plate draws it), over the
#     fixed sheave and plumb down the right to the weight's right eye;
#   * the HAULING cord: one end is made fast in the weight's left eye; it runs plumb up the right
#     side of the movable sheave, over the top of it and plumb down its left side, where the hand
#     has it (the plate draws the loose end hanging off at a slant; the hand hauls it plumb, so the
#     pull and the sheave's turn are the textbook ones, and the hand is what Brown's "power" is).
#
# Nothing is driven but the hand: a slide joint in a guide along its cord, hauled at a constant
# 6 cm/s. Both cords are real ropes - chains of round hemp links riding on the sheaves, their eyes
# pinned to the bodies they are tied to - so the load is carried by the cords' own tension, the
# sheaves are turned by the cords rubbing on their rims, and nothing couples the hand to the weight
# except those cords.
#
# Brown's "power" is what the checks measure. The hauling cord's pull T is the same on both sides
# of the movable sheave (it rolls on it), and the sheave hangs in the standing cord, whose pull is
# 2T plus the sheave's own 9.8 N; the weight hangs in BOTH cords at the top of the box, so
# 196.2 = (2T + 9.8) + T, and T = 62.1 N. Speed: the hand's 6 cm/s buys the weight a third of it
# (2 cm/s), and the sheave it is tied to falls at the same third - the standing cord's length is
# unchanged while the box rises and the sheave drops. The sheave rolls on its right-hand cord,
# which rises with it, so it turns at 2v/3R; the fixed sheave turns at v/3R.
number: 21
slug: different-arrangements-of-pulleys
name: Different Arrangements of Pulleys (third)
plate: [19, 20, 21, 22]
brown: "19, 20, 21 and 22. Are different arrangements of pulleys. The following rule applies to these pulleys:—In a system of pulleys where each pulley is embraced by a cord attached at one end to a fixed point and at the other to the center of the movable pulley, the effect of the whole will be = the number 2, multiplied by itself as many times as there are movable pulleys in the system."
units: cm
sim: {timestep: 0.0001, integrator: implicitfast, iterations: 60, duration_s: 2.4}
bodies:
  # The ceiling, with the hook the fixed sheave's strap hangs by.
  - id: ceiling
    shape: part
    fixed: true
    pos: [0, 0, 0]
    density: 700
    color: "#c6b99c"
    pieces:
      - {kind: poly, points: [[-13.0, 17.8], [16.0, 17.8], [16.0, 20.1], [-13.0, 20.1]], y: [-0.9, 0.9], collide: 0}
      - {kind: rod, from: [1.4, 0, 17.8], to: [1.4, 0, 16.2], radius: 0.3, collide: 0, color: "#8f8a80"}      # the eye's stem
      - {kind: band, center: [1.4, 16.2], r: [0.55, 0.95], a: [0.25, 2.90], y: [-0.3, 0.3], slices: 8, collide: 0, color: "#8f8a80"}   # the hook's bend
      - {kind: rod, from: [1.4, 0, 3.6], to: [1.4, 0, 15.6], radius: 0.36, collide: 0, color: "#8f8a80"}      # the strap
  # The big fixed sheave, hung by that strap and free to turn on its axle (the plate draws it solid).
  - {id: top, shape: pulley, radius: 8.6, width: 3.0, pos: [0, 0, 0], mass: 1.5, spokes: 0, hub: 1.7, flange: 0.55, color: "#e6dcc6"}
  # The movable sheave: the hauling cord goes over it, so it must turn on its own pin as well as ride
  # its vertical guide (`spin`) - it rolls on the cord's right-hand strand, which rises with it, at
  # 2v/3R, while the standing cord is tied to its axle, which falls at v/3.
  - {id: sheave, shape: pulley, radius: 7.3, width: 3.0, pos: [-9.0, 0, -24.0], mass: 1.0, spokes: 0, hub: 1.5, flange: 0.5,
     spin: {damping: 0.004, frictionloss: 0.01}, color: "#e6dcc6"}
  # The weight: Brown's squared block, hung in two eyes on its top face, one cord in each.
  - id: load
    shape: part
    pos: [3.75, 0, -79.8]
    mass: 20
    density: 600
    color: "#9c8460"
    pieces:
      - {kind: poly, points: [[-8.8, -73.3], [16.3, -73.3], [16.3, -86.3], [-8.8, -86.3]], y: [-4.2, 4.2], collide: 0}
      - {kind: poly, points: [[-8.8, -75.0], [16.3, -75.0], [16.3, -84.6], [-8.8, -84.6]], y: [4.2, 4.35], collide: 0, color: "#7d6845"}
      # the two eyes the cords are made fast to
      - {kind: disc, center: [-1.3, -70.7], radius: 0.9, inner: 0.42, y: [-0.4, 0.4], collide: 0, color: "#8f8a80"}
      - {kind: disc, center: [9.0, -70.7], radius: 0.9, inner: 0.42, y: [-0.4, 0.4], collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [-1.3, 0, -73.3], to: [-1.3, 0, -71.6], radius: 0.32, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [9.0, 0, -73.3], to: [9.0, 0, -71.6], radius: 0.32, collide: 0, color: "#8f8a80"}
  # The hand, hauling the cord at 6 cm/s: a guide along the strand, carrying fist and sleeve.
  - id: hand
    shape: grip
    pos: [-16.7, 0, -45.0]
    mass: 0.9
    color: "#c9bda2"
    rods:
      - {from: [-15.81, 0, -43.5], to: [-17.61, 0, -46.5], radius: 1.9}     # the fist closed on the cord
      - {from: [-15.31, 0, -41.8], to: [-15.81, 0, -43.5], radius: 1.5}     # the cuff
      - {from: [-14.61, 0, -39.4], to: [-15.31, 0, -41.8], radius: 1.2}     # the forearm
joints:
  - {id: j_top, type: hinge, body: top, axis: [0, 1, 0], damping: 0.01}
  - {id: j_sheave, type: slide, body: sheave, axis: [0, 0, 1], range: [-16, 4]}   # the cords' strands keep it plumb
  - {id: j_load, type: slide, body: load, axis: [0, 0, 1], range: [-8, 16]}
  - {id: j_hand, type: slide, body: hand, axis: [0, 0, -1], range: [-2, 40]}   # down the plumb strand
cords:
  # The standing cord: the sheave's centre, plumb up out through its rim, over the fixed sheave, down
  # to the weight's right eye. Both falls are plumb, as the plate draws them: the left one stands on the
  # fixed sheave's left tangent (x = 0 - 9.0), which is the sheave's own centre in x.
  - id: standing
    from: {body: sheave, at: [-9.0, 0, -24.0]}
    to: {body: load, at: [9.0, 0, -70.7]}
    over: [top]
    clear_through: [sheave]   # its own end is seized at the movable sheave's axle, inside that wheel
    links: 46
    thickness: 0.8
    density: 1400          # hemp
    stiffness: 400000      # N/m per link: a cord is nearly inextensible (134 N stretches it 1.5 cm)
    pretension: 134      # N, what it carries in a steady lift: 2T + the sheave's 9.8 N, so it starts loaded
    damping: 3000          # N s/m per link: hemp's own internal friction, so a cord does not ring like a spring
    friction: 0.5          # hemp on a wooden sheave
  # The hauling cord: the weight's left eye, up over the movable sheave and away down-left to the
  # hand. Its pull is what lifts the sheave (both strands pull down on it) and half the weight.
  - id: haul
    from: {body: load, at: [-1.3, 0, -70.7]}
    to: {body: hand, at: [-16.7, 0, -45.0]}
    over: [sheave]
    under: [sheave]        # right side up, over the top, down the left: counter-clockwise in x-z
    links: 44
    thickness: 0.8
    density: 1400
    stiffness: 400000
    pretension: 62        # N, T = (196.2 - 9.8)/3, so it starts loaded
    damping: 3000          # N s/m per link: hemp's own internal friction, so a cord does not ring like a spring
    friction: 0.5
contact: {solref: [0.0005, 1], solimp: [0.98, 0.999, 0.0001], margin: 0}
driver: {joint: j_hand, kind: velocity, speed: 6, kv: 60000, max_torque: 600}
checks:
  # Brown's point: the hand's three parts of cord buy the weight one part of rise, 1/3 of its 6 cm/s
  # haul. The cords take up their own stretch in the first second, so the window is after that.
  - {type: ratio, out: j_load, in: j_hand, expect: 0.3333, tol: 0.015, settle_s: 1.2, window_s: 1.0}
  # And the standing cord ties the sheave's centre to the weight's eye, so the sheave falls exactly
  # as fast as the box rises - both are the standing cord's own length, unchanged.
  - {type: ratio, out: j_sheave, in: j_hand, expect: -0.3333, tol: 0.015, settle_s: 1.2, window_s: 1.0}
  # Each sheave rolls on the cord at the rate its own strands set, and nothing else turns them.
  # The fixed sheave: the cord's left strand falls with the sheave's centre at v/3 and its right
  # strand rises with the weight at v/3, so it turns at v/3R = 1/(3 x 0.090 m) = 3.70 rad per metre hauled.
  - {type: ratio, out: j_top, in: j_hand, expect: -3.704, tol: 0.2, settle_s: 1.2, window_s: 1.0}
  # The movable sheave: its centre falls at v/3 while its cord's right strand rises at v/3, so the
  # rim runs at 2v/3 against the strand - it turns at 2/(3 x 0.077 m) = 8.66 rad per metre hauled.
  - {type: ratio, out: sheave_spin, in: j_hand, expect: -8.658, tol: 0.45, settle_s: 1.2, window_s: 1.0}
  # Brown's "power". The box (196.2 N) hangs in both cords; the sheave hangs in the standing cord at
  # 2T + its own 9.8 N, so T = (196.2 - 9.8)/3 = 62.1 N; the hand's own 0.9 kg pulls 8.8 N of that
  # down its own guide, so the driver pulls 53.3 N.
  - {type: force, expect: 53.3, tol: 4.0, settle_s: 1.2, window_s: 1.0}
  - {type: position, joint: j_load, min: 0.8, max: 6.0, settle_s: 1.2, window_s: 1.2}
  - {type: penetration, max: 0.0005, settle_s: 1.2}
camera: {target: [3, 0, -46], position: [40, -270, -36], fov: 30}   # the plate's view: ceiling to weight, clear of the title
display:
  tiers:
    - {id: full, label: Full, ms: 1.0533}
    - {id: fine, label: Fine, links: [46, 44], timestep: 0.0012, integrator: discrete, armature: 1.0e-7, ms: 1.3902}
    - {id: light, label: Lightest, links: [22, 20], timestep: 0.0012, integrator: discrete, ms: 0.2465}
  output: j_load
  labels: {j_hand: Hand hauling the cord (driver), j_load: Weight in two eyes, j_sheave: Movable sheave, j_top: Fixed sheave on its strap}
  expect: {default: 0.3333}