(Print) Young's Modulus For C++

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 50

DDJ2012

DEFLECTION OF A CANTILEVER
MEMBERS : 1) ILYIA SYAFIRA BINTI AB RAZAK 921216-14-6620 AD 100291 2) NOOR AINI BINTI MOHD JUKI 921201-01-5046 AD100815 3) MUHAMMAD DANIEL PUTRA BIN NORMADANI 921026-01-5523 AD100652

1|DEFLECTION OF A CANTILEVER

BACKGROUND OF YOUNGS MODULUS


Young's modulus is a measure of the stiffness of an elastic material and is a quantity used to characterize materials. It is defined as the ratio of the unaxial stress over the unaxial strain in the range of stress in which Hooke's Law holds. In solid mechanics, the slope of the stress-strain curve at any point is called the tangent modulus. The tangent modulus of the initial, linear portion of a stress-strain curve is called Young's modulus, also known as the tensile modulus. It can be experimentally determined from the slope of a stress-strain curve created during tensile tests conducted on a sample of the material. In anisotropic materials, Young's modulus may have different values depending on the direction of the applied force with respect to the material's structure. It is also commonly called the elastic modulus or modulus of elasticity, because Young's modulus is the most common elastic modulus used, but there are other elastic moduli measured, too, such as the bulk modulus and the shear modulus. Young's modulus is named after Thomas Young, the 19th century British scientist. However, the concept was developed in 1727 by Leonhard Euler, and the first experiments that used the concept of Young's modulus in its current form were performed by the Italian scientist Giordano Riccati in 1782, predating Young's work by 25 years.

UNITS OF YOUNGS MODULUS


Young's modulus is the ratio of stress, which has units of pressure, to strain, which is dimensionless; therefore, Young's modulus has units of pressure. The SI unit of modulus of elasticity (E, or less commonly Y) is the pascal (Pa or N/m or m1kgs2). The practical units used are megapascals (MPa or N/mm) or gigapascals (GPa or kN/mm). In United States customary units, it is expressed as pounds (force) per square inch (psi).

2|DEFLECTION OF A CANTILEVER

USAGE
The Young's modulus calculates the change in the dimension of a bar made of an isotropic elastic material under tensile or compressive loads. For instance, it predicts how much a material sample extends under tension or shortens under compression. Some calculations also require the use of other material properties, such as the shear modulus, density, or Poisson's ratio. It also helps in selection of materials for particular structural applications.

Linear versus non-linear


For many materials, Young's modulus is essentially constant over a range of strains. Such materials are called linear, and are said to obey Hooke's law. Examples of linear materials are steel, carbon fibre and glass. Non-linear materials

include rubber and soils, except under very small strains.

Directional materials
Young's modulus is not always the same in all orientations of a material. Most metals and ceramics, along with many other materials, are isotropic, and their mechanical properties are the same in all orientations. However, metals and ceramics can be treated with certain impurities, and metals can be mechanically worked to make their grain structures directional. These materials then become anisotropic, and Young's modulus will change depending on the direction from which the force is applied. Anisotropy can be seen in many composites as well. For example, carbon fibre has much higher Young's modulus (is much stiffer) when force is loaded parallel to the fibres (along the grain). Other such materials include wood and reinforced concrete. Engineers can use this directional phenomenon to their advantage in creating structures.

3|DEFLECTION OF A CANTILEVER

EXAMPLE OF CALCULATION
Young's modulus, E, can be calculated by dividing the tensile stress by the tensile strain in the elastic (initial, linear) portion of the stress-strain curve:

where E is the Young's modulus (modulus of elasticity) F is the force exerted on an object under tension; A0 is the original cross-sectional area through which the force is applied; L is the amount by which the length of the object changes; L0 is the original length of the object.

Force exerted by stretched or compressed material


The Young's modulus of a material can be used to calculate the force it exerts under specific strain.

In which F is the force exerted by the material when compressed or stretched by L. Hooke's law can be derived from this formula, which describes the stiffness of an ideal spring:

Where;

4|DEFLECTION OF A CANTILEVER

Elastic potential energy


The elastic potential energy stored is given by the integral of this expression with respect to L:

where Ue is the elastic potential energy. The elastic potential energy per unit volume is given by:

, where

is the strain in the material.

This formula can also be expressed as the integral of Hooke's law:

5|DEFLECTION OF A CANTILEVER

