# No. 14, Blocks and Tackle (Brown 1868, plate 14).
#
# "The power obtained by this contrivance is calculated as follows: Divide the weight by double the
# number of pulleys in the lower block; the quotient is the power required to balance the weight."
#
# The plate: an upper block hung by a hook, a lower block with the ball weight on its hook below, and
# one rope reeved back and forth between the sheaves of the two blocks -- four falls, as it counts
# them -- its standing end made fast at the left of the upper block, and its free end coming off the
# upper block at the right, which the hand pulls. Each sheave turns on its own hinge on the block's
# pin, and the lower block hangs on the rope alone (a vertical slide is its guide, as the plate
# draws it plumb). The rope is a real rope: 100 round hemp links with a stretch joint at each, lying
# on the rims, its eyes pinned to the block and to the hand. So the load is carried by the rope's own
# tension round four sheaves, the sheaves are turned by the rope rubbing on their rims, and nothing
# couples the hand to the weight except that rope.
#
# Brown's rule is what the checks measure: the ball rises at a quarter of the speed the hand pulls
# (1/(2 x 2 pulleys in the lower block)), and the pull needed is the weight over four falls. The two
# departures from the plate, both stated here: the reeving marches along in the plane (a vertical
# fall touches one sheave on its left and the next on its right, so each wrap steps two radii along,
# which puts the upper block two radii right of the lower one -- in the plate the sheaves stand side
# by side on the pin and the falls are a pair's width apart), and the ball is drawn on the block's
# hook as part of the block's body, since it can only rise and never swings.
number: 14
slug: blocks-and-tackle
name: Blocks and Tackle
brown: "Blocks and tackle. The power obtained by this contrivance is calculated as follows: Divide the weight by double the number of pulleys in the lower block; the quotient is the power required to balance the weight."
units: cm
sim: {timestep: 0.0001, integrator: implicitfast, iterations: 60, duration_s: 2.4}
bodies:
  # The upper block, hung by its hook: fixed structure, so a `part` with no joint. Its two cheeks
  # stand either side of the rope (the rope and the sheaves run in the gap at y = 0), the pin carries
  # the two sheaves, and the left-hand end is the strop the standing end of the rope is tied to.
  - id: upblock
    shape: part
    fixed: true
    pos: [0, 0, 58]
    density: 600
    color: "#c6b99c"
    pieces:
      - {kind: poly, y: [-4.2, -1.9], collide: 0, points: [[-15.50, 64.00], [-18.10, 63.41], [-20.19, 61.74], [-21.35, 59.34], [-21.35, 56.66], [-20.19, 54.26], [-18.10, 52.59], [-15.50, 52.00], [14.70, 52.00], [17.30, 52.59], [19.39, 54.26], [20.55, 56.66], [20.55, 59.34], [19.39, 61.74], [17.30, 63.41], [14.70, 64.00]]}
      - {kind: poly, y: [1.9, 4.2], collide: 0, points: [[-15.50, 64.00], [-18.10, 63.41], [-20.19, 61.74], [-21.35, 59.34], [-21.35, 56.66], [-20.19, 54.26], [-18.10, 52.59], [-15.50, 52.00], [14.70, 52.00], [17.30, 52.59], [19.39, 54.26], [20.55, 56.66], [20.55, 59.34], [19.39, 61.74], [17.30, 63.41], [14.70, 64.00]]}
      # the pin, carried through both cheeks and out past them, as the plate shows its ends
      - {kind: rod, from: [-4.9, -4.6, 58], to: [-4.9, 4.6, 58], radius: 0.5, collide: 0}
      - {kind: rod, from: [14.7, -4.6, 58], to: [14.7, 4.6, 58], radius: 0.5, collide: 0}
      # the hook it hangs by: a shank, the bend of the hook, and the eye at the top of it
      - {kind: rod, from: [-4.9, 0, 63.5], to: [-4.9, 0, 66.6], radius: 0.55, collide: 0}
      - {kind: band, center: [-4.9, 66.6], r: [1.9, 2.9], a: [-1.05, 3.60], y: [-0.5, 0.5], slices: 8, collide: 0}
      - {kind: disc, center: [-4.9, 69.4], radius: 3.1, inner: 1.5, y: [-0.5, 0.5], collide: 0}
  # The sheaves of the upper block, each on its own hinge on that pin.
  - {id: u1, shape: pulley, mount: upblock, radius: 4.5, width: 3.0, pos: [-4.9, 0, 58], mass: 0.3, spokes: 0, hub: 1.2, flange: 0.9, color: "#e6dcc6"}
  - {id: u2, shape: pulley, mount: upblock, radius: 4.5, width: 3.0, pos: [14.7, 0, 58], mass: 0.3, spokes: 0, hub: 1.2, flange: 0.9, color: "#e6dcc6"}
  # The lower block: the same two cheeks and pin on a vertical guide (the rope alone holds it up),
  # its hook, and the ball weight on the hook. One body: the ball can only rise, never swing.
  - id: lowblock
    shape: part
    pos: [0, 0, 34]
    mass: 22.5          # the ball is 20 kg, the block and its sheaves about 2.5 kg between them
    density: 700
    color: "#c6b99c"
    pieces:
      - {kind: poly, y: [-4.2, -1.9], collide: 0, points: [[-14.70, 40.00], [-17.30, 39.41], [-19.39, 37.74], [-20.55, 35.34], [-20.55, 32.66], [-19.39, 30.26], [-17.30, 28.59], [-14.70, 28.00], [4.90, 28.00], [7.50, 28.59], [9.59, 30.26], [10.75, 32.66], [10.75, 35.34], [9.59, 37.74], [7.50, 39.41], [4.90, 40.00]]}
      - {kind: poly, y: [1.9, 4.2], collide: 0, points: [[-14.70, 40.00], [-17.30, 39.41], [-19.39, 37.74], [-20.55, 35.34], [-20.55, 32.66], [-19.39, 30.26], [-17.30, 28.59], [-14.70, 28.00], [4.90, 28.00], [7.50, 28.59], [9.59, 30.26], [10.75, 32.66], [10.75, 35.34], [9.59, 37.74], [7.50, 39.41], [4.90, 40.00]]}
      - {kind: rod, from: [-14.7, -4.6, 34], to: [-14.7, 4.6, 34], radius: 0.5, collide: 0}
      - {kind: rod, from: [4.9, -4.6, 34], to: [4.9, 4.6, 34], radius: 0.5, collide: 0}
      # the hook and the ball weight hanging on it, between the two middle falls
      - {kind: rod, from: [-4.9, 0, 28.6], to: [-4.9, 0, 25.6], radius: 0.5, collide: 0}
      - {kind: band, center: [-4.9, 25.6], r: [1.7, 2.6], a: [3.35, 6.30], y: [-0.45, 0.45], slices: 8, collide: 0}
      - {kind: disc, center: [-4.9, 19.8], radius: 3.6, y: [-3.6, 3.6], collide: 0, color: "#8f8a80"}
  - {id: l1, shape: pulley, mount: lowblock, radius: 4.5, width: 3.0, pos: [-14.7, 0, 34], mass: 0.3, spokes: 0, hub: 1.2, flange: 0.9, color: "#e6dcc6"}
  - {id: l2, shape: pulley, mount: lowblock, radius: 4.5, width: 3.0, pos: [4.9, 0, 34], mass: 0.3, spokes: 0, hub: 1.2, flange: 0.9, color: "#e6dcc6"}
  # The hand, gripping the free end of the rope and pulling it down.
  - id: hand
    shape: grip
    pos: [19.6, 0, 50]
    mass: 0.6
    color: "#c9bda2"
    rods:
      - {from: [17.9, 0, 50.4], to: [21.3, 0, 50.4], radius: 1.7}     # the fist closed on the rope
      - {from: [21.3, 0, 50.4], to: [23.6, 0, 48.6], radius: 1.4}     # the cuff
      - {from: [23.6, 0, 48.6], to: [27.5, 0, 45.2], radius: 1.15}     # the forearm
