# No. 308 (Brown 1868): "A detached pendulum escapement, leaving the pendulum, P, free or detached from the escape-wheel, except at the time of receiving the impulse and unlocking the wheel. There is but one pallet, I, which receives impulse only during the vibrations of the pendulum to the left. The lever, Q, locks the escape-wheel until just before the time for giving the impulse, when it is unlocked by the click, C, attached to the pendulum. As the pendulum returns to the right, the click, which oscillates on a pivot, will be pushed aside by the lever."
#
# Model (cm, gravity on). The escape-wheel has six pins at r 2 on its front face, turned clockwise by a constant torque (the weight). The pendulum P hangs from a
# pivot 14 above the wheel's axis. The lever Q, pivoted below and to the right of the wheel, holds a pin on the stone at its upper end (the pin rests on the stone's
# top, its load passing nearly through Q's pivot); a spring holds Q against its banking. Q's tail reaches down and to the left, ending in a short upright bar. The click
# C is pivoted on an arm of the pendulum, its tip standing up just right of the bar; a spring holds it upright against a stop. As the pendulum swings to the left,
# C (held by its stop) pushes the bar to the left: Q turns, its stone moves out from under the pin, and the wheel is free. As Q turns the bar also rises, and C's
# tip passes under it; Q's spring brings it back to lock the next pin. Meanwhile a pin at the bottom of the wheel overtakes the pallet I, on the pendulum, and drives
# it to the left (the impulse), and rises clear of it before the wheel locks a sixth of a turn on. On the return to the right C meets the bar's other side; Q is on
# its banking and cannot give, so C turns down on its pivot and passes under, and its spring sets it up again. The pendulum is drawn 6 degrees
# aside to the right at the start. The only input is the torque on the wheel. Generator: opencode-runs/batch12/gen308.py.
number: 308
slug: detached-pendulum-escapement
name: Detached pendulum escapement
brown: "A detached pendulum escapement, leaving the pendulum, P, free or detached from the escape-wheel, except at the time of receiving the impulse and unlocking the wheel. There is but one pallet, I, which receives impulse only during the vibrations of the pendulum to the left. The lever, Q, locks the escape-wheel until just before the time for giving the impulse, when it is unlocked by the click, C, attached to the pendulum. As the pendulum returns to the right, the click, which oscillates on a pivot, will be pushed aside by the lever."
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 50, duration_s: 11, floor: false}
bodies:
  - id: wheel
    shape: part
    pos: [0, 0, 0]
    mass: 0.01
    friction: 0.1
    color: "#e6d7b0"
    pieces:
      - {kind: disc, center: [0, 0], radius: 1.75, y: [-0.1, 0.05]}   # the wheel
      - {kind: disc, center: [0, 0], radius: 0.2, y: [-0.15, 0.6], color: "#8f8a80"}   # its arbor
      - {kind: disc, center: [1.0, -1.73205], radius: 0.15, y: [-0.6, -0.1], collide: 2, color: "#5c5348"}   # a pin
      - {kind: disc, center: [2.0, -0.0], radius: 0.15, y: [-0.6, -0.1], collide: 2, color: "#5c5348"}
      - {kind: disc, center: [1.0, 1.73205], radius: 0.15, y: [-0.6, -0.1], collide: 2, color: "#5c5348"}
      - {kind: disc, center: [-1.0, 1.73205], radius: 0.15, y: [-0.6, -0.1], collide: 2, color: "#5c5348"}
      - {kind: disc, center: [-2.0, 0.0], radius: 0.15, y: [-0.6, -0.1], collide: 2, color: "#5c5348"}
      - {kind: disc, center: [-1.0, -1.73205], radius: 0.15, y: [-0.6, -0.1], collide: 2, color: "#5c5348"}
  - id: pendulum
    shape: part
    pos: [0, 0, 14.0]
    friction: 0.1
    color: "#9aa3ad"
    pieces:
      - {kind: poly, points: [[1.47669, -1.96309], [2.0734, -1.90037], [2.11521, -2.29818], [1.5185, -2.3609]], y: [-0.6, -0.15], collide: 1, color: "#b85c38"}   # the pallet I: its right face takes the impulse
      - {kind: poly, points: [[1.47669, -1.96309], [1.97395, -1.91083], [2.01576, -2.30864], [1.5185, -2.3609]], y: [-0.15, 0.9]}   # its stalk to the rod
      - {kind: disc, center: [0, 14.0], radius: 0.7, y: [-0.7, 1.2]}   # the pendulum's boss
      - {kind: rod, from: [0, 1.0, 14.0], to: [2.34144, 1.0, -8.27729], radius: 0.2, color: "#8f8a80"}   # the pendulum rod, behind the wheel
      - {kind: rod, from: [2.08534, 1.0, -5.84071], to: [2.68206, -1.0, -5.77799], radius: 0.07}   # the arm carrying the click
      - {kind: disc, center: [2.50868, -9.86853], radius: 2.2, y: [0.7, 1.3], density: 60000.0, color: "#e6d7b0"}   # the bob P
  - id: click
    shape: part
    pos: [2.68206, 0, -5.77799]
    mount: pendulum
    mass: 0.0005
    color: "#6b5a44"
    pieces:
      - {kind: disc, center: [2.68206, -5.77799], radius: 0.09, y: [-1.2, -0.8]}   # its pivot
      - {kind: rod, from: [2.68206, -1.0, -5.77799], to: [2.62979, -1.0, -5.28073], radius: 0.05}   # the click C
      - {kind: disc, center: [2.62979, -5.28073], radius: 0.1, y: [-1.2, -0.8], collide: 2}   # its tip
  - id: lever
    shape: part
    pos: [2.1, 0, -3.2]
    mass: 0.001
    friction: 0.1
    color: "#9aa3ad"
    pieces:
      - {kind: disc, center: [2.1, -3.2], radius: 0.15, y: [-1.2, -0.6]}   # Q's boss
      - {kind: rod, from: [2.1, -0.7, -3.2], to: [2.1, -0.7, -0.25], radius: 0.06}   # Q's upright arm
      - {kind: poly, points: [[1.88, -0.154], [2.25, -0.154], [2.25, -0.28], [1.88, -0.28]], y: [-0.75, -0.1], collide: 1, color: "#b85c38"}   # the stone: a pin rests on its top
      - {kind: rod, from: [2.1, -1.0, -3.2], to: [0.4, -1.0, -5.0], radius: 0.06}   # Q's tail
      - {kind: poly, points: [[0.35, -5.0], [0.45, -5.0], [0.45, -5.6], [0.35, -5.6]], y: [-1.2, -0.8], collide: 1}   # the bar at its end, which the click meets
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: disc, center: [0, 14.0], radius: 0.3, y: [-0.9, 1.4], color: "#5c5348"}   # the pendulum's pin
      - {kind: disc, center: [2.1, -3.2], radius: 0.07, y: [-1.3, -0.5], color: "#5c5348"}   # Q's pin
      - {kind: poly, points: [[-0.6, -0.6], [0.6, -0.6], [0.6, 0.6], [-0.6, 0.6]], y: [0.6, 0.8]}   # the cock behind the wheel