SCOPE OF PROJECT
The problem of our project is deflection of cantilever. This problem is about to determine which cross-section of beams that gives the highest deflection. We use YOUNGS MODULUS FORMULA to solve this problem. The reason why we chose YOUNGS MODULUS formula are: We have many types of cross-section We have to calculate all the deflection for every cross-section. We have to list all the cross-section in ascending order and descending order in terms of its corresponding deflection. We solve this problem in the C++ program. As we know C++ program is the best solution for engineering problem. Deflection of cantilever is one of engineering problem. So, the best solution for the problem is using the C ++ program. Other reasons why we use C++ for solving our problem are: We give a menu to the users so that they can choose the information that they want. Customer can input the value of exerted load and the length of the beam. Customer also can choose the types of material and they can read the information in the table given. Material Magnesium Titanium Steel Aluminium Cooper Shear modulus (G) 16(109) 115(109) 250(109) 70(109) 120(109) Young modulus (E) 45(109) 85(109) 145(109) 20(109) 44(109)

6|DEFLECTION OF A CANTILEVER

As the structure of the project of our project: First, we give customer the menu, so that they can choose the information that they want. Second, all the data we input in a file called input. Third, solve the calculation of second moment area in a function called inertia. Fourth, we solve the calculation of maximum deflection in a function called yMaxx. Lastly, we arrange the deflection in ascending order and descending order in a function called asDes.

7|DEFLECTION OF A CANTILEVER

main FUNCTION FLOW-CHART

8|DEFLECTION OF A CANTILEVER

9|DEFLECTION OF A CANTILEVER

10 | D E F L E C T I O N O F A C A N T I L E V E R

INPUT FUNCTION FLOW-CHART

11 | D E F L E C T I O N O F A C A N T I L E V E R

12 | D E F L E C T I O N O F A C A N T I L E V E R

13 | D E F L E C T I O N O F A C A N T I L E V E R

14 | D E F L E C T I O N O F A C A N T I L E V E R

15 | D E F L E C T I O N O F A C A N T I L E V E R

Inertia FUNCTION FLOW-CHART

16 | D E F L E C T I O N O F A C A N T I L E V E R

17 | D E F L E C T I O N O F A C A N T I L E V E R

yMaxx FUNCTION FLOW-CHART

18 | D E F L E C T I O N O F A C A N T I L E V E R

19 | D E F L E C T I O N O F A C A N T I L E V E R

asDes FUNCTION FLOW-CHART

20 | D E F L E C T I O N O F A C A N T I L E V E R

21 | D E F L E C T I O N O F A C A N T I L E V E R

22 | D E F L E C T I O N O F A C A N T I L E V E R

23 | D E F L E C T I O N O F A C A N T I L E V E R

24 | D E F L E C T I O N O F A C A N T I L E V E R

25 | D E F L E C T I O N O F A C A N T I L E V E R

26 | D E F L E C T I O N O F A C A N T I L E V E R

PROGRAM CODING FOR DEFLECTION OF A CANTILEVER


FUNCTION : MAIN #include <cstdlib> #include <string> #include <iostream> #include <fstream> #include <cmath> using namespace std; /*-----declaring functions ------------*/ void input(int,int); void inertia(int); int main() { int error1 = 0; int soalan,pilihan,jenisbahan; char teruskan; teruskan='Y', 'y';

27 | D E F L E C T I O N O F A C A N T I L E V E R

