# No. 359 (Brown 1868): "Primitive drilling apparatus. Being once set in motion, it is kept going by hand, by alternately pressing down and relieving the
# transverse bar to which the bands are attached, causing the bands to wind upon the spindle alternately in opposite directions, while the heavy disk or
# fly-wheel gives a steady momentum to the drill-spindle in its rotary motion."
#
# Model (cm): the spindle turns on its point (a hinge about z) and carries the heavy disk; the bit's cut is a damping on it. The transverse bar slides on the
# spindle (held by the hand, so it cannot turn). Two bands, made fast together at the spindle's top, lie wound round it side by side and run down to the
# bar's ends. The one driven input is the hand on the bar: it presses down for half of each stroke and lets go for the other half (it can only push). Pressing
# unwinds the bands and spins the spindle; the disk's momentum winds them on again the other way, lifting the bar for the next press, so the spindle turns
# alternately one way and the other. Generator: opencode-runs/fid/gen/gen359.py.
number: 359
slug: primitive-drilling-apparatus
name: Primitive drilling apparatus
brown: "Primitive drilling apparatus. Being once set in motion, it is kept going by hand, by alternately pressing down and relieving the transverse bar to which the bands are attached, causing the bands to wind upon the spindle alternately in opposite directions, while the heavy disk or fly-wheel gives a steady momentum to the drill-spindle in its rotary motion."
units: cm
sim: {timestep: 5e-05, integrator: implicitfast, iterations: 60, duration_s: 12, floor: false}
bodies:
  # the spindle, the heavy disk and the bit: one shafting turning about z
  - {id: spindle, shape: assembly, pos: [0, 0, 0], color: "#d9cfb6"}
  # the transverse bar, sliding on the spindle
  - id: bar
    shape: part
    pos: [0, 0, 16.0]
    density: 4000
    color: "#c9b48a"
    pieces:
      - {kind: poly, points: [[-9.6, 15.4], [9.6, 15.4], [9.6, 16.6], [-9.6, 16.6]], y: [-1, 1], collide: 0}
      - {kind: rod, from: [-9.0, 0, 15.4], to: [-9.0, 0, 14.75], radius: 0.18, collide: 0, color: "#6f5a3c"}
      - {kind: rod, from: [9.0, 0, 15.4], to: [9.0, 0, 14.75], radius: 0.18, collide: 0, color: "#6f5a3c"}
      - {kind: disc, center: [-9.0, 14.7], radius: 0.4, y: [-0.3, 0.3], collide: 0, color: "#6f5a3c"}
      - {kind: disc, center: [9.0, 14.7], radius: 0.4, y: [-0.3, 0.3], collide: 0, color: "#6f5a3c"}
joints:
  - {id: j_s, type: hinge, body: spindle, axis: [0, 0, 1], damping: 0.002}   # the spindle; its damping is the bit's cut
  - {id: j_b, type: slide, body: bar, axis: [0, 0, 1], damping: 0.5, range: [-13.50, 8.00]}   # the bar, the one driven joint (the hand presses it down); + : up
wheels:
  # where the bands lie on the spindle (local +y is the spindle's axis, +z)
  - {id: drum, body: spindle, pos: [0, 0, 22.5], quat: [0.70710678, 0.70710678, 0, 0], radius: 1.4, width: 9.0, flange: 0.0, spokes: 0, web: true, mass: 0.05, color: "#d9cfb6"}
shafts:
  - {id: spindle_rod, body: spindle, from: [0, 0, -2.6], to: [0, 0, 27.2], radius: 1.4, density: 700}
  - {id: disk, body: spindle, from: [0, 0, -1.2], to: [0, 0, 1.2], radius: 10.6, density: 1000, color: "#b39b6e"}
  - {id: disk_rim, body: spindle, from: [0, 0, -1.6], to: [0, 0, 1.6], radius: 9.6, density: 1000, color: "#b39b6e"}
  - {id: chuck, body: spindle, from: [0, 0, -4.4], to: [0, 0, -2.6], radius: 1.5, color: "#8f8a80"}
  - {id: bit, body: spindle, from: [0, 0, -8.0], to: [0, 0, -4.4], radius: 0.4, color: "#6f6a60"}
  - {id: bit_tip, body: spindle, from: [0, 0, -9.0], to: [0, 0, -8.0], radius: 0.15, color: "#6f6a60"}
cords:
  - id: band_l
    from: {body: bar, at: [-9.0, 0, 16.6]}
    to: {body: spindle, at: [-1.575, 0.0, 26.0], wound: true}
    over: [drum]
    senses: [1]
    wraps: [{wheel: drum, turns: 0, advance: 2.5}]
    links: 54
    segments: 6
    root_damping: 0.0001
    joint_armature: 0.000001
    thickness: 0.35
    stiffness: 50000
    pretension: 1.0
    damping: 2.0
    friction: 0.6
  - id: band_r
    from: {body: bar, at: [9.0, 0, 16.6]}
    to: {body: spindle, at: [1.575, -0.0, 26.0], wound: true}
    over: [drum]
    senses: [1]
    wraps: [{wheel: drum, turns: 0, advance: 2.5}]
    links: 54
    segments: 6
    root_damping: 0.0001
    joint_armature: 0.000001
    thickness: 0.35
    stiffness: 50000
    pretension: 1.0
    damping: 2.0
    friction: 0.6
contact: {solref: [0.001, 1], solimp: [0.9, 0.95, 0.001], margin: 0}
driver: {joint: j_b, kind: feet, feet: {joints: [j_b], sign: [-1], force: 8.0, hz: 0.4}, max_torque: 24.0}
checks:
  # two presses to one swing each way: the spindle turns alternately one way and the other, once round and more, at the hand's beat
  - {type: period, joint: j_s, expect_s: 5, tol: 0.1, settle_s: 2.0, window_s: 10.0}
  - {type: position, joint: j_s, min: -15.0, max: 2.5, settle_s: 0, window_s: 12.0}
  # the bar rides on the bands, clear of its stops (the flywheel below, the spindle's top above)
  - {type: position, joint: j_b, min: -12.0, max: 6.5, settle_s: 0, window_s: 12.0}
  - {type: penetration, max: 0.001, settle_s: 0.5}
camera: {target: [0, 0, 9.0], position: [0, -80.0, 14.0], fov: 34}
display:
  output: j_s
  labels: {j_b: "Bar (the hand presses)", j_s: "Drill spindle"}
