# No. 265 (Brown 1868): "Variable motion. If the conical drum has a regular circular motion, and the friction-roller is made to traverse lengthwise,
# a variable rotary motion of the friction-roller will be obtained."
#
# Model (cm, gravity on): the conical drum (1.5 to 5.5 radius over 10, axis level along y) is the one driven joint, 30 turns a minute.
# The friction-roller C (radius 1.5) hangs from a carriage (2 kg) on a rail laid parallel to the drum's top line, so falling at 21.8 deg;
# a dashpot on the rail lets the carriage down slowly, and so traverses the roller lengthwise from the wide end toward the narrow one. The roller rides
# in a short vertical slide on the carriage and rests on the drum by its own weight (0.1 kg slide). It turns by friction at r(drum)/r(roller),
# the drum's radius where it touches: falling from 5.02/1.5 as it goes. Only the drum's contact on C turns it. Generator: opencode-runs/batch12/gen265.py.
number: 265
slug: variable-motion-conical-drum
name: Variable motion from a conical drum and a traversing friction-roller
brown: "Variable motion. If the conical drum has a regular circular motion, and the friction-roller is made to traverse lengthwise, a variable rotary motion of the friction-roller will be obtained."
units: cm
sim:
  timestep: 0.0001
  integrator: implicitfast
  iterations: 100
  solver: CG
  multiccd: true
  duration_s: 9
  floor: false
