number: 327
slug: roller-guided-cross-head
name: Roller-Guided Cross-Head
brown: "Differs from 326 in having rollers substituted for the slides on the cross-head, said rollers working against straight guide-bars, A, A, attached to the frame. This is used for small engines in France."
units: cm
sim: {timestep: 0.0005, integrator: implicitfast, iterations: 50, duration_s: 8, floor: false}
bodies:
  # the engine frame, with the guide-bars A, A and the cylinder over them
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    friction: 0.05
    color: "#9a9284"
    pieces:
      - {kind: poly, points: [[-9.0000, -6.5000], [9.0000, -6.5000], [9.0000, -5.5000], [-9.0000, -5.5000]], y: [-3.5, 1.5], collide: 0}
      - {kind: poly, points: [[-1.2000, -5.5000], [1.2000, -5.5000], [1.2000, -0.6000], [-1.2000, -0.6000]], y: [0.4, 1.4], collide: 0}
      - {kind: poly, points: [[-3.4970, 8.5000], [-2.2970, 8.5000], [-2.2970, 24.0000], [-3.4970, 24.0000]], y: [-1, 1], collide: 1}
      - {kind: poly, points: [[2.2970, 8.5000], [3.4970, 8.5000], [3.4970, 24.0000], [2.2970, 24.0000]], y: [-1, 1], collide: 1}
      - {kind: poly, points: [[-3.4970, 24.0000], [-2.2970, 24.0000], [-2.2970, 24.8000], [-3.4970, 24.8000]], y: [-1, 1], collide: 0}
      - {kind: poly, points: [[2.2970, 24.0000], [3.4970, 24.0000], [3.4970, 24.8000], [2.2970, 24.8000]], y: [-1, 1], collide: 0}
      - {kind: poly, points: [[-7.0000, -5.5000], [-6.0000, -5.5000], [-6.0000, 24.8000], [-7.0000, 24.8000]], y: [-1, 1], collide: 0}
      - {kind: poly, points: [[6.0000, -5.5000], [7.0000, -5.5000], [7.0000, 24.8000], [6.0000, 24.8000]], y: [-1, 1], collide: 0}
      - {kind: poly, points: [[-7.0000, 24.8000], [7.0000, 24.8000], [7.0000, 25.8000], [-7.0000, 25.8000]], y: [-1, 1], collide: 0}
      - {kind: poly, points: [[-3.5000, 25.8000], [3.5000, 25.8000], [3.5000, 34.0000], [-3.5000, 34.0000]], y: [-1.5, 1.5], collide: 0, color: "#7d776c"}
  # the crank with its fly-wheel, turned at a steady speed (the one driven joint)
  - id: K
    shape: part
    pos: [0, 0, 0]
    mount: frame
    density: 7800
    color: "#8f8a80"
    pieces:
      - {kind: disc, center: [0, 0], radius: 1.0, y: [-0.4, 0.4], collide: 0}
      - {kind: rod, from: [0, 0.4, 0], to: [0, 1.6, 0], radius: 0.6, collide: 0}
      - {kind: disc, center: [0, 0], radius: 4.8, inner: 3.6, y: [1.6, 2.6], collide: 0, color: "#6f6a60"}
      - {kind: disc, center: [0, 0], radius: 3.6, y: [1.9, 2.3], collide: 0, color: "#6f6a60"}
      - {kind: poly, points: [[-0.8, 0], [0.8, 0], [0.6, 4.0], [-0.6, 4.0]], y: [-3.0, -2.2], collide: 0}
      - {kind: rod, from: [0, -2.6, 0], to: [0, 0.4, 0], radius: 0.6, collide: 0}
      - {kind: disc, center: [0, 4.0], radius: 0.4, y: [-2.2, -0.9], collide: 2, color: "#6f6a60"}
  # the cross-head with the piston-rod: free to move across, up and down and to turn, kept on its
  # line only by its four rollers on the guide-bars
  - {id: Ax, shape: part, pos: [0, 0, 20.0000], mount: frame, mass: 0.01, color: "#8f8a80", pieces: [{kind: disc, center: [0, 20.0000], radius: 0.1, y: [1.0, 1.05], collide: 0}]}
  - {id: Az, shape: part, pos: [0, 0, 20.0000], mount: Ax, mass: 0.01, color: "#8f8a80", pieces: [{kind: disc, center: [0, 20.0000], radius: 0.1, y: [1.0, 1.05], collide: 0}]}
  - id: A
    shape: part
    pos: [0, 0, 20.0000]
    mount: Az
    density: 7800
    friction: 0.05
    color: "#b8ad96"
    pieces:
      - {kind: poly, points: [[-1.5000, 18.0000], [1.5000, 18.0000], [1.5000, 22.0000], [-1.5000, 22.0000]], y: [-0.95, 0.95], collide: 0}
      - {kind: rod, from: [0, 0, 22.0000], to: [0, 0, 33.0000], radius: 0.4, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [0, -1.9, 20.0000], to: [0, -0.95, 20.0000], radius: 0.4, collide: 0, color: "#6f6a60"}
  - {id: Ra, shape: part, pos: [-1.5000, 0, 21.2000], mount: A, density: 7800, friction: 0.5, color: "#6f6a60", pieces: [{kind: rod, from: [-1.5000, -0.5, 21.2000], to: [-1.5000, 0.5, 21.2000], radius: 0.8, collide: 2, capsule: true}, {kind: disc, center: [-1.5000, 21.2000], radius: 0.25, y: [-1.0, 1.0], collide: 0}]}
  - {id: Rb, shape: part, pos: [-1.5000, 0, 18.8000], mount: A, density: 7800, friction: 0.5, color: "#6f6a60", pieces: [{kind: rod, from: [-1.5000, -0.5, 18.8000], to: [-1.5000, 0.5, 18.8000], radius: 0.8, collide: 2, capsule: true}, {kind: disc, center: [-1.5000, 18.8000], radius: 0.25, y: [-1.0, 1.0], collide: 0}]}
  - {id: Rc, shape: part, pos: [1.5000, 0, 21.2000], mount: A, density: 7800, friction: 0.5, color: "#6f6a60", pieces: [{kind: rod, from: [1.5000, -0.5, 21.2000], to: [1.5000, 0.5, 21.2000], radius: 0.8, collide: 2, capsule: true}, {kind: disc, center: [1.5000, 21.2000], radius: 0.25, y: [-1.0, 1.0], collide: 0}]}
  - {id: Rd, shape: part, pos: [1.5000, 0, 18.8000], mount: A, density: 7800, friction: 0.5, color: "#6f6a60", pieces: [{kind: rod, from: [1.5000, -0.5, 18.8000], to: [1.5000, 0.5, 18.8000], radius: 0.8, collide: 2, capsule: true}, {kind: disc, center: [1.5000, 18.8000], radius: 0.25, y: [-1.0, 1.0], collide: 0}]}
  # the connecting-rod, on the cross-head pin; its big end is a bearing on the crank-pin
  - id: R
    shape: part
    pos: [0, 0, 20.0000]
    mount: A
    density: 7800
    color: "#a39a88"
    pieces:
      - {kind: rod, from: [0, -1.6, 19.4000], to: [0, -1.6, 5.0000], radius: 0.35, collide: 0}
      - {kind: disc, center: [0, 20.0000], radius: 0.7, y: [-1.9, -1.3], collide: 0}
      - {kind: band, center: [0, 4.0], r: [0.42, 1.0], a: [0, 6.2832], y: [-1.9, -1.3], slices: 36, collide: 1}