joints:
  - {id: j_wheel, type: hinge, body: wheel, axis: [0, 1, 0], damping: 0.0001}   # the escape-wheel; + : clockwise (its way)
  - {id: j_pend, type: hinge, body: pendulum, axis: [0, 1, 0], damping: 0.002}   # the pendulum; + : clockwise (the bob to the left)
  - {id: j_q, type: hinge, body: lever, axis: [0, 1, 0], damping: 5e-05, range: [0, 0.5], stiffness: 0.002, springref: -0.1}   # Q; + : unlocking
  - {id: j_c, type: hinge, body: click, axis: [0, 1, 0], damping: 1e-05, range: [-1.0, 0], stiffness: 0.0005, springref: 0.1}   # C; held upright on its stop at 0, gives only to the - side
contact: {solref: [0.002, 1], solimp: [0.95, 0.99, 0.0005], margin: 0}
# The weight: a constant torque on the wheel, clockwise. Nothing else is driven.
driver: {joint: j_wheel, kind: torque, torque: 0.005, max_torque: 1}
checks:
  - {type: period, joint: j_pend, tol: 0.04, settle_s: 3, window_s: 6}
  # a sixth of a turn for each swing to the left: a twelfth a beat
  - {type: advance, joint: j_wheel, beat: j_pend, expect: 0.5236, tol: 0.03, settle_s: 3, window_s: 7.3}
  - {type: monotonic, joint: j_wheel, direction: 1, max_back: 0.04, settle_s: 2, window_s: 7}
  - {type: amplitude, joint: j_pend, min: 0.05, max: 0.2, sustain: 0.9, settle_s: 3, window_s: 6}
  - {type: penetration, max: 0.0005, settle_s: 1}
camera: {target: [0, 0, -2.9], position: [0, -31.5, -2.9], fov: 30}
display:
  output: j_pend
  swing: j_pend
  labels: {j_wheel: "Escape-wheel (weight)", j_pend: "Pendulum P and pallet I", j_q: "Locking lever Q", j_c: "Click C"}
  proof: {label: "Pallet, lever and click out of contact", sub: "nothing makes good the pendulum's losses, and the weight spins the wheel freely"}