bodies:
  - id: drum
    shape: part
    pos: [0, 0, 0]
    density: 1200
    friction: 0.9
    color: "#d9c9a3"
    pieces:
      - {kind: rod, from: [0, -2.5, 0], to: [0, 12.5, 0], radius: 0.5, collide: 0, color: "#8f8a80"}   # its shaft
      - {kind: loft, a: [[1.4968, 0.0, 0.0981], [1.4712, 0.0, 0.2926], [1.4204, 0.0, 0.4822], [1.3453, 0.0, 0.6634], [1.2472, 0.0, 0.8334], [1.1278, 0.0, 0.989], [0.989, 0.0, 1.1278], [0.8334, 0.0, 1.2472], [0.6634, 0.0, 1.3453], [0.4822, 0.0, 1.4204], [0.2926, 0.0, 1.4712], [0.0981, 0.0, 1.4968], [-0.0981, 0.0, 1.4968], [-0.2926, 0.0, 1.4712], [-0.4822, 0.0, 1.4204], [-0.6634, 0.0, 1.3453], [-0.8334, 0.0, 1.2472], [-0.989, 0.0, 1.1278], [-1.1278, 0.0, 0.989], [-1.2472, 0.0, 0.8334], [-1.3453, 0.0, 0.6634], [-1.4204, 0.0, 0.4822], [-1.4712, 0.0, 0.2926], [-1.4968, 0.0, 0.0981], [-1.4968, 0.0, -0.0981], [-1.4712, 0.0, -0.2926], [-1.4204, 0.0, -0.4822], [-1.3453, 0.0, -0.6634], [-1.2472, 0.0, -0.8334], [-1.1278, 0.0, -0.989], [-0.989, 0.0, -1.1278], [-0.8334, 0.0, -1.2472], [-0.6634, 0.0, -1.3453], [-0.4822, 0.0, -1.4204], [-0.2926, 0.0, -1.4712], [-0.0981, 0.0, -1.4968], [0.0981, 0.0, -1.4968], [0.2926, 0.0, -1.4712], [0.4822, 0.0, -1.4204], [0.6634, 0.0, -1.3453], [0.8334, 0.0, -1.2472], [0.989, 0.0, -1.1278], [1.1278, 0.0, -0.989], [1.2472, 0.0, -0.8334], [1.3453, 0.0, -0.6634], [1.4204, 0.0, -0.4822], [1.4712, 0.0, -0.2926], [1.4968, 0.0, -0.0981]], b: [[5.4882, 10.0, 0.3597], [5.3943, 10.0, 1.073], [5.2081, 10.0, 1.7679], [4.9328, 10.0, 2.4326], [4.5731, 10.0, 3.0556], [4.1351, 10.0, 3.6264], [3.6264, 10.0, 4.1351], [3.0556, 10.0, 4.5731], [2.4326, 10.0, 4.9328], [1.7679, 10.0, 5.2081], [1.073, 10.0, 5.3943], [0.3597, 10.0, 5.4882], [-0.3597, 10.0, 5.4882], [-1.073, 10.0, 5.3943], [-1.7679, 10.0, 5.2081], [-2.4326, 10.0, 4.9328], [-3.0556, 10.0, 4.5731], [-3.6264, 10.0, 4.1351], [-4.1351, 10.0, 3.6264], [-4.5731, 10.0, 3.0556], [-4.9328, 10.0, 2.4326], [-5.2081, 10.0, 1.7679], [-5.3943, 10.0, 1.073], [-5.4882, 10.0, 0.3597], [-5.4882, 10.0, -0.3597], [-5.3943, 10.0, -1.073], [-5.2081, 10.0, -1.7679], [-4.9328, 10.0, -2.4326], [-4.5731, 10.0, -3.0556], [-4.1351, 10.0, -3.6264], [-3.6264, 10.0, -4.1351], [-3.0556, 10.0, -4.5731], [-2.4326, 10.0, -4.9328], [-1.7679, 10.0, -5.2081], [-1.073, 10.0, -5.3943], [-0.3597, 10.0, -5.4882], [0.3597, 10.0, -5.4882], [1.073, 10.0, -5.3943], [1.7679, 10.0, -5.2081], [2.4326, 10.0, -4.9328], [3.0556, 10.0, -4.5731], [3.6264, 10.0, -4.1351], [4.1351, 10.0, -3.6264], [4.5731, 10.0, -3.0556], [4.9328, 10.0, -2.4326], [5.2081, 10.0, -1.7679], [5.3943, 10.0, -1.073], [5.4882, 10.0, -0.3597]], collide: 1}   # the conical drum
  - id: carriage
    shape: part
    pos: [0, 8.5, 6.52]
    mass: 2.0
    color: "#a89a7e"
    pieces:
      - {kind: poly, points: [[-1.4, 8.82], [1.4, 8.82], [1.4, 10.62], [-1.4, 10.62]], y: [7.1, 9.9], collide: 0}   # the carriage on its rail
      - {kind: poly, points: [[-0.9, 8.42], [-0.5, 8.42], [-0.5, 8.82], [-0.9, 8.82]], y: [7.9, 9.1], collide: 0}   # the slide's guides
      - {kind: poly, points: [[0.5, 8.42], [0.9, 8.42], [0.9, 8.82], [0.5, 8.82]], y: [7.9, 9.1], collide: 0}
  - id: slide_c
    shape: part
    pos: [0, 8.5, 6.52]
    mount: carriage
    mass: 0.1
    color: "#b9a179"
    pieces:
      - {kind: poly, points: [[-0.45, 6.02], [0.45, 6.02], [0.45, 9.62], [-0.45, 9.62]], y: [8.9, 9.2], collide: 0}   # the roller's fork
      - {kind: poly, points: [[-0.45, 6.02], [0.45, 6.02], [0.45, 9.62], [-0.45, 9.62]], y: [7.8, 8.1], collide: 0}
      - {kind: poly, points: [[-0.45, 8.22], [0.45, 8.22], [0.45, 9.62], [-0.45, 9.62]], y: [7.8, 9.2], collide: 0}
  - id: roller_c
    shape: part
    pos: [0, 8.5, 6.52]
    mount: slide_c
    density: 2700
    friction: 0.9
    color: "#e6dcc6"
    pieces:
      - {kind: disc, center: [0, 6.52], radius: 1.5, y: [8.2, 8.8], collide: 2}   # the friction-roller C
      - {kind: poly, points: [[-0.12, 6.52], [0.12, 6.52], [0.12, 7.92], [-0.12, 7.92]], y: [8.15, 8.2], collide: 0, color: "#6f675a"}   # a mark on its face
      - {kind: rod, from: [0, 8.1, 6.52], to: [0, 8.9, 6.52], radius: 0.25, collide: 0, color: "#8f8a80"}   # its pin
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: poly, points: [[-4, -8], [4, -8], [4, -7], [-4, -7]], y: [-4, 14.0], collide: 0, color: "#b9b09c"}   # the bed
      - {kind: poly, points: [[-1.2, -7], [1.2, -7], [1.2, 0.8], [-1.2, 0.8]], y: [-2.3, -1.5], collide: 0}   # the drum's bearings
      - {kind: poly, points: [[-1.2, -7], [1.2, -7], [1.2, 0.8], [-1.2, 0.8]], y: [11.5, 12.3], collide: 0}
      - {kind: rod, from: [0, -1.249, 5.8204], to: [0, 11.2854, 10.8342], radius: 0.35, collide: 0, color: "#7d766a"}   # the carriage's rail
      - {kind: poly, points: [[-0.4, -7], [0.4, -7], [0.4, 5.8204], [-0.4, 5.8204]], y: [-1.649, -0.849], collide: 0, color: "#9d917a"}   # its posts
      - {kind: poly, points: [[-0.4, -7], [0.4, -7], [0.4, 10.8342], [-0.4, 10.8342]], y: [10.8854, 11.6854], collide: 0, color: "#9d917a"}
