c program of machine design

Upload: piyush-baid

Post on 09-Jan-2016

21 views

Category:

Documents


1 download

DESCRIPTION

C PROGRAM of Machine Design

TRANSCRIPT

  • Prof.ManthanUpadhyayGandhinagarInstituteofTechnology

    5-2. STEPS IN DESIGN OF MACHINE PARTS: The design of any machine component is carried out by certain procedure.

    The following steps are followed in design of machine parts:

    (1) Layout with dimensions.

    (2) Force and loads on member.

    (3) Mathematical models and equations.

    (4) Calculations.

    (5) Preparation of drawing.

    (6) Manufacturing drawing. 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.

    5-4. DESIGN AND ANALYSIS:

    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:

    (1) Fixed variables.

    (2) Input parameters.

    (3) Free variables.

    (4) Functional variables.

  • Prof.ManthanUpadhyayGandhinagarInstituteofTechnology

    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.

    5-5. PARAMETERS OF COMPUTER AIDED DESIGN:

    There are three important parameters used in design of machine elements:

    (1) Functional requirement.

    (2) Material group parameter.

    (3) Geometrical requirement.

    5-5-1. Functional requirement:

    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.

    5-5-2. Material group parameter:

    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.

    5-5-3. Geometrical requirement:

    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

    5-6. PROCEDURE FOR CAD SOFTWARE:

    The CAD softwares in Engineering can be prepared by following system:

    (1) Write the main objectives of design.

    (2) Prepare the list of input and output variables.

    (3) Write the required mathematical equations.

    (4) Prepare a flow chart indicating the flow of calculations.

    (5) Write a program using flow chart.

    (6) Perform the trial testing of program. 5-7. DESIGN OF MACHINE ELEMENTS:

    The design of machine components is an important area of mechanical engineering in which Computer Aided Design is used. The design of machine components generally involves the calculations of stress, strain or dimensions of component. There are different type of materials which can be used for machine components as well as there are different types of sections which could be utilized for design of machine components. CAD process provides a convenience to the user to obtain the required result by modifying the data values. The following examples show the variety of designs which could be evolved using CAD process.

    5-8. BENDING MOMENT:

    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

  • Program 5-4.

    Prof.ManthanUpadhyayGandhinagarInstituteofTechnology

    /* PROGRAM TO CALCULATE DIAMETER OF SHAFT */ #include #include #define P1 22.0/7.0 main() { printf(the value of m_funct()= %g\n, m_funct(); } Float m_funct() {

    float tq,fs,s,a,d,p,n; printf(enter the values of power, speed, factor of safety, ultimate strength\n); scanf(%f%f%f%f ,&p, &n, &fs, &ys); tq = P*60/(20*PI*n); a = (tq* 16*fs)/(ys*PI); d = pow(a,0.33); return(d);

    } 5-9-3. Shaft subjected to bending moment and twisting moment:

    In a machine part design problem a shaft is subjected to a twisting and bending moment and dimension of shaft are to be calculated.

    If the shaft is made up of solid shaft, then the modulus of section

    d = diameter of solid shaft

    If the shaft is hollow shaft, then the modulus of section is

  • 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 The main flow chart of program is given in fig 5.6

    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.

  • Program 5-5.

    Prof.ManthanUpadhyayGandhinagarInstituteofTechnology

    /* WRITE A PROGRAM TO CALCULATE DIAMETER OF SHAFT */ #include #define pi 22.0/7.0 float data I (w,a,syt,fs,t) float w,fs,syt,a; {

    float z,m,f,pi,y,x,te; f=syt/fs; m=w*a; te=sqrt(m*m+t*t); z=te/f; y=32.0*z/pi; x=pow(y,0.333) return(x);

    } float data2(w,a,syt,fs,n,t) float w,fs,syt,a,n; {

    float m,f,pi,p,g,te; fsyt/fs; m=w*a; te=sqrt(m*m+t*t); p=((m*32.00)/(f*pi(l.0 l.0/(n*n*n*n))))); g==pow(p,0.3 33); return(g);

    } main() {

    float w,a,syt,fs,d,n,d 1,d2,t;char c; printf(enter the values of w,a,syt,fs,n,c,\n); scanf(%f%f%f%f%f%f%c,&w,&a,&syt,&fs,&n,&t,&c); if(c==s)

    { d=datal (w,a,syt,fs,t); printf(the value of d is %g -c\n,d);

    } else if(c==h) { dl =data2(w,a,syt,fs,n,t); d2=dl/n; printf(the value of dl is%g -cm\n,the value of d2 is%g cm\n,d1,d2);

    } }

  • Program 5-7.

    Prof.ManthanUpadhyayGandhinagarInstituteofTechnology

    /* PROGRAM TO DETERMINE THICKNESS OF THE PLATE*/ #include main() ( float ka,kb,kc,kd,se,se 1 ,l,d,t,p,sut,fs; printf(Enter the value of ka,kb,kc,kd factors \n); scanf(Iof%f%f%f ,&ka,&kb,&kc,&kd); printf(Enter the strength and factor of safety \n); scanf(Iof%f,&sut,&fs); printf(Enter the value of width and diameter of hole \n); scanf(%f%f,&1,&d); sel = 0.5 * sut / fs; se = ka * kb * kc *kd * sel; printf(Enter the load \n); scanf(%f,&p); t = p / ((1 d) * se); printf(Thickness of plate = %g \n,t); }

    5-12. DESIGN OF PRESSURE VESSEL:

    The pressure vessel is a closed vessel subjected to high pressure conditions.

    There are two types of pressure vessels:

    (1) Thin pressure vessel.

    (2) Thick pressure vessel. Here the design of thin pressure vessel is considered. The pressure vessel consists of a circular section cylinder with both ends closed. It is composed of diameter D and length L. Refer fig. 5-13.

    Problem:

  • Prof.ManthanUpadhyayGandhinagarInstituteofTechnology

    514. SELECTION OF STANDARD SIZES:

    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

  • Program 5-9.

    Prof.ManthanUpadhyayGandhinagarInstituteofTechnology

    / WRITE A PROGRAM TO SUPPLY FIVE DIFFERENT MATERIALS AME, STANDARD SIZES AND STRESSES TO THE PROGRAM. CALCULATE LHE DIAMETER OF DEAD SHAFT OF CIRCULAR CROSS-SECTION IVEN BENDING MOMENT.SELECT AND PRINT THE GIVEN MATERIAL ND SELECT STANDARD SIZES OF SHAFT */

    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 #define P1 22.0/7.0 #include 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

  • Prof.ManthanUpadhyayGandhinagarInstituteofTechnology

    } } } return; }

    else continue;

    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.

    /* DESIGN THICKNESS OF A PRESSURE VESSEL OF CYLINDRICAL

    TYPE SUBJECTED TO A MAXIMUM PRESSURE AND OF GIVEN DIAMETER. SELECT THE SIZE OF SHEET FROM THE STANDARD SIZES AVAILABLE IN MARKET AND SPECIALLY THE MATERIAL IF L IS THE LENGTH AND THE DENSITY OF PRESSURE VESSEL, THEN THE WEIGHT OF PRESSURE VESSEL SHEET SHOULD BE BELOW W Kg. ESTIMATE THE VOLUME 0F MATERIAL TO BE STORED IN THE VESSEL. (VOLUME STORED = pi *D*D*H/4;).

    (VOLUME OF MATERIAL =Vm=(PI*D*H*T + PI*D*D*T/4)) */struct bat/*

    {

    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 #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