# No. 401 (Brown 1868): "E. P. Brownell's patent crank-motion to obviate dead-centers. The pressure on the treadle causes the slotted slide, A, to move forward with the wrist until the latter has passed the center, when the spring, B, forces the slide against the stops until it is again required to move forward."
#
# Model (cm, Brown's front view, no gravity): the fly-wheel (counter-clockwise, Brown's arrow) carries the slotted slide A across its face on a slide joint;
# its slots run on two stop pins in the wheel, and the spring B (400 N/m, 1 cm stretched) holds it out against them. The wrist on the slide takes the
# connecting-rod down to the treadle, a lever pivoted in its middle. The foot (the one input, press-only, 3.5 N m on the treadle) presses its far end
# down, so the rod pushes the wrist up, from just before each lower dead-center (0.5 rad) through the half turn after it, and lets
# it rise for the other half: the press is timed by the wheel's own position (feet.timed on j_w, as a person pushes at the right moment), not by a clock.
# The wheel starts at rest on its lower dead-center, wrist, rod and centre in line: there the push runs the slide in along its slots off the stops (only
# the pins and the slots' ends touch), the wrist goes over the center and the wheel turns; B puts the slide back on its stops as the push eases, and
# the fly-wheel carries it over the upper dead-center.
# Generator: opencode-runs/batch13/gen401.py.
number: 401
slug: brownell-crank-dead-centers
name: Brownell's crank-motion to obviate dead-centers
brown: "E. P. Brownell's patent crank-motion to obviate dead-centers. The pressure on the treadle causes the slotted slide, A, to move forward with the wrist until the latter has passed the center, when the spring, B, forces the slide against the stops until it is again required to move forward."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 100
  solver: PGS
  duration_s: 16
  floor: false
  gravity: 0
