# No. 132 (Brown 1868): "This is a motion which has been used in presses to produce the necessary pressure upon the platen. Horizontal motion is given to the arm of the lever which turns the upper disk. Between the top and bottom disks are two bars which enter holes in the disks. These bars are in oblique positions, as shown in the drawing, when the press is not in operation; but when the top disk is made to rotate, the bars move toward perpendicular positions and force the lower disk down."
#
# Model (cm, gravity on): the upper disk turns on a vertical axis (the one driven joint, a lever swung by hand through 1.1 rad each way of its start). Two bars of 14 cm are pinned in holes of the upper disk at 6 cm from the axis
# (ball pins) and swivel in holes of the lower disk, also 6 cm from the axis, on the opposite side (a universal joint: a swivel about the vertical, and the bar's own tilt). As the pins come round
# the horizontal distance between a bar's ends, 2 R cos(psi/2), shrinks and the bar stands up: the lower disk and its platen, guided to slide on the vertical axis, go down 6.0 cm over the swing. Generator: opencode-runs/batch10/gen132.py.
number: 132
slug: press-oblique-bars
name: Press with two oblique bars between two disks
brown: "This is a motion which has been used in presses to produce the necessary pressure upon the platen. Horizontal motion is given to the arm of the lever which turns the upper disk. Between the top and bottom disks are two bars which enter holes in the disks. These bars are in oblique positions, as shown in the drawing, when the press is not in operation; but when the top disk is made to rotate, the bars move toward perpendicular positions and force the lower disk down."
units: cm
sim: {timestep: 0.0005, integrator: implicitfast, iterations: 80, duration_s: 14.0, floor: false}
bodies:
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: poly, points: [[-32, 40], [32, 40], [32, 47], [-32, 47]], y: [-12, 12], collide: 0, color: "#bdb4a0"}   # the head beam
      - {kind: poly, points: [[-30, 37], [30, 37], [32, 40], [-32, 40]], y: [-10, 10], collide: 0, color: "#c9c0ac"}
      - {kind: poly, points: [[-25.5, 3], [-22.5, 3], [-22.5, 40], [-25.5, 40]], y: [-1.5, 1.5], collide: 0}   # the columns
      - {kind: poly, points: [[22.5, 3], [25.5, 3], [25.5, 40], [22.5, 40]], y: [-1.5, 1.5], collide: 0}
      - {kind: poly, points: [[-29, 0], [-19, 0], [-19, 3], [-29, 3]], y: [-4, 4], collide: 0, color: "#b9b09c"}   # their feet
      - {kind: poly, points: [[19, 0], [29, 0], [29, 3], [19, 3]], y: [-4, 4], collide: 0, color: "#b9b09c"}
      - {kind: poly, points: [[-12, 0], [12, 0], [12, 2], [-12, 2]], y: [-5, 5], collide: 0, color: "#b9b09c"}   # the bed under the platen
      - {kind: rod, from: [0, 0, 36], to: [0, 0, 41], radius: 2.6, color: "#8f8a80"}   # the upper disk's spindle through the head
  - id: disk
    shape: part
    pos: [0, 0, 30.0]
    mass: 1.4
    friction: 0.2
    color: "#d9cfb6"
    pieces:
      - {kind: loft, a: [[10.5, 0.0, 30.0], [10.1422, 2.7176, 30.0], [9.0933, 5.25, 30.0], [7.4246, 7.4246, 30.0], [5.25, 9.0933, 30.0], [2.7176, 10.1422, 30.0], [0.0, 10.5, 30.0], [-2.7176, 10.1422, 30.0], [-5.25, 9.0933, 30.0], [-7.4246, 7.4246, 30.0], [-9.0933, 5.25, 30.0], [-10.1422, 2.7176, 30.0], [-10.5, 0.0, 30.0], [-10.1422, -2.7176, 30.0], [-9.0933, -5.25, 30.0], [-7.4246, -7.4246, 30.0], [-5.25, -9.0933, 30.0], [-2.7176, -10.1422, 30.0], [-0.0, -10.5, 30.0], [2.7176, -10.1422, 30.0], [5.25, -9.0933, 30.0], [7.4246, -7.4246, 30.0], [9.0933, -5.25, 30.0], [10.1422, -2.7176, 30.0]], b: [[10.5, 0.0, 33.2], [10.1422, 2.7176, 33.2], [9.0933, 5.25, 33.2], [7.4246, 7.4246, 33.2], [5.25, 9.0933, 33.2], [2.7176, 10.1422, 33.2], [0.0, 10.5, 33.2], [-2.7176, 10.1422, 33.2], [-5.25, 9.0933, 33.2], [-7.4246, 7.4246, 33.2], [-9.0933, 5.25, 33.2], [-10.1422, 2.7176, 33.2], [-10.5, 0.0, 33.2], [-10.1422, -2.7176, 33.2], [-9.0933, -5.25, 33.2], [-7.4246, -7.4246, 33.2], [-5.25, -9.0933, 33.2], [-2.7176, -10.1422, 33.2], [-0.0, -10.5, 33.2], [2.7176, -10.1422, 33.2], [5.25, -9.0933, 33.2], [7.4246, -7.4246, 33.2], [9.0933, -5.25, 33.2], [10.1422, -2.7176, 33.2]], collide: 0}   # the upper disk
      - {kind: loft, a: [[4.5, 0.0, 33.2], [4.3467, 1.1647, 33.2], [3.8971, 2.25, 33.2], [3.182, 3.182, 33.2], [2.25, 3.8971, 33.2], [1.1647, 4.3467, 33.2], [0.0, 4.5, 33.2], [-1.1647, 4.3467, 33.2], [-2.25, 3.8971, 33.2], [-3.182, 3.182, 33.2], [-3.8971, 2.25, 33.2], [-4.3467, 1.1647, 33.2], [-4.5, 0.0, 33.2], [-4.3467, -1.1647, 33.2], [-3.8971, -2.25, 33.2], [-3.182, -3.182, 33.2], [-2.25, -3.8971, 33.2], [-1.1647, -4.3467, 33.2], [-0.0, -4.5, 33.2], [1.1647, -4.3467, 33.2], [2.25, -3.8971, 33.2], [3.182, -3.182, 33.2], [3.8971, -2.25, 33.2], [4.3467, -1.1647, 33.2]], b: [[4.5, 0.0, 36.2], [4.3467, 1.1647, 36.2], [3.8971, 2.25, 36.2], [3.182, 3.182, 36.2], [2.25, 3.8971, 36.2], [1.1647, 4.3467, 36.2], [0.0, 4.5, 36.2], [-1.1647, 4.3467, 36.2], [-2.25, 3.8971, 36.2], [-3.182, 3.182, 36.2], [-3.8971, 2.25, 36.2], [-4.3467, 1.1647, 36.2], [-4.5, 0.0, 36.2], [-4.3467, -1.1647, 36.2], [-3.8971, -2.25, 36.2], [-3.182, -3.182, 36.2], [-2.25, -3.8971, 36.2], [-1.1647, -4.3467, 36.2], [-0.0, -4.5, 36.2], [1.1647, -4.3467, 36.2], [2.25, -3.8971, 36.2], [3.182, -3.182, 36.2], [3.8971, -2.25, 36.2], [4.3467, -1.1647, 36.2]], collide: 0, color: "#c5b99c"}   # its boss
      - {kind: poly, points: [[0, 33.4], [19, 34.0], [19, 35.6], [0, 36.0]], y: [-1.1, 1.1], collide: 0, color: "#a8a398"}   # the lever
      - {kind: rod, from: [-1.605, -5.7813, 29.6], to: [-1.605, -5.7813, 32.2], radius: 0.9, collide: 0, color: "#6f6a60"}   # the holes the bars enter
      - {kind: rod, from: [1.605, 5.7813, 29.6], to: [1.605, 5.7813, 32.2], radius: 0.9, collide: 0, color: "#6f6a60"}
  - id: platen
    shape: part
    pos: [0, 0, 19.7657]
    mass: 3.0
    friction: 0.2
    color: "#cfc6b4"
    pieces:
      - {kind: loft, a: [[10.5, 0.0, 16.7657], [10.1422, 2.7176, 16.7657], [9.0933, 5.25, 16.7657], [7.4246, 7.4246, 16.7657], [5.25, 9.0933, 16.7657], [2.7176, 10.1422, 16.7657], [0.0, 10.5, 16.7657], [-2.7176, 10.1422, 16.7657], [-5.25, 9.0933, 16.7657], [-7.4246, 7.4246, 16.7657], [-9.0933, 5.25, 16.7657], [-10.1422, 2.7176, 16.7657], [-10.5, 0.0, 16.7657], [-10.1422, -2.7176, 16.7657], [-9.0933, -5.25, 16.7657], [-7.4246, -7.4246, 16.7657], [-5.25, -9.0933, 16.7657], [-2.7176, -10.1422, 16.7657], [-0.0, -10.5, 16.7657], [2.7176, -10.1422, 16.7657], [5.25, -9.0933, 16.7657], [7.4246, -7.4246, 16.7657], [9.0933, -5.25, 16.7657], [10.1422, -2.7176, 16.7657]], b: [[10.5, 0.0, 19.7657], [10.1422, 2.7176, 19.7657], [9.0933, 5.25, 19.7657], [7.4246, 7.4246, 19.7657], [5.25, 9.0933, 19.7657], [2.7176, 10.1422, 19.7657], [0.0, 10.5, 19.7657], [-2.7176, 10.1422, 19.7657], [-5.25, 9.0933, 19.7657], [-7.4246, 7.4246, 19.7657], [-9.0933, 5.25, 19.7657], [-10.1422, 2.7176, 19.7657], [-10.5, 0.0, 19.7657], [-10.1422, -2.7176, 19.7657], [-9.0933, -5.25, 19.7657], [-7.4246, -7.4246, 19.7657], [-5.25, -9.0933, 19.7657], [-2.7176, -10.1422, 19.7657], [-0.0, -10.5, 19.7657], [2.7176, -10.1422, 19.7657], [5.25, -9.0933, 19.7657], [7.4246, -7.4246, 19.7657], [9.0933, -5.25, 19.7657], [10.1422, -2.7176, 19.7657]], collide: 0}   # the lower disk
      - {kind: poly, points: [[-27, 10.2657], [27, 10.2657], [27, 16.7657], [-27, 16.7657]], y: [-9, 9], collide: 0, color: "#bdb4a0"}   # the platen
      - {kind: poly, points: [[-27, 14.7657], [-25.5, 14.7657], [-25.5, 16.7657], [-27, 16.7657]], y: [-2.5, 2.5], collide: 0, color: "#a8a398"}   # its guides on the columns
      - {kind: poly, points: [[25.5, 14.7657], [27, 14.7657], [27, 16.7657], [25.5, 16.7657]], y: [-2.5, 2.5], collide: 0, color: "#a8a398"}
  - id: sw_1
    shape: part
    pos: [6.0, 0.0, 19.7657]
    mount: platen
    mass: 0.15
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: loft, a: [[7.8, 0.0, 19.1657], [7.7387, 0.4659, 19.1657], [7.5588, 0.9, 19.1657], [7.2728, 1.2728, 19.1657], [6.9, 1.5588, 19.1657], [6.4659, 1.7387, 19.1657], [6.0, 1.8, 19.1657], [5.5341, 1.7387, 19.1657], [5.1, 1.5588, 19.1657], [4.7272, 1.2728, 19.1657], [4.4412, 0.9, 19.1657], [4.2613, 0.4659, 19.1657], [4.2, 0.0, 19.1657], [4.2613, -0.4659, 19.1657], [4.4412, -0.9, 19.1657], [4.7272, -1.2728, 19.1657], [5.1, -1.5588, 19.1657], [5.5341, -1.7387, 19.1657], [6.0, -1.8, 19.1657], [6.4659, -1.7387, 19.1657], [6.9, -1.5588, 19.1657], [7.2728, -1.2728, 19.1657], [7.5588, -0.9, 19.1657], [7.7387, -0.4659, 19.1657]], b: [[7.8, 0.0, 20.2657], [7.7387, 0.4659, 20.2657], [7.5588, 0.9, 20.2657], [7.2728, 1.2728, 20.2657], [6.9, 1.5588, 20.2657], [6.4659, 1.7387, 20.2657], [6.0, 1.8, 20.2657], [5.5341, 1.7387, 20.2657], [5.1, 1.5588, 20.2657], [4.7272, 1.2728, 20.2657], [4.4412, 0.9, 20.2657], [4.2613, 0.4659, 20.2657], [4.2, 0.0, 20.2657], [4.2613, -0.4659, 20.2657], [4.4412, -0.9, 20.2657], [4.7272, -1.2728, 20.2657], [5.1, -1.5588, 20.2657], [5.5341, -1.7387, 20.2657], [6.0, -1.8, 20.2657], [6.4659, -1.7387, 20.2657], [6.9, -1.5588, 20.2657], [7.2728, -1.2728, 20.2657], [7.5588, -0.9, 20.2657], [7.7387, -0.4659, 20.2657]], collide: 0, color: "#8f8a80"}
  - id: bar_1
    shape: part
    pos: [6.0, 0.0, 19.7657]
    mount: sw_1
    mass: 0.4
    friction: 0.2
    color: "#a8a398"
    pieces:
      - {kind: rod, from: [6.0, 0.0, 19.7657], to: [-1.605, -5.7813, 30.0], radius: 0.9, collide: 0, color: "#a8a398"}
  - id: sw_2
    shape: part
    pos: [-6.0, 0.0, 19.7657]
    mount: platen
    mass: 0.15
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: loft, a: [[-4.2, 0.0, 19.1657], [-4.2613, 0.4659, 19.1657], [-4.4412, 0.9, 19.1657], [-4.7272, 1.2728, 19.1657], [-5.1, 1.5588, 19.1657], [-5.5341, 1.7387, 19.1657], [-6.0, 1.8, 19.1657], [-6.4659, 1.7387, 19.1657], [-6.9, 1.5588, 19.1657], [-7.2728, 1.2728, 19.1657], [-7.5588, 0.9, 19.1657], [-7.7387, 0.4659, 19.1657], [-7.8, 0.0, 19.1657], [-7.7387, -0.4659, 19.1657], [-7.5588, -0.9, 19.1657], [-7.2728, -1.2728, 19.1657], [-6.9, -1.5588, 19.1657], [-6.4659, -1.7387, 19.1657], [-6.0, -1.8, 19.1657], [-5.5341, -1.7387, 19.1657], [-5.1, -1.5588, 19.1657], [-4.7272, -1.2728, 19.1657], [-4.4412, -0.9, 19.1657], [-4.2613, -0.4659, 19.1657]], b: [[-4.2, 0.0, 20.2657], [-4.2613, 0.4659, 20.2657], [-4.4412, 0.9, 20.2657], [-4.7272, 1.2728, 20.2657], [-5.1, 1.5588, 20.2657], [-5.5341, 1.7387, 20.2657], [-6.0, 1.8, 20.2657], [-6.4659, 1.7387, 20.2657], [-6.9, 1.5588, 20.2657], [-7.2728, 1.2728, 20.2657], [-7.5588, 0.9, 20.2657], [-7.7387, 0.4659, 20.2657], [-7.8, 0.0, 20.2657], [-7.7387, -0.4659, 20.2657], [-7.5588, -0.9, 20.2657], [-7.2728, -1.2728, 20.2657], [-6.9, -1.5588, 20.2657], [-6.4659, -1.7387, 20.2657], [-6.0, -1.8, 20.2657], [-5.5341, -1.7387, 20.2657], [-5.1, -1.5588, 20.2657], [-4.7272, -1.2728, 20.2657], [-4.4412, -0.9, 20.2657], [-4.2613, -0.4659, 20.2657]], collide: 0, color: "#8f8a80"}
  - id: bar_2
    shape: part
    pos: [-6.0, 0.0, 19.7657]
    mount: sw_2
    mass: 0.4
    friction: 0.2
    color: "#a8a398"
    pieces:
      - {kind: rod, from: [-6.0, 0.0, 19.7657], to: [1.605, 5.7813, 30.0], radius: 0.9, collide: 0, color: "#a8a398"}
