# No. 242 (Brown 1868): "A brake used in cranes and hoisting machines. By pulling down the end of the lever, the ends of the brake-strap are drawn
# toward each other, and the strap tightened on the brake-wheel."
#
# Model (cm, gravity on): the brake-wheel (radius 9) on the crane's barrel shaft, turned clockwise by the load (a constant torque, the one driven
# joint) against a little friction in its bearings, so it runs at a steady speed. The strap (a chain of links on real contact with the rim) goes from
# a pin on the lever below its fulcrum, clockwise round about three quarters of the wheel, to a pin above the fulcrum. Pulling the lever's long end
# down swings both pins away from the wheel, drawing the strap's ends toward each other and tight on the rim; the friction stops the wheel and holds
# the load. The operator's hand is a spring on the lever whose free position he sets (on at 2.5 s, off at 6 s), as in No. 5. Generator:
# opencode-runs/batch11/gen242.py.
number: 242
slug: crane-band-brake
name: A band brake for cranes and hoisting machines
brown: "A brake used in cranes and hoisting machines. By pulling down the end of the lever, the ends of the brake-strap are drawn toward each other, and the strap tightened on the brake-wheel."
units: cm
sim: {timestep: 0.0001, integrator: implicitfast, iterations: 60, duration_s: 9}
bodies:
  - {id: wheel, shape: pulley, radius: 9, width: 2.4, pos: [0, 0, 0], mass: 2.0, spokes: 0, hub: 2.4, flange: 0, color: "#e6dcc6"}
  - id: lever
    shape: part
    pos: [13.8, 0, -2.05]
    color: "#b8ad97"
    pieces:
      - {kind: poly, points: [[13.874, -2.4939], [13.726, -1.6061], [22.426, -0.1561], [22.574, -1.0439]], y: [-2.2, -1.6]}
      - {kind: poly, points: [[14.0944, -1.7792], [13.5056, -2.3208], [11.2056, 0.1792], [11.7944, 0.7208]], y: [-2.2, -1.6]}
      - {kind: poly, points: [[13.6875, -1.6661], [13.9125, -2.4339], [11.0125, -3.2839], [10.7875, -2.5161]], y: [-2.2, -1.6]}
      - {kind: disc, center: [13.8, -2.05], radius: 0.9, inner: 0.35, y: [-2.4, -1.4]}
      - {kind: rod, from: [11.5, -2.2, 0.45], to: [11.5, 0.4, 0.45], radius: 0.35, color: "#8f8a80"}   # the strap's upper end
      - {kind: rod, from: [10.9, -2.2, -2.9], to: [10.9, 0.4, -2.9], radius: 0.35, color: "#8f8a80"}   # the strap's lower end
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: rod, from: [0, -2.0, 0], to: [0, 3.4, 0], radius: 1.0, color: "#8f8a80"}   # the barrel shaft
      - {kind: rod, from: [13.8, -2.6, -2.05], to: [13.8, 3.4, -2.05], radius: 0.35, color: "#8f8a80"}   # the fulcrum
      - {kind: poly, points: [[-11.5, -11.5], [24, -11.5], [24, 11.5], [-11.5, 11.5]], y: [2.6, 3.4], color: "#b9b09c"}   # the plate behind
joints:
  - {id: j_wheel, type: hinge, body: wheel, axis: [0, -1, 0], damping: 0.2000}   # the one driven joint; +: counter-clockwise as seen (the load turns it clockwise)
  - {id: j_lever, type: hinge, body: lever, axis: [0, -1, 0], range: [-0.35, 0.3], stiffness: 150, springref: 0.25, damping: 8}   # the hand's spring; -: the long end pulled down
cords:
  - id: strap
    from: {body: lever, at: [10.9, 0, -2.9]}
    to: {body: lever, at: [11.5, 0, 0.45]}
    over: [wheel]
    links: 48
    thickness: 0.8
    density: 1100          # leather
    stiffness: 40000
    pretension: 0.5
    damping: 8
    friction: 0.4           # leather on iron
    color: "#6f5a3c"
contact: {solref: [0.0005, 1], solimp: [0.98, 0.999, 0.0001], margin: 0}
driver: {joint: j_wheel, kind: torque, torque: -0.6, max_torque: 1.2}
hand:
  - {t: 2.5, springref: {j_lever: -0.3}}
  - {t: 6, springref: {j_lever: 0.25}}
checks:
  - {type: turning, joint: j_wheel, direction: -1, min_mean: 1.5, slow: 0.2, min_fraction: 0.8, settle_s: 1.0, window_s: 1.5}   # brake off: the load runs the wheel round
  - {type: still, joint: j_wheel, max: 0.05, settle_s: 3.5, window_s: 2.5}   # brake on: the strap holds it
  - {type: turning, joint: j_wheel, direction: -1, min_mean: 0.8, slow: 0.2, min_fraction: 0.6, settle_s: 7, window_s: 2}   # off again: it runs
  - {type: penetration, max: 0.002, settle_s: 0.5}
camera: {target: [5.5, 0, 0], position: [5.5, -64.0, 2], fov: 34}
display:
  output: j_wheel
  labels: {j_wheel: "Brake-wheel (the load)", j_lever: "Lever"}
  lever: {joint: j_lever, label: "Brake", states: {"Off": 0.25, "On (lever pulled down)": -0.3}}
  proof: {label: "Strap out of contact", sub: "nothing holds the wheel"}

