# No. 496 (Brown 1868): "Drawing and twisting in spinning cotton, wool, etc. ..."
# Generator: opencode-runs/batch15/gen496.py.
number: 496
slug: drawing-and-twisting
name: Drawing and twisting
brown: "Drawing and twisting in spinning cotton, wool, etc. The front drawing-rolls, B, rotate faster than the back ones, A, and so produce a draught, and draw out the fibers of the sliver or roving passing between them. Roving passes from the front drawing-rolls to throstle, which, by its rotation around the bobbin, twists and winds the yarn on the bobbin."
units: cm
sim: {timestep: 0.0001, integrator: implicitfast, iterations: 100, solver: PGS, multiccd: true, duration_s: 10, floor: false}
bodies:
  - {id: rollA, shape: assembly, pos: [-11, 0, 23.85], color: "#cfc4aa"}
  - {id: rollB, shape: assembly, pos: [-2.35, 0, 23.85], color: "#cfc4aa"}
  - {id: idler, shape: assembly, pos: [-5.41777, 0, 18.1195], color: "#cfc4aa"}
  - {id: upright, shape: assembly, pos: [-2.35, 12.2771, 0], color: "#cfc4aa"}
  - {id: spindle, shape: assembly, pos: [0, 0, 0], color: "#b8ad96"}
  - {id: bobbin, shape: assembly, pos: [0, 0, 0], color: "#c9a77a"}
  - id: saddleA
    shape: part
    pos: [-11, 0, 28.55]
    mass: 0.3
    color: "#8f8a80"
    pieces:
      - {kind: loft, a: [[-11.5, 1.6, 29.25], [-10.5, 1.6, 29.25], [-10.5, 2.4, 29.25], [-11.5, 2.4, 29.25]], b: [[-11.5, 1.6, 28.05], [-10.5, 1.6, 28.05], [-10.5, 2.4, 28.05], [-11.5, 2.4, 28.05]], collide: 0}
      - {kind: rod, from: [-11, -1.6, 28.55], to: [-11, 2.4, 28.55], radius: 0.3, collide: 0}
  - id: saddleB
    shape: part
    pos: [-2.35, 0, 28.55]
    mass: 0.3
    color: "#8f8a80"
    pieces:
      - {kind: loft, a: [[-2.85, 1.6, 29.25], [-1.85, 1.6, 29.25], [-1.85, 2.4, 29.25], [-2.85, 2.4, 29.25]], b: [[-2.85, 1.6, 28.05], [-1.85, 1.6, 28.05], [-1.85, 2.4, 28.05], [-2.85, 2.4, 28.05]], collide: 0}
      - {kind: rod, from: [-2.35, -1.6, 28.55], to: [-2.35, 2.4, 28.55], radius: 0.3, collide: 0}
  - {id: topA, shape: pulley, radius: 2.2, width: 3, pos: [-11, 0, 28.55], mass: 0.35, spokes: 0, flange: 0, web: true, mount: saddleA, color: "#cfc4aa"}
  - {id: topB, shape: pulley, radius: 2.2, width: 3, pos: [-2.35, 0, 28.55], mass: 0.35, spokes: 0, flange: 0, web: true, mount: saddleB, color: "#cfc4aa"}
  - id: roving
    shape: part
    pos: [-24, 0, 26.2]
    mass: 0.01
    color: "#6d675c"
    pieces:
      - {kind: rod, from: [-24, 0, 25.9], to: [-24, 0, 26.5], radius: 0.2, collide: 0}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#d6cdb8"
    pieces:
      - {kind: loft, a: [[-11.9, 1.7, 29.45], [-10.1, 1.7, 29.45], [-10.1, 2.6, 29.45], [-11.9, 2.6, 29.45]], b: [[-11.9, 1.7, 20.65], [-10.1, 1.7, 20.65], [-10.1, 2.6, 20.65], [-11.9, 2.6, 20.65]], collide: 0}
      - {kind: loft, a: [[-3.25, 1.7, 29.45], [-1.45, 1.7, 29.45], [-1.45, 2.6, 29.45], [-3.25, 2.6, 29.45]], b: [[-3.25, 1.7, 20.65], [-1.45, 1.7, 20.65], [-1.45, 2.6, 20.65], [-3.25, 2.6, 20.65]], collide: 0}
      - {kind: loft, a: [[-12.5, 1.7, 20.65], [-0.85, 1.7, 20.65], [-0.85, 2.6, 20.65], [-12.5, 2.6, 20.65]], b: [[-12.5, 1.7, 19.65], [-0.85, 1.7, 19.65], [-0.85, 2.6, 19.65], [-12.5, 2.6, 19.65]], collide: 0}
      - {kind: loft, a: [[-6.1178, 2.6, 18.8195], [-4.7178, 2.6, 18.8195], [-4.7178, 3, 18.8195], [-6.1178, 3, 18.8195]], b: [[-6.1178, 2.6, 17.4195], [-4.7178, 2.6, 17.4195], [-4.7178, 3, 17.4195], [-6.1178, 3, 17.4195]], collide: 0}
      - {kind: rod, from: [-5.4178, 2.6, 18.1195], to: [-5.4178, 3.9, 18.1195], radius: 0.25, collide: 0, color: "#6d675c"}
      - {kind: loft, a: [[-3.35, 13.8771, 24.65], [-1.35, 13.8771, 24.65], [-1.35, 14.6771, 24.65], [-3.35, 14.6771, 24.65]], b: [[-3.35, 13.8771, -9.5], [-1.35, 13.8771, -9.5], [-1.35, 14.6771, -9.5], [-3.35, 14.6771, -9.5]], collide: 0}
      - {kind: loft, a: [[-1.6, -1.6, -2.6], [1.6, -1.6, -2.6], [1.6, 1.6, -2.6], [-1.6, 1.6, -2.6]], b: [[-1.6, -1.6, -3.8], [1.6, -1.6, -3.8], [1.6, 1.6, -3.8], [-1.6, 1.6, -3.8]], collide: 0}
      - {kind: loft, a: [[-1.4, -1.4, -11.6], [1.4, -1.4, -11.6], [1.4, 1.4, -11.6], [-1.4, 1.4, -11.6]], b: [[-1.4, -1.4, -13.2], [1.4, -1.4, -13.2], [1.4, 1.4, -13.2], [-1.4, 1.4, -13.2]], collide: 0}
