summaryrefslogtreecommitdiff
path: root/698/CH2/EX2.1/P1_factor_of_safety.sce
blob: 682f423a8b8524584674eadb19f6653f19b64447 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
clc
//Example 2.1
//Factor of safety

//------------------------------------------------------------------------------
//Given Data:
//Dimensions
b=0.04//m
h=0.05//m
// the value of h is given 20mm in the problem statement but taken 50mm while solving, therefore we will take 50mm as the value of h
//Force
P=200000//N

//------------------------------------------------------------------------------
//Stress induced
S=P/(b*h)
S=S*(10^-6)//To convert units into Mpa

//Yield strength
Sy=500//Mpa

//Factor of safety
fos=Sy/S

//------------------------------------------------------------------------------
//Printing the result file to .txt
res1=mopen(TMPDIR+'1_factor_of_safety.txt','wt')
mfprintf(res1,"The stress in the bar is given by:\n")
mfprintf(res1,"\n\tSx=P/A\n")
mfprintf(res1,"\n\tFactor of safety=(Yield Strength)/(Induced Strength)\n\n")
mfprintf(res1,"The factor of safety is %d",fos)
mclose(res1)
editor(TMPDIR+'1_factor_of_safety.txt')
//------------------------------------------------------------------------------
//-----------------------------End of program-----------------------------------