Question: Just design I beam based on the coding below. R-Studio language. I'm waiting for answer please i don't have much time. Thank You. #------------------------------------ sub
Just design I beam based on the coding below.
R-Studio language.
I'm waiting for answer please i don't have much time. Thank You.
#------------------------------------ sub function 1----------------------------------------------
IBeam.Design.R
l
P
Elastic
O
denct
FOS
D
z
a
b
c
# No of beam user want to design
n
# Data frame to store the information for design meet requirement
df
"Thickness web","Width Bottom Flange","Thickness Bottom Flage",
"Moment Of Inertia","Bending Stress","Factor Of Safety",
"Deflection","Efficiency","Status")
# Remove first row of data frame
df
# Data frame to store the information for design that doesn't meet requirement
df.R
"Thickness web","Width Bottom Flange","Thickness Bottom Flage",
"Moment Of Inertia","Bending Stress","Factor Of Safety",
"Deflection","Efficiency","Status")
# Remove first row of data frame
df.R
for (n in 1:n) {
cat("Beam",n,' ',"The dimension must be in meter,m")
#width of top flange in m
wft
#thickness of top flange in m
tft
#height of web in m
hw
#thickness of web in m
tw
# width of bottom flange in m
wfb
#thickness of bottom flange in m
tfb
# To plot 2 graph in 1 plot
par(mfrow = c(1,2))
# x-coordinate of dimension
x
# y-coordinate of dimension
y
# Plotting I-Beam
plot(x,y, col="white", xlab="X", ylab="Y")
polygon(x,y, col = "cyan")
# area of the top flange
aft
# centroid of the top flange
yft
ayft
# area of the web
aw
# centroid of the web
yw
ayw
# area of the bottom flange
afb
# centroid of the bottom flange
yfb
ayfb
# Total area of the beam
area
# centroid of overall beam
centroid
# distance between centroid of top flange and centroid of overall beam
dft
# moment of inertia for the top flange
Ift
# distance between centroid of web and centroid of overall beam
dw
# moment of inertia for the web
Iw
# distance between centroid of bottom flange and centroid of overall beam
dfb
# moment of inertia for bottom flange
Ifb
# total moment of inertia of the beam in m^4
MOI
# Volume of designed beam in m^3
volume
# self-weight of the designed beam in kN
W
# Uniform Distribution Load of self-weight in kN/m
UDL
# Ploting IL moment
# Main x axis
x1
# IL Moment at x =11
# y-coodinate of IL before x=11
x11
Mbefore
# y-coordinate of IL after x=11
x11
Mafter
# All y-coordinate of IL for x=11
y1
# IL Moment at support A
# y-coordinate of IL before support A
xA
MAbefore
# y-coordinate of IL after support A
xA
MAafter
# All y-coordinate of IL for support A
y2
# IL Moment at support B
# y-coordinate of IL before support B
xB
MBbefore
# y-coordinate of IL after support B
xB
MBafter
# All y-coordinate of IL for support B
y3
# Plot IL for Moment at x=11
plot(x1,y1, type = "l", col = "blue",ylab = "IL Moment")
# Plot IL for Moment at support A
lines(x1,y2, type = "l", col = "green")
# Plot IL for Moment at support B
lines(x1,y3, type = "l", col = "yellow")
# Legend of the ILs
legend ( "topleft",c("X = 11(MaxSag)" ,"Support A(MaxHog)","Support B(Hog)"),
col = c("blue","green","yellow"), lty = c(1,1,1), cex = 0.5)
# Max Hogging in Nmm
max_hogging
# Max Sagging in Nmm
max_sagging
#((0.5*Mbefore[1]*x1[2])=-9
#(0.5*Mafter[2]*(x1[5]-x1[4]))
# Bending Stress of designed beam in MPa
O1
# Factor of safety of designed beam
FOS1
# Efficiency
E
# Deflection (Downward-occur at x=11m)
# Support reaction A (Real Beam)
RA
# Support reaction B (Real Beam)
RB
# Support reaction A (Virtual beam)
RAV
# Support reaction A (Virtual beam)
RBV
# Cut 1 with limit 0
# Lower limit
x
cut1a
# Upper limit
x
cut1b
# Deflection cut 1
cut1
# Cut 2 with limit 0
# Constant (Real beam)
A
# Lower limit
x
cut2a
# Upper limit
x
cut2b
# Deflection cut 2
cut2
# Cut 3 with limit 0
# Constant (Real beam)
B
# Lower limit
x
cut3a
# Upper limit
x
cut3b
# Deflection cut 3
cut3
# Cut 4 with limit 0
# Lower limit
x
cut4a
# Upper limit
x
cut4b
# Deflection cut 4
cut4
# Total downward deflection
D.D
# Deflection (Upward-occur at the end of left beam)
# Support reaction A (Real Beam)
RA
# Support reaction B (Real Beam)
RB
# Support reaction A (Virtual)
RAV2
# Support reaction A (Virtual)
RBV2
# Cut 1 with limit 0
# Upper limit
x
cut1Ua
# Lower limit
x
cut1Ub
# Deflection cut 1
cut1U
# Cut 2 with limit 0
# Constant (Real beam)
A
# Constant
H
M
# Lower limit
x
cut2Ua
# Upper limit
x
cut2Ub
# Deflection cut 2
cut2U
# Cut 3 with limit 0
# Constant (Real beam)
B
# Lower limit
x
cut3Ua
# Upper limit
x
cut3Ub
# Deflection cut 3
cut3U
# Cut 4 with limit 0
# Lower limit
x
cut4Ua
# Upper limit
x
cut4Ub
# Deflection cut 4
cut4U
# Total upward deflection
D.U
# Selection design meet requirement
if (O1
# No of designed beam meet the requirements
z
cat(' ',"YEAY! YOUR DESIGN MEETS THE REQUIREMENTS. YOUR BEAM IS SAFE.",
' ',"CHECK UP FOR THE DATA FRAME df(or df4) ABOVE TO SEE ALL THE",
"INFORMATION ABOUT YOUR Designed I-BEAM AND THE PLOT SECTION TO SEE",
"YOUR PLOTTING I-BEAM AND THE IL GRAPH",' ',' ')
# Status of the designed beam
status
# Data frame contains all of the information of designed beam
df
names(df)
Web(m)","Thickness web(m)","Width Bottom Flange(m)",
"Thickness Bottom Flage(m)","Moment Of Inertia(m^4)",
"Bending Stress(MPa)","Factor Of Safety","Deflection
(mm/mm)","Efficiency","Status")
View(df)
} else {
# No of designed beam meet the requirement
z
cat(' ',"OPS! YOUR DESIGN DOESN'T MEET THE REQUIREMENTS. YOUR BEAM IS NOT",
"SAFE",' ',"CHECK UP FOR THE DATA FRAME df.R ABOVE TO SEE ALL THE",
"INFROMATION ABOUT YOUR Designed I-BEAM AND THE PLOTs SECTION TO SEE",
"YOUR PLOTTING I-BEAM AND THE IL GRAPH",' ',' ')
# Status of the designed beam
status
# Data frame contains all the information of designed beam
df.R
names(df.R)
Web(m)","Thickness web(m)","Width Bottom Flange(m)",
"Thickness Bottom Flage(m)","Moment Of Inertia(m^4)",
"Bending Stress(MPa)","Factor Of Safety","Deflection
(mm/mm)","Efficiency","Status")
View(df.R)
}
}
# No of beam meet the requirements in global variables
z1
# Data frame contain all information of design meet the requirements in global
# variables
df1
return(df1)
}
#------------------------------------------sub function 2-----------------------------------------
minimum5
# min 5 designs meet requirement
if (z1 > 4) {
# Data frame that have at least 5 designs meet requirements in local variables
df4
cat(' ',' ',"YEAY! THE DESIGNS THAT MEET THE REQUIREMENTs IS MORE THAN 5.",
' ',' ')
} else {
# No of beam needed to achieve at least 5 designs meet requirements
j
# No of beam meet the requirements in global variables
N
cat("OH NO!. The designs that meet the requirements is less than 5. Please",
"design",j,"more beams",' ',' ')
# Data frame combine new designs information with the previous one in local
df4
# Store combine data frame in global data frame
df1
View(df4)
# Updated of no of design beam that meet the requirement in global variables
z1
# Call minimum function to make sure at least 5 the design meet requirements
minimum5()
}
# Data frame that have at least 5 designs meet requirements in global variables
df3
return(df3)
}
#---------------------------------------main function---------------------------------------------
IBeam.R
Purpose 1 design. Use the coding below to design 1 beam readline(prompt="HI! WANNA DESIGN BEAMS? PRESS ENTER THEN . . .")
# Call IBeam.Design.R function to design beams
IBeam.Design.R()
# call minimum5 function to make sure at least 5 designs meet the requirement
minimum5()
# Location of max value of efficiency
maxE
# Data frame of max efficiency
r
View(r)
cat("YEAY! FINALLY WE GET THE BEST DESIGN. CHECK UP FOR THE DATA FRAME r ABOVE",
"TO SEE THE BEST I-BEAM DESIGN.",' ',' ')
return(r)
}
IBeam.R()
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
