Analogue Computing

From TAMI
Jump to navigationJump to search

מחשבים אנלוגיים

יכול להיות מגניב לנסות לבנות מחשבים מכניים, כמו אלה שמתוארים בסרטים המדהימים של חיל הים האמריקאי על "המחשבים" המוקדמים ששימשו לבקרת ירי בספינות. אם נצליח, יכול להיות נחמד אני חושב לנסות לבנות צעצועי הרכבה לילדים שיאפשרו להם לבנות מכונת חישוב אנלוגית כמו עם לֶגוֹ.

Compiling Analogue Computers

The idea is to create a domain specific language for specifying (simple?) mathematical functions. The programs are then compiled into CAD files for the required components, and an instruction manual is produced for constructing the analogue computer.

Proof of Concept

The prototype goal is to build an analogue computer for a simple mathematical function (say f(x) = x*(x+1)).

The plan (in reverse order)

  1. Build a machine computing f(x) = x*(x+1)
  2. Build interface.
  3. Build "circuit".
  4. Build components.
  5. Design the circuit.
  6. Design gears for multiplication.
  7. Find out how to do multiplication.
  8. Design gears for addition.
  9. Find out how to do addition.

Progress

  1. Found out how to do addition: differential with half the ratio (see the Navy films).
  2. Found manuals for gears (shall I upload them? May be copyrighted...).
  3. Designed a few simple gears. The SCAD program below produces: this image.
  4. Found the ISO for bevel gears. (I got an electronic copy through the university, again copyright issues :-/.)

Additional Links

Standard for gear terminology. (Again, obtained through the University.)

SCAD Program

Pi = 3.1416;

translate([0, 0, 5])
  HelixGear(8, 16);

translate([2.25, 0, 5])
  rotate(v = [0, 1, 0], a = 12)
  rotate(v = [1, 0, 0], a = 90)
    HelixGear(8, 16);

translate([-2.25, .0, 5])
  rotate(v = [0, 0, 1], a = 12)
    mirror([0, 0, 1])
      HelixGear(8, 16);

gear(8, 16);

translate([-1.7725, -1.3])
  rack(8, 3, 11);

///////////////////////////

module Hole(l, v1, r, v2) {
  w1 = perp(v1);
  w2 = -perp(v2);
  c = intersect(l, w1, r, w2);
  translate(c) 
   circle(distance(c, l), $fn = 100);
}

function ToothVertices(a, phi, t) =
	[
	  	[-a*tan(phi)-t/2, 0], 
  		[-t/2+a*tan(phi), 2*a],   
  		[t/2-a*tan(phi), 2*a],
  		[a*tan(phi)+t/2, 0],
	  ];


module HelixGear(P, N) {
  // See Gear Theory, p. 5
  phi = 20;
  psi = 45;
  p = 3.1416/P;
  a = 1/P;
  t = 1.5708/P;
  ht = 2.157/P;
  b = ht - a;
  c = ht - 2*a;
  D = N/P;
  Dr = D - 2*b;
  Db = D*cos(phi);

  ToothTranslation = [0, Db/2];

  V = ToothVertices(a, phi, t);
  L = V[3] + ToothTranslation;
  Ltemp = V[2] + ToothTranslation;
  V1  = L - Ltemp;

  R = VecRotate (-360/N, V[0] + ToothTranslation);
  Rtemp = VecRotate (-360/N, V[1] + ToothTranslation);
  W1 = R - Rtemp;
  
  linear_extrude(height = 1, center = true, convexity = 10, twist = 45) // 2d -> 3d
{  for (i = [0 : N - 1]) 
    rotate(360*i/N) 
{
    translate([0, Db/2])
      tooth(a, phi, t);
      difference() 
      {
         polygon(points = [V[0] + ToothTranslation, L, R, [0, 0]], paths = [[0, 1, 2, 3, 0]]);
         Hole(L, V1, R, W1);
      }
 } 
}
}


module gear(P, N) {
  // See Gear Theory, p. 5
  phi = 20;
  p = 3.1416/P;
  a = 1/P;
  t = 1.5708/P;
  ht = 2.157/P;
  b = ht - a;
  c = ht - 2*a;
  D = N/P;
  Dr = D - 2*b;
  Db = D*cos(phi);

  ToothTranslation = [0, Db/2];

  V = ToothVertices(a, phi, t);
  L = V[3] + ToothTranslation;
  Ltemp = V[2] + ToothTranslation;
  V1  = L - Ltemp;

  R = VecRotate (-360/N, V[0] + ToothTranslation);
  Rtemp = VecRotate (-360/N, V[1] + ToothTranslation);
  W1 = R - Rtemp;
  
  linear_extrude(height = .5, center = true, convexity = 10, twist = 0) // 2d -> 3d
{  for (i = [0 : N - 1]) 
    rotate(360*i/N) 
{
    translate([0, Db/2])
      tooth(a, phi, t);
      difference() 
      {
         polygon(points = [V[0] + ToothTranslation, L, R, [0, 0]], paths = [[0, 1, 2, 3, 0]]);
         Hole(L, V1, R, W1);
      }
 } 
}
}


module rack(P, Depth, TeethNumber) {
  // See Gear Theory, p. 5
  phi = 20;
  p = 3.1416/P;
  a = 1/P;
  t = 1.5708/P;
  ht = 2.2/P;
  c = ht - 2*a;

  RackDepth = Depth*a;

  V = ToothVertices(a, phi, t);
  ToothTranslation = [p, 0];
   L = V[3];
   U = V[3] - V[2];
   R = V[0] + ToothTranslation;
   W = V[0] - V[1];



  linear_extrude(height = .5, center = true, convexity = 10, twist = 0) // 2d -> 3d
  {
    for (i = [0:TeethNumber-1])
      translate( [i*p, 0])
	    tooth(a, phi, t);

    difference() 
    {
      translate([-p/2, 0])
        polygon(
          points = [
            [0, 0], [p*TeethNumber, 0], 
            [p*TeethNumber, -RackDepth], [0, -RackDepth]
          ],
          paths = [[0, 1, 2, 3, 0]]
        );

      for (i = [0:TeethNumber-1]) {
        translate([i*p, 0])
          Hole(L, U, R, W);
      }
    }
  }
}


module tooth(a, phi, t) {
    polygon(points = ToothVertices(a, phi, t), 
	  paths = [[0, 1, 2, 3, 0]]
    );
  }

module PunchHole(a, r) {
  translate([0, .1*a])
    circle(r = r, $fn = 100);
}

// simple 2D linear algebra.

function intersect(a, v, b, w) = 
  a + v*((
    (b - a)[0]*w[1] - w[0]*(b-a)[1]
  )/(v[0]*w[1] - w[0]*v[1])
  );

function perp(v) = [-v[1], v[0]];

function norm(v) = sqrt(v[0]*v[0] + v[1]*v[1]);

function distance(v1, v2) = norm(v2 - v1);

function VecRotate(deg, v) = 
  [ v[0]*cos(deg) - v[1]*sin(deg)
  , v[1]*cos(deg) + v[0]*sin(deg)];


/////////////////////////////////////////////////////////