joints:
  - {id: j_B, type: hinge, body: rollB, axis: [0, 1, 0], damping: 0.001}    # the front rolls' shaft: the driver
  - {id: j_A, type: hinge, body: rollA, axis: [0, 1, 0], damping: 0.02}
  - {id: j_i, type: hinge, body: idler, axis: [0, 1, 0], damping: 0.01}
  - {id: j_u, type: hinge, body: upright, axis: [0, 0, 1], damping: 0.002}
  - {id: j_s, type: hinge, body: spindle, axis: [0, 0, 1], damping: 0.002}   # the spindle, with the flyer on its top
  - {id: j_bob, type: hinge, body: bobbin, axis: [0, 0, 1], frictionloss: 0.0002, damping: 2e-05}   # the bobbin, loose on the spindle, dragged on its rail
  - {id: j_sA, type: slide, body: saddleA, axis: [0, 0, 1], range: [-0.15, 0.8], damping: 0.5}   # the top rolls lie on the bottom ones by their weight
  - {id: j_sB, type: slide, body: saddleB, axis: [0, 0, 1], range: [-0.15, 0.8], damping: 0.5}
  - {id: j_tA, type: hinge, body: topA, axis: [0, 1, 0], damping: 0.00002}
  - {id: j_tB, type: hinge, body: topB, axis: [0, 1, 0], damping: 0.00002}
  - {id: j_f, type: slide, body: roving, axis: [1, 0, 0], damping: 1.5}   # the roving drawn off its can
