-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMinorProjectModule.py
More file actions
235 lines (172 loc) · 5.91 KB
/
MinorProjectModule.py
File metadata and controls
235 lines (172 loc) · 5.91 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
from handcalcs.decorator import handcalc
from math import pi, sqrt
def material_fy (material: str) -> float:
if material == "ASTM A36":
return 36
elif material == "ASTM A572_Gr50":
return 50
elif material == "ASTM A500_GrB_46":
return 46
else :
return "Material not defined"
def calc_wall_element_slenderness (b:float, d:float, t:float, E:float, fy:float) -> str:
"""
Calculates if any of the walls of a built up box section is categorize as slendern or not.
b: base of the box section
d: depth of the box section
t: wall thickness of box section
E: elastic section modulus
fy: material nominal yield resistance
"""
b_1= b - (2*t)
d_1= d - (2*t)
upper_limit= 1.49*(sqrt(E/fy))
is_base_slender = b_1/t > upper_limit
is_depth_slender = d_1/t > upper_limit
if is_base_slender or is_depth_slender:
return "Section with slender walls. Compression capacity NOT available with this app"
else:
return "Section without slender walls. Compression capacity available with this app"
def calc_area_section_bub (b: float, d: float, t:float) -> float:
"""
Calculates the section area of a built-up box section.
b: base of the box section
d: depth of the box section
t: wall thickness of box section
"""
b_1= b - (2*t)
d_1= d - (2*t)
a_bub = (b*d)-(d_1*b_1)
return a_bub
def calc_r_x(b:float, d:float, t:float, a=float) -> float:
"""
Calculates the radious of gyration about "X" axis.
b: base of the box section
d: depth of the box section
t: wall thickness of box section
a: section area of box section
"""
b_1= b - (2*t)
d_1= d - (2*t)
rx_bub = sqrt(((b*d**3)-(b_1*d_1**3))/(12*a))
return rx_bub
def calc_r_y(b:float, d:float, t:float, a=float) -> float:
"""
Calculates the radious of gyration about "Y" axis.
b: base of the box section
d: depth of the box section
t: wall thickness of box section
a: section area of box section
"""
b_1= b - (2*t)
d_1= d - (2*t)
ry_bub = sqrt(((d*b**3)-(d_1*b_1**3))/(12*a))
return ry_bub
def calc_lcr_x(k_x:float, L: float, rx:float) -> float:
"""
Calculates the effective length of member abour x-axis.
k_x : effective lenght factor about x-axis
L: clear effective height of member (m)
rx: raius of gyration about x-axis
"""
L_in= L/0.0254
lcr_x= (k_x*L_in)/(rx)
return lcr_x
def calc_lcr_y(k_y:float, L: float, ry:float) -> float:
"""
Calculates the effective length of member abour y-axis.
k_y : effective lenght factor about y-axis
L: clear effective height of member (m)
ry: raius of gyration about x-axis
"""
L_in= L/0.0254
lcr_y= (k_y*L_in)/(ry)
return lcr_y
def calc_fe_x ( lcr_x:float, E: float) -> float:
"""
Calculates the elastic buckling stress about x-axis.
lcr_x: effective length of member about x-axis.
E: modulus of elasticity of steel (ksi)
"""
fe_x = (pi**2 * E) / (lcr_x**2)
return fe_x
def calc_fe_y ( lcr_y:float, E: float) -> float:
"""
Calculates the elastic buckling stress about y-axis.
lcr_y: effective length of member about y-axis.
E: modulus of elasticity of steel (ksi)
"""
fe_y = (pi**2 * E) / (lcr_y**2)
return fe_y
def calc_nominal_fn_x(lcr_x:float, E:float, fy:float, fe_x:float) -> float:
"""
Calculates the nominal stress about x-axis
"""
fn_limit = 4.71 * (sqrt(E/fy))
if lcr_x <= 25:
fn_x = fy
elif lcr_x <= fn_limit:
fn_x = fy * (0.658 ** (fy/fe_x))
elif lcr_x > fn_limit:
fn_x = 0.877 * fe_x
return fn_x
def calc_nominal_fn_y(lcr_y:float, E:float, fy:float, fe_y:float) -> float:
"""
Calculates the nominal stress about y-axis
"""
fn_limit = 4.71 * (sqrt(E/fy))
if lcr_y <= 25:
fn_y = fy
elif lcr_y <= fn_limit:
fn_y = fy * (0.658 ** (fy/fe_y))
elif lcr_y > fn_limit:
fn_y = 0.877 * fe_y
return fn_y
def calc_cx_capacity (fn_x:float, A: float, phi: float) -> float:
"""
Calculates the axial compression capacity about x-axis
"""
pn_x = fn_x * A * phi
return pn_x
def calc_cy_capacity (fn_y:float, A: float, phi: float) -> float:
"""
Calculates the axial compression capacity about y-axis
"""
pn_y = fn_y * A * phi
return pn_y
def calc_compression_resistance_x_axis (b:float, d: float, t:float, L: float, kx:float, ky:float, material: str, E: float, phi:float) -> float:
"""
Calculates the compression resistance about x_axis
"""
fy = material_fy(material)
a_bub= calc_area_section_bub(b, d, t)
rx_bub = calc_r_x(b,d,t,a_bub)
lcr_x= calc_lcr_x(kx, L, rx_bub)
fe_x= calc_fe_x(lcr_x, E)
fn_x = calc_nominal_fn_x (lcr_x, E, fy, fe_x)
pn_x = calc_cx_capacity (fn_x, a_bub, phi)
return pn_x
def calc_compression_resistance_y_axis (b:float, d: float, t:float, L: float, kx:float, ky:float, material: str, E: float, phi:float) -> float:
"""
Calculates the compression resistance about x_axis
"""
fy = material_fy(material)
a_bub= calc_area_section_bub(b, d, t)
ry_bub= calc_r_y(b,d,t,a_bub)
lcr_y= calc_lcr_y(ky, L, ry_bub)
fe_y = calc_fe_y(lcr_y, E)
fn_y = calc_nominal_fn_y (lcr_y, E, fy, fe_y)
pn_y = calc_cy_capacity (fn_y, a_bub, phi)
return pn_y
hc_renderer = handcalc(override="long")
calc_l_area_section_bub = hc_renderer(calc_area_section_bub)
calc_l_r_x= hc_renderer(calc_r_x)
calc_l_r_y= hc_renderer(calc_r_y)
calc_l_lcr_x= hc_renderer(calc_lcr_x)
calc_l_lcr_y= hc_renderer(calc_lcr_y)
calc_l_fe_x= hc_renderer(calc_fe_x)
calc_l_fe_y= hc_renderer(calc_fe_y)
calc_l_nominal_fn_x= hc_renderer(calc_nominal_fn_x)
calc_l_nominal_fn_y= hc_renderer(calc_nominal_fn_y)
calc_l_cx_capacity= hc_renderer(calc_cx_capacity)
calc_l_cy_capacity= hc_renderer(calc_cy_capacity)