joints:
  - {id: j_K, type: hinge, body: K, axis: [0, -1, 0], damping: 0.001}
  - {id: j_x, type: slide, body: Ax, axis: [1, 0, 0], damping: 0.01, range: [-3, 3]}
  - {id: j_z, type: slide, body: Az, axis: [0, 0, 1], damping: 0.01, range: [-12, 3]}
  - {id: j_rot, type: hinge, body: A, axis: [0, -1, 0], damping: 0.001}
  - {id: j_R, type: hinge, body: R, axis: [0, -1, 0], damping: 0.001}
  - {id: j_Ra, type: hinge, body: Ra, axis: [0, -1, 0], damping: 0.000002}
  - {id: j_Rb, type: hinge, body: Rb, axis: [0, -1, 0], damping: 0.000002}
  - {id: j_Rc, type: hinge, body: Rc, axis: [0, -1, 0], damping: 0.000002}
  - {id: j_Rd, type: hinge, body: Rd, axis: [0, -1, 0], damping: 0.000002}
contact: {solref: [0.001, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_K, kind: velocity, rpm: 30, kv: 0.5, max_torque: 5}
checks:
  - {type: turning, joint: j_K, direction: 1, min_mean: 3.0, min_fraction: 0.95, settle_s: 0.5, window_s: 7.0}
  # the crank throws the cross-head up and down its full stroke, twice the crank's 4 cm radius ...
  - {type: amplitude, joint: j_z, min: 0.039, max: 0.041, settle_s: 0.5, window_s: 7.0}
  # ... the rollers roll on the guide-bars instead of sliding: each turns 1/r = 125 rad per metre of
  # stroke, the two sides opposite ways ...
  - {type: follow, out: j_Ra, in: j_z, expect: 125.5, tol: 2.0, min_r2: 0.99, settle_s: 0.5, window_s: 7.0}
  - {type: follow, out: j_Rd, in: j_z, expect: -125.5, tol: 2.0, min_r2: 0.99, settle_s: 0.5, window_s: 7.0}
  # ... and between them the cross-head is kept on its line, though the connecting-rod pushes it sideways
  - {type: position, joint: j_x, min: -0.005, max: 0.005, settle_s: 0.5, window_s: 7.0}
  - {type: position, joint: j_rot, min: -0.0005, max: 0.0005, settle_s: 0.5, window_s: 7.0}
  - {type: penetration, max: 0.0003, settle_s: 0.2}
camera: {target: [0, 0, 3], position: [-69, -138, 18], fov: 30}
display:
  output: j_z
  labels: {j_K: Crank (driver), j_x: Cross-head across the guides, j_z: Cross-head and piston-rod, j_rot: Turn of cross-head, j_Ra: Upper left roller, j_Rc: Upper right roller, j_R: Connecting-rod}

