# No. 255 (Brown 1868): "A flanged pulley to drive or be driven by a flat belt."
#
# Model (cm, gravity on, front view, shafts level): two flanged pulleys (flanges 1 above the rim, 4 wide), the smaller (radius 6) on the
# driving shaft, turned at 40 rpm (the one driven joint), the larger (radius 9) 32 away carrying a load (a damper). A flat belt of links on
# real contact, tensioned, runs between the flanges on both and drives the larger by friction at the ratio of the pitch radii, r + 0.2 (0.6739).
# Generator: opencode-runs/batch11/gen255.py.
number: 255
slug: flanged-pulley-flat-belt
name: A flanged pulley for a flat belt
brown: "A flanged pulley to drive or be driven by a flat belt."
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 50, duration_s: 6, floor: false}
bodies:
  - {id: p_a, shape: pulley, radius: 6, width: 4, flange: 1, pos: [0, 0, 0], mass: 1.2, spokes: 4, hub: 1.8}
  - {id: p_b, shape: pulley, radius: 9, width: 4, flange: 1, pos: [32, 0, 0], mass: 2.0, spokes: 6, hub: 2.4, color: "#e6dcc4"}
shafts:
  - {id: s_a, body: p_a, from: [0, -4, 0], to: [0, 6, 0], radius: 0.8}
  - {id: s_b, body: p_b, from: [0, -4, 0], to: [0, 6, 0], radius: 1.0}
joints:
  - {id: j_a, type: hinge, body: p_a, axis: [0, 1, 0], damping: 0.002}   # the one driven joint
  - {id: j_b, type: hinge, body: p_b, axis: [0, 1, 0], damping: 0.05}   # the load
belts:
  - id: belt
    around: [p_a, p_b]
    links: 120
    thickness: 0.4
    width: 3.4
    density: 950
    stiffness: 30000
    damping: 2
    pretension: 30
    friction: 0.6
contact: {solref: [0.004, 1], solimp: [0.9, 0.95, 0.001], margin: 0}
driver: {joint: j_a, kind: velocity, rpm: 40, kv: 2, max_torque: 5}
checks:
  - {type: ratio, out: j_b, in: j_a, expect: 0.6739, tol: 0.03, settle_s: 1, window_s: 4.5}   # the ratio of the pitch radii, less creep
  - {type: belt_on, belt: belt, max_radial_dev: 1.0, max_lateral: 0.6, duration_s: 2}
  - {type: penetration, max: 0.004, settle_s: 0.5}
camera: {target: [16, 0, 0], position: [16, -16, 66], fov: 30}
display:
  output: j_b
  labels: {j_a: "Small pulley (driver)", j_b: "Large pulley"}
  expect: {default: 0.6739}

