# No. 489 (Brown 1868): "Vertical bucket paddle-wheel. The buckets, a, a, are pivoted into the arms, b, b, at equal distances from the shaft. To the pivots are attached cranks, c, c, which are pivoted at their ends to the arms of a ring, d, which is fitted loosely to a stationary eccentric, e. The revolution of the arms and buckets with the shaft causes the ring, d, also to rotate upon the eccentric, and the action of this ring on the cranks keeps the buckets always upright, so that they enter the water and leave it edgewise without resistance or lift, and while in the water are in the most effective position for propulsion."
# Model (cm, gravity on, Brown's side view). Brown's 4 arms b on the shaft carry the buckets a on pins 9 cm out; each bucket
# (7 cm, upright, seen edge on) has a crank c (2.5 cm, pointing forward) whose end is pinned to an arm of the ring d,
# which turns loose on the stationary eccentric e, held by the vessel 2.5 cm ahead of the shaft. Shaft, pivot, crank end and
# eccentric make a parallelogram, so the ring turns with the arms and the cranks, and so the buckets, keep their direction (by the
# linkage alone: every piece is a body on its own pin, the four pins close the loops). The wheel is on a vessel (3 kg) free to move
# along the still water (a slide; its hull's drag a damping of 0.6 N s/m), and the engine turns the shaft in it at 24 rpm (the
# only input). The water is particles in the plane of the buckets (src/fluid/, about 0.5 cm apart): the buckets enter and leave
# it edgewise and push it back while they are in it; the water's push on them drives the vessel forward.
# Generator: opencode-runs/water/gen489.py.
number: 489
slug: vertical-bucket-paddle-wheel
name: Vertical bucket paddle-wheel
brown: "Vertical bucket paddle-wheel. The buckets, a, a, are pivoted into the arms, b, b, at equal distances from the shaft. To the pivots are attached cranks, c, c, which are pivoted at their ends to the arms of a ring, d, which is fitted loosely to a stationary eccentric, e. The revolution of the arms and buckets with the shaft causes the ring, d, also to rotate upon the eccentric, and the action of this ring on the cranks keeps the buckets always upright, so that they enter the water and leave it edgewise without resistance or lift, and while in the water are in the most effective position for propulsion."
units: cm
sim:
  timestep: 0.002
  integrator: implicitfast
  iterations: 50
  duration_s: 10
  floor: false