joints:
  - {id: j_block, type: slide, body: lowblock, axis: [0, 0, 1], range: [-8, 12]}      # the rope is its guide
  - {id: j_u1, type: hinge, body: u1, axis: [0, 1, 0], damping: 0.005}                # each sheave on its own hinge
  - {id: j_u2, type: hinge, body: u2, axis: [0, 1, 0], damping: 0.005}
  - {id: j_l1, type: hinge, body: l1, axis: [0, 1, 0], damping: 0.005}
  - {id: j_l2, type: hinge, body: l2, axis: [0, 1, 0], damping: 0.005}
  - {id: j_hand, type: slide, body: hand, axis: [0, 0, -1], range: [-6, 40]}          # the hand's guide, down the rope
cords:
  # One rope, four falls. From its standing end, made fast at the left of the upper block: down
  # under l1, up over u1, down under l2, up over u2, and away down the right to the hand.
  # `under` names the sheaves it passes beneath (the rope lifts them, and the load below them); the
  # rest it passes over. The falls come out plumb, because a fall touches one sheave on its left and
  # the next on its right, which is what puts each sheave two radii further along.
  - id: rope
    from: {body: upblock, at: [-19.6, 0, 53.6]}   # the standing end, tied at the block's left end
    to: {body: hand, at: [19.6, 0, 50]}           # the free end, in the hand's fist
    over: [l1, u1, l2, u2]
    under: [l1, l2]        # passed under each sheave of the lower block, over each of the upper
    links: 100
    thickness: 0.8
    density: 1400          # hemp
    stiffness: 150000      # N/m per link (1.6 cm links): 57 N stretches the rope 2.4%; stiffer is unstable at this timestep
    pretension: 54         # N, the pull each fall already carries under the ball: (196 + 25)/4
    damping: 12
    friction: 0.5          # hemp on a wooden sheave