joints:
  - {id: j_d, type: hinge, body: disk, axis: [0, 0, 1], damping: 0.02}   # the one driven joint, the lever swung by hand; + : counter-clockwise from above
  - {id: j_p, type: slide, body: platen, axis: [0, 0, 1], damping: 1.0, range: [-12, 8]}   # the lower disk and platen slide on the vertical axis; + : up
  - {id: j_s1, type: hinge, body: sw_1, axis: [0, 0, 1], damping: 0.01}   # the lower end of each bar swivels about the vertical
  - {id: j_t1, type: hinge, body: bar_1, axis: [0.6052, -0.7961, 0], damping: 0.01}   # and the bar tilts about the horizontal across it
  - {id: j_s2, type: hinge, body: sw_2, axis: [0, 0, 1], damping: 0.01}
  - {id: j_t2, type: hinge, body: bar_2, axis: [-0.6052, 0.7961, 0], damping: 0.01}
pins:
  - {id: pin_1, a: bar_1, b: disk, at: [-1.605, -5.7813, 30.0]}
  - {id: pin_2, a: bar_2, b: disk, at: [1.605, 5.7813, 30.0]}
contact: {solref: [0.002, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_d, kind: velocity, rpm: 0, swing: {amplitude: 1.1, hz: 0.15}, kv: 200.0, max_torque: 80}
checks:
  - {type: follow, out: j_p, in: j_d, expect: -0.0252, tol: 0.0015, min_r2: 0.98, settle_s: 0.5, window_s: 0.7}   # the platen's descent per radian of the lever, from 1.80 to 2.30 rad
  - {type: follow, out: j_p, in: j_d, expect: -0.0253, tol: 0.0015, min_r2: 0.98, settle_s: 2.2, window_s: 0.6}   # the platen's descent per radian of the lever, from 2.26 to 1.83 rad
  - {type: follow, out: j_p, in: j_d, expect: -0.0332, tol: 0.002, min_r2: 0.98, settle_s: 3.3, window_s: 0.5}   # the platen's descent per radian of the lever, from 1.33 to 0.83 rad
  - {type: follow, out: j_p, in: j_d, expect: -0.0258, tol: 0.0015, min_r2: 0.98, settle_s: 5.7, window_s: 0.5}   # the platen's descent per radian of the lever, from 0.43 to 0.83 rad
  - {type: position, joint: j_p, min: -3.6733, max: 3.5243, settle_s: 0.0, window_s: 14}
  - {type: amplitude, joint: j_d, min: 0.968, max: 1.155, settle_s: 1, window_s: 12}
camera: {target: [0, 0, 15.0], position: [0, -152.0, 15.0], fov: 34}
display:
  output: j_p
  labels: {j_d: "Lever and upper disk (driver)", j_p: "Lower disk and platen"}
  proof: {label: "Bars removed", sub: "the disk turns but the platen is not pressed"}