wheels:
  - {id: rollA, body: rollA, pos: [0, 0, 0], radius: 2.2, width: 3, flange: 0, spokes: 0, web: true, mass: 0.35, color: "#cfc4aa"}
  - {id: rollB, body: rollB, pos: [0, 0, 0], radius: 2.2, width: 3, flange: 0, spokes: 0, web: true, mass: 0.35, color: "#cfc4aa"}
  - {id: drive, body: rollB, pos: [0, 14.8771, 0], radius: 3.6, width: 1.2, flange: 0.25, spokes: 4, web: false, mass: 3, color: "#8a7f6a"}   # the line-shaft pulley that turns the front rolls
  - {id: ihub, body: idler, pos: [0, 5.3, 0], radius: 2.2, width: 0.8, flange: 0, spokes: 0, web: true, mass: 0.8, color: "#8a7f6a"}
  - {id: g1, body: spindle, pos: [0.65, 0, 14.7], radius: 0.5, width: 0.5, flange: 0.15, spokes: 0, web: true, mass: 0.002, color: "#6d675c"}
  - {id: g2, body: spindle, pos: [4.3, 0, 11.6], radius: 0.5, width: 0.5, flange: 0.15, spokes: 0, web: true, mass: 0.002, color: "#6d675c"}
  - {id: eye, body: spindle, pos: [4.574, -0.39, 2.4], quat: [0.93807303, 0.00000000, -0.00000000, 0.34643758], radius: 0.45, width: 0.4, flange: 0.15, spokes: 0, web: true, mass: 0.002, color: "#6d675c"}
  - {id: wound, body: bobbin, pos: [0, 0, 1.8], quat: [0.70710678, 0.70710678, 0, 0], radius: 3, width: 1.4, flange: 0, spokes: 0, web: true, mass: 0.01, color: "#e8dfc8"}
spurs:
  - {id: gB, body: rollB, pos: [0, 3.4, 0], teeth: 12, module: 0.5, width: 2, backlash: 0.04, phase: 0}
  - {id: gI, body: idler, pos: [0, 3.4, 0], teeth: 14, module: 0.5, width: 2, backlash: 0.04, phase: 0.0112}
  - {id: gA, body: rollA, pos: [0, 3.4, 0], teeth: 18, module: 0.5, width: 2, backlash: 0.04, phase: 0.192}
  - {id: gU, body: upright, pos: [0, 0, -8], quat: [0.70710678, 0.70710678, 0, 0], teeth: 40, module: 0.5, width: 2, backlash: 0.04, phase: 0}
  - {id: gS, body: spindle, pos: [0, 0, -8], quat: [0.70710678, 0.70710678, 0, 0], teeth: 10, module: 0.5, width: 2, backlash: 0.04, phase: 0.3142}
bevels:
  - {id: bB, body: rollB, pos: [0, 12.2771, 0], teeth: 16, pitch_radius: 2, cone_angle: 0.7853982, face_width: 1.0, backlash: 0.03, phase: 0, quat: [0, 0, 0, 1]}
  - {id: bU, body: upright, pos: [0, 0, 23.85], teeth: 16, pitch_radius: 2, cone_angle: 0.7853982, face_width: 1.0, backlash: 0.03, phase: 0.1963, quat: [0.70710678, -0.70710678, 0, 0]}
shafts:
  - {id: shA, body: rollA, from: [0, -1.8, 0], to: [0, 4, 0], radius: 0.35}
  - {id: shB, body: rollB, from: [0, -1.8, 0], to: [0, 15.5771, 0], radius: 0.35}
  - {id: shI, body: idler, from: [0, 2.7, 0], to: [0, 5.8, 0], radius: 0.4}
  - {id: shU, body: upright, from: [0, 0, -8.8], to: [0, 0, 23.45], radius: 0.35}
  - {id: sp, body: spindle, from: [0, 0, -12.0], to: [0, 0, 13.2], radius: 0.3}
  - {id: collar, body: spindle, from: [0, 0, -2.5], to: [0, 0, -1.6], radius: 0.8}
  - {id: barrel, body: bobbin, from: [0, 0, -0.9], to: [0, 0, 11.2], radius: 0.8, density: 700}
  - {id: fl_bot, body: bobbin, from: [0, 0, -0.9], to: [0, 0, 0.0], radius: 3.7, density: 700, color: "#9c7a50"}
  - {id: fl_top, body: bobbin, from: [0, 0, 10.6], to: [0, 0, 11.2], radius: 3.3, density: 700, color: "#9c7a50"}
  - {id: fl0, body: spindle, from: [0, 0, 13.3], to: [2.4, 0, 13.5], radius: 0.2, color: "#6d675c"}
  - {id: fl1, body: spindle, from: [2.4, 0, 13.5], to: [4.2, 0, 12.6], radius: 0.2, color: "#6d675c"}
  - {id: fl2, body: spindle, from: [4.2, 0, 12.6], to: [4.75, 0, 10.8], radius: 0.2, color: "#6d675c"}
  - {id: fl3, body: spindle, from: [4.75, 0, 10.8], to: [4.75, 0, 3.2], radius: 0.2, color: "#6d675c"}
  - {id: fl4, body: spindle, from: [4.75, 0, 3.2], to: [4.9, 0, 2.2], radius: 0.2, color: "#6d675c"}
  - {id: fl5, body: spindle, from: [0, 0, 13.3], to: [-2.4, 0, 13.5], radius: 0.2, color: "#6d675c"}
  - {id: fl6, body: spindle, from: [-2.4, 0, 13.5], to: [-4.2, 0, 12.6], radius: 0.2, color: "#6d675c"}
  - {id: fl7, body: spindle, from: [-4.2, 0, 12.6], to: [-4.75, 0, 10.8], radius: 0.2, color: "#6d675c"}
  - {id: fl8, body: spindle, from: [-4.75, 0, 10.8], to: [-4.75, 0, 3.2], radius: 0.2, color: "#6d675c"}
  - {id: fl9, body: spindle, from: [-4.75, 0, 3.2], to: [-4.9, 0, 2.2], radius: 0.2, color: "#6d675c"}
  - {id: cap, body: spindle, from: [0, 0, 13.0], to: [0, 0, 17.4], radius: 0.55, color: "#6d675c"}
  - {id: cap2, body: spindle, from: [0, 0, 15.6], to: [0, 0, 16.4], radius: 0.75, color: "#6d675c"}
  - {id: full, body: bobbin, from: [0, 0, 0.0], to: [0, 0, 10.6], radius: 2.95, density: 300, color: "#e8dfc8"}
