0% found this document useful (0 votes)
164 views

C++ Programs

This document contains code for designing and analyzing several mechanical components: 1. A helical gear including calculations for gear ratio, module, tooth size, and determining whether the design is safe based on beam strength, tangential load, and wear load. 2. A rolling contact bearing including calculations for dynamic load rating based on radial load, axial load, operating speed, and expected life. 3. Helical springs including calculations for spring constant based on wire diameter, number of coils, modulus of rigidity, and axial load.

Uploaded by

brijkishor2017
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
164 views

C++ Programs

This document contains code for designing and analyzing several mechanical components: 1. A helical gear including calculations for gear ratio, module, tooth size, and determining whether the design is safe based on beam strength, tangential load, and wear load. 2. A rolling contact bearing including calculations for dynamic load rating based on radial load, axial load, operating speed, and expected life. 3. Helical springs including calculations for spring constant based on wire diameter, number of coils, modulus of rigidity, and axial load.

Uploaded by

brijkishor2017
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 41

HELICAL GEAR

#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<math.h>
#define PI 3.1415
void main()
{
clrscr();
float st_g,st_p,psi1,psi,fbg,fbp,c,Zp,Zg,Yp,Yg,Zfp,Zfg;
float Fi,Fw,Fbs,Ft,Fd,Dp,kw,f,m,mn,v,cv,Q,Np,G,Dg,Ng;
int choice;
printf("\t\t\tDESIGN FOR HELICAL GEAR\n\n");
printf("\n\t\tEnter the Following Values\n\n");
printf("Number of Teeth on Pinion(Zp):\t ");
scanf("%f",&Zp);
printf("\nEnter the gear ratio:\t ");
scanf("%f",&G);
printf("\nTransverse Module(m) in mm:\t ");
scanf("%f",&m);
printf("\nPinion Speed(Np) in Rpm:\t ");
scanf("%f",&Np);
printf("\nHelix Angle(psi) in Degree:\t ");
scanf("%f",&psi1);
psi=cos((psi1*PI)/180);

printf("\nSafe working Strength for pinion(fbp) in Mpa:\t ");


scanf("%f",&fbp);
printf("\nSafe working Strength for Gear(fbg) in Mpa:\t ");
scanf("%f",&fbg);
printf("\nFactor(c):\t ");
scanf("%f",&c);
printf("\nLoad Stress Factor(kw):\t ");
scanf("%f",&kw);
Zg=(G*Zp);
mn=(m*psi);
Zfp=(Zp/(psi*psi*psi));
Zfg=(Zg/(psi*psi*psi));
Q=(2*G)/(G+1);
f=12*m;
Dp=Zp*m;
Dg=Zg*m;
Ng=(Np/G);
printf("\nSelect a tooth system:\n\n1.20FD system\n2.20stub teeth system\n3.14.5FD system\n");
printf("\nEnter your option:\t");
scanf("\t%d",&choice);
if(choice==1)
{
Yp=(.154-(.912/Zfp));
Yg=(.154-(.912/Zfg));
st_g=Yg*Zfg;

st_p=Yp*Zfp;
if(st_g>st_p)
{
printf("\nPinion is weaker. design is based on Pinion");
v=(((PI*Dp*Np)/60)/1000);
if((v>=0)&&(v<10))
cv=(6/(6+v));
if((v>=10)&&(v<=20))
cv=(5.6/(5.6+sqrt(v)));
}
if(st_p>st_g)
{
printf("\nGear is weaker. design is based on Gear");
v=(((PI*Dg*Ng)/60)/1000);
if((v>=0)&&(v<10))
cv=6/(6+v);
if((v>=10)&&(v<=20))
cv=(5.6/(5.6+sqrt(v)));
}
}
if(choice==2)
{
Yp=(.175-.841/Zfp);
Yg=(.175-.841/Zfg);
st_g=Yg*Zfg;

st_p=Yp*Zfp;
if(st_g>st_p)
{
printf("\nPinion is weaker. design is based on Pinion");
v=(((PI*Dp*Np)/60)/1000);
if((v>=0)&&(v<10))
cv=6/(6+v);
if((v>=10)&&(v<=20))
cv=(5.6/(5.6+sqrt(v)));
}
if(st_p>st_g)
{
printf("\nGear is weaker. design is based on Gear");
v=(((PI*Dg*Ng)/60)/1000);
if((v>=0)&&(v<10))
cv=6/(6+v);
if((v>=10)&&(v<=20))
cv=(5.6/(5.6+sqrt(v)));
}
}
if(choice==3)
{
Yp=(.124-.864/Zfp);
Yg=(.124-.864/Zfg);
st_g=Yg*Zfg;

st_p=Yp*Zfp;
if(st_g>st_p)
{
printf("\nPinion is weaker. design is based on pinion");
v=(((PI*Dp*Np)/60)/1000);
if((v>=0)&&(v<10))
cv=6/(6+v);
if((v>=10)&&(v<=20))
cv=(5.6/(5.6+sqrt(v)));
}
if(st_p>st_g)
{
printf("\nGear is weaker. design is based on Gear");
v=(((PI*Dg*Ng)/60)/1000);
if((v>=0)&&(v<10))
cv=6/(6+v);
if((v>=10)&&(v<=20))
cv=(5.6/(5.6+sqrt(v)));
}
}
if((choice==0)||(choice>3))
{
printf("Wrong Choice Entered ");
exit;
}

if(st_g>st_p)
{
Ft=fbp*f*mn*Yp*cv*PI;
Fbs=fbp*f*mn*Yp*PI;
Fw=Dp*f*kw*Q/(psi*psi);
}
if(st_p>st_g)
{
Ft=fbg*f*mn*Yg*cv*PI;
Fbs=fbg*f*mn*Yg*PI;
Fw=Dg*f*kw*Q/(psi*psi);
}
Fi=(21*v*(c*f*psi*psi+Ft)*psi)/(21*v+(sqrt(c*f*psi*psi+Ft)));
Fd=Ft+Fi;
printf("\n\n$$$$$$$$$$$$$$$$$$HELICAL GEAR DESIGN$$$$$$$$$$$$$$$$$$");
printf("\n\n\tFbs=%f",Fbs);
printf("\n\tFt=%f",Ft);
printf("\n\tFw=%f",Fw);
printf("\n\tFd=%f",Fd);
if ((Fw>Fd)&&(Fbs>Fd))
{
printf("\n\nDesign is Safe.");
}
if ((Fbs<Fd)&&(Fw<Fd))
{

printf("\nDesign is not SAFE at all.Heat Treatment is required");


}
getch();
}
/*DESIGN fOR STEEL HELICAL GEAR WITH 20 DEGREE NORMAL PRESSURE ANGLE*/
#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<math.h>
void main()
{
clrscr();
float alpha,alpha1,P,Np,Ng,G,Sp,Sg,Tp,Tg,m,b,Dp,Dg;
float v,Kv,yp,yg,Ft,syp,syg,Q,BHN,Zp,Zg,mn,pi,Fw,Fs,Kw;
int opt;
pi=3.14159;
printf("\n\t\t\t\tDESIGN Of HELICAL GEAR");
printf("\nENTER fOLLOWING VALUES");
printf("\nENTER THE GEAR RATIO =\t\t\t\t\t");
scanf("%f",&G);
printf("\nENTER TRANSVERSE MODULE IN mm =\t\t\t\t");
scanf("%f",&m);
printf("\nENTER PINION SPEED IN RPM =\t\t\t\t");
scanf("%f",&Np);
printf("\nENTER HELIX ANGLE IN DEGREES =\t\t\t\t");

scanf("%f",&alpha1);
alpha=cos((alpha1*pi)/180);
printf("\nENTER ALLOWABLE WORKING STRESS fOR PINION IN MPa =\t");
scanf("%f",&Sp);
printf("\nENTER ALLOWABLE WORKING STRESS fOR GEAR IN MPa =\t");
scanf("%f",&Sg);
printf("\nENTER BHN =\t\t\t\t\t\t");
scanf("%f",&BHN);
Kw=0.16*(BHN/100)*(BHN/100);
Q=(2*G)/(G+1);
b=14*m;
Ng=(Np/G);
printf("\nSELECT TOOTH SYSTEM:\n 1. 20 DEGREE FULL DEPTH\n 2. 20 DEGREE STUB");
printf("\nENTER YOUR OPTION=\t");
scanf("\t%d",&opt);
if(opt==1)
{
Tp=18;
Tg=(G*Tp);
mn=(m*alpha);
Zp=(Tp/(alpha*alpha*alpha));
Zg=(Tg/(alpha*alpha*alpha));
Dp=(Zp*m)/alpha;
Dg=(Zg*m)/alpha;
yp=(.154-(.912/Zp));

yg=(.154-(.912/Zg));
syg=yg*Zg;
syp=yp*Zp;
if(syg>syp)
{
printf("\nPINION IS WEAKER THEREFORE CALUCULATION ARE BASED ON PINION");
v=(((pi*Dp*Np)/60)/1000);
if((v>=0)&&(v<10))
Kv=(6/(6+v));
if((v>=10)&&(v<=20))
Kv=(5.6/(5.6+sqrt(v)));
Ft=Sp*b*mn*yp*Kv*pi;
Fs=Sp*b*mn*yp;
Fw=(Dp*b*Kw*Q)/(alpha*alpha);
}
if(syp>syg)
{
printf("\nGEAR IS WEAKER THEREfORE CALUCULATION ARE BASED ON GEAR");
v=(((pi*Dg*Ng)/60)/1000);
if((v>=0)&&(v<10))
Kv=6/(6+v);
if((v>=10)&&(v<=20))
Kv=(5.6/(5.6+sqrt(v)));
}
}

if(opt==2)
{
Tp=14;
Tg=(G*Tp);
mn=(m*alpha);
Zp=(Tp/(alpha*alpha*alpha));
Zg=(Tg/(alpha*alpha*alpha));
Dp=(Zp*m)/alpha;
Dg=(Zg*m)/alpha;
yp=(.175-.841/Zp);
yg=(.175-.841/Zp);
syg=yg*Zp;
syp=yp*Zp;
if(syg>syp)
{
printf("\PINION IS WEAKER THEREfORE CALUCULATION ARE BASED ON PINION");
v=(((pi*Dp*Np)/60)/1000);
if((v>=0)&&(v<10))
Kv=6/(6+v);
if((v>=10)&&(v<=20))
Kv=(5.6/(5.6+sqrt(v)));
Ft=Sp*b*mn*yp*Kv*pi;
Fs=Sp*b*mn*yp;
Fw=(Dp*b*Kw*Q)/(alpha*alpha);
}

if(syp>syg)
{
printf("\nGEAR IS WEAKER THEREfORE CALUCULATION ARE BASED ON GEAR");
v=(((pi*Dg*Ng)/60)/1000);
if((v>=0)&&(v<10))
Kv=6/(6+v);
if((v>=10)&&(v<=20))
Kv=(5.6/(5.6+sqrt(v)));
}
}
if(syg>syp)
{
}
if(syp>syg)
{
Ft=Sg*b*mn*yg*Kv*pi;
Fs=Sg*b*mn*yg;
Fw=(Dg*b*Kw*Q)/(alpha*alpha);
}
printf("\n\BEAM STRENGTH =\t\%f N",Fs);
printf("\n\TANGENTIAL LOAD = %f N",Ft);
printf("\n\WEAR LOAD =\t\%f N",Fw);
P=Ft*v;
printf("\n\POWER RATING = %f KW",P);
if (Fs>Fw)

{
printf("\nDESIGN IS SAFE");
}
else
printf("\nDESIGN IS NOT SAFE PLEASE START PROGRAME AGAIN AND RE-ENTER VALUES");
exit;
getch();
}
/*CALCULATION FOR DETERMINING SPRING CONSTANT FOR HELICAL SPRINGS OF CIRCULAR WIRE*/
#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<math.h>
void main()
{
clrscr();
float Do,D,d,n,F,G,W,T1,C,p,s,pi,T2,T,MT,K,l,Lf,a,b,e;
int opt;
pi=3.14159;
printf("\nENTER FOLLOWING VALUES");
printf("\n\nENTER OUTER DIAMETER OF COIL IN mm =\t\t\t\t");
scanf("%f",&Do);
printf("\nENTER WIRE DIAMETER mm =\t\t\t\t\t");
scanf("%f",&d);
printf("\nENTER NUMBER OF ACTIVE COILS =\t\t\t\t\t");

scanf("%f",&n);
printf("\nENTER AXIAL LOAD N =\t\t\t\t\t\t");
scanf("%f",&W);
printf("\nENTER MODULUS OF RIGIDITY FOR SPRING MATERIAL KN/sq.mm =\t");
scanf("%f",&G);
D=Do-d;
C=D/d;
Lf=(n*d)+(n-1);
p=Lf/(n-1);
printf("\n\nMEAN DIAMETER OF COIL = %f mm",D);
printf("\n\nPITCH OF COILS =\t %f mm",p);
printf("\n\nWAHL'S STRESS FACTOR = %f",C);
T1=(8*W*D)/(pi*pow(d,3));
T2=(4*W)/(pi*pow(d,2));
printf("\n\nSELECT EDGE OF WIRE \n 1. INNER EDGE \n 2. OUTER EDGE");
printf("\nENTER YOUR OPTION = ");
scanf("%d",&opt);
if(opt==1)
{
T=T1+T2;
printf("\nRESULTANT SHEAR STRESS INDUCED IN WIRE =\t%f N",T);
}
if(opt==2)
{
T=T1-T2;

printf("\nRESULTANT SHEAR STRESS INDUCED IN WIRE =\t%f N",T);


}
a=(4*C)-1;
b=(4*C)-4;
e=.615/C;
K=(a/b)+e;
MT=(K*8*W*D)/(pi*pow(d,3));
printf("\n\nMAXIMUM SHEAR STRESS INDUCED IN WIRE =\t\t%f N",MT);
l=pi*D*n;
printf("\n\nTOTAL ACTIVE LENGTH OF WIRE =\t\t\t%f mm",l);
s=(8*W*n*pow(C,3))/(G*1000*d);
F=W/s;
printf("\n\nSPRING CONSTANT= %f N/mm ",F);
getch();
}
/*DESIGN OF ROLLING CONTACT BEARING*/
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<process.h>
void main()
{
clrscr();
float Fr,Fa,N,Rtd,Co,X,Y,V,K,Lh,L,C,Pe,Wd,Aly;
printf("\nENTER FOLLOWING VALUES");

printf("\nENTER RADIAL LOAD IN N =\t\t\t\t");


scanf("%f",&Fr);
printf("\nENTER AXIAL LOAD IN N =\t\t\t\t\t");
scanf("%f",&Fa);
printf("\nENTER OPERATING SPEED IN RPM =\t\t\t\t");
scanf("%f",&N);
printf("\nENTER AVERAGE EXPECTED LIFE OF BEARING IN YEARS =\t");
scanf("%f",&Aly);
printf("\nENTER RUNNING TIME IN HOURS (1 to 24) PER DAY =\t\t");
scanf("%f",&Rtd);
printf("\nENTER STATIC LOAD CAPACITY IN N =\t\t\t");
scanf("%f",&Co);
Wd=300;
V=1;
K=3;
printf("\nDEFAULT DATA TAKEN:");
printf("\n1. WORKING DAYS =\t\t%f DAYS",Wd);
printf("\n2. ROTATIONAL FACTOR =\t\t%f",V);
X=Fa/Fr;
Y=Fa/Co;
Pe=(X*V*Fr)+(Y*Fa);
Lh=Aly*Wd*Rtd;
L=60*N*Lh;
C=Pe*pow(L/pow(10,6),(1/K));
printf("\n\nDYNAMIC EQUIVALENT RADIAL LOAD =\t%f N",Pe);

printf("\nLIFE OF BEARING =\t\t\t%f HOURS",Lh);


printf("\nLIFE OF BEARING IN REVOLUTION =\t\t%f",L);
printf("\nBASIC DYNAMIC LOAD RATING =\t\t%f N",C);
if((Lh>=500)&&(Lh<1500))
printf("\n LIFE OF BEARING %f HOURS THEREFORE BEARING IS USED IN AIRCRAFT ENGINES",Lh);
if((Lh>=1500)&&(Lh<2500))
printf("\n LIFE OF BEARING %f HOURS THEREFORE BEARING IS USED IN HEAVY CAR/TRUCK",Lh);
if((Lh>=2500)&&(Lh<5000))
printf("\n LIFE OF BEARING %f HOURS THEREFORE BEARING IS USED IN AGRICULTURAL
EQUIPMENT",Lh);
if((Lh>=5000)&&(Lh<6000))
printf("\n LIFE OF BEARING %f HOURS THEREFORE BEARING IS USED IN SMALL COLD MILLS",Lh);
if((Lh>=6000)&&(Lh<10000))
printf("\n LIFE OF BEARING %f HOURS THEREFORE BEARING IS USED IN LARGE MULTIPURPOSE
MILLS",Lh);
if((Lh>=10000)&&(Lh<15000))
printf("\n LIFE OF BEARING %f HOURS THEREFORE BEARING IS USED IN MEDIUM ELECTRICAL
MAOTORS",Lh);
if((Lh>=15000)&&(Lh<25000))
printf("\n LIFE OF BEARING %f HOURS THEREFORE BEARING IS USED IN PROPELLER THRUST
BEARINGS",Lh);
if((Lh>=25000)&&(Lh<40000))
printf("\n LIFE OF BEARING %f HOURS THEREFORE BEARING IS USED IN LOCOMOTIVE AXLE BOXES",Lh);
if((Lh>=40000)&&(Lh<50000))
printf("\n LIFE OF BEARING %f HOURS THEREFORE BEARING IS USED IN MINE VENTILATION FANS",Lh);
if(Lh>=50000)
printf("\n LIFE OF BEARING %f HOURS THEREFORE BEARING IS USED IN RAIL VECHICALS",Lh);

if(Lh<500)
printf("\n BEARING IS USED FOR SPECIAL PURPOSE");
getch();
}
/*DESIGN OF SLIDING CONTACT BEARING FOR CENTRIFUGAL PUMP USING SAE10 OIL*/
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<process.h>
void main()
{
clrscr();
float W,N,to,ta,p,t,x,C,l,d,K,c,f,k,Qg,Qd;
float Qa,m,S,mu,cr,bcn,pi;
pi=3.14159;
printf("\nENTER FOLLOWING VALUES");
printf("\nENTER LOAD ON JOURNAL IN N =\t\t\t\t\t\t");
scanf("%f",&W);
printf("\nENTER SPEED OF JOURNAL IN RPM =\t\t\t\t\t\t");
scanf("%f",&N);
printf("\nENTER LIMITING TEMPERATURE RISE IN DEGREE CELCIUS =\t\t\t");
scanf("%f",&t);
printf("\nENTER VALID LENGTH TO DIAMETER RATIO OF JOURNAL BETWEEN 1 TO 2 =\t");
scanf("%f",&x);
printf("\nENTER HEAT DISSIPATION COEFFICIENT IN W/sq.m*degree celcius =\t\t");

scanf("%f",&C);
printf("\nENTER SPECIFIC HEAT OF OIL(1800 to 2100 KJ/Kg/Degree celcius) =\t\t");
scanf("%f",&S);
mu=0.017;
d=100;
cr=0.0013;
to=55;
ta=15.5;
printf("\nDEFAULT DATA FOR SAE10 GRADE OIL AND CENTRIFUGAL PUMP IS AS:");
printf("\n1. ABSOLUTE VISCOSITY =\t\t\t%fKg/ms",mu);
printf("\n2. DIAMETER OF JOURNAL =\t\t%fmm",d);
printf("\n3. CLEARANCE RATIO(c/d) =\t\t%f",cr);
printf("\n4. ABSOLUTE TEMPERATURE =\t\t%fDEGREE CELSIUS",to);
printf("\n5. AMBIENT TEMPERATURE =\t\t%fDEGREE CELSIUS",ta);
l=d*x;
p=W/(l*d);
bcn=(mu*N)/p;
K=(mu*N)/(3*p);
printf("\n\nLENGTH OF BEARING =\t\t\t%fmm",l);
printf("\nPRESSURE =\t\t\t\t%fN/sq.mm",p);
printf("\nBEARING CHARACTERSTIC NUMBER =\t\t%f",bcn);
printf("\nBEARING MODULUS =\t\t\t%f",K);
k=0.002;
f=((33/pow(10,8))*bcn*(1/cr))+k;
printf("\nCOEFFICIENT OF FRICTION FROM MACKEES EQN =\t%f",f);

Qg=(f*W*pi*N*d)/60000;
printf("\n\HEAT GENERATED =\t\t\t\t%fW",Qg);
Qd=(C*l*d*(to-ta))/2000000;
printf("\n\HEAT DISSIPATED =\t\t\t\t%fW",Qd);
Qa=Qg-Qd;
m=Qa/(S*t);
if(Qg>Qd)
{
printf("\nAMOUNT OF ARTIFICIAL COOLING REQUIRED =\t\t%fW",Qa);
printf("\nMASS OF ARTIFICIAL COOLING REQUIRED =\t\t%fKg/s",m);
}
else
printf("\nNO COOLING IS REQUIRED");
getch();
}
SPUR BASIC
#include<stdio.h>
#include<conio.h>
void main()
{
float t,d,a,cp,pd,m,D,wd,wh,od,rd,bd;
clrscr();
printf("\t\t\t DESIGN OF GEAR\n\n");
printf("\n\t\t ENTER THE FOLLOWING DATA\n\n");
printf("\n\n ENTER THE NUMBER OF TEETH =\t");

scanf("%f",&t);
printf("\n\n ENTER THE DIAMETRICAL PITCH =\t");
scanf("%f",&d);
printf("\n\n ENTER THE PRESSURE ANGLE =\t");
scanf("%f",&a);
printf("\n\n\t\t GEAR DESIGN PARAMETERS ARE FOLLOWING\n\n");
pd=(t/d);
printf("\n\n PITCH DIAMETER =\t%f",pd);
cp=(3.14*pd)/t;
printf("\n\n CIRCULAR PITCH =\t%f",cp);
m=(1/d);
printf("\n\n ADDENDUM =\t\t%f",m);
D=(1.25*m);
printf("\n\n DEDENDUM = \t\t%f",D);
wd=(2*m);
printf("\n\n WORKING DEPTH = \t%f",wd);
wh=(2.25*m);
printf("\n\n WHOLE DEPTH = \t\t%f",wh);
od=((t+2)*m);
printf("\n\n OUTSIDE DIAMETER =\t%f",od);
rd=((t-2)*m);
printf("\n\n ROOT DIAMETER = \t%f",rd);
getch();
}
/* DESIGN OF SPUR GEAR FOR POWER RATING BASED ON STRENGTH */

#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<process.h>
void main()
{
clrscr();
float Np,G,Sp,Sg,Tp,Tg,m,b,Dp,Dg;
float v,Kv,yp,yg,Ft,P,pi,syp,syg;
int op1;
pi=3.14159;
printf("\t\DESIGN OF SPUR GEAR");
printf("\nENTER FOLLOWING VALUES");
printf("\nENTER SPEED OF PINION IN RPM =\t\t\t");
scanf("%f",&Np);
printf("\nENTER ALLOWABLE STRESS ON PINION(in MPa) =\t");
scanf("%f",&Sp);
printf("\nENTER ALLOWABLE STRESS ON GEAR(in MPa) =\t");
scanf("%f",&Sg);
printf("\nENTER GEAR RATIO =\t\t\t\t");
scanf("%f",&G);
printf("\nENTER VALUE OF MODULE IN MM=\t\t\t");
scanf("%f",&m);
printf("PLEASE SELECT A TOOTH SYSTEM:\n 1. 20 DEGREE FULL DEPTH\n 2. 20 DEGREE STUB\n 3. 14.5
DEGREE FULL DEPTH\n 4. 14.5 DEGREE COMPOSITE\n");
printf("\nENTER YOUR OPTION =\t");

scanf("%d",&op1);
if(op1==1)
{
Tp=18;
Tg=G*Tp;
yp=0.154-(.912/Tp);
yg=.154-(.912/Tg);
Dp=Tp*(m/1000);
Dg=(G*Tg)/1000;
syp=Sp*yp;
syg=Sg*yg;
if(syg>syp)
{
printf("\nPINION IS WEAKER THEREFORE CALUCULATION WILL BE BASED ON PINION");
v=(pi*Dp*Np)/60;
if((v>=10&&v<20))
Kv=6/(6+v);
if(v>=0&&v<10)
Kv=3/(3+v);
if(v>20)
Kv=5.6/(5.6+sqrt(v));
}
if(syp>syg)
{
printf("\nGERA IS WEAKER THEREFORE CALCULATION ARE BASED ON GEAR");

v=((pi*Dg*(Np/G))/60);
if((v>=10)&&(v<20))
Kv=6/(6+v);
if(v>=0&&v<10)
Kv=3/(3+v);
if(v>20)
Kv=5.6/(5.6+sqrt(v));
}
}
if(op1==2)
{
Tp=14;
Tg=G*Tp;
yp=0.175-(.841/Tp);
yg=.175-(.841/Tg);
Dp=Tp*(m/1000);
Dg=(G*Tg)/1000;
syp=Sp*yp;
syg=Sg*yg;
if(syg>syp)
{
printf("\nPINION IS WEAKER THEREFORE CALUCULATION WILL BE BASED ON PINION");
v=(pi*Dp*Np)/60;
if((v>=10)&&(v<20))
Kv=6/(6+v);

if(v>=0&&v<10)
Kv=3/(3+v);
if(v>20)
Kv=5.6/(5.6+sqrt(v));
}
if(syp>syg)
{
printf("\nGERA ISWEAKER THEREFORE CALCULATION ARE BASED ON GEAR");
v=((pi*Dg*(Np/G))/60);
if((v>=10)&&(v<20))
Kv=6/(6+v);
if(v>=0&&v<10)
Kv=3/(3+v);
if(v>20)
Kv=5.6/(5.6+sqrt(v));
}
}
if(op1==3)
{
Tp=32;
Tg=G*Tp;
yp=0.124-(.684/Tp);
yg=.124-(.684/Tg);
Dp=Tp*(m/1000);
Dg=(G*Tg)/1000;

syp=Sp*yp;
syg=Sg*yg;
if(syg>syp)
{
printf("\nPINION IS WEAKER THEREFORE CALUCULATION WILL BE BASED ON PINION");
v=(pi*Dp*Np)/60;
if((v>=10)&&(v<20))
Kv=6/(6+v);
if(v>=0&&v<10)
Kv=3/(3+v);
if(v>20)
Kv=5.6/(5.6+sqrt(v));
}
if(syp>syg)
{
printf("\nGERA ISWEAKER THEREFORE CALCULATION ARE BASED ON GEAR");
v=((pi*Dg*(Np/G))/60);
if((v>=10)&&(v<20))
Kv=6/(6+v);
if(v>=0&&v<10)
Kv=3/(3+v);
if(v>20)
Kv=5.6/(5.6+sqrt(v));
}
}

if(op1==4)
{
Tp=18;
Tg=G*Tp;
yp=0.124-(.684/Tp);
yg=.124-(.684/Tg);
Dp=Tp*(m/1000);
Dg=(G*Tg)/1000;
syp=Sp*yp;
syg=Sg*yg;
if(syg>syp)
{
printf("\nPINION IS WEAKER THEREFORE CALUCULATION WILL BE BASED ON PINION");
v=(pi*Dp*Np)/60;
if((v>=10)&&(v<20))
Kv=6/(6+v);
if(v>=0&&v<10)
Kv=3/(3+v);
if(v>20)
Kv=5.6/(5.6+sqrt(v));
}
if(syp>syg)
{
printf("\nGERA ISWEAKER THEREFORE CALCULATION ARE BASED ON GEAR");
v=((pi*Dg*(Np/G))/60);

if((v>=10)&&(v<20))
Kv=6/(6+v);
if(v>=0&&v<10)
Kv=3/(3+v);
if(v>20)
Kv=5.6/(5.6+sqrt(v));
}
}
b=14*m;
if(syg>syp)
Ft=Sp*Kv*b*m*pi*yp;
else
Ft=Sg*Kv*b*m*pi*yg;
P=Ft*v;
printf("\n\BEAM STRENGTH OF TOOTH =\t\t%fN",Ft);
printf("\n\POWER RATING ON THE BASIS OF STRENGTH = %fKW",P);
getch();
}
SPUR GEAR
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<process.h>
#define PI 3.1415
void main()

{
clrscr();
float tp,tg,m,Np,fbp,fbg,k,c,G,Q,Dp,Dg,Ng;
float v,b,cv,Yp,Yg,st_g,st_p,Ft,Fbs,Fw,Fi,Fd ;
int choice,ch,Y,N;
printf("\t\t\tDESIGN FOR SPUR GEAR\n\n");
printf("\n\t\tEnter the Following Values\n\n");
printf("Number of Teeth on Pinion(tp):\t ");
scanf("%f",&tp);
printf("\nEnter Gear ratio(G):\t ");
scanf("%f",&G);
printf("\nTransverse Module(m) in mm:\t ");
scanf("%f",&m);
printf("\nPinion Speed(Np) in Rpm:\t ");
scanf("%f",&Np);
printf("\nSafe working Strength for pinion(fbp) in Mpa:\t ");
scanf("%f",&fbp);
printf("\nSafe working Strength for Gear(fbg) in Mpa:\t ");
scanf("%f",&fbg);
printf("\nLoad stress factor(k):\t");
scanf("%f",&k);
printf("\nDynamic load factor(c):\t");
scanf("%f",&c);
tg=(G*tp);
Ng=(Np/G);

Q=(2*G)/(G+1);
Dp=tp*m;
Dg=tg*m;
b=12*m;
printf("\nSelect a tooth system:\n 1.20 FD system\n 2.20 stub teeth\n 3.14.5 FD system\n ");
printf("\nEnter your option:\t");
scanf("\t%d",&choice);
if(choice==1)
{
Yp=(.154-(.912/tp));
Yg=(.154-(.912/tg));
st_g=Yg*fbg;
st_p=Yp*fbp;
if(st_g>st_p)
{
printf("\nPinion is weaker. design is based on Pinion");
v=(((PI*Dp*Np)/60)/1000);
if(v>=0&&v<10);
cv=3/(3+v);
if((v>=10)&&(v<20))
cv=6/(6+v);
if(v>20)
cv=5.6/(5.6+sqrt(v));
}
if(st_p>st_g)

{
printf("\nGear is weaker. design is based on Gear");
v=(((PI*Dg*Ng)/60)/1000);
if(v>=0&&v<10)
cv=3/(3+v);
if((v>=10)&&(v<20))
cv=6/(6+v);
if(v>20)
cv=5.6/(5.6+sqrt(v));
}
}
if(choice==2)
{
Yp=(.175-.841/tp);
Yg=(.175-.841/tg);
st_g=Yg*fbg;
st_p=Yp*fbp;
if(st_g>st_p)
{
printf("\nPinion is weaker. design is based on pinion");
v=(((PI*Dp*Np)/60)/1000);
if(v>=0&&v<10)
cv=3/(3+v);
if((v>=10)&&(v<20))
cv=6/(6+v);

if(v>20)
cv=5.6/(5.6+sqrt(v));
}
if(st_p>st_g)
{
printf("\nGear is weaker. design is based on Gear");
v=(((PI*Dg*Ng)/60)/1000);
if(v>=0&&v<10)
cv=3/(3+v);
if((v>=10)&&(v<20))
cv=6/(6+v);
if(v>20)
cv=5.6/(5.6+sqrt(v));
}
}
if(choice==3)
{
Yp=(.124-.864/tp);
Yg=(.124-.864/tg);
st_g=Yg*fbg;
st_p=Yp*fbp;
if(st_g>st_p)
{
printf("\nPinion is weaker. design is based on Pinion");
v=(((PI*Dp*Np)/60)/1000);

if(v>=0&&v<10)
cv=3/(3+v);
if((v>=10)&&(v<20))
cv=6/(6+v);
if(v>20)
cv=5.6/(5.6+sqrt(v));
}
if(st_p>st_g)
{
printf("\nGear is weaker. design is based on Gear");
v=(((PI*Dg*Ng)/60)/1000);
if(v>=0&&v<10)
cv=3/(3+v);
if((v>=10)&&(v<20))
cv=6/(6+v);
if(v>20)
cv=5.6/(5.6+sqrt(v));
}
}
if((choice==0)||(choice>3))
{
printf("Wrong Choice Entered");
exit;
}
if(st_g>st_p)

{
Ft=fbp*cv*b*m*PI*Yp;
Fbs=fbp*b*m*PI*Yp;
Fw=Dp*b*k*Q;
}
if(st_p>st_g)
{
Ft=fbg*cv*b*m*PI*Yg;
Fbs=fbg*b*m*PI*Yg;
Fw=Dg*b*k*Q;
}
Fi=(21*v*(c*b+Ft))/(21*v+(sqrt(c*b+Ft)));
Fd=Ft+Fi;
printf("\n\n$$$$$$$$$$$$$$$$$$SPUR GEAR DESIGN$$$$$$$$$$$$$$$$$$");
printf("\n\n\tFbs=%f",Fbs);
printf("\n\tFt=%f",Ft);
printf("\n\tFw=%f",Fw);
printf("\n\tFd=%f",Fd);
if((Fw>Fd)&&(Fbs>Fd))
{
printf("\n\nDesign is Safe.");
}
if((Fbs<Fd)&&(Fw<Fd))
{
printf("\nDesign is not SAFE at all. Heat Treatment is required\n");

}
getch();
}
/*

DESIGN OF WORMGEAR*/

#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<process.h>
void main()
{
clrscr();
float G,c,kp,nw,Sb,dw,Pc,ma,Dg,yg,laNgle,km,Ft,PS,PW;
float Tg,b,Ng,Vg,Vw,v,q,kv,Fs,Fw,Fd,yp,PD,l,pi;
int opt;
pi=3.14159;
printf("\nENTER FOLLOWING VALUES");
printf("\nENTER GEAR RATIO =\t\t\t\t");
scanf("%f",&G);
printf("\nENTER CENTRAL DISTANCE IN mm =\t\t\t");
scanf("%f",&c);
printf("\nENTER PRESSURE CONSTANT =\t\t\t");
scanf("%f",&kp);
printf("\nENTER MATERIAL COMBINATION FACTOR =\t\t");
scanf("%f",&km);
printf("\nENTER SPEED OF WORM IN RPM =\t\t\t");

scanf("%f",&nw);
printf("\nENTER SAFE WORKING STRESS FOR WORM IN MPa =\t");
scanf("%f",&Sb);
dw=(pow((c/1000),0.875)/3.48)*1000;
Pc=(dw/3);
ma=(Pc/pi);
Dg=(2*c-dw);
nw=(Dg/(G*ma));
PD=(3650*pow((c/1000),1.7)/(G+5));
Vw=((pi*dw*nw)/60)/1000;
v=(2.3/(2.3+Vw+((3*Vw)/G)));
q=(G/(G+2.5));
PW=((nw*kp*q*v)/G);
Ng=(nw/G);
Vg=((pi*Dg*Ng)/60)/1000;
Tg=(Dg/ma);
l=(Pc*(4.5+(Tg/50)));
kv=(6/(6+Vg));
b=(0.73*dw);
printf("\nSELECT PRESSURE ANGLE\n 1. 20 DEGREE\n 2. 14.5 DEGREE\n 3. 25 DEGREE\n 4. 30 DEGREE ");
printf("\nENTER YOUR OPTION =\t");
scanf("\t%d",&opt);
if(opt==1)
{
yg=0.125;

}
if(opt==2)
{
yg=.1;
}
if(opt==3)
{
yg=.15;
}
if(opt==4)
{
yg=.175;
}
Ft=Sb*kv*b*pi*yg*ma;
Fs=Sb*b*pi*ma*yg;
Fw=(Dg*b*km)/1000;
PS=(Ft*Vg)/1000;
Fd=(Ft*((6+Vg)/6));
printf("\n\AXIAL LENGTH =\t\t\t\t%f mm",l);
printf("\n\POWER BASED ON HEAT DISSIPATION =\t%f KW",PD);
printf("\n\POWER BASED ON BEAM STRENGTH =\t\t%f KW",PS);
printf("\n\POWER BASED ON WEAR =\t\t\t%f KW",PW);
printf("\n\BEAM STRENGTH =\t\t\t\t%f N",Fs);
printf("\n\TANGENTIAL LOAD =\t\t\t%f N",Ft);
printf("\n\WEAR LOAD =\t\t\t\t%f N",Fw);

printf("\n\DYNAMIC LOAD =\t\t\t\t%f N",Fd);


if((Fs<Fd)&&(Fw<Fd))
{
printf("\nDESIGN IS NOT SAFE EXIT PROGRAM AND RE-ENTER VALUES");
}
else
printf("\nDESIGN IS SAFE");
getch();
}
WORM GEAR
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<process.h>
#define PI 3.1415
void main()
{
clrscr();
float g,c,k1,Nw,fbw,k,dw,pc,ma,dg,Yg,psi,K,ft,l,nw;
float tg,b,Ng,al1,al,vg,vw,v,q,kv,p,p1,fbs,fw,fd,Yp,p2 ;
int choice;
printf("\t\t\tDESIGN FOR WORM GEAR\n\n");
printf("\n\t\tEnter the Following Values\n\n");
printf("\nEnter the gear ratio:\t");
scanf("%f",&g);

printf("\nEnter Central distance:\t ");


scanf("%f",&c);
printf("\nEnter the pressure constant:\t");
scanf("%f",&k1);
printf("\nEnter the material combination factor:\t");
scanf("%f",&k);
printf("\nWorm Gear Speed(Np) in Rpm:\t ");
scanf("%f",&Nw);
printf("\nSafe working Strength for worm gear(fbp) in Mpa:\t ");
scanf("%f",&fbw);
dw=(pow((c/1000),0.875)/3.48)*1000;
pc=(dw/3);
ma=(pc/PI);
dg=(2*c-dw);
nw=(dg/(g*ma));
al1=atan((ma*nw)/dw);
al=((al1*180)/PI);
p1=(3650*pow((c/1000),1.7)/(g+5));
vw=((PI*dw*Nw)/60)/1000;
v=(2.3/(2.3+vw+((3*vw)/g)));
q=(g/(g+2.5));
p=((Nw*k1*q*v)/g);
Ng=(Nw/g);
vg=((PI*dg*Ng)/60)/1000;
tg=(dg/ma);

l=(pc*(4.5+(tg/50)));
kv=(6/(6+vg));
b=(0.73*dw);
if(al<=10)
k=k;
if(al>10&&al<25)
k=1.25*k;
if(al>25)
k=1.5*k;
printf("\nSelect a tooth system:\n 1.20 FD system\n 2.20 stub teeth\n 3.14.5 FD system\n ");
printf("\nEnter your option:\t");
scanf("\t%d",&choice);
if(choice==1)
{
Yg=(.154-(.912/tg));
}
if(choice==2)
{
Yg=(.175-.841/tg);
}
if(choice==3)
{
Yg=(.124-.864/tg);
}
if((choice==0)||(choice>3))

{
printf("Wrong Choice Entered");
exit;
}
ft=fbw*kv*b*PI*Yg*ma;
fbs=fbw*b*PI*ma*Yg;
fw=(dg*b*k)/1000;
p2=(ft*vg)/1000;
fd=(ft*((6+vg)/6));
printf("\n\n$$$$$$$$$$$$$$$$$$WORM GEAR DESIGN$$$$$$$$$$$$$$$$$$");
printf("\n\nAxial length of worm gear=%f",l);
printf("\n\n$$$$$$$ON POWER BASIS$$$$$$$");
printf("\n\n\tPower on heat dissipation=%f",p1);
printf("\n\n\tPower on beam strength=%f",p2);
printf("\n\n\tPower based on wear=%f",p);
printf("\n\n$$$$$$$ON LOAD BASIS$$$$$$$");
printf("\n\n\tFbs=%f",fbs);
printf("\n\n\tFt=%f",ft);
printf("\n\n\tFw=%f",fw);
printf("\n\n\tFd=%f",fd);
if((fw>=fd)&&(fbs>=fd))
{
printf("\n\nDesign is Safe.");
}
if((fbs<fd)&&(fw<fd))

{
printf("\nDesign is not SAFE at all. Heat Treatment is required\n");
}
getch();
}

You might also like