bodies:
  - id: vessel
    shape: part
    pos: [-60, 0, 16]
    mass: 3
    color: "#5b4a3a"
    pieces:
      - {kind: poly, points: [[-94, 5], [-40, 5], [-32, 19], [-97, 19]], y: [4.0, 14.0], collide: 0, color: "#5b4a3a"}   # the vessel's side (beyond the wheel)
      - {kind: poly, points: [[-97, 19], [-32, 19], [-32, 19.8], [-97, 19.8]], y: [3.6, 14.0], collide: 0, color: "#8a6a45"}   # its gunwale
      - {kind: poly, points: [[-73.5, 26.98], [-44, 26.98], [-44, 19.8], [-73.5, 19.8]], y: [3.2, 4.0], collide: 0, color: "#6d5a46"}   # the paddle-box's back
      - {kind: disc, center: [-60, 16], radius: 2.0, y: [3.0, 4.0], collide: 0, color: "#6f6a60"}   # the shaft's bearing in the vessel's side
      - {kind: disc, center: [-57.5, 16], radius: 3.6, y: [-2.3, -1.7], collide: 0, color: "#9a948a"}   # the stationary eccentric e (held by the vessel)
      - {kind: poly, points: [[-58.1, 16], [-56.9, 16], [-56.9, 19.4], [-58.1, 19.4]], y: [-2.3, -1.9], collide: 0, color: "#9a948a"}   # its stay to the vessel
  - id: wheel
    shape: part
    mount: vessel
    pos: [-60, 0, 16]
    density: 700
    color: "#a08a66"
    pieces:
      - {kind: disc, center: [-60, 16], radius: 1.3, y: [-3.4, 2.8], collide: 0, color: "#6f6a60"}   # the shaft
      - {kind: disc, center: [-60, 16], radius: 3.2, y: [-0.6, 0.2], collide: 0}   # the arms' boss
      - {kind: poly, points: [[-59.505, 15.505], [-53.1411, 21.869], [-54.131, 22.8589], [-60.495, 16.495]], y: [-0.6, 0.2], collide: 0}   # an arm b
      - {kind: disc, center: [-53.636, 22.364], radius: 0.9, y: [-0.6, 0.2], collide: 0}   # its boss at the bucket's pivot
      - {kind: poly, points: [[-59.505, 16.495], [-65.869, 22.8589], [-66.8589, 21.869], [-60.495, 15.505]], y: [-0.6, 0.2], collide: 0}
      - {kind: disc, center: [-66.364, 22.364], radius: 0.9, y: [-0.6, 0.2], collide: 0}
      - {kind: poly, points: [[-60.495, 16.495], [-66.8589, 10.131], [-65.869, 9.1411], [-59.505, 15.505]], y: [-0.6, 0.2], collide: 0}
      - {kind: disc, center: [-66.364, 9.636], radius: 0.9, y: [-0.6, 0.2], collide: 0}
      - {kind: poly, points: [[-60.495, 15.505], [-54.131, 9.1411], [-53.1411, 10.131], [-59.505, 16.495]], y: [-0.6, 0.2], collide: 0}
      - {kind: disc, center: [-53.636, 9.636], radius: 0.9, y: [-0.6, 0.2], collide: 0}
  - id: bk0
    shape: part
    mount: wheel
    pos: [-53.636, 0, 22.364]
    density: 700
    friction: 0.3
    color: "#8f7a58"
    pieces:
      - {kind: poly, points: [[-53.411, 18.864], [-53.411, 25.864], [-53.861, 25.864], [-53.861, 18.864]], y: [0.3, 2.5], collide: 2, color: "#8f7a58"}   # the bucket a (upright, seen edge on)
      - {kind: disc, center: [-53.636, 22.364], radius: 0.45, y: [-3.2, 2.5], collide: 0, color: "#6f6a60"}   # its pivot pin in the arm
      - {kind: poly, points: [[-53.636, 21.914], [-51.136, 21.914], [-51.136, 22.814], [-53.636, 22.814]], y: [-3.2, -2.5], collide: 0, color: "#7d766a"}   # the crank c
      - {kind: disc, center: [-53.636, 22.364], radius: 0.75, y: [-3.2, -2.5], collide: 0, color: "#7d766a"}
      - {kind: disc, center: [-51.136, 22.364], radius: 0.6, y: [-3.2, -2.5], collide: 0, color: "#7d766a"}
  - id: bk1
    shape: part
    mount: wheel
    pos: [-66.364, 0, 22.364]
    density: 700
    friction: 0.3
    color: "#8f7a58"
    pieces:
      - {kind: poly, points: [[-66.139, 18.864], [-66.139, 25.864], [-66.589, 25.864], [-66.589, 18.864]], y: [0.3, 2.5], collide: 2, color: "#8f7a58"}   # the bucket a (upright, seen edge on)
      - {kind: disc, center: [-66.364, 22.364], radius: 0.45, y: [-3.2, 2.5], collide: 0, color: "#6f6a60"}   # its pivot pin in the arm
      - {kind: poly, points: [[-66.364, 21.914], [-63.864, 21.914], [-63.864, 22.814], [-66.364, 22.814]], y: [-3.2, -2.5], collide: 0, color: "#7d766a"}   # the crank c
      - {kind: disc, center: [-66.364, 22.364], radius: 0.75, y: [-3.2, -2.5], collide: 0, color: "#7d766a"}
      - {kind: disc, center: [-63.864, 22.364], radius: 0.6, y: [-3.2, -2.5], collide: 0, color: "#7d766a"}
  - id: bk2
    shape: part
    mount: wheel
    pos: [-66.364, 0, 9.636]
    density: 700
    friction: 0.3
    color: "#8f7a58"
    pieces:
      - {kind: poly, points: [[-66.139, 6.136], [-66.139, 13.136], [-66.589, 13.136], [-66.589, 6.136]], y: [0.3, 2.5], collide: 2, color: "#8f7a58"}   # the bucket a (upright, seen edge on)
      - {kind: disc, center: [-66.364, 9.636], radius: 0.45, y: [-3.2, 2.5], collide: 0, color: "#6f6a60"}   # its pivot pin in the arm
      - {kind: poly, points: [[-66.364, 9.186], [-63.864, 9.186], [-63.864, 10.086], [-66.364, 10.086]], y: [-3.2, -2.5], collide: 0, color: "#7d766a"}   # the crank c
      - {kind: disc, center: [-66.364, 9.636], radius: 0.75, y: [-3.2, -2.5], collide: 0, color: "#7d766a"}
      - {kind: disc, center: [-63.864, 9.636], radius: 0.6, y: [-3.2, -2.5], collide: 0, color: "#7d766a"}
  - id: bk3
    shape: part
    mount: wheel
    pos: [-53.636, 0, 9.636]
    density: 700
    friction: 0.3
    color: "#8f7a58"
    pieces:
      - {kind: poly, points: [[-53.411, 6.136], [-53.411, 13.136], [-53.861, 13.136], [-53.861, 6.136]], y: [0.3, 2.5], collide: 2, color: "#8f7a58"}   # the bucket a (upright, seen edge on)
      - {kind: disc, center: [-53.636, 9.636], radius: 0.45, y: [-3.2, 2.5], collide: 0, color: "#6f6a60"}   # its pivot pin in the arm
      - {kind: poly, points: [[-53.636, 9.186], [-51.136, 9.186], [-51.136, 10.086], [-53.636, 10.086]], y: [-3.2, -2.5], collide: 0, color: "#7d766a"}   # the crank c
      - {kind: disc, center: [-53.636, 9.636], radius: 0.75, y: [-3.2, -2.5], collide: 0, color: "#7d766a"}
      - {kind: disc, center: [-51.136, 9.636], radius: 0.6, y: [-3.2, -2.5], collide: 0, color: "#7d766a"}
  - id: ring
    shape: part
    mount: vessel
    pos: [-57.5, 0, 16]
    density: 700
    color: "#8a8478"
    pieces:
      - {kind: poly, points: [[-53.8, 16], [-52.8, 16], [-52.8903, 16.9169], [-53.8711, 16.7218]], y: [-2.4, -1.6], collide: 0}   # the ring d (loose on the eccentric)
      - {kind: poly, points: [[-53.8711, 16.7218], [-52.8903, 16.9169], [-53.1578, 17.7986], [-54.0816, 17.4159]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-54.0816, 17.4159], [-53.1578, 17.7986], [-53.5921, 18.6112], [-54.4236, 18.0556]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-54.4236, 18.0556], [-53.5921, 18.6112], [-54.1766, 19.3234], [-54.8837, 18.6163]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-54.8837, 18.6163], [-54.1766, 19.3234], [-54.8888, 19.9079], [-55.4444, 19.0764]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-55.4444, 19.0764], [-54.8888, 19.9079], [-55.7014, 20.3422], [-56.0841, 19.4184]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-56.0841, 19.4184], [-55.7014, 20.3422], [-56.5831, 20.6097], [-56.7782, 19.6289]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-56.7782, 19.6289], [-56.5831, 20.6097], [-57.5, 20.7], [-57.5, 19.7]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-57.5, 19.7], [-57.5, 20.7], [-58.4169, 20.6097], [-58.2218, 19.6289]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-58.2218, 19.6289], [-58.4169, 20.6097], [-59.2986, 20.3422], [-58.9159, 19.4184]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-58.9159, 19.4184], [-59.2986, 20.3422], [-60.1112, 19.9079], [-59.5556, 19.0764]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-59.5556, 19.0764], [-60.1112, 19.9079], [-60.8234, 19.3234], [-60.1163, 18.6163]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-60.1163, 18.6163], [-60.8234, 19.3234], [-61.4079, 18.6112], [-60.5764, 18.0556]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-60.5764, 18.0556], [-61.4079, 18.6112], [-61.8422, 17.7986], [-60.9184, 17.4159]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-60.9184, 17.4159], [-61.8422, 17.7986], [-62.1097, 16.9169], [-61.1289, 16.7218]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-61.1289, 16.7218], [-62.1097, 16.9169], [-62.2, 16], [-61.2, 16]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-61.2, 16], [-62.2, 16], [-62.1097, 15.0831], [-61.1289, 15.2782]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-61.1289, 15.2782], [-62.1097, 15.0831], [-61.8422, 14.2014], [-60.9184, 14.5841]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-60.9184, 14.5841], [-61.8422, 14.2014], [-61.4079, 13.3888], [-60.5764, 13.9444]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-60.5764, 13.9444], [-61.4079, 13.3888], [-60.8234, 12.6766], [-60.1163, 13.3837]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-60.1163, 13.3837], [-60.8234, 12.6766], [-60.1112, 12.0921], [-59.5556, 12.9236]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-59.5556, 12.9236], [-60.1112, 12.0921], [-59.2986, 11.6578], [-58.9159, 12.5816]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-58.9159, 12.5816], [-59.2986, 11.6578], [-58.4169, 11.3903], [-58.2218, 12.3711]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-58.2218, 12.3711], [-58.4169, 11.3903], [-57.5, 11.3], [-57.5, 12.3]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-57.5, 12.3], [-57.5, 11.3], [-56.5831, 11.3903], [-56.7782, 12.3711]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-56.7782, 12.3711], [-56.5831, 11.3903], [-55.7014, 11.6578], [-56.0841, 12.5816]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-56.0841, 12.5816], [-55.7014, 11.6578], [-54.8888, 12.0921], [-55.4444, 12.9236]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-55.4444, 12.9236], [-54.8888, 12.0921], [-54.1766, 12.6766], [-54.8837, 13.3837]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-54.8837, 13.3837], [-54.1766, 12.6766], [-53.5921, 13.3888], [-54.4236, 13.9444]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-54.4236, 13.9444], [-53.5921, 13.3888], [-53.1578, 14.2014], [-54.0816, 14.5841]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-54.0816, 14.5841], [-53.1578, 14.2014], [-52.8903, 15.0831], [-53.8711, 15.2782]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-53.8711, 15.2782], [-52.8903, 15.0831], [-52.8, 16], [-53.8, 16]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-57.1464, 15.6464], [-50.7825, 22.0104], [-51.4896, 22.7175], [-57.8536, 16.3536]], y: [-2.4, -1.6], collide: 0}   # its arm, to a crank's end
      - {kind: poly, points: [[-57.1464, 16.3536], [-63.5104, 22.7175], [-64.2175, 22.0104], [-57.8536, 15.6464]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-57.8536, 16.3536], [-64.2175, 9.9896], [-63.5104, 9.2825], [-57.1464, 15.6464]], y: [-2.4, -1.6], collide: 0}
      - {kind: poly, points: [[-57.8536, 15.6464], [-51.4896, 9.2825], [-50.7825, 9.9896], [-57.1464, 16.3536]], y: [-2.4, -1.6], collide: 0}
  - id: basin
    shape: part
    pos: [0, 0, 0]
    fixed: true
    friction: 0
    color: "#c8b98f"
    pieces:
      - {kind: poly, points: [[-101, -1.5], [96, -1.5], [96, 0], [-101, 0]], y: [-0.5, 3.0], collide: 2, color: "#bfae86"}   # the water's bed
      - {kind: poly, points: [[-101, 0], [-100, 0], [-100, 12], [-101, 12]], y: [-0.5, 3.0], collide: 2, color: "#a89878"}
      - {kind: poly, points: [[95, 0], [96, 0], [96, 12], [95, 12]], y: [-0.5, 3.0], collide: 2, color: "#a89878"}
