number: 332
slug: side-lever-marine-engine-parallel-motion
name: A side-lever marine engine's parallel motion
brown: "A parallel motion used for the piston-rod of side lever marine engines. F, C, is the radius bar, and E the cross-head to which the parallel bar, E, D, is attached."
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 100, solver: CG, multiccd: true, duration_s: 8, floor: false}
bodies:
  # the framing: the side lever's centre A, the radius bar's centre F, and the cylinder
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    density: 7800
    color: "#9a9284"
    pieces:
      - {kind: poly, points: [[-18.0000, -10.0000], [50.0000, -10.0000], [50.0000, -9.0000], [-18.0000, -9.0000]], y: [-2.6, 5.4], collide: 0}
      - {kind: poly, points: [[-1.2000, -9.0000], [1.2000, -9.0000], [1.2000, 0.0000], [-1.2000, 0.0000]], y: [3.6, 4.2], collide: 0}
      - {kind: disc, center: [0, 0], radius: 1.4, y: [3.6, 4.2], collide: 0}
      - {kind: poly, points: [[44.2000, -9.0000], [45.8000, -9.0000], [45.8000, 22.0000], [44.2000, 22.0000]], y: [-2.6, -2.0], collide: 0}
      - {kind: disc, center: [45.0000, 22.0000], radius: 1.0, y: [-2.6, -2.0], collide: 0}
      - {kind: poly, points: [[21.0000, 6.0000], [37.0000, 6.0000], [37.0000, 19.0000], [21.0000, 19.0000]], y: [-1.5, 1.5], collide: 0, color: "#8a8274"}
      - {kind: poly, points: [[19.0000, 19.0000], [39.0000, 19.0000], [39.0000, 20.0000], [19.0000, 20.0000]], y: [-1.8, 1.8], collide: 0, color: "#7d776c"}
      - {kind: poly, points: [[21.5000, -9.0000], [23.0000, -9.0000], [23.0000, 6.0000], [21.5000, 6.0000]], y: [-1.2, 1.2], collide: 0}
      - {kind: poly, points: [[35.0000, -9.0000], [36.5000, -9.0000], [36.5000, 6.0000], [35.0000, 6.0000]], y: [-1.2, 1.2], collide: 0}
  # the side lever, rocked on A by the engine (the driven joint)
  - id: L
    shape: part
    pos: [0, 0, 0]
    density: 7800
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[-3.0000, -1.1000], [30.0000, -1.1000], [30.0000, 1.1000], [-3.0000, 1.1000]], y: [2.8, 3.5], collide: 0}
      - {kind: disc, center: [0, 0], radius: 2.6, y: [2.8, 3.5], collide: 0}
      - {kind: poly, points: [[-12.0000, -1.1000], [-3.0000, -1.1000], [-3.0000, 1.1000], [-12.0000, 1.1000]], y: [2.8, 3.5], collide: 0}
      - {kind: disc, center: [-12, 0], radius: 4.5, y: [2.6, 5.2], collide: 0, color: "#7d776c"}   # the lever's other arm, a weight in place of the engine's crank side
      - {kind: rod, from: [0, 2.4, 0], to: [0, 4.0, 0], radius: 0.6, collide: 0, color: "#6f6a60"}
      - {kind: rod, from: [13.0, 1.6, 0], to: [13.0, 3.0, 0], radius: 0.35, collide: 0, color: "#6f6a60"}
      - {kind: rod, from: [29.0, 1.6, 0], to: [29.0, 3.0, 0], radius: 0.35, collide: 0, color: "#6f6a60"}
  # the side rod, from the lever's end B up to the cross-head E: its upper eye a bearing on E's pin
  - id: S
    shape: part
    pos: [29.0, 0, 0]
    mount: L
    density: 2650
    color: "#b0a690"
    pieces:
      - {kind: rod, from: [29.0000, 2.3, 0.0000], to: [29.0000, 2.3, 35.0000], radius: 0.6, collide: 0}
      - {kind: disc, center: [29.0000, 0.0000], radius: 0.75, y: [2.0, 2.6], collide: 0}
      - {kind: band, center: [29.0000, 35.0000], r: [0.42, 0.95], a: [0, 6.2832], y: [2.0, 2.6], slices: 36, collide: 1}
  # the rod from the lever's middle M up to D, carrying the pin C for the radius bar
  - id: R
    shape: part
    pos: [13.0, 0, 0]
    mount: L
    density: 2650
    color: "#b0a690"
    pieces:
      - {kind: rod, from: [13.0000, 2.3, 0.0000], to: [13.0000, 2.3, 35.0000], radius: 0.6, collide: 0}
      - {kind: disc, center: [13.0000, 0.0000], radius: 0.75, y: [2.0, 2.6], collide: 0}
      - {kind: disc, center: [13.0000, 35.0000], radius: 0.75, y: [2.0, 2.6], collide: 0}
      - {kind: rod, from: [13.0, -0.6, 35.0000], to: [13.0, 2.0, 35.0000], radius: 0.3, collide: 0, color: "#6f6a60"}
      - {kind: disc, center: [13.0, 22.0000], radius: 0.4, y: [-2.0, 2.0], collide: 2, color: "#6f6a60"}
  # the parallel bar D-E, on D; its other eye a bearing on E's pin
  - id: Pb
    shape: part
    pos: [13.0, 0, 35.0000]
    mount: R
    density: 2650
    color: "#a39a88"
    pieces:
      - {kind: rod, from: [13.0000, -0.9, 35.0000], to: [29.0000, -0.9, 35.0000], radius: 0.6, collide: 0}
      - {kind: disc, center: [13.0000, 35.0000], radius: 0.75, y: [-1.2, -0.6], collide: 0}
      - {kind: band, center: [29.0000, 35.0000], r: [0.42, 0.95], a: [0, 6.2832], y: [-1.2, -0.6], slices: 36, collide: 1}
  # the radius bar F-C, on its centre F; its eye a bearing on C's pin
  - id: Fb
    shape: part
    pos: [45.0000, 0, 22.0000]
    mount: frame
    density: 2650
    color: "#a39a88"
    pieces:
      - {kind: rod, from: [45.0000, -1.7, 22.0000], to: [13.0000, -1.7, 22.0000], radius: 0.6, collide: 0}
      - {kind: disc, center: [45.0000, 22.0000], radius: 0.75, y: [-2.0, -1.4], collide: 0}
      - {kind: band, center: [13.0000, 22.0000], r: [0.42, 0.95], a: [0, 6.2832], y: [-2.0, -1.4], slices: 36, collide: 1}
  # the cross-head E on the piston-rod. The piston in its cylinder keeps the rod upright; it is free to move
  # across and up and down, and only the side rod and the parallel bar, through E's pin, place it
  - {id: Px, shape: part, pos: [29.0, 0, 35.0000], mount: frame, mass: 0.01, color: "#8f8a80", pieces: [{kind: disc, center: [29.0, 12], radius: 0.1, y: [0.0, 0.05], collide: 0}]}
  - id: P
    shape: part
    pos: [29.0, 0, 35.0000]
    mount: Px
    density: 7800
    color: "#b8ad96"
    pieces:
      - {kind: disc, center: [29.0, 35.0000], radius: 0.4, y: [-1.2, 2.6], collide: 2, color: "#6f6a60"}
      - {kind: poly, points: [[28.0000, 34.0000], [30.0000, 34.0000], [30.0000, 36.2000], [28.0000, 36.2000]], y: [-0.5, 1.9], collide: 0}
      - {kind: rod, from: [29.0, 0.7, 34.0000], to: [29.0, 0.7, 12], radius: 0.45, collide: 0, color: "#8f8a80"}