yarns:
  - id: yarn
    dir: [1, 0, 0]
    feed: {joint: j_f}
    nips:
      - {bottom: rollA, top: topA, at: [-11, 0, 26.2], mu: 0.5}
      - {bottom: rollB, top: topB, at: [-2.35, 0, 26.2], mu: 0.5}
    draft_yield: 1
    wind: {spindle: j_s, bobbin: j_bob, radius: 3.15, sense: 1}
    stiffness: 2000
    damping: 0.5
    pretension: 0.02
    lump_mass: 0.01
    thickness: 0.3
    color: "#3b3226"
    path:
      - {body: roving, at: [-24, 0, 26.2], span: 0}
      - {body: world, at: [-11, 0, 26.2], span: 0}
      - {body: world, at: [-11, 0, 26.2], span: 1}
      - {body: world, at: [-2.35, 0, 26.2], span: 1}
      - {body: world, at: [-2.35, 0, 26.2], span: 2}
      - {body: world, at: [-1.175, 0, 25.8852], span: 2}
      - {body: world, at: [-0.3148, 0, 25.025], span: 2}
      - {body: world, at: [0, 0, 23.85], span: 2}
      - {body: spindle, at: [0, 0, 17.6], span: 2}
      - {body: spindle, at: [0.65, 0, 15.35], span: 2}
      - {body: spindle, at: [1.3, 0, 14.7], span: 2}
      - {body: spindle, at: [4.3, 0, 12.25], span: 2}
      - {body: spindle, at: [4.95, 0, 11.6], span: 2}
      - {body: spindle, at: [4.95, 0, 3.6], span: 2}
      - {body: spindle, at: [4.574, -0.39, 2.4], span: 2}
      - {body: spindle, at: [2.0459, -2.3952, 1.8], span: 2}
contact: {solref: [0.002, 1], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_B, kind: velocity, rpm: 6, kv: 3, max_torque: 5}
checks:
  - {type: ratio, out: j_A, in: j_B, expect: 0.6667, tol: 0.02, settle_s: 1, window_s: 8}
  - {type: ratio, out: yarn_s0, in: yarn_s1, expect: 0.6667, tol: 0.02, settle_s: 1, window_s: 8}   # the draught
  - {type: ratio, out: j_bob, in: j_s, expect: 0.8135, tol: 0.03, settle_s: 2, window_s: 7}   # the bobbin lags the flyer by the yarn delivered
  - {type: penetration, max: 0.002, settle_s: 0.5}
camera: {target: [-6, 0, 2.4], position: [-6, -200, 4.4], fov: 18}
display:
  output: j_s
  labels: {j_B: "Front rolls B (driver)", j_A: "Back rolls A", j_s: "Spindle and flyer", j_bob: "Bobbin", j_f: "Roving"}
