# No. 161 (Brown 1868): "Centrifugal governor for steam engines. The central spindle and attached arms and balls are driven from the engine by the bevel-gears at the top, and the balls fly out from the center by centrifugal force. If the speed of the engine increases, the balls fly out further from the center, and so raise the slide at the bottom and thereby reduce the opening of the regulating-valve which is connected with said slide."
#
# Model (cm, gravity on): the spindle is the one driven joint (100 turns a minute; the engine and its bevel-gears at the top are not drawn: the spindle is what they turn). Two arms (14 cm, a 2.0 cm ball on each) hang from pivots at its top; a link (9 cm, pinned at each end) from each arm
# to a sleeve on the spindle lifts the sleeve as the balls fly out. The balls (0.4 kg each) are carried round by the spindle and fly out until the sleeve's weight and the arms' balance the pull of the spin. Generator: opencode-runs/batch11/gen161.py.
number: 161
slug: centrifugal-governor-steam-engine
name: Centrifugal governor for steam engines
brown: "Centrifugal governor for steam engines. The central spindle and attached arms and balls are driven from the engine by the bevel-gears at the top, and the balls fly out from the center by centrifugal force. If the speed of the engine increases, the balls fly out further from the center, and so raise the slide at the bottom and thereby reduce the opening of the regulating-valve which is connected with said slide. A diminution of speed produces an opposite effect."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 100
  solver: PGS
  multiccd: true
  duration_s: 9.0
  floor: false
bodies:
  - id: shaft
    shape: part
    pos: [0, 0, 0]
    mass: 0.4
    color: "#e4d9bf"
    pieces:
      - {kind: rod, from: [0, 0, 0], to: [0, 0, 38.0], radius: 0.8, collide: 0}
      - {kind: rod, from: [0, 0, 33.0], to: [0, 0, 35.4], radius: 1.6, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [-1.5, 0, 34.0], to: [1.5, 0, 34.0], radius: 0.5, collide: 0, color: "#8f8a80"}
  - id: sleeve
    shape: part
    pos: [0, 0, 18.4926]
    mount: shaft
    mass: 0.15
    color: "#b8ad97"
    pieces:
      - {kind: rod, from: [0, 0, 17.2926], to: [0, 0, 19.6926], radius: 1.4, collide: 0}
      - {kind: rod, from: [-1.0, 0, 18.4926], to: [1.0, 0, 18.4926], radius: 0.5, collide: 0, color: "#8f8a80"}
  - id: arm_r
    shape: part
    pos: [1.2, 0, 34.0]
    mount: shaft
    mass: 0.4
    color: "#a89a7e"
    pieces:
      - {kind: rod, from: [1.2, 0.0, 34.0], to: [7.1167, 0.0, 21.3117], radius: 0.35, collide: 0, color: "#a89a7e"}
      - {kind: rod, from: [7.1167, -1.3, 21.3117], to: [7.1167, 1.3, 21.3117], radius: 2.0, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [1.2, -1.0, 34.0], to: [1.2, 1.0, 34.0], radius: 0.7, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [4.5809, -0.9, 26.7495], to: [4.5809, -0.5, 26.7495], radius: 0.5, collide: 0, color: "#8f8a80"}
  - id: arm_l
    shape: part
    pos: [-1.2, 0, 34.0]
    mount: shaft
    mass: 0.4
    color: "#a89a7e"
    pieces:
      - {kind: rod, from: [-1.2, 0.0, 34.0], to: [-7.1167, 0.0, 21.3117], radius: 0.35, collide: 0, color: "#a89a7e"}
      - {kind: rod, from: [-7.1167, -1.3, 21.3117], to: [-7.1167, 1.3, 21.3117], radius: 2.0, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [-1.2, -1.0, 34.0], to: [-1.2, 1.0, 34.0], radius: 0.7, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [-4.5809, -0.9, 26.7495], to: [-4.5809, -0.5, 26.7495], radius: 0.5, collide: 0, color: "#8f8a80"}
  - id: link_r
    shape: part
    pos: [1.0, 0, 18.4926]
    mount: sleeve
    mass: 0.03
    color: "#b8ad97"
    pieces:
      - {kind: rod, from: [1.0, -0.9, 18.4926], to: [4.5809, -0.9, 26.7495], radius: 0.3, collide: 0, color: "#b8ad97"}
      - {kind: rod, from: [1.0, -1.2, 18.4926], to: [1.0, -0.6, 18.4926], radius: 0.5, collide: 0, color: "#8f8a80"}
  - id: link_l
    shape: part
    pos: [-1.0, 0, 18.4926]
    mount: sleeve
    mass: 0.03
    color: "#b8ad97"
    pieces:
      - {kind: rod, from: [-1.0, -0.9, 18.4926], to: [-4.5809, -0.9, 26.7495], radius: 0.3, collide: 0, color: "#b8ad97"}
      - {kind: rod, from: [-1.0, -1.2, 18.4926], to: [-1.0, -0.6, 18.4926], radius: 0.5, collide: 0, color: "#8f8a80"}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: poly, points: [[-9.0, -4.6], [9.0, -4.6], [9.0, -3.2], [-9.0, -3.2]], y: [-4, 4], collide: 0, color: "#b9b09c"}
      - {kind: rod, from: [0, 0, -3.2], to: [0, 0, 2.0], radius: 1.6, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [0, 2.4, -3.2], to: [0, 2.4, 40.0], radius: 0.7, collide: 0}