bodies:
  - id: wheel
    shape: part
    pos: [0, 0, 0]
    density: 7800
    color: "#8f8a80"
    pieces:
      - {kind: disc, center: [0, 0], radius: 10.0, inner: 8.6, y: [-0.3, 1.0]}   # the rim
      - {kind: disc, center: [0, 0], radius: 8.7, inner: 8.0, y: [0.0, 0.8], color: "#9b968c"}   # the web's bead
      - {kind: disc, center: [0, 0], radius: 8.7, y: [0.5, 0.9], color: "#a39d90"}   # the web
      - {kind: disc, center: [0, 0], radius: 1.2, y: [-0.4, 0.9]}   # the hub
      - {kind: rod, from: [0, -0.9, 0], to: [0, 3.0, 0], radius: 0.6, color: "#6f6a60"}   # the shaft
      - {kind: rod, from: [1.3989, -0.5, -0.0543], to: [1.3849, -0.5, 0.2658], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [1.3849, -0.5, 0.2658], to: [1.2981, -0.5, 0.5768], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [1.2981, -0.5, 0.5768], to: [1.1419, -0.5, 0.862], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [1.1419, -0.5, 0.862], to: [0.9235, -0.5, 1.106], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [0.9235, -0.5, 1.106], to: [0.6536, -0.5, 1.2956], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [0.6536, -0.5, 1.2956], to: [0.3456, -0.5, 1.4199], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [0.3456, -0.5, 1.4199], to: [0.0151, -0.5, 1.4715], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [0.0151, -0.5, 1.4715], to: [-0.3208, -0.5, 1.4467], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-0.3208, -0.5, 1.4467], to: [-0.6445, -0.5, 1.3457], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-0.6445, -0.5, 1.3457], to: [-0.939, -0.5, 1.1727], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-0.939, -0.5, 1.1727], to: [-1.1882, -0.5, 0.9359], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-1.1882, -0.5, 0.9359], to: [-1.3786, -0.5, 0.6468], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-1.3786, -0.5, 0.6468], to: [-1.4992, -0.5, 0.3198], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-1.4992, -0.5, 0.3198], to: [-1.5429, -0.5, -0.0282], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-1.5429, -0.5, -0.0282], to: [-1.5064, -0.5, -0.3795], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-1.5064, -0.5, -0.3795], to: [-1.3904, -0.5, -0.7155], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-1.3904, -0.5, -0.7155], to: [-1.2, -0.5, -1.0184], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-1.2, -0.5, -1.0184], to: [-0.9442, -0.5, -1.2719], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-0.9442, -0.5, -1.2719], to: [-0.6357, -0.5, -1.4621], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-0.6357, -0.5, -1.4621], to: [-0.2898, -0.5, -1.5782], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-0.2898, -0.5, -1.5782], to: [0.0756, -0.5, -1.613], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [0.0756, -0.5, -1.613], to: [0.4418, -0.5, -1.5638], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [0.4418, -0.5, -1.5638], to: [0.7894, -0.5, -1.4321], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [0.7894, -0.5, -1.4321], to: [1.1001, -0.5, -1.2236], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [1.1001, -0.5, -1.2236], to: [1.357, -0.5, -0.9485], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [1.357, -0.5, -0.9485], to: [1.5461, -0.5, -0.6203], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [1.5461, -0.5, -0.6203], to: [1.6565, -0.5, -0.2556], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [1.6565, -0.5, -0.2556], to: [1.6816, -0.5, 0.127], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [1.6816, -0.5, 0.127], to: [1.6189, -0.5, 0.5077], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [1.6189, -0.5, 0.5077], to: [1.4706, -0.5, 0.8663], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [1.4706, -0.5, 0.8663], to: [1.2436, -0.5, 1.184], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [1.2436, -0.5, 1.184], to: [0.9487, -0.5, 1.4434], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [0.9487, -0.5, 1.4434], to: [0.6007, -0.5, 1.6304], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [0.6007, -0.5, 1.6304], to: [0.217, -0.5, 1.7342], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [0.217, -0.5, 1.7342], to: [-0.1824, -0.5, 1.7485], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-0.1824, -0.5, 1.7485], to: [-0.5771, -0.5, 1.6714], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-0.5771, -0.5, 1.6714], to: [-0.9461, -0.5, 1.5059], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-0.9461, -0.5, 1.5059], to: [-1.2698, -0.5, 1.2597], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-1.2698, -0.5, 1.2597], to: [-1.5308, -0.5, 0.9447], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-1.5308, -0.5, 0.9447], to: [-1.7147, -0.5, 0.5767], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-1.7147, -0.5, 0.5767], to: [-1.8109, -0.5, 0.1743], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-1.8109, -0.5, 0.1743], to: [-1.8135, -0.5, -0.2418], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-1.8135, -0.5, -0.2418], to: [-1.7212, -0.5, -0.6498], radius: 0.09, color: "#3d3a35"}
      - {kind: rod, from: [-1.7212, -0.5, -0.6498], to: [-1.5378, -0.5, -1.0285], radius: 0.09, color: "#3d3a35"}
  - id: pin1
    shape: part
    pos: [4.3582, 0, -0.8521]
    mount: wheel
    density: 7800
    color: "#4d4a44"
    pieces:
      - {kind: rod, from: [4.3582, -0.3, -0.8521], to: [4.3582, -1.3, -0.8521], radius: 0.3, collide: 1, capsule: true, color: "#4d4a44"}   # a stop pin
  - id: pin2
    shape: part
    pos: [-1.6343, 0, -3.6179]
    mount: wheel
    density: 7800
    color: "#4d4a44"
    pieces:
      - {kind: rod, from: [-1.6343, -0.3, -3.6179], to: [-1.6343, -1.3, -3.6179], radius: 0.3, collide: 1, capsule: true, color: "#4d4a44"}   # a stop pin
  - id: slide
    shape: part
    pos: [1.0896, 0, -2.3607]
    mount: wheel
    density: 7800
    color: "#c7bb9f"
    pieces:
      - {kind: poly, points: [[4.7912, 0.1187], [-4.47, -4.1557], [-3.8833, -5.4268], [5.3779, -1.1524]], y: [-1.0, -0.4], collide: 0, color: "#c7bb9f"}   # the slotted slide A
      - {kind: rod, from: [4.3582, -1.02, -0.8521], to: [2.5423, -1.02, -1.6902], radius: 0.33999999999999997, color: "#5a564e"}   # a slot (drawn)
      - {kind: poly, points: [[4.7808, -0.2165], [4.4811, -0.3548], [4.8164, -1.0812], [5.116, -0.9429]], y: [-1.3, -0.4], collide: 2}   # the slot's end on the stop side
      - {kind: poly, points: [[2.0841, -1.4611], [1.7845, -1.5994], [2.1197, -2.3258], [2.4194, -2.1875]], y: [-1.3, -0.4], collide: 2}   # its other end
      - {kind: rod, from: [-1.6343, -1.02, -3.6179], to: [-3.4502, -1.02, -4.456], radius: 0.33999999999999997, color: "#5a564e"}   # a slot (drawn)
      - {kind: poly, points: [[-1.2118, -2.9823], [-1.5114, -3.1206], [-1.1762, -3.847], [-0.8765, -3.7087]], y: [-1.3, -0.4], collide: 2}   # the slot's end on the stop side
      - {kind: poly, points: [[-3.9084, -4.2269], [-4.208, -4.3652], [-3.8728, -5.0916], [-3.5732, -4.9533]], y: [-1.3, -0.4], collide: 2}   # its other end
      - {kind: disc, center: [0.0, -2.8636], radius: 0.5, y: [-1.5, -0.4], color: "#6f6a60"}   # the wrist
  - id: conrod
    shape: part
    pos: [0.0, 0, -2.8636]
    mount: slide
    mass: 0.1
    color: "#b8ad97"
    pieces:
      - {kind: rod, from: [0.0, -1.9, -2.8636], to: [-0.0, -1.9, -22.8636], radius: 0.3}
      - {kind: disc, center: [0.0, -2.8636], radius: 0.7, y: [-2.1999999999999997, -1.5999999999999999]}
      - {kind: disc, center: [-0.0, -22.8636], radius: 0.7, y: [-2.1999999999999997, -1.5999999999999999]}
  - id: treadle
    shape: part
    pos: [6.8235, 0, -20.0]
    mass: 0.3
    color: "#a89a7e"
    pieces:
      - {kind: poly, points: [[-0.2322, -22.3103], [16.1811, -15.4223], [16.6454, -16.5288], [0.2322, -23.4168]], y: [-1.5, -0.7], collide: 0, color: "#a89a7e"}
      - {kind: poly, points: [[12.9595, -16.0151], [15.9102, -14.7768], [16.9163, -17.1743], [13.9656, -18.4126]], y: [-2.2, -0.4], collide: 0, color: "#b8ad97"}
      - {kind: rod, from: [-0.0, -1.9, -22.8636], to: [-0.0, -0.7, -22.8636], radius: 0.3, color: "#6f6a60"}
      - {kind: disc, center: [6.8235, -20.0], radius: 0.9, y: [-1.7, -0.5], color: "#6f6a60"}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: disc, center: [6.8235, -20.0], radius: 1.4, y: [-0.5, 0.5]}   # the treadle's stud
      - {kind: poly, points: [[5.6235, -20.0], [8.0235, -20.0], [9.0235, -24.5], [4.6235, -24.5]], y: [-0.5, 0.5], collide: 0}   # its bracket
      - {kind: poly, points: [[0.8235, -24.5], [12.8235, -24.5], [12.8235, -25.3], [0.8235, -25.3]], y: [-2.0, 1.0], collide: 0}   # the floor
