-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcesses.py
More file actions
382 lines (323 loc) · 14.2 KB
/
Processes.py
File metadata and controls
382 lines (323 loc) · 14.2 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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
import math
from utils import *
class Sheathing:
def __init__(self, concrete_weight_plus_live_load=0):
self.is_plywood = None
self.ply_class = None
self.is_face_grain_across = None
self.sheathing_values = None
self.final_parameter = None
self.final_sheathing_weight = None
self.concrete_weight_plus_live_load = concrete_weight_plus_live_load
def _get_sheathing_info(self):
"""Get sheathing details from user."""
plywood_or_plyform = get_int(
"Please choose between Plywood (1) and Plyform (2): ", 1, 2
)
self.is_plywood = plywood_or_plyform == 1
if self.is_plywood:
self.ply_class = get_int(
"Please choose between Structural I and Marine (1), another class for different species (2): ",
1,
2,
)
else:
self.ply_class = get_int(
"Please choose between Class I (1), Class II (2), Structural I (3): ",
1,
3,
)
self.is_face_grain_across = get_int(
"Please choose between face grain across (1) or along (2): ", 1, 2
)
return self.is_plywood, self.ply_class, self.is_face_grain_across
def _get_sheathing_thickness(self):
"""
Function to gather the sheathing thickness and related parameters based on user input.
Different options are provided for plyform, plywood, and species classes.
Returns the final values and parameters used in further calculations.
"""
# For Plyform sheathing
if not self.is_plywood:
input_plyform_thickness = get_option(
"Please enter plyform thickness: ", plyform_thickness, float=True
)
final_sheathing_thickness = input_plyform_thickness
final_sheathing_weight = plyform_weight_by_thickness[
final_sheathing_thickness
]
final_parameter = plyform_general_mapper[
f"{self.ply_class}_{self.is_face_grain_across}"
][final_sheathing_thickness]
# For Plywood with Structural/Marine type
elif self.ply_class == 1:
input_structural_marine_thickness = get_option(
"Please enter structural marine thickness: ",
structural_marine_thickness,
float=True,
)
final_sheathing_thickness = input_structural_marine_thickness
final_sheathing_weight = plywood_weight_marine[final_sheathing_thickness]
final_parameter = (
plywood_across_marine[final_sheathing_thickness]
if self.is_face_grain_across == 1
else plywood_along_marine[final_sheathing_thickness]
)
# For Plywood with different species
elif self.ply_class == 2:
input_species_thickness = get_option(
"Please enter different species thickness: ",
different_species_thickness,
float=True,
)
final_sheathing_thickness = input_species_thickness
final_sheathing_weight = plywood_weight_different[final_sheathing_thickness]
final_parameter = (
plywood_across_different[final_sheathing_thickness]
if self.is_face_grain_across == 1
else plywood_along_different[final_sheathing_thickness]
)
# Output the results of the thickness calculations
print(f"Final Sheathing Thickness: {final_sheathing_thickness}")
print(f"Final Sheathing Weight: {final_sheathing_weight}")
print(f"Final Parameters: {final_parameter}\n")
sheathing_values = {}
# Additional input required if plywood is selected
if self.is_plywood:
stress_group = get_int(
"Please choose stress group of plywood (1-6): ", 1, 6
)
final_stress = stress_of_plywood
stress_grade_level = get_int(
"Please choose stress grade level S-1, 2, or 3: ", 1, 3
)
# Determine index based on stress grade level and wet/dry condition
if stress_grade_level != 3:
is_wet = get_int("Is it wet (1) or dry (2)? ", 1, 2)
index = (
0
if stress_grade_level == 1 and is_wet == 1
else 1
if stress_grade_level == 1 and is_wet == 2
else 2
if stress_grade_level == 2 and is_wet == 1
else 3
)
else:
is_wet = 2
index = 4
# Assign final stress values
for k, v in final_stress.items():
if stress_group in v:
sheathing_values[k] = v[stress_group][index]
sheathing_values["Fs"] = rolling_shear_table[self.ply_class][index]
# If Plyform is selected, assign stress values based on the class
else:
sheathing_values = plyform_stress[self.ply_class]
# Output final values and return them
print("Final Values:")
for k, v in sheathing_values.items():
print(f"{k}: {v}")
self.sheathing_values = sheathing_values
self.final_parameter = final_parameter
self.final_sheathing_weight = final_sheathing_weight
def _get_sheathing_distance(self):
"""
Function to calculate the optimal sheathing distance based on input parameters like
bending stress, shear stress, elasticity, concrete weight, and live load.
Returns the number of spans, design span, and final distance between sheathing.
"""
# Get number of spans from the user
no_of_spans = get_int("Please enter number of spans (1-3): ", 1, 3)
# Bending stress (Fb), shear stress (Fs), and modulus of elasticity (E)
fb = self.sheathing_values["Fb"]
fs = self.sheathing_values["Fs"]
E = self.sheathing_values["E"]
print(f"fb: {fb:.2f}")
# Shear factor based on plywood or plyform selection
se_index = 2 if self.is_plywood else 1
sheathing_se = self.final_parameter[se_index]
rolling_shear = self.final_parameter[-1] # Rolling shear value
print(f"rs: {rolling_shear}")
print(f"se: {sheathing_se}")
print(f"wb: {self.concrete_weight_plus_live_load}")
print(f"fs: {fs:.2f}")
print(f"E: {E}")
# Moment of inertia based on plywood or plyform selection
i_index = 1 if self.is_plywood else 0
final_parameter_i = self.final_parameter[i_index]
print(f"I: {final_parameter_i:.2f}")
# Design span input
design_span = (
get_float("Enter design span (m): ") * 1000
) # Convert to millimeters
# Calculate lb (based on bending stress and concrete weight)
lb_constant = 120 if no_of_spans == 3 else 96
lb = (
((lb_constant * fb * sheathing_se) / self.concrete_weight_plus_live_load)
** 0.5
) / 1000
# Calculate ls (based on shear stress and rolling shear)
ls = (ls_constant_mapper[no_of_spans] * fs * rolling_shear) / (
self.concrete_weight_plus_live_load * 1000
)
# Deflection constraints
deflection_a_input = design_span / 360
deflection_b_input = design_span / 16
deflection_a_equation = (
(1743 * E * final_parameter_i) / (360 * self.concrete_weight_plus_live_load)
) ** (1 / 3) / 1000
deflection_b_equation = (
(1743 * E * final_parameter_i) / (16 * self.concrete_weight_plus_live_load)
) ** (1 / 4) / 1000
final_deflection_a = min(deflection_a_input, deflection_a_equation)
final_deflection_b = min(deflection_b_input, deflection_b_equation)
# Output deflection results
print(f"lb: {lb:.2f}")
print(f"ls: {ls:.2f}")
print(f"std deflection conservative: {deflection_a_input:.2f}")
print(f"std deflection conservative equation: {deflection_a_equation:.2f}")
print(f"std deflection non-conservative: {deflection_b_input:.2f}")
print(f"std deflection non-conservative equation: {deflection_b_equation:.2f}")
print(f"d a: {final_deflection_a:.2f}")
print(f"d b: {final_deflection_b:.2f}")
# Final distance between sheathing is the minimum of all the constraints
joist_dist = min(lb, ls, final_deflection_a, final_deflection_b)
return joist_dist, no_of_spans
def get_sheathing_distance(self):
"""Get sheathing distance based on user input."""
self._get_sheathing_info()
self._get_sheathing_thickness()
return self._get_sheathing_distance()
class Joisting:
def __init__(self, weight_on_joists=0, no_of_spans=0, rolling_shear=0):
(
self.nominal_size,
self.joist_i,
self.joist_s,
self.joist_values,
) = get_characteristics()
self.joist_i /= 1e12
self.weight_on_joists = weight_on_joists
self.no_of_spans = no_of_spans
self.rolling_shear = rolling_shear
def get_stringing_distance(self):
"""Calculate joist-related values."""
try:
thickness, width = map(int, self.nominal_size.split("x"))
fb_factor = adjustments_factor[width][thickness]
except:
fb_factor = 1
cd = 0.9 # Duration factor
new_fb = fb_factor * cd * self.joist_values["Fb"]
lb_constant = 120 if self.no_of_spans == 3 else 96
joist_lb = (
(lb_constant * new_fb * self.joist_s * 1e-9) / self.weight_on_joists
) ** 0.5
if self.no_of_spans == 3:
joist_ls = (
20 * self.joist_values["Fv"] * self.rolling_shear * 1e-4
) / self.weight_on_joists
else:
breadth, depth = map(float, inch_to_metric[self.nominal_size].split("*"))
joist_ls = (
16 * self.joist_values["Fv"] * breadth * depth * 1e-6
) / 2 + 2 * depth * 1e-3
if self.no_of_spans == 3:
deflection_360 = (
(1743 * self.joist_values["E"] * self.joist_i)
/ (360 * self.weight_on_joists)
) ** (1 / 3)
deflection_16 = (
(1743 * self.joist_values["E"] * self.joist_i)
/ (16 * self.weight_on_joists)
) ** (1 / 4)
else:
deflection_360 = (
(4608 * self.joist_values["E"] * self.joist_i)
/ (1800 * self.weight_on_joists)
) ** (1 / 3)
deflection_16 = (
(4608 * self.joist_values["E"] * self.joist_i)
/ (80 * self.weight_on_joists)
) ** (1 / 4)
return min(joist_lb, joist_ls, deflection_360, deflection_16)
class Shores:
def __init__(self, weight_on_shores=0):
(
self.nominal_size,
self.shores_i,
self.shores_s,
self.shores_values,
) = get_characteristics()
self.weight_on_shores = weight_on_shores
def get_shores_distance(self):
"""Calculate shores-related values."""
try:
thickness, width = map(int, self.nominal_size.split("x"))
fb_factor = adjustments_factor[width][thickness]
except:
fb_factor = 1
cd = 0.9
new_fb = fb_factor * cd * self.shores_values["Fb"]
shores_lb = (
(120 * new_fb * self.shores_s * 1e-9) / self.weight_on_shores
) ** 0.5
breadth, depth = map(float, inch_to_metric[self.nominal_size].split("*"))
shores_ls = (192 * self.shores_values["Fv"] * breadth * depth * 1e-6) / (
15 * self.weight_on_shores
) + 2 * depth * 1e-3
deflection_360 = (
(1743 * self.shores_values["E"] * self.shores_i)
/ (360 * self.weight_on_shores)
) ** (1 / 3)
deflection_16 = (
(1743 * self.shores_values["E"] * self.shores_i)
/ (16 * self.weight_on_shores)
) ** (1 / 4)
return min(shores_lb, shores_ls, deflection_360, deflection_16)
class Props:
def __init__(self, weight_on_props=0):
self.weight_on_props = weight_on_props
def calculate_props_distance(self):
"""
Function to calculate the distance between props.
"""
r1 = get_float("Please enter r1: ")
r2 = get_float("Please enter r2: ")
mass = get_float("Please enter mass of props: ")
inertia = 0.5 * mass * (r1**2 + r2**2)
y = get_float("Please enter y: ")
s = inertia / y
e = get_float("Please enter Modulus of Elasticity: ")
fv = get_float("Please enter fv: ")
fb = get_float("Please enter fb: ")
lb = (120 * fb * s / self.weight_on_props) ** 0.5
lv = (192 * fv * r1 * r2 / 15 * self.weight_on_props) + 2 * r1
deflection_360 = ((1743 * e * inertia) / (360 * self.weight_on_props)) ** (
1 / 3
)
deflection_16 = ((1743 * e * inertia) / (16 * self.weight_on_props)) ** (1 / 4)
return min(lb, lv, deflection_360, deflection_16)
class Frames:
def __init__(self, total_load) -> None:
self.total_load = total_load
def calculate_critical_load(self):
"""
Function to calculate the distance between frames in X and Y directions.
"""
e = get_float("Please enter Modulus of Elasticity: ")
i_x = get_float("Please enter Moment of Inertia in X-section: ")
i_y = get_float("Please enter Moment of Inertia in Y-section: ")
k = get_float("Please enter k (degree of freedom): ")
l = get_float("Please enter L (free length): ")
critical_load_x = (math.pi**2) * e * i_x / (l * k) ** 2
critical_load_y = (math.pi**2) * e * i_y / (l * k) ** 2
return critical_load_x, critical_load_y
def calculate_frames_dist(self):
"""
Function to calculate the distance between frames.
"""
dist_x = get_float("Please enter distance to next frame in X (Dx): ")
dist_y = get_float("Please enter distance to next frame in Y (Dy): ")
return dist_x, dist_y