# No. 493 (Brown 1868): "Lewis, for lifting stone in building."
#
# Model (cm, joint checks in metres, gravity on, seen from in front with the stone cut through the hole, as Brown's section). A
# 6 cm hole is cut 8 cm into a block of stone that rests on the ground. In it stand a central taper pin, thicker at the
# foot (3.2 cm) than at the mouth, and two packing pieces, one each side, whose inner faces fit the taper and whose outer faces lie
# against the hole's walls. Each packing piece is free to move up and down and out and in. The crane hoists the central pin (the only
# input: it is drawn up at 3 cm/s); its taper wedges the packing pieces out against the walls, and their grip by friction
# lifts the stone. Generator: opencode-runs/batch14/gen493.py.
number: 493
slug: lewis
name: "\u201cLewis,\u201d for lifting stone in building"
brown: "\u201cLewis,\u201d for lifting stone in building. It is composed of a central taper pin or wedge, with two wedge-like packing-pieces arranged one on each side of it. The three pieces are inserted together in a hole drilled into the stone, and when the central wedge is hoisted upon it wedges the packing-pieces out so tightly against the sides of the hole as to enable the stone to be lifted."
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 50, duration_s: 6, floor: false}
bodies:
  - id: ground
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#b9ad94"
    pieces:
      - {kind: poly, points: [[-30, -3], [30, -3], [30, 0], [-30, 0]], y: [-14, 14], collide: 1}
  - id: stone
    shape: part
    pos: [0, 0, 0]
    density: 2400
    friction: 0.8
    color: "#cfc6b4"
    pieces:
      - {kind: poly, points: [[-16, 0], [-3, 0], [-3, 16], [-16, 16]], y: [-2.2, 10], collide: 2}
      - {kind: poly, points: [[3, 0], [16, 0], [16, 16], [3, 16]], y: [-2.2, 10], collide: 2}
      - {kind: poly, points: [[-3, 0], [3, 0], [3, 8], [-3, 8]], y: [-2.2, 10], collide: 2}
      - {kind: poly, points: [[-3, 8], [3, 8], [3, 16], [-3, 16]], y: [2.2, 10], collide: 0}   # behind the hole
  - id: wedge
    shape: part
    pos: [0, 0, 8.6]
    density: 7800
    friction: 0.15
    color: "#7c776d"
    pieces:
      - {kind: loft, a: [[-1.600, -1.8, 8.600], [1.600, -1.8, 8.600], [1.600, 1.8, 8.600], [-1.600, 1.8, 8.600]], b: [[-0.660, -1.8, 22.000], [0.660, -1.8, 22.000], [0.660, 1.8, 22.000], [-0.660, 1.8, 22.000]], collide: 2}   # the taper pin
      - {kind: rod, from: [0, -2.6, 23.2], to: [0, 2.6, 23.2], radius: 0.45, collide: 0}   # the shackle's bolt
      - {kind: rod, from: [0, -2.9, 23.2], to: [0, -2.3, 23.2], radius: 0.8, collide: 0}
      - {kind: disc, center: [0, 26.4], radius: 3.0, inner: 2.0, y: [-0.6, 0.6], collide: 0}   # the shackle's bow
      - {kind: rod, from: [-2.6, 0, 23.2], to: [-2.6, 0, 26.2], radius: 0.5, collide: 0}
      - {kind: rod, from: [2.6, 0, 23.2], to: [2.6, 0, 26.2], radius: 0.5, collide: 0}
      - {kind: rod, from: [0, 0, 29.2], to: [0, 0, 62], radius: 0.6, collide: 0, color: "#c9b48a"}   # the crane's rope
  - {id: cl, shape: assembly, pos: [-2.2, 0, 8.02]}
  - {id: cr, shape: assembly, pos: [2.2, 0, 8.02]}
  - id: pl
    shape: part
    pos: [-2.2, 0, 8.02]
    mount: cl
    density: 7800
    friction: 0.15
    color: "#8f897e"
    pieces:
      - {kind: loft, a: [[-2.970, -1.8, 8.020], [-1.671, -1.8, 8.020], [-1.671, 1.8, 8.020], [-2.970, 1.8, 8.020]], b: [[-2.970, -1.8, 18.500], [-0.935, -1.8, 18.500], [-0.935, 1.8, 18.500], [-2.970, 1.8, 18.500]], collide: 1}
  - id: pr
    shape: part
    pos: [2.2, 0, 8.02]
    mount: cr
    density: 7800
    friction: 0.15
    color: "#8f897e"
    pieces:
      - {kind: loft, a: [[1.671, -1.8, 8.020], [2.970, -1.8, 8.020], [2.970, 1.8, 8.020], [1.671, 1.8, 8.020]], b: [[0.935, -1.8, 18.500], [2.970, -1.8, 18.500], [2.970, 1.8, 18.500], [0.935, 1.8, 18.500]], collide: 1}
shafts:   # hidden inside the packing pieces: the carriers' own mass
  - {id: sl, body: cl, from: [0, -0.5, 1], to: [0, 0.5, 1], radius: 0.2}
  - {id: sr, body: cr, from: [0, -0.5, 1], to: [0, 0.5, 1], radius: 0.2}
joints:
  - {id: j_w, type: slide, body: wedge, axis: [0, 0, 1], damping: 1, range: [-0.6, 40]}   # + : hoisted
  - {id: j_s, type: slide, body: stone, axis: [0, 0, 1], damping: 1, range: [-1, 40]}
  - {id: j_lz, type: slide, body: cl, axis: [0, 0, 1], damping: 0.5, range: [-1, 40]}
  - {id: j_rz, type: slide, body: cr, axis: [0, 0, 1], damping: 0.5, range: [-1, 40]}
  - {id: j_lx, type: slide, body: pl, axis: [1, 0, 0], damping: 0.5, range: [-0.5, 0.5]}
  - {id: j_rx, type: slide, body: pr, axis: [1, 0, 0], damping: 0.5, range: [-0.5, 0.5]}
driver: {joint: j_w, kind: velocity, speed: 3, kv: 100000, max_torque: 3000}
contact: {solref: [0.002, 1], solimp: [0.95, 0.99, 0.001], margin: 0}
checks:
  - {type: follow, out: j_s, in: j_w, expect: 1, tol: 0.05, min_r2: 0.99, settle_s: 1, window_s: 4.5}
  - {type: penetration, max: 0.003, settle_s: 0.2}
camera: {target: [0, 0, 8], position: [0, -230, 16], fov: 17}
display:
  output: j_s
  labels: {j_w: "Central pin (hoisted)", j_s: Stone, j_lx: "Packing piece (left)", j_rx: "Packing piece (right)"}