while (teruskan == 'Y'||teruskan == 'y') { cout<<"Sila buat pilihan maklumat yang ingin diketahui : "<<endl; cout<<"1. Nilai I bagi jenis keratan rentas yang berbeza."<<endl; cout<<"2. Nilai ymax bagi keratan rentas yang berbeza."<<endl; cout<<"3. Senarai ymax dalam turutan menaik dan turutan menurun bagi bahan dan keratan rentas berbeza."<<endl; cin>>soalan; cout<<"\n\n";

switch(soalan) { case 1: cout<<"Anda memilih informasi :"<<endl; cout<<"Nilai I bagi jenis keratan rentas yang berbeza."<<endl; cout<<"Sila pilih jenis keratan-rentas "<<endl; cout<<"1. Segi empat sama"<<endl; cout<<"2. Segi empat sama berlubang"<<endl; cout<<"3. Bulatan"<<endl; cout<<"No pilihan anda ialah : "; cin>>pilihan; inertia(pilihan);
28 | D E F L E C T I O N O F A C A N T I L E V E R

break;

case 2 : cout<<"Anda memilih informasi : "<<endl; cout<<"Nilai ymax bagi keratan rentas yang berbeza "<<endl; //minta pengguna memilih maklumat yang dikehendaki cout<<"Sila pilih jenis bahan. "<<endl; cout<<"1. Magnesium "<<endl; cout<<"2. Titanium "<<endl; cout<<"3. Steel"<<endl; cout<<"4. Aluminium"<<endl; cout<<"5. Copper"<<endl; cout<<"Jenis bahan : "<<"\a"; cin>>jenisbahan; input(soalan,jenisbahan); break;

29 | D E F L E C T I O N O F A C A N T I L E V E R

case 3: cout<<"Anda memilih informasi : "<<endl; cout<<"Senarai ymax dalam turutan menaik dan menurun bagi bahan dan keratan rentas berbeza. "<<endl; //minta pengguna memilih maklumat yang dikehendaki cout<<"Sila pilih jenis bahan. "<<endl; cout<<"1. Magnesium "<<endl; cout<<"2. Titanium "<<endl; cout<<"3. Steel"<<endl; cout<<"4. Aluminium"<<endl; cout<<"5. Copper"<<endl; cout<<"Jenis bahan : "; cin>>jenisbahan; input(soalan,jenisbahan); break;

default : cout<<"Anda membuat pilihan yang salah. "<<endl; cout<<"Sila buat pilihan semula. "<<endl; cout<<"TRY TO UNDERSTAND INSTRUCTION\a\a\a\a\a "<<endl; error1=1; }
30 | D E F L E C T I O N O F A C A N T I L E V E R

//Choices? Yes (Y or y) or No (Any other alphabet) cout << "Masukkan Y jika mahu memilih bentuk yang lain: "; cin >> teruskan;

if (teruskan!= 'Y'||teruskan!= 'y') cout << " " << endl; }

cout << "Terima Kasih.\n\n";

return 0; }

31 | D E F L E C T I O N O F A C A N T I L E V E R

FUNCTION NAME: INPUT #include <cstdlib> #include <cmath> #include <iomanip> #include <iostream> #include <fstream> using namespace std; void asDes(double); void yMaxx(double, int); void input(int soalan1,int jenisbahan1) { fstream fin; fin.open("YM.txt"); int x=0, keratan,error1=0; char matl[5][100]; double shear[5], young[5], e; if(soalan1==2) { while (!fin.eof()) {

32 | D E F L E C T I O N O F A C A N T I L E V E R

fin>>matl[x]; fin>>shear[x]; fin>>young[x]; x++; } switch(jenisbahan1) { case 1: e=young[0]; break; case 2: e=young[1]; break; case 3: e=young[2]; break; case 4: e=young[3]; break; case 5: e=young[4]; break;

33 | D E F L E C T I O N O F A C A N T I L E V E R

default: cout<<"Anda membuat pilihan yang salah. "<<endl; cout<<"Sila buat pilihan semula. "<<endl; break; } cout<<"\nSila pilih jenis keratan-rentas "<<endl; cout<<"1. Segi empat sama"<<endl; cout<<"2. Segi empat sama berlubang"<<endl; cout<<"3. Bulatan"<<endl; cout<<"No pilihan anda ialah : "; cin>>keratan; yMaxx(e, keratan); } else if(soalan1==3) { while (!fin.eof()) { fin>>matl[x]; fin>>shear[x]; fin>>young[x]; x++; }

34 | D E F L E C T I O N O F A C A N T I L E V E R

switch(jenisbahan1) { case 1: e=young[0]; break; case 2: e=young[1]; break; case 3: e=young[2]; break; case 4: e=young[3]; break; case 5: e=young[4]; break; default: cout<<"Anda membuat pilihan yang salah. "<<endl; cout<<"Stay away from the laptop. "<<endl; cout<<"It will be explode. \a\a\a\a"<<endl; error1=1; }
35 | D E F L E C T I O N O F A C A N T I L E V E R

if(error1==0) { asDes(e); } } }

36 | D E F L E C T I O N O F A C A N T I L E V E R

