# No. 495 (Brown 1868): "Entwistle's patent gearing."
#
# Model (cm; the shaft D runs along y, seen from the side so that A is on the right, as Brown). Three equal straight bevels (20 teeth,
# 6 cm pitch radius, 45-degree cones, apexes at one point on D): A is fixed to the frame; B turns on the stud E, which stands out
# from D at the apex (it rides round with D); C is loose on D and carries the drum C'. D is turned by the pulley at its right-hand end
# (the only input, a steady 20 rpm). B is carried round A and so rolls on it, turning on its own stud; it drives C both by its
# rotation on E and by its revolution round A, so C (and the drum C', which takes a light load) turns twice as fast as D, the same way.
# Generator: opencode-runs/batch14/gen495.py.
number: 495
slug: entwistle-patent-gearing
name: "Entwistle\u2019s patent gearing"
brown: "Entwistle\u2019s patent gearing. Bevel-gear, A, is fixed. B, gearing with A, is fitted to rotate on stud, E, secured to shaft, D, and it also gears with bevel-gear, C, loose, on the shaft, D. On rotary motion being given to shaft, D, the gear, E, revolves around A, and also rotates upon its own axis, and so acts upon C in two ways, namely, by its rotation on its own axis and by its revolution around A. With three gears of equal size, the gear, C, makes two revolutions for every one of the shaft, D. This velocity of revolution may, however, be varied by changing the relative sizes of the gears. C is represented with an attached drum, C'. This gearing may be used for steering apparatus, driving screw-propellers, etc. By applying power to C, action may be reversed, and a slow motion of D obtained."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 80
  solver: PGS          # as No. 7: Newton/CG are not stable through two simultaneous bevel meshes
  multiccd: true
  duration_s: 6
  floor: false
bodies:
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[-9, -15], [9, -15], [9, -13], [-9, -13]], y: [-22, 19], collide: 0}   # the bed
      - {kind: loft, a: [[-4, -22, -13], [4, -22, -13], [4, -18, -13], [-4, -18, -13]], b: [[-1.6, -21, -1.4], [1.6, -21, -1.4], [1.6, -19, -1.4], [-1.6, -19, -1.4]], collide: 0}   # the left-hand standard
      - {kind: disc, center: [0, 0], radius: 2.2, inner: 0.8, y: [-21.5, -18.5], collide: 0}
      - {kind: loft, a: [[-5, 9.6, -13], [5, 9.6, -13], [5, 14, -13], [-5, 14, -13]], b: [[-2.6, 9.6, -2], [2.6, 9.6, -2], [2.6, 12.6, -2], [-2.6, 12.6, -2]], collide: 0}   # the right-hand standard, A's seat
  - {id: fixA, shape: assembly, pos: [0, 0, 0], color: "#cfc4a8"}   # A, bolted to the right-hand standard
  - {id: shaftD, shape: assembly, pos: [0, 0, 0], color: "#d9cfb6"}
  - id: studE
    shape: part
    pos: [0, 0, 0]
    mount: shaftD
    mass: 0.3
    color: "#d8ceba"
    pieces:
      - {kind: loft, a: [[-2.4, -2.0, -1.0], [2.4, -2.0, -1.0], [2.4, 2.0, -1.0], [-2.4, 2.0, -1.0]], b: [[-2.4, -2.0, 1.4], [2.4, -2.0, 1.4], [2.4, 2.0, 1.4], [-2.4, 2.0, 1.4]], color: "#9a948a", collide: 0}   # E's boss on D
      - {kind: rod, from: [0, 0, 1.4], to: [0, 0, 8.2], radius: 0.7, color: "#8f8a80", collide: 0}   # the stud E
      - {kind: rod, from: [0, 0, 8.2], to: [0, 0, 9], radius: 1.2, color: "#8f8a80", collide: 0}
  - id: pinB
    shape: part
    pos: [0, 0, 0]
    mount: studE
    mass: 0.15
    color: "#d8ceba"
    pieces:
      - {kind: rod, from: [0, 0, 1.6], to: [0, 0, 2.2], radius: 1.0, color: "#cfc4a8", collide: 0}
  - {id: gearC, shape: assembly, pos: [0, 0, 0], color: "#cfc4a8"}   # C, its hub and the drum C'
joints:
  - {id: j_A, type: hinge, body: fixA, axis: [0, 1, 0], range: [-0.0002, 0.0002], damping: 0.01}   # A fixed
  - {id: j_D, type: hinge, body: shaftD, axis: [0, 1, 0], damping: 0.01}
  - {id: j_E, type: hinge, body: studE, axis: [0, 1, 0], range: [-0.0002, 0.0002], damping: 0.01}   # E fast on D
  - {id: j_B, type: hinge, body: pinB, axis: [0, 0, 1], damping: 0.001}
  - {id: j_C, type: hinge, body: gearC, axis: [0, 1, 0], damping: 0.02}   # C loose on D; the drum's load
wheels:
  - {id: pulley, body: shaftD, pos: [0, 16.0, 0], radius: 6.0, width: 4.4, mass: 1.0, spokes: 0, hub: 1.0, flange: 0.0}
shafts:
  - {id: sD, body: shaftD, from: [0, -22.5, 0], to: [0, 18.5, 0], radius: 0.75}
  - {id: hubA, body: fixA, from: [0, 3.4, 0], to: [0, 10.0, 0], radius: 2.0, inner: 0.8}
  - {id: hubC, body: gearC, from: [0, -9.0, 0], to: [0, -3.4, 0], radius: 2.0, inner: 0.8}
  - {id: drumC, body: gearC, from: [0, -17.6, 0], to: [0, -9.0, 0], radius: 2.8, inner: 0.8}   # the drum C'
  - {id: rimC, body: gearC, from: [0, -18.2, 0], to: [0, -17.6, 0], radius: 3.6, inner: 0.8}
  - {id: rimC2, body: gearC, from: [0, -9.6, 0], to: [0, -9.0, 0], radius: 3.6, inner: 0.8}
bevels:
  - {id: gA, body: fixA, teeth: 20, pitch_radius: 6, cone_angle: 0.7853982, face_width: 3.5, backlash: 0.04, phase: 0.1570796}
  - {id: gC, body: gearC, teeth: 20, pitch_radius: 6, cone_angle: 0.7853982, face_width: 3.5, backlash: 0.04, phase: 0.1570796, quat: [0, 1, 0, 0]}
  - {id: gB, body: pinB, teeth: 20, pitch_radius: 6, cone_angle: 0.7853982, face_width: 3.5, backlash: 0.04, phase: 0, quat: [0.7071068, 0.7071068, 0, 0]}
contact: {solref: [0.0008, 1], solimp: [0.95, 0.99, 0.001], margin: 0}
driver: {joint: j_D, kind: velocity, rpm: 20, kv: 2, max_torque: 5}
checks:
  - {type: ratio, out: j_C, in: j_D, expect: 2.0, tol: 0.03, settle_s: 1.5, window_s: 4}
  - {type: penetration, max: 0.001, settle_s: 1.5}
camera: {target: [0, -1, -9], position: [200, -1, 3], fov: 15}
display:
  output: j_C
  labels: {j_D: "Shaft D (driven)", j_B: "B on stud E", j_C: "C and drum C'"}
