There are very little decidions or tests to be done for calculation of the planetary geometry. Formulas described in chapter can be directly coded in C++. Description in C++ language follows. Some intermediate results which are not important for final results are listed under DEBUG clauses.
void pgEditFile::Calculate() { char buf[100]; char *gear[] = { "Sun", "Ring", "Carrier" }; #define PRIN1(string) sprintf(buf, string "\r\n"); Insert(buf) #define PRINT(fmt, vars) sprintf(buf, "\t" fmt "\r\n", vars); Insert(buf) #define kd kinematic #define gd geometry PRIN1("Analysis of Planetary Transmissions\r\n\r\n"); PRIN1("INPUT DATA:\r\n"); PRIN1("Kinematics:\r\n"); PRINT("Input\t->\t%s", gear[kd.iInput]); PRINT("Fixed\t->\t%s", gear[kd.iFixed]); PRINT("Output\t->\t%s\r\n", gear[kd.iOutput]); PRINT("Number of teeth of the Sun gear: \t%3d", kd.iTeethSun); PRINT("Number of the Planets : \t%3d", kd.iNoPlanets); PRINT("Number of teeth of the Ring gear:\t%3d", kd.iTeethRing); PRIN1("\r\nGeometry:\r\n"); PRINT("Normal modul:\t\t%5.2lf mm", gd.dNorModul); PRINT("Helix angle:\t\t%4.0lf deg", gd.dHelAng); PRINT("Normal angle:\t\t%5.1lf deg", gd.dNorAng); PRINT("Addendum of basic rack:\t%5.2lf of module", gd.dBasicRack); PRINT("Bottom clearance:\t\t%5.2lf of module ", gd.dCoeff); PRINT("Face width:\t\t%6.2lf mm", gd.dFaceWidth); PRINT("Gear quality:\t\t%3.0lf", gd.dGearQuality); PRIN1("\r\nRESULTS"); #define R kd.iTeethRing #define S kd.iTeethSun // int P = int(floor(double(R-S)/2.0)); int P ; #ifdef DEBUG PRIN1( "\r\n*******************" ) ; PRINT( "\r\n(z3-z1)/2 = %lg", 0.5*(R - S) ) ; PRIN1( "\r\n******************" ) ; #endif if( S < 12 ) { /* in case that the sun has less than 12 teeth */ /* to calculate: (R-S)/2 - P = 1 or 1.5 */ P = int( 0.5*(R - S) ) - 1 ; } else { /* in case that the sun has 12 or more teeth */ /* to calculate: (R-S)/2 - P = 0.5 or 1 */ P = int( 0.5*(R - S) - 0.5 ) ; } kd.iTeethPlanet = P ; PRINT("Number of teeth of the Planet gears: %d", P); #define alpha (double(R)/double(S)) double ratio; switch (kd.iInput) { case SEL_SUN: if (kd.iFixed == SEL_RING) ratio = 1.0 + alpha; else ratio = -alpha; break; case SEL_RING: if (kd.iFixed == SEL_SUN) ratio = (1.0 + alpha)/alpha; else ratio = -1.0/alpha; break; case SEL_CARRIER: if (kd.iFixed == SEL_SUN) ratio = alpha /(1.0 + alpha); else ratio = 1.0 /( 1.0 + alpha); break; default: MessageBox("calculate input"); } PRINT("Transmission ratio:\t\t%lg", ratio); #define deg2rd( deg ) (M_PI*deg/180) #define rd2deg( rd ) (180*rd/M_PI) #define sqr( x ) (x*x) #define alfa_n deg2rd( gd.dNorAng ) #define beta deg2rd( gd.dHelAng ) #define X2 results.x2 #define X3 results.x3 #define X1 results.x1 #define D1 results.d1 #define D2 results.d2 #define D3 results.d3 #define Da1 results.da1 #define Da2 results.da2 #define Da3 results.da3 int z1 = kd.iTeethSun ; int z2 = kd.iTeethPlanet ; int z3 = - kd.iTeethRing ; X3 = 0 ; double mt = gd.dNorModul/cos(beta) ; double alfa_t = atan( tan(alfa_n)/cos(beta) ) ; // // calculation for gears z1 and z2 // results.b2 = gd.dFaceWidth; results.b1 = results.b2 + gd.dNorModul ; double ad12 = 0.5*mt*double(z1 + z2) ; double a12 = (mt * (7*abs(z3) - 6*z2 + z1)) / 16.0 ; a12 = 0.1*( (int)(10*a12 + 0.5) ) ; double ad23 = 0.5*mt*(z2 + z3) ; double a23 = -a12 ; double alfa_wt12 = acos(ad12*cos(alfa_t)/a12) ; double alfa_wt23 = acos(ad23*cos(alfa_t)/a23) ; double sum_x1 = (inv(alfa_wt12)-inv(alfa_t))*double(z1+z2)/ (2*tan(alfa_t)*cos(beta)) ; double sum_x2 = (inv(alfa_wt23)-inv(alfa_t))*double(z2+z3)/ (2*tan(alfa_t)*cos(beta)) ; X2 = sum_x2 - X3 ; X1 = sum_x1 - X2 ; D1 = mt*z1 ; D2 = mt*z2 ; double df1 = D1-2*gd.dNorModul*(gd.dBasicRack+gd.dCoeff-X1) ; double df2 = D2-2*gd.dNorModul*(gd.dBasicRack+gd.dCoeff-X2) ; double teethHeight = a12 - gd.dNorModul*gd.dCoeff - 0.5*(df1+df2) ; Da1 = df1 + 2*teethHeight ; Da2 = df2 + 2*teethHeight ; #ifdef DEBUG double mount = 1.0*(S+R)/kd.iNoPlanets ; double db1 = D1*cos(alfa_t) ; double db2 = D2*cos(alfa_t) ; double g_alfa ; g_alfa = 0.5*( sqrt( sqr(Da1) - sqr(db1) ) - db1*tan(alfa_t) ) + gd.dNorModul*(1-X1)/sin(alfa_t) ; double p_et = gd.dNorModul*M_PI*cos(alfa_t)/cos(beta) ; double conRatio = g_alfa / p_et ; double overlapRatio = gd.dFaceWidth*sin(beta)/ (M_PI*gd.dNorModul) ; double totalRatio = conRatio + overlapRatio ; double dv1 = D1 + 2*X1*gd.dNorModul ; double dv2 = D2 + 2*X2*gd.dNorModul ; #endif double alfa_vt1 = acos( z1*cos(alfa_t)/ (z1 + 2*X1*cos(beta) ) ) ; double alfa_vt2 = acos( z2*cos(alfa_t)/ (z2 + 2*X2*cos(beta) ) ) ; double beta_b = asin( sin(beta)*cos(alfa_n) ) ; double k1 ; k1 = z1/M_PI*( tan(alfa_vt1)/sqr(cos(beta_b))-2*X1*tan(alfa_n)/z1 - inv( alfa_t ) ) + 0.5*z1/abs( z1 ) ; results.k1 = floor( k1 + 0.5 ) ; double k2 ; k2 = z2/M_PI*( tan(alfa_vt2)/sqr(cos(beta_b))-2*X2*tan(alfa_n)/z2 - inv( alfa_t ) ) + 0.5*z2/abs( z2 ) ; results.k2 = floor( k2 + 0.5 ) ; results.wk1 = gd.dNorModul*cos(alfa_n)* ( (results.k1 - 0.5*z1/abs(z1))*M_PI + z1*inv(alfa_t) ) + 2*X1*gd.dNorModul*sin(alfa_n) ; results.wk2 = gd.dNorModul*cos(alfa_n)* ( (results.k2 - 0.5*z2/abs(z2))*M_PI + z2*inv(alfa_t) ) + 2*X2*gd.dNorModul*sin(alfa_n) ; double fi = gd.dGearQuality < 9 ? 1.4 : 1.6 ; results.ff = 1.5 + 0.25*(gd.dNorModul + 9*sqrt(gd.dNorModul) ) ; results.ff *= pow( fi, max( 0, (int) (gd.dGearQuality-6) ) ) ; results.fr1 = 1.68+2.18*sqrt(gd.dNorModul)+ (2.3+1.2*log10(gd.dNorModul))*sqrt(sqrt(D1)) ; results.fr1 *= pow( 1.4, max( 0, (int) (gd.dGearQuality - 6) ) ) ; results.fr2 = 1.68+2.18*sqrt(gd.dNorModul)+ (2.3+1.2*log10(gd.dNorModul))*sqrt(sqrt(D2)) ; results.fr2 *= pow( 1.4, max( 0, (int) (gd.dGearQuality - 6) ) ) ; results.fb = 0.8*sqrt(gd.dFaceWidth) + 4 ; results.fb *= pow( 1.6, max( 0, (int) (gd.dGearQuality - 6) ) ) ; // // calculation for gears z2 and z3 // #ifdef DEBUG double x0 = 0.15 ; int z0 = 40 ; #endif results.b3 = gd.dFaceWidth + 2*gd.dNorModul ; #ifdef DEBUG double d0 = mt*z0 ; double db0 = d0*cos(alfa_t) ; double da0 = d0 + 2*gd.dNorModul*(gd.dBasicRack+gd.dCoeff+x0) ; double df0 = d0-2*gd.dNorModul*(gd.dBasicRack+gd.dCoeff-x0) ; double alfa_wt0 = ainv( inv(alfa_t) +2.0*tan(alfa_n)*double(x0+X3)/double(z0+z3) ) ; double a0 = gd.dNorModul*(z0+z3)*cos(alfa_t)/ (2*cos(beta)*cos(alfa_wt0)) ; #endif D3 = mt*z3 ; #ifdef DEBUG double db3 = D3*cos(alfa_t) ; double df30 = 2*a0 - da0 ; #endif Da3 = 2*a23 - df2 - 2*gd.dCoeff*gd.dNorModul ; #ifdef DEBUG double dnf32 = 1.0*z3/abs(z3)*sqrt( sqr(2*a23*sin(alfa_wt23)-sqrt(sqr(Da2)-sqr(db2))) + sqr(db3) ) ; double dnf30 = 1.0*z3/abs(z3)*sqrt( sqr(2*a0*sin(alfa_wt0)-sqrt(sqr(da0)-sqr(db0))) + sqr(db3) ) ; g_alfa = 0.5*( sqrt( sqr(Da2) - sqr(db2) ) + 1.0*z3/abs(z3)*sqrt( sqr(Da3)-sqr(db3) ) ) - (db2+db3)*tan(alfa_wt23) ; p_et = gd.dNorModul*M_PI*cos(alfa_t)/cos(beta) ; conRatio = g_alfa / p_et ; overlapRatio = gd.dFaceWidth*sin(beta)/(M_PI*gd.dNorModul) ; totalRatio = conRatio + overlapRatio ; #endif results.dm = floor( 1.5*gd.dNorModul + 0.5 ) ; double alfa_kt ; alfa_kt = ainv( results.dm/(z3*gd.dNorModul*cos(alfa_n)) - 0.5*(M_PI-4*X3*tan(alfa_n))/z3 + inv(alfa_t) ) ; double dk = D3*cos(alfa_t)/cos(alfa_kt) ; if( z3 % 2 == 0 ) { results.mdk = dk + results.dm ; } else { results.mdk = dk*cos(0.5*M_PI/z3) + results.dm ; } results.fr3 = 1.68+2.18*sqrt(gd.dNorModul)+ (2.3+1.2*log10(gd.dNorModul))*sqrt(sqrt(-D3)) ; results.fr3 *= pow( 1.4, max( 0, (int) (gd.dGearQuality - 6) ) ) ; PRINT( "Center distance (a):\t\t%lg mm", a12 ) ; PRIN1( "\r\n\tWidths (b):" ) ; PRINT( "\tSun\t\t%6.2lf mm", results.b1 ) ; PRINT( "\tPlanet\t\t%6.2lf mm", results.b2 ) ; PRINT( "\tRing\t\t%6.2lf mm", results.b3 ) ; PRIN1( "\r\n\tAddendum modification coefficients (x):" ) ; PRINT( "\tSun\t\t%6.4lf of module", results.x1 ) ; PRINT( "\tPlanet\t\t%6.4lf of module", results.x2 ) ; PRINT( "\tRing\t\t%6.4lf of module", results.x3 ) ; PRIN1( "\r\n\tReference diameter (d):" ) ; PRINT( "\tSun\t\t%8.4lf mm", results.d1 ) ; PRINT( "\tPlanet\t\t%8.4lf mm", results.d2 ) ; PRINT( "\tRing\t\t%8.4lf mm", results.d3 ) ; PRIN1( "\r\n\tTip diameter (da):" ) ; PRINT( "\tSun\t\t%8.4lf mm", results.da1 ) ; PRINT( "\tPlanet\t\t%8.4lf mm", results.da2 ) ; PRINT( "\tRing\t\t%8.4lf mm", results.da3 ) ; PRIN1( "\r\n\tNumber of teeth in a span (k):" ) ; PRINT( "\tSun\t\t%4.0lf", results.k1 ) ; PRINT( "\tPlanet\t\t%4.0lf", results.k2 ) ; // PRINT( "\t\tRing\t\t%4.0lf", results.k3 ) ; PRIN1( "\r\n\tBase tangent length for \"k\" teeth (Wk):" ) ; PRINT( "\tSun\t\t%8.4lf mm", results.wk1 ) ; PRINT( "\tPlanet\t\t%8.4lf mm", results.wk2 ) ; // PRINT( "\t\tRing\t\t%f", results.wk3 ) ; PRINT( "\r\nDiameter of measuring sphere (Dm):\t%8.4lf mm", results.dm ) ; PRINT( "\r\nDimension over balls (Mdk):\t%8.4lf mm", results.mdk ) ; PRINT( "\r\nProfile form error (�f):\t%d �m", (int) floor(results.ff+0.5) ) ; PRIN1( "\r\nRadial run-out (Fr):" ) ; PRINT( "\tSun\t\t%d �m", (int) floor(results.fr1+0.5) ) ; PRINT( "\tPlanet\t\t%d �m", (int) floor(results.fr2+0.5) ) ; PRINT( "\tRing\t\t%d �m", (int) floor(results.fr3+0.5) ) ; PRINT( "\r\nTotal aligment error (Fb): %d �m", (int) floor(results.fb+0.5) ) ; }