FUNCTION NAME: inertia #include <cstdlib> #include <cmath> #include <iomanip> #include <iostream> #include <fstream> using namespace std; void inertia(int pilihan1) { const double PAI=3.142; double a,b,I1; switch(pilihan1) { case 1: cout<<"\nAnda memilih bentuk segi empat sama sisi"<<endl; cout<<"Sila masukkan nilai kelebaran segi empat(b): "<<"\a"; cout<<"b : "<<"\a"; cin>>b; I1=pow(b,4)/12; cout<<"\nNilai momen luas kedua bagi segi empat sama sisi ialah : "<<I1<<endl; break;

37 | D E F L E C T I O N O F A C A N T I L E V E R

case 2: cout<<"\nAnda memilih bentuk segi empat sama sisi dengan lubang."<<endl; cout<<"Sila masukkan nilai kelebaran segi empat (b) dan kelebaran lubang segi empat (a): "<<endl; cout<<"b : "<<"\a"; cin>>b; cout<<"\t a : "<<"\a"; cin>>a; I1=(pow(b,4)-pow(a,4))/12; cout<<"\nNilai momen luas kedua bagi segi empat sama sisi dengan lubang ialah : "<<I1<<endl; break; case 3: cout<<"\nAnda memilih bentuk bulatan. "; cout<<"Sila masukkan diameter bulatan (b): "<<endl; cout<<"b : "; cin>>b; I1=(PAI*pow(b,4))/64; cout<<"\nNilai momen luas kedua bagi bulatan ialah : "<<I1<<endl; break;

38 | D E F L E C T I O N O F A C A N T I L E V E R

default : cout<<"Anda memasukkan pilihan yang salah. "<<endl; cout<<"Sila buat pilihan semula"<<endl; break; } }

39 | D E F L E C T I O N O F A C A N T I L E V E R

FUNCTION NAME: yMaxx #include <cstdlib> #include <cmath> #include <iomanip> #include <iostream> #include <fstream> using namespace std; void yMaxx (double e, int keratan1) { const double PAI=3.142; int m=0,error1=0; double a,b,P,L,I,ymax;

switch(keratan1) { case 1: cout<<"\nAnda memilih bentuk segi empat sama sisi"<<endl; cout<<"Sila masukkan nilai kelebaran segi empat(b): "<<"\a"; cout<<"b : "<<"\a"; cin>>b; I=pow(b,4)/12; break;

40 | D E F L E C T I O N O F A C A N T I L E V E R

case 2: cout<<"\nAnda memilih bentuk segi empat sama sisi dengan lubang."<<endl; cout<<"Sila masukkan nilai kelebaran segi empat (b) dan kelebaran lubang segi empat (a): "<<endl; cout<<"b : "<<"\a"; cin>>b; cout<<"\t a : "<<"\a"; cin>>a; I=(pow(b,4)-pow(a,4))/12; break;

case 3: cout<<"\nAnda memilih bentuk bulatan. "; cout<<"Sila masukkan diameter bulatan (b): "<<endl; cout<<"b : "; cin>>b; I=(PAI*pow(b,4))/64; break;

default : cout<<"\nAnda memasukkan pilihan yang salah. "<<endl; cout<<"Sila buat pilihan semula"<<endl;

41 | D E F L E C T I O N O F A C A N T I L E V E R

if(error1==0) { break; } } cout<<"\nSila masukkan nilai P : "; cin>>P; cout<<"\nSila masukkan nilai L : "; cin>>L; cout << e <<endl; ymax=(P*(pow(L,3)))/(e*I); cout<<"Nilai ymax ialah "<<ymax<<endl; }

42 | D E F L E C T I O N O F A C A N T I L E V E R

FUNCTION NAME: asDes #include <cstdlib> #include <cmath> #include <iomanip> #include <iostream> #include <fstream> using namespace std; void asDes(double e1) { double b,d,x,y,Iner1,Iner2,Iner3,P,L,ymaxA,ymaxB,ymaxC; const double paimu=3.142;

cout<<"\nSquare"<<endl; cout<<"Masukkan nilai b: "; cin>>b; Iner1=(b*b*b*b)/12; cout<<endl;

cout<<"Square with hole"<<endl; cout<<"Masukkan nilai x dan y:"<<endl; cout<<"x:"; cin>>x; cout<<"y:";
43 | D E F L E C T I O N O F A C A N T I L E V E R

cin>>y; Iner2=((y*y*y*y)-(x*x*x*x))/12; cout<<endl;