joints:
  - {id: j_A, type: hinge, body: L, axis: [0, -1, 0], damping: 0.001}
  - {id: j_S, type: hinge, body: S, axis: [0, -1, 0], damping: 0.001}
  - {id: j_R, type: hinge, body: R, axis: [0, -1, 0], damping: 0.001}
  - {id: j_Pb, type: hinge, body: Pb, axis: [0, -1, 0], damping: 0.001}
  - {id: j_F, type: hinge, body: Fb, axis: [0, -1, 0], damping: 0.001}
  - {id: j_x, type: slide, body: Px, axis: [1, 0, 0], damping: 0.05, range: [-1, 1]}
  - {id: j_z, type: slide, body: P, axis: [0, 0, 1], damping: 0.05, range: [-7, 7]}
contact: {solref: [0.002, 1], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_A, kind: velocity, rpm: 0, swing: {amplitude: 0.21, hz: 0.25}, kv: 400, max_torque: 100}
checks:
  # the side lever, rocked on A, lifts the cross-head E in step with it, the rods turning the
  # lever's swing into a rise and fall of the piston-rod ...
  - {type: follow, out: j_z, in: j_A, expect: 0.288, tol: 0.006, min_r2: 0.999, settle_s: 0.5, window_s: 7.0}
  - {type: amplitude, joint: j_z, min: 0.0595, max: 0.0625, settle_s: 0.5, window_s: 7.0}
  # ... while the radius bar F C swings back against it, holding C (and through the parallel bar, E)
  # to a straight line: E strays across by under a millimetre over a 12 cm stroke
  - {type: follow, out: j_F, in: j_A, expect: -0.404, tol: 0.01, min_r2: 0.999, settle_s: 0.5, window_s: 7.0}
  - {type: position, joint: j_x, min: -0.1, max: 0.1, settle_s: 0.5, window_s: 7.0}
  - {type: penetration, max: 0.0003, settle_s: 0.2}
camera: {target: [16, 0, 10], position: [16, -112, 14], fov: 30}
display:
  output: j_z
  labels: {j_A: "Side lever, rocked on A (driver)", j_x: Cross-head E across, j_z: Cross-head E and piston-rod, j_F: Radius bar F C, j_Pb: Parallel bar E D}