joints:
  - {id: j_s, type: hinge, body: shaft, axis: [0, 0, 1], damping: 0.002}   # the one driven joint: the spindle
  - {id: j_r, type: hinge, body: arm_r, axis: [0, -1, 0], damping: 0.004}   # the right arm; + : outward (the ball flies out)
  - {id: j_l, type: hinge, body: arm_l, axis: [0, 1, 0], damping: 0.004}   # the left arm; + : outward
  - {id: j_z, type: slide, body: sleeve, axis: [0, 0, 1], range: [-6, 14], stiffness: 0.0, springref: 0, damping: 0.05}   # the sleeve (the slide): + up
  - {id: j_lr, type: hinge, body: link_r, axis: [0, 1, 0], damping: 0.0005}
  - {id: j_ll, type: hinge, body: link_l, axis: [0, 1, 0], damping: 0.0005}
pins:
  - {"id": "pin_r", "a": "link_r", "b": "arm_r", "at": [4.5809, 0, 26.7495]}
  - {"id": "pin_l", "a": "link_l", "b": "arm_l", "at": [-4.5809, 0, 26.7495]}
contact: {solref: [0.002, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_s, kind: velocity, rpm: 100.0, kv: 1.0, max_torque: 5}
checks:
  - {type: follow, out: j_z, in: j_r, expect: 0.1001, tol: 0.006, min_r2: 0.998, settle_s: 0.4, window_s: 0.8}   # the sleeve rises as the links' geometry says (m of rise per radian of arm), as the balls fly out
  - {type: position, joint: j_r, min: 0.25, max: 0.34, settle_s: 4.0, window_s: 5.0}   # the balls stand out about 40 degrees from the spindle (the energy balance of balls, sleeve and spin gives 43: the arms' own mass is not at the ball)
  - {type: ratio, out: j_l, in: j_r, expect: 1.0, tol: 0.02, settle_s: 3.0, window_s: 5.0}   # both arms alike
  - {type: position, joint: j_z, min: 1.9, max: 2.8, settle_s: 4.0, window_s: 5.0}   # and the sleeve stands up about 2.3 cm
  - {type: penetration, max: 0.0015, settle_s: 0.5}
camera: {target: [0.0, 0, 15.8], position: [0.0, -114.0, 15.8], fov: 34}
display:
  output: j_z
  labels: {j_s: "Spindle (driver)", j_r: "Right ball arm", j_l: "Left ball arm", j_z: "Sleeve (slide)"}
  proof: {label: "Links unpinned", sub: "the balls fly out but the sleeve does not rise"}