joints:
  - {id: j_w, type: hinge, body: wheel, axis: [0, -1, 0], damping: 0.03, frictionloss: 0.01}   # the fly-wheel; + : counter-clockwise (Brown's arrow)
  - {id: j_s, type: slide, body: slide, axis: [0.908, 0, 0.4191], damping: 0.05, stiffness: 400, springref: -1, range: [-0.6, 2.6]}   # the slide A; + : in along its slots, off the stops; the spring B draws it back
  - {id: j_p1, type: hinge, body: pin1, axis: [0, 1, 0], damping: 0.0001}   # a stop pin, free to turn in its hole in the wheel
  - {id: j_p2, type: hinge, body: pin2, axis: [0, 1, 0], damping: 0.0001}   # a stop pin, free to turn in its hole in the wheel
  - {id: j_r, type: hinge, body: conrod, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_t, type: hinge, body: treadle, axis: [0, 1, 0], damping: 0.0005}   # the treadle (the foot's: the one driven joint); + : clockwise (the foot end down)
pins:
  - {"id": "pin_b", "a": "conrod", "b": "treadle", "at": [-0.0, -1.9, -22.8636]}
contact: {solref: [0.002, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_t, kind: feet, feet: {joints: [j_t], sign: [1], force: 3.5, timed: {joint: j_w, shape: sin, gain: 1, offset: -0.5}}, max_torque: 3}
checks:
  - {type: monotonic, joint: j_w, direction: 1, max_back: 0.05, settle_s: 0.0, window_s: 12.0}   # from rest on the lower dead-center, the wheel goes one way only: it never backs at a dead-center
  - {type: turning, joint: j_w, direction: 1, min_mean: 5.0, min_fraction: 0.9, settle_s: 2.0, window_s: 10.0}   # and keeps turning (Brown's arrow), the foot pressing from each lower dead-center
  - {type: clicks, joint: j_s, lift: 0.015, min: 10, settle_s: 0.0, window_s: 12.0}   # the slide A leaves its stops (more than 1.5 cm in along its slots) at every lower dead-center and the spring B puts it back
  - {type: penetration, max: 0.002, settle_s: 0.5}
camera: {target: [3, 0, -12], position: [3, -78, -12], fov: 34}
display:
  output: j_w
  labels: {j_t: "Treadle (the foot)", j_w: "Fly-wheel", j_s: "Slide A", j_r: "Connecting-rod"}
  proof: {label: "Rod unpinned", sub: "the foot presses but the wheel stands"}

