# No. 124 (Brown 1868): "Fiddle drill. Reciprocating rectilinear motion of the bow, the string of which passes around the pulley on the spindle carrying the drill, producing alternating rotary motion of the drill."
#
# Model (cm): a bow held by the hand and worked to and fro in the line of its string (the one driven joint, a hand schedule 4 cm each way at 0.5 Hz). Its string is a real cord, tied to the two ends of the bow and
# passing over the 3.5 cm pulley on the spindle, which turns on its axle; nothing but the string's grip on the pulley turns the spindle. The spindle axis points at the viewer.
# There is no gravity (a plan). Generator: opencode-runs/batch9/gen124.py.
number: 124
slug: fiddle-drill
name: A fiddle drill, the bow's string turning the spindle
brown: "Fiddle drill. Reciprocating rectilinear motion of the bow, the string of which passes around the pulley on the spindle carrying the drill, producing alternating rotary motion of the drill."
units: cm
sim: {timestep: 0.0001, integrator: implicitfast, iterations: 60, duration_s: 6.0, gravity: 0, floor: false}
bodies:
  - id: spindle
    shape: pulley
    radius: 3.5
    width: 2.4
    pos: [0, 0, 0]
    mass: 0.15
    spokes: 4
    hub: 1.2
    flange: 0.5
    color: "#e6dcc6"
  - id: bow
    shape: part
    pos: [0, 0, 0]
    mass: 0.4
    color: "#a8884f"
    pieces:
      - {kind: poly, points: [[-15.5499, -4.0104], [-15.6102, -0.8127], [-14.5104, -0.7919], [-14.4501, -3.9896]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[-15.6001, -0.6968], [-14.9864, 2.442], [-13.9068, 2.231], [-14.5205, -0.9079]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[-14.9521, 2.5532], [-13.6918, 5.4927], [-12.6808, 5.0592], [-13.9411, 2.1198]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[-13.6349, 5.5942], [-11.7844, 8.2027], [-10.8872, 7.5663], [-12.7377, 4.9577]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[-11.7074, 8.29], [-9.3496, 10.4509], [-8.6063, 9.6399], [-10.9642, 7.479]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[-9.2559, 10.52], [-6.4963, 12.1365], [-5.9403, 11.1873], [-8.7, 9.5708]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[-6.3902, 12.1843], [-3.3522, 13.1841], [-3.0084, 12.1393], [-6.0464, 11.1395]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[-3.2385, 13.2086], [-0.0582, 13.5469], [0.0582, 12.4531], [-3.1221, 12.1148]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[0.0582, 13.5469], [3.2385, 13.2086], [3.1221, 12.1148], [-0.0582, 12.4531]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[3.3522, 13.1841], [6.3902, 12.1843], [6.0464, 11.1395], [3.0084, 12.1393]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[6.4963, 12.1365], [9.2559, 10.52], [8.7, 9.5708], [5.9403, 11.1873]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[9.3496, 10.4509], [11.7074, 8.29], [10.9642, 7.479], [8.6063, 9.6399]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[11.7844, 8.2027], [13.6349, 5.5942], [12.7377, 4.9577], [10.8872, 7.5663]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[13.6918, 5.4927], [14.9521, 2.5532], [13.9411, 2.1198], [12.6808, 5.0592]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[14.9864, 2.442], [15.6001, -0.6968], [14.5205, -0.9079], [13.9068, 2.231]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[15.6102, -0.8127], [15.5499, -4.0104], [14.4501, -3.9896], [14.5104, -0.7919]], y: [-0.5, 0.5]}
      - {kind: disc, center: [-15.0, -4.0], radius: 0.9, inner: 0.3, y: [-0.5, 0.5]}   # the string's two eyes
      - {kind: disc, center: [15.0, -4.0], radius: 0.9, inner: 0.3, y: [-0.5, 0.5]}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: rod, from: [0, 1.2, 0], to: [0, 4.0, 0], radius: 0.8, color: "#8f8a80"}   # the spindle's head, held against the work
      - {kind: poly, points: [[-2.0, -2.0], [2.0, -2.0], [2.0, 2.0], [-2.0, 2.0]], y: [3.4, 4.2]}
joints:
  - {id: j_sp, type: hinge, body: spindle, axis: [0, 1, 0], damping: 0.0005}   # + : clockwise
  - {id: j_b, type: slide, body: bow, axis: [1, 0, 0], damping: 0.05}   # the bow: + to the right
cords:
  - id: string
    from: {body: bow, at: [-15.0, 0, -4.0]}
    to: {body: bow, at: [15.0, 0, -4.0]}
    over: [spindle]
    links: 40
    thickness: 0.6
    density: 1400
    stiffness: 20000.0
    pretension: 2.0
    damping: 2.0
    friction: 0.5
contact: {solref: [0.001, 1], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_b, kind: velocity, rpm: 0, swing: {amplitude: 0.04, hz: 0.5}, kv: 60000.0, max_torque: 600.0}
checks:
  # The string grips the pulley and turns it as it runs over it: rad of spindle per metre of bow, 1/R_c = 1/3.8 cm less the string's slope at the pulley and its stretch (the inextensible-string solution at the left span is 22.9)
  - {type: follow, out: j_sp, in: j_b, expect: 22.7, tol: 1.0, min_r2: 0.999, settle_s: 1.0, window_s: 4}
  - {type: position, joint: j_sp, min: -1.1, max: 1.1, settle_s: 0.0, window_s: 5}   # about a radian each way for 4 cm of bow
  - {type: position, joint: j_b, min: -4.6, max: 4.6, settle_s: 0.0, window_s: 5}
camera: {target: [0, 0, 6.0], position: [0, -70.0, 6.0], fov: 34}
display:
  output: j_sp
  labels: {j_b: "Bow (driver)", j_sp: "Spindle"}
  proof: {label: "String not gripping the pulley", sub: "the bow moves to and fro but the spindle stands"}