pins:
  - {id: p_c0, a: bk0, b: ring, at: [-51.136, -2.0, 22.364]}   # a crank c's end on an arm of the ring d
  - {id: p_c1, a: bk1, b: ring, at: [-63.864, -2.0, 22.364]}
  - {id: p_c2, a: bk2, b: ring, at: [-63.864, -2.0, 9.636]}
  - {id: p_c3, a: bk3, b: ring, at: [-51.136, -2.0, 9.636]}
joints:
  - {id: j_v, type: slide, body: vessel, axis: [1, 0, 0], damping: 0.6}   # + : forward (to the right)
  - {id: j_w, type: hinge, body: wheel, axis: [0, 1, 0], damping: 0.0001}   # + : the top going forward (clockwise as seen)
  - {id: j_d, type: hinge, body: ring, axis: [0, 1, 0], damping: 0.0001}   # the ring d on the eccentric e
  - {id: j_b0, type: hinge, body: bk0, axis: [0, 1, 0], damping: 0.0002}   # a bucket a on its arm's pin
  - {id: j_b1, type: hinge, body: bk1, axis: [0, 1, 0], damping: 0.0002}
  - {id: j_b2, type: hinge, body: bk2, axis: [0, 1, 0], damping: 0.0002}
  - {id: j_b3, type: hinge, body: bk3, axis: [0, 1, 0], damping: 0.0002}
contact: {solref: [0.004, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_w, kind: velocity, rpm: 24, max_torque: 5}   # the engine turns the shaft in the vessel: the only input
checks:
  - {type: monotonic, joint: j_v, direction: 1, max_back: 0.3, settle_s: 2.0, window_s: 7}
  - {type: penetration, max: 0.003}
camera: {target: [-12, 0, 11], position: [-12, -150, 15], fov: 36}
fluid:
  plane: xz
  slab: [0.3, 2.5]
  spacing: 0.5
  dt: 0.002
  domain: [-101, -1.5, 96, 34.5]
  fill: [[-100, 0, 95, 8]]
  tiers: [{id: light, label: "Lighter water (fewer particles)", spacing: 0.7}]
display:
  output: j_v
  labels: {j_v: "Vessel (forward)", j_w: "Paddle-wheel (engine)", j_b0: "A bucket on its pin"}
