10 ESC$=CHR$(27) 20 CL$=ESC$+"[2J" 30 PRINT CL$ 40 PI=3.14159 50 P=0 60 O$="Old dimension was " 70 N$=". What is the new dimension?" 80 PRINT " Walschaerts valve gear program by Greg Trice" 90 PRINT " --------------------------------------------" 100 PRINT:PRINT:PRINT 110 PRINT " This program calculates the dimensions of the various parts" 120 PRINT "of a Walschaerts valve gear to realize given valve events." 130 PRINT:PRINT:PRINT 140 PRINT "Type of valve?......Inside admission [1]" 150 PRINT " Outside admission [2]" 160 INPUT AD 170 IF AD<>1 AND AD<>2 THEN GOTO 160 180 PRINT "What units are you using?.......inches [1]" 190 PRINT " millimetres[2]" 200 INPUT UN 210 IF UN<>1 AND UN<>2 THEN GOTO 200 220 IF UN=1 THEN U$="in" ELSE U$="mm" 230 PRINT "Lap of valve (";U$;".)" 240 INPUT LA 250 PRINT "Lead (";U$;".)?" 260 INPUT LE 270 PRINT "Full gear port opening (";U$;".)?" 280 INPUT PO 290 PRINT "Piston stroke(";U$;".)?" 300 INPUT ST 310 PRINT "Height of valve spindle above piston rod (";U$;".)?" 320 INPUT VP 330 PRINT "Length of drop-arm below piston rod (";U$;".)?" 340 INPUT DA 350 PRINT "Height of link trunnion above motion centre line (";U$;".)?" 360 INPUT H 370 PRINT "Length of radius rod (";U$;".)?" 380 INPUT R1 390 PRINT "Horizontal distance of link trunnion along motion c.l. (";U$;".)?" 400 INPUT L 410 PRINT "Radius of link driving pin (";U$;".)?" 420 INPUT R 430 PRINT "Total angle of link swing (degrees)?" 440 INPUT F 450 PRINT "Which end of link for forward gear ...Top [1] 460 PRINT " ..or Bottom [2]" 470 INPUT WE 480 IF WE<>1 AND WE<>2 THEN GOTO 470 490 VT=2*(PO+LA) 500 RR=ST/2 510 X0=VP+DA 520 Y0=RR 530 H0=SQR(X0*X0+Y0*Y0)-X0 540 IF AD=2 THEN GOTO 580 550 C1=VP+DA+.5*H0 560 C2=C1*(LA+LE)/(RR-LA-LE) 570 GOTO 600 580 C1=(VP+DA+.5*H0)/(1+(LA+LE)/RR) 590 C2=(LA+LE)*C1/RR 600 IF AD=1 THEN H1=VP+C2 ELSE H1=VP-C2 610 H2=H1-H 620 EP=ATN(H2/SQR(R1*R1+H2*H2)) 630 IF AD=2 THEN GOTO 660 640 R0=((C1+C2)/C1)*SQR(VT*VT-(2*C2*RR/(C1+C2))^2) 650 GOTO 670 660 R0=(C1/(C1+C2))*SQR(VT*VT-(2*C2*RR/C1)^2) 670 FI=F*PI/360 680 DB=R0/(2*TAN(FI)) 690 D=SQR(L*L+H*H) 700 A=SQR(L*L+H*H+R*R) 710 XX=A*A/(R*D) 720 OM=ATN(L/H) 730 A1=0 740 A2=FI 750 R2=R*COS(A1)*SIN(A2) 760 K2=1-2*COS(A1)*COS(A2)+COS(A2)*COS(A2) 770 K3=SIN(A1)*COS(A2)*SQR(K2-((COS(A1)*SIN(A2))^4)*R*R/(D*D)) 780 CP=((R*COS(A1)*COS(A1)*SIN(A2)*SIN(A2)/D)*(1-COS(A1)*COS(A2))+K3)/K2 790 PS=ATN(SQR(1/(CP*CP)-1)) 800 AL=EP+OM-PS 810 TH=ATN(1/TAN(OM+ATN(R*SIN(PS)/(D-R*COS(PS))))) 820 ER=D*SIN(PS+A1)/COS(A1) 830 BS=R*SIN(AL) 840 RC=((AD-1)+(WE-1)) MOD 2 850 IF RC=0 THEN TH=-PI/2+TH ELSE TH=PI/2+TH 860 CL=SQR(RR*RR+R2*R2-2*RR*R2*COS(TH)) 870 PRINT CL$ 880 PRINT " Final calculated values" 890 PRINT " -----------------------" 900 PRINT :PRINT :PRINT 910 PRINT "Combination lever:" 920 PRINT " Upper section ";C2;U$ 930 PRINT " Lower section ";C1;U$ 940 PRINT "Expansion link:" 950 PRINT " Backset angle ";AL*180/PI;"deg." 960 PRINT " Backset distance (behind tangent) ";BS;U$ 970 PRINT " Dieblock depth in full gear ";DB;U$ 980 PRINT "Excentric rod:" 990 PRINT " Length ";ER;U$ 1000 PRINT "Return crank:" 1010 PRINT " Radius described by end ";R2;U$ 1020 PRINT " Angle trailing main crank ";TH*180/PI;"deg." 1030 PRINT " Length of crank ";CL;U$ 1040 IF P=0 THEN GOTO 1220 1050 LPRINT " Final calculated values" 1060 LPRINT " -----------------------" 1070 LPRINT:LPRINT:LPRINT 1080 LPRINT "Combination lever:" 1090 LPRINT " Upper section ";C2;U$ 1100 LPRINT " Lower section ";C1;U$ 1110 LPRINT "Expansion link:" 1120 LPRINT " Backset angle ";AL*180/PI;"deg." 1130 LPRINT " Backset distance (behind tangent) ";BS;U$ 1140 LPRINT " Dieblock depth in full gear ";DB;U$ 1150 LPRINT "Excentric rod:" 1160 LPRINT " Length ";ER;U$ 1170 LPRINT "Return crank:" 1180 LPRINT " Radius described by end ";R2;U$ 1190 LPRINT " Angle trailing main crank ";TH*180/PI;"deg." 1200 LPRINT " Length of crank ";CL;U$ 1210 LPRINT 1220 PRINT:PRINT:PRINT 1230 PRINT "Do you wish a re-run with any dimensions changed? [y/n]" 1240 INPUT Q$ 1250 IF Q$="n" THEN GOTO 1280 1260 IF Q$="y" THEN GOTO 1350 1270 GOTO 1240 1280 PRINT "Do you wish a printout? [y/n]" 1290 INPUT P$ 1300 IF P$="n" THEN END 1310 IF P$="y" THEN GOTO 1330 1320 GOTO 1290 1330 P=1 1340 GOTO 870 1350 PRINT CL$ 1360 PRINT "Which dimension do you wish to change?" 1370 PRINT 1380 PRINT " Lap of valve....................................[1]" 1390 PRINT " Lead of valve...................................[2]" 1400 PRINT " Full gear port opening..........................[3]" 1410 PRINT " Distance from valve rod to piston rod...........[4]" 1420 PRINT " Piston stroke...................................[5]" 1430 PRINT " Length of drop arm below piston rod.............[6]" 1440 PRINT " Length of radius rod............................[7]" 1450 PRINT " Height of link trunnions above motion CL........[8]" 1460 PRINT " Horizontal distance from link to driving axle...[9]" 1470 PRINT " Swing radius of link driving pin...............[10]" 1480 PRINT " Total angle of link swing......................[11]" 1490 INPUT DC 1500 IF INT(DC)<>DC OR DC<1 OR DC>11 THEN GOTO 1490 1510 ON DC GOTO 1520,1550,1580,1610,1640,1670,1700,1730,1760,1790,1820 1520 PRINT O$;LA;U$;N$ 1530 INPUT LA 1540 GOTO 490 1550 PRINT O$;LE;U$;N$ 1560 INPUT LE 1570 GOTO 490 1580 PRINT O$;PO;U$;N$ 1590 INPUT PO 1600 GOTO 490 1610 PRINT O$;VP;U$;N$ 1620 INPUT VP 1630 GOTO 490 1640 PRINT O$;ST;U$;N$ 1650 INPUT ST 1660 GOTO 490 1670 PRINT O$;DA;U$;N$ 1680 INPUT DA 1690 GOTO 490 1700 PRINT O$;R1;U$;N$ 1710 INPUT R1 1720 GOTO 490 1730 PRINT O$;H;U$;N$ 1740 INPUT H 1750 GOTO 490 1760 PRINT O$;L;U$;N$ 1770 INPUT L 1780 GOTO 490 1790 PRINT O$;R;U$;N$ 1800 INPUT R 1810 GOTO 490 1820 PRINT O$;F;"deg";N$ 1830 INPUT F 1840 GOTO 490 T L 1780 GOTO 490 1790 PRINT O$;R;U$;N$ 1800 INPUT R 1810 GOTO 490 1820 PRINT O$;F;"deg";N$ 1830 INP