C PROGRAM of Machine Design
C PROGRAM of Machine Design
C PROGRAM of Machine Design
(4) Calculations.
5-3. SOFTWARE:
CLanguage is very useful for analysis of the design process because of variety of
statement available to reduce memory and execution time of program. The use of
structures in C-Language allows a structured programming and data based systems
suitable for creation of libraries and the file operation allows for storage of the data on
files. It also permits character and string operation which is required for storage and
printing of names of parts, material etc.
The use of C++ Language allows for the use of classes and objected oriented
programming. The benefit of using classes is the protection of data and installation of
security in programming. The class base programming utilizes the data members and
function members because of which it is very easily possible to create a data base
structure or to perform complex numerical calculations or to handle to difficult graphic
picture likely to be required for analysis and design.
The new technology emerging in the field of software is Java language which is
completely object base programming. In this programming technique classes are used and
the readymade classes can be utilized for preparing user made classes by way of
inheritance and polymorphism. The Java programming technique also provides easy way
of utilizing the classes related to GUI components like menus, buttons, panels and text
fields to allow customization of the software. It also allows for the operation on data base
files and the internet connectivity is very easily available. The use of data structure
allows for the operation on any data base system and the various data base operations like
listing, append, search, locate, sort etc.
The program on design and analysis contain some type of mathematical calculations for
solving the equation. Then for preparing software, we require the variables of the
program. In these variables there are four categories:
The variables used in program may be initially supplied as standard values which are
fixed variable and that variable whose value vary in every run of program and are
supplied through the data entry are known as Input parameters. There are also free
variables used in the program which act like dummy variables are also used for solving
the equation. The functional variables are the output variables which are solved using
stepwise calculation of the program. The mathematical equations are written by stepwise
calculations.
It is necessary in analysis or design program to know the type of input variables and
output variables. These variables can be obtained by writing the required formula in
stepwise format. If the number of unknown variables is equal to number of equation, then
the problem involves a simple procedure for analysis.
In the design of machine element, the selection of suitable material from the directory of
material can be done by storing the materials and their strengths in one directory. It is
sometimes possible to calculate the size of material, but this size may not be a standard
size. Hence the program must select the size from the standard sizes available in market
from the directory. In analysis of a system, we want to locate a particular value of
variable in calculation for a certain limiting condition. This can be done by a computer
program.
If the program carries unknown variables in non-linear equation, then the equations are
solved using trial and error methods. The numerical methods are very useful for solving
such complex equations.
These are the requirements fixed on the basis of the functional specifications of the
component. The component is required to satisfy its functional criteria to operate in a
satisfactory manner and should work efficiently.
The material group parameters are the parameters which specify the properties of
material in terms of stress, modulus of elasticity etc. These are the parameters which
could be obtained from the libraries.
These are the specifications of the requirement of space, dimensions, volume etc. The
geometric requirement of part relates to the standard dimensions and the availability of
space for normal functioning of component.
Prof.ManthanUpadhyayGandhinagarInstituteofTechnology
Consider a simply supported beam with uniformly distributed load (UDL) having span L.
Refer fig. 5-1.
The maximum bending moment of uniformly distributed load over a simple beam is
calculated by following method:
where,
W = uniformly distributed
L = length of span
FIG.
5-1
Prof.ManthanUpadhyayGandhinagarInstituteofTechnology
Program 5-4.
In a machine part design problem a shaft is subjected to a twisting and bending moment
and dimension of shaft are to be calculated.
Prof.ManthanUpadhyayGandhinagarInstituteofTechnology
The program has input values of Bending moment, torque and safe stress of material and
diameter is calculated by using simple arithmetic equation. In case if the shaft is made up
of two types of section solid and hollow section, then the computer program can calculate
the desired section dimension on the basis of types of sections. This can be performed by
fixing the character name for the desired section.
A program given below indicates a shaft subject to following loading condition Refer fig.
5-5.
FIG. 5-5
FIG. 5-6
The shaft can be made up of solid and hollow sections depending upon the requirement.
The computer program calculates the size of shaft for both options.
Prof.ManthanUpadhyayGandhinagarInstituteofTechnology
Program 5-5.
Prof.ManthanUpadhyayGandhinagarInstituteofTechnology
Program 5-7.
Problem:
Prof.ManthanUpadhyayGandhinagarInstituteofTechnology
In design of machine components, the dimensions calculated for the parts do I not
confirm to the standard sizes or the sizes in single decimal value of mm. Therefore, it
becomes necessary to select a higher standard size from the size library. The size library
can be created in the program by use of array variables. The size or dimension calculated
in the programme is compared with the standard size which is available in a array. If the
dimension calculated is less than the standard size then the size is considered to be
selected. The various standards for different components are sizes may be diameter,
length, or section dimension.
Prof.ManthanUpadhyayGandhinagarInstituteofTechnology
Prof.ManthanUpadhyayGandhinagarInstituteofTechnology
Program 5-9.
struct bat
{
float sut;
char name[20];
}f[5];
int a[20]={6,10,12,16,20,25,30,34,40,45,50,55,60,65,70,75,80,85,90,100};
#include<conio.h>
#define P1 22.0/7.0
#include<math.h>
main()
{
struct bat f[5]={
{150.0,Mild steel},
{200.0,Carbon steel},
{230.0,Soft steel},
{250.0,H.S.steel},
{300.0,Carbon Bronze}
}
float bm,syt,p,fs,d,r;int i,j;
printf(Enter the value of bending moment bm &b/d ratio\n);
scanf(%f%f%f,&bm,&r);
clrscr();
{
for(i=0;i<5;++i)
{
syt=f sut/fs;
fs=3.0; /*factor of safety*/
p=(bm*32.0)/(PI*fs);
d=pow(p,0.333);
d=ceil(d);
for(j=0;j<2 0;++j)
{
if(d<=a
{
d=a[j];
Prof.ManthanUpadhyayGandhinagarInstituteofTechnology
else
continue;
}
}
return;
}
In this program the diameter of a dead shaft of rectangular cross-section for the given
bending moment because of the load on the shaft is calculated there are different
materials supplied through a structure in which the name of material and the strength of
material is given. For every material the diameter is calculated and the size of the shaft is
selected from the standard array by using the material size library supplied through an
array.
Program 5-10.
float sut;
float row;
char name[20];
}f[5];
/*density of material in kg per cubic meter*/
int a[10]={2,4,6,8,10,12,14,16,18,20};
#include<conio .h>
#includemath.h
#define P1 22.0/7.0
main()
{
struct bat f [5]={
{150.0,132.0,Mild steel},
{200.0,52.0,Carbon steel},
{250.0,84.0,H.S.steel},
{300.0,30.0,Bronze},
{350.0,1 10.0,Copper}
};
float v,d,h,vm,t,1,w,p,ft,fs,n,x=5000.0 ;int i,j;
clrscr();
Prof.ManthanUpadhyayGandhinagarInstituteofTechnology
printf(Enter dia. of pressure vessel in meter & max press in N/square m\n);
scanf(%f%f,&d,&p);
printf(Enter height of vessel in meters\n);
scanf(%f,&h);
fs=6 .0 ;n 1.0;
for(i=0;i<5;++i)
{
ft=f . sut/fs;
/*allowable stress*/
t=(p*d)/(2.0*ft*n);
/*thickness in m*/
for(j=0;j<=10;++j)
if(t<=a[j])
{
t=a[j];
printf(Standard thickness for material[%d] is t=%g meters\n,i+1,t);
break;
}
else
continue;
}
v=PI*d*d*h/4.0;
/*inside volume in cubic meter*/
vm=((PI*d*h*t)+(PI*d*d*t/2.0)); /*volume of material cubic meter*/
I=PI*d+2.O*d;
/*length of material in meter*/
w=vm*f .row;
/ *total weight of material in kg /*
printf( w=%g\n,w);
/ /*discarding this statement*/
/*If x is maximum weight of the material equal to 5000 kg*/
if(w<=x)
{
printf(Selected Thickness=%g meters\n,t);
printf(Name of selected material is\n);
puts(f[i] .name);
break;
}
else
continue;
getch();
return;
}
/*IF WE GIVE DIA=3.3 METER, PRESSURE=14.0 AND HEIGHT=4.0 THEN THE
RESULTANT THICKNESS IS 2 M AND MATERIAL IS BRONZE*/
Prof.ManthanUpadhyayGandhinagarInstituteofTechnology