# The rope lies on four sheaves under the load's weight and rubs on all of them as it moves, so its
# contact has to be stiff: the links press about 2.5 mm into the rims, which the pull works against.
contact: {solref: [0.0005, 1], solimp: [0.98, 0.999, 0.0001], margin: 0}
driver: {joint: j_hand, kind: velocity, speed: 8, kv: 60000, max_torque: 400}
checks:
  # Brown's rule: the ball rises at 1/(2 x the two pulleys in the lower block) = a quarter of the
  # speed the hand pulls. The rope takes up its own stretch in the first second, so the window is
  # taken after that.
  - {type: ratio, out: j_block, in: j_hand, expect: 0.25, tol: 0.02, settle_s: 1.2, window_s: 1.0}
  # Each sheave is turned only by the rope on its rim, and the four falls run at four different
  # speeds. With the block rising at u = v/4: the standing fall is at rest, so l1 rolls up it
  # (ω R = u); the fall over u1 runs at 2u, the one down to l2 at 2u, the one up from l2 at 4u = v
  # (l2's centre climbs at u, so ω R = 3u); and the hand's fall runs at v. With R = 4.5 + 0.4 = 4.9 cm,
  # per metre of hand: u1 2u/R = 10.20 rad, l1 u/R = 5.10 rad (turning the other way, the rope being
  # under it), and l2 against u2 is 3u : 4u, so −0.75.
  - {type: ratio, out: j_u1, in: j_hand, expect: 10.204, tol: 0.6, settle_s: 1.2, window_s: 1.0}
  - {type: ratio, out: j_l1, in: j_hand, expect: -5.102, tol: 0.4, settle_s: 1.2, window_s: 1.0}
  - {type: ratio, out: j_l2, in: j_u2, expect: -0.75, tol: 0.06, settle_s: 1.2, window_s: 1.0}
  # Brown's rule for the power: the weight over double the pulleys in the lower block. The ball and
  # block are 22.5 kg and the two sheaves 0.6 kg, so 226.6 N over four falls = 56.7 N in the rope;
  # the hand's own 0.6 kg rides down the rope with it (−5.9 N), so the driver pulls 50.8 N.
  - {type: force, expect: 50.8, tol: 3.0, settle_s: 1.2, window_s: 1.0}
  # And the ball is seen to rise: 8/4 = 2 cm/s once the rope has taken up its stretch (the block
  # first settles about 2 cm as the falls take the load, so it is back near 0.7 cm at 1.2 s).
  - {type: position, joint: j_block, min: 0.3, max: 3.2, settle_s: 1.2, window_s: 1.0}
  # (That the rope stays on all four sheaves is what the three sheave rates above show: each matches
  # its fall speeds to 1.5%. The harness's belt_on compares against the path at rest, which a
  # rising block leaves by design, so it is not used here.)
  - {type: penetration, max: 0.002, settle_s: 1.2}
camera: {target: [-0.5, 0, 44], position: [16, -150, 50], fov: 30}   # the plate's view: both blocks, the ball, the hand
display:
  output: j_block
  labels: {j_hand: Hand pulling the rope (driver), j_block: Lower block and ball, j_u1: Sheave in the upper block, j_l1: Sheave in the lower block}
  expect: {default: 0.25}