cout<<"Round"<<endl; cout<<"Masukkan nilai d:"; cin>>d; Iner3=paimu*(d*d*d*d)/64; cout<<endl;

cout<<"Masukkan nilai P & L"<<endl; cout<<"P:"; cin>>P; cout<<"L:"; cin>>L;

ymaxA=(P*(pow(L,3)))/(e1*Iner1); ymaxB=(P*(pow(L,3)))/(e1*Iner2); ymaxC=(P*(pow(L,3)))/(e1*Iner3);

44 | D E F L E C T I O N O F A C A N T I L E V E R

//susunan menaik if (ymaxA<ymaxB && ymaxB<ymaxC) { cout<<"Maka susunan menaik ialah "<<ymaxA<<" , "<<ymaxB<<" , "<<ymaxC<<endl; } else if (ymaxB<ymaxA && ymaxA<ymaxC) { cout<<"Maka susunan menaik ialah "<<ymaxB<<" , "<<ymaxA<<" , "<<ymaxC<<endl; } else if (ymaxC<ymaxA && ymaxA<ymaxB) { cout<<"Maka susunan menaik ialah "<<ymaxC<<" , "<<ymaxA<<" , "<<ymaxB<<endl; } else if (ymaxA<ymaxC && ymaxC<ymaxB) { cout<<"Maka susunan menaik ialah "<<ymaxA<<" , "<<ymaxC<<" , "<<ymaxB<<endl; }

45 | D E F L E C T I O N O F A C A N T I L E V E R

else if (ymaxB<ymaxC && ymaxC<ymaxA) { cout<<"Maka susunan menaik ialah "<<ymaxB<<" , "<<ymaxC<<" , "<<ymaxA<<endl; } else if(ymaxC<ymaxB && ymaxB<ymaxA) { cout<<"Maka susunan menaik ialah "<<ymaxC<<" , "<<ymaxB<<" , "<<ymaxA<<endl; }

//susunan menurun

if ((ymaxA>ymaxB) && (ymaxB>ymaxC)) { cout<<"Maka susunan menurun ialah "<<ymaxA<<" , "<<ymaxB<<" , "<<ymaxC<<endl; } else if ((ymaxB>ymaxA)&&(ymaxA>ymaxC)) { cout<<"Maka susunan menurun ialah "<<ymaxB<<" , "<<ymaxA<<" , "<<ymaxC<<endl; }

46 | D E F L E C T I O N O F A C A N T I L E V E R

else if ((ymaxC>ymaxA)&&(ymaxA>ymaxB)) { cout<<"Maka susunan menurun ialah "<<ymaxC<<" , "<<ymaxA<<" , "<<ymaxB<<endl; } else if ((ymaxA>ymaxC)&&(ymaxC>ymaxB)) { cout<<"Maka susunan menurun ialah "<<ymaxA<<" , "<<ymaxC<<" , "<<ymaxB<<endl; } else if ((ymaxB>ymaxC)&&(ymaxC>ymaxA)) { cout<<"Maka susunan menurun ialah "<<ymaxB<<" , "<<ymaxC<<" , "<<ymaxA<<endl; } else if((ymaxC>ymaxB)&&(ymaxB>ymaxA)) { cout<<"Maka susunan menurun ialah "<<ymaxC<<" , "<<ymaxB<<" , "<<ymaxA<<endl; }

47 | D E F L E C T I O N O F A C A N T I L E V E R

48 | D E F L E C T I O N O F A C A N T I L E V E R

49 | D E F L E C T I O N O F A C A N T I L E V E R

CONCLUSION
Special thanks to Encik Zainudin A. Rasid for his guidance on how to do the program. Thanks to all friends of ours for helping us in completing this project. They still tried to spend some times for us to help us complete this project. So, here it is. The project of Cantilever Deflection of a Beam. This project can gives user information for the second moment of area, maximum youngs modulus value, and the ascending order and descending order of the youngs modulus value just by entering the numbers. Hopefully this program will help those users a lot in completing their assignment about the cantilever deflection of a beam. This project made learn harder and more about programming. Even so this project is a bit tough, but since we manage to finish and complete it, we feel very great and it makes us feel that programming is easier than we thought. Finally, thanks to those who are helping us.

50 | D E F L E C T I O N O F A C A N T I L E V E R

You might also like