joints:
  - {id: j_d, type: hinge, body: drum, axis: [0, 1, 0], damping: 0.01}   # the one driven joint
  - {id: j_t, type: slide, body: carriage, axis: [0, 0.9285, 0.3714], range: [-9.3, 0.3], damping: 750}   # the carriage along its rail; - : toward the narrow end
  - {id: j_c, type: slide, body: slide_c, axis: [0, 0, 1], range: [-1.5, 1.5], damping: 0.5}   # C's slide; + : up
  - {id: j_r, type: hinge, body: roller_c, axis: [0, 1, 0], damping: 1e-05}   # C on its pin
contact: {solref: [0.001, 1], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_d, kind: velocity, rpm: 30, kv: 20.0, max_torque: 6.0}
checks:
  - {type: ratio_range, out: j_r, in: j_d, min: -3.30, max: -2.94, min_swing: 0.1, settle_s: 0.5, window_s: 1.0, slices: 8}   # near the wide end: r/R about 3.23 falling to 3.0
  - {type: position, joint: j_t, min: -1.6, max: -0.3, settle_s: 0.5, window_s: 1.0}   # where the carriage is then (cm along the rail)
  - {type: ratio_range, out: j_r, in: j_d, min: -1.79, max: -1.48, min_swing: 0.1, settle_s: 7.0, window_s: 1.0, slices: 8}   # toward the narrow end: about 1.75 falling to 1.52
  - {type: position, joint: j_t, min: -7.6, max: -6.2, settle_s: 7.0, window_s: 1.0}
  - {type: ratio_range, out: j_r, in: j_d, min: -3.30, max: -1.48, min_swing: 1.4, settle_s: 0.5, window_s: 7.5, slices: 30}   # the variable rotary motion over the traverse
  - {type: position, joint: j_c, min: -0.2, max: 0.2, settle_s: 0.0, window_s: 9}   # the roller stays down on the drum
camera: {target: [0, 4.5, 0.0], position: [55.0, -30.0, 22.0], fov: 34.0}
display:
  output: j_r
  labels: {j_d: "Conical drum (driver)", j_t: "Roller's traverse", j_c: "Roller, up and down", j_r: "Friction-roller"}
  proof: {label: "Variable motion", sub: "the drum turns steadily; the roller, traversed toward the narrow end, turns ever slower"}

