def create_deck_stiffener_local(b_sup, b_inf, h, t, t_deck): assert b_sup >= b_inf, "width out of bound or wrong way around" #assumption: b_sup is equal to distance between stiffeners #create points a = point.point(b_sup,0) b = point.point(-b_sup, 0) c = point.point(0.5*b_sup, 0) d = point.point(-0.5*b_sup, 0) e = point.point(-0.5*b_inf, h) f = point.point(0.5*b_inf, h) #create plates code_1 = plate_code.plate_code(1,0,0,0,0) line_1 = line.line(code_1, a, b, t_deck) code_2 = plate_code.plate_code(2,0,0,0,0) line_2 = line.line(code_2, d, e, t) code_3 = plate_code.plate_code(3,0,0,0,0) line_3 = line.line(code_3, e, f, t) code_4 = plate_code.plate_code(4,0,0,0,0) line_4 = line.line(code_4, f, c, t) deck_stiffener = crosssection.crosssection(b_sup, b_inf, h) #add the lines to itself deck_stiffener.addline(line_1) deck_stiffener.addline(line_2) deck_stiffener.addline(line_3) deck_stiffener.addline(line_4) return deck_stiffener
def create_stiffener_local(b_sup, b_inf, h, t): #assert b_sup >= b_inf, "width out of bound or wrong way around" half_width_diff = b_sup - b_inf length_side = math.sqrt(half_width_diff**2 + h**2) own_angle = math.atan(half_width_diff / h) #create plate 2 a2 = point.point(-b_sup / 2, 0) b2 = point.point(a2.y + math.sin(own_angle) * length_side, math.cos(own_angle) * length_side) code2 = plate_code.plate_code(0, 1, 0, 0, 2) line2 = line.line(code2, a2, b2, t) #create plate 3 a3 = b2 b3 = point.point(a3.y + b_inf, a3.z) code3 = plate_code.plate_code(0, 1, 0, 0, 3) line3 = line.line(code3, a3, b3, t) #create plate 4 a4 = b3 b4 = point.point(b_sup / 2, 0) code4 = plate_code.plate_code(0, 1, 0, 0, 4) line4 = line.line(code4, a4, b4, t) stiffener_local = crosssection.crosssection(b_sup, b_inf, h) #add the lines to itself stiffener_local.addline(line2) stiffener_local.addline(line3) stiffener_local.addline(line4) return stiffener_local
def test_stiffeners_everywhere(self): initial_cs = create_initial_cs(4000, 4000, 2000, 20, 20, 20) stiffener_1 = st.create_stiffener_global(1, 1, 1000, 0, 0, 300, 200, 200, 15) stiffener_2 = st.create_stiffener_global(1, 2, -1000, 0, 0, 300, 200, 200, 15) stiffener_3 = st.create_stiffener_global(2, 3, -2000, 1000, 3 * math.pi / 2, 200, 100, 100, 10) stiffener_4 = st.create_stiffener_global(3, 4, -1000, 2000, math.pi, 300, 200, 200, 15) stiffener_5 = st.create_stiffener_global(3, 5, 1000, 2000, math.pi, 300, 200, 200, 15) stiffener_6 = st.create_stiffener_global(4, 6, 2000, 1000, math.pi / 2, 200, 100, 100, 10) stiffeners = [ stiffener_1, stiffener_2, stiffener_3, stiffener_4, stiffener_5, stiffener_6 ] final_cs = merge.merge(initial_cs, stiffeners) length = len(final_cs.lines) self.assertEqual(length, 34) last_line = final_cs.get_line(tpl_number=16) code_16 = plcd.plate_code(4, 0, 16, 0, 0) self.assertEqual(last_line.code, code_16)
def remove_stiffener(self, st_number): to_remove = [] #going to the plates of this stiffener (all lines have this number) for line1 in self.lines(): if line1.code.st_number is st_number: #if the line is a trapezoid line, it has to be removed and the adjecent ones fused if line1.code.pl_type == 0: #trapezoid plate of the stiffener left_tr_pl = None right_tr_pl = None for line_tr in self.lines(): if line_tr.code.pl_type == 0 and line_tr.code.tpl_number == line1.code.tpl_number - 1: left_tr_pl = line_tr elif line_tr.code.p1_type == 0 and line_tr.code.tpl_number == line1.tpl_number + 1: right_tr_pl = line_tr #creating a new line that spans over the length of all 3 new_code = plate_code.plate_code(line1.code.pl_position, 0, line1.code.tpl_number - 1, 0, 0) new_tr_pl = line.line(new_code, left_tr_pl.a, right_tr_pl.b, line1.t) new_tr_pl.t_stress = line1.t_stress self.lines.append(new_tr_pl) to_remove.append(rigth_tr_pl) to_remove.append(left_tr_pl) to_remove.append(line1) #if the line is a stiffener line (not trapezoid) it can be removed directly elif line.code.pl_type == 1: to_remove.append(line) #after the trapezoid line is added and all the ones to go are added to to_remove, all in to_removed can be removed for pl in to_remove: self.lines.remove(pl)
def test_area(self): a = point.point(2000, 0) b = point.point(-2000, 3000) code = plate_code.plate_code(1, 0, 0, 0, 0) t = 5 plate = line.line(code, a, b, t) area = plate.get_area_tot() self.assertEqual(area, 25000)
def test_length(self): a = point.point(2000, 0) b = point.point(-2000, 3000) code = plate_code.plate_code(1, 0, 0, 0, 0) t = 5 plate = line.line(code, a, b, t) length = plate.get_length_tot() self.assertEqual(length, 5000)
def test_empty(self): initial_cs = create_initial_cs(4000, 3000, 2000, 20, 20, 20) stiffeners = [] final_cs = merge.merge(initial_cs, stiffeners) length = len(final_cs.lines) line_4 = final_cs.get_line(pl_type=0, pl_position=4, tpl_number=4) code_4 = plcd.plate_code(4, 0, 4, 0, 0) self.assertEqual(length, 4) self.assertEqual(line_4.code, code_4)
def test_center(self): a = point.point(2000, 0) b = point.point(-1000, 1000) code = plate_code.plate_code(1, 0, 0, 0, 0) t = 5 horizontal = line.line(code, a, b, t) y = horizontal.get_center_y_tot() z = horizontal.get_center_z_tot() self.assertEqual(y, 500) self.assertEqual(z, 500)
def create_stiffener_global(pl_position, st_number, center_y, center_z, angle, b_sup, b_inf, h, t): y_corr = center_y - math.cos(angle) * b_sup * 0.5 z_corr = center_z - math.sin(angle) * b_sup * 0.5 assert b_sup >= b_inf, "width out of bound or wrong way around" half_width_diff = (b_sup - b_inf) / 2 length_side = math.sqrt(half_width_diff**2 + h**2) if half_width_diff > 0: own_angle = math.atan(h / half_width_diff) else: own_angle = math.pi / 2 #create plate 2 a2 = point.point(y_corr, z_corr) b2 = point.point(y_corr + math.cos(own_angle + angle) * length_side, z_corr + math.sin(own_angle + angle) * length_side) code2 = plate_code.plate_code(pl_position, 1, 0, st_number, 2) line2 = line.line(code2, a2, b2, t) #create plate 3 a3 = point.point(y_corr + math.cos(own_angle + angle) * length_side, z_corr + math.sin(own_angle + angle) * length_side) b3 = point.point(a3.y + math.cos(angle) * b_inf, a3.z + math.sin(angle) * b_inf) code3 = plate_code.plate_code(pl_position, 1, 0, st_number, 3) line3 = line.line(code3, a3, b3, t) #create plate 4 a4 = point.point(a3.y + math.cos(angle) * b_inf, a3.z + math.sin(angle) * b_inf) b4 = point.point(y_corr + math.cos(angle) * b_sup, z_corr + math.sin(angle) * b_sup) code4 = plate_code.plate_code(pl_position, 1, 0, st_number, 4) line4 = line.line(code4, a4, b4, t) stiffener_global = crosssection.crosssection(b_sup, b_inf, h) #add the lines to itself stiffener_global.addline(line2) stiffener_global.addline(line3) stiffener_global.addline(line4) return stiffener_global
def test_stiffeners_top(self): initial_cs = create_initial_cs(4000, 3000, 2000, 20, 20, 20) stiffener_1 = st.create_stiffener_global(1, 1, 1000, 0, 0, 300, 200, 200, 15) stiffener_2 = st.create_stiffener_global(1, 2, -1000, 0, 0, 300, 200, 200, 15) stiffeners = [stiffener_1, stiffener_2] final_cs = merge.merge(initial_cs, stiffeners) length = len(final_cs.lines) self.assertEqual(length, 14) stiffener_1_line_3 = final_cs.get_line(st_number=1, st_pl_position=3) st_1_3_length = stiffener_1_line_3.get_length_tot() self.assertEqual(st_1_3_length, 200) line_top_right = final_cs.get_line(tpl_number=5) code_5 = plcd.plate_code(1, 0, 5, 0, 0) self.assertEqual(line_top_right.code, code_5) self.assertEqual(line_top_right.a.y, -1150)
def test_i_along_tot(self): pl_position = 0 st_number = 1 center_y = 0 center_z = 0 angle = 0 b_sup = 10000 b_inf = 8000 h = 5000 t = 20 #creation of cs horizontally cs_y = stiffener.create_stiffener_global(pl_position, st_number, center_y, center_z, angle, b_sup, b_inf, h, t) plate_between_code_y = plate_code.plate_code(0,0,1,1,1) plate_between_y = line.line(plate_between_code_y, copy.deepcopy(cs_y.get_line(st_pl_position = 4).b), copy.deepcopy(cs_y.get_line(st_pl_position = 2).a), t) cs_y.addline(plate_between_y) cs_y_i_y= cs_y.get_i_y_tot() cs_y_i_y_red = cs_y.get_i_y_red() #creation of cs rotated angle = math.pi*5/3 cs_rot = cs_y.get_cs_rot(angle) cs_rot_plate_between = cs_rot.get_line(pl_type = 0) cs_rot_i_along = cs_rot.get_i_along_tot(cs_rot_plate_between) cs_rot_i_along_red = cs_rot.get_i_along_red(cs_rot_plate_between) self.assertTrue(cs_rot_i_along/cs_y_i_y - 1 < 0.001) self.assertTrue(cs_rot_i_along_red/cs_y_i_y_red - 1 < 0.001) angle = math.pi*3.453 cs_rot = cs_y.get_cs_rot(angle) cs_rot_plate_between = cs_rot.get_line(pl_type = 0) cs_rot_i_along = cs_rot.get_i_along_tot(cs_rot_plate_between) cs_rot_i_along_red = cs_rot.get_i_along_red(cs_rot_plate_between) self.assertTrue(cs_rot_i_along/cs_y_i_y - 1 < 0.001) self.assertTrue(cs_rot_i_along_red/cs_y_i_y_red - 1 < 0.001) angle = math.pi*(-2.34) cs_rot = cs_y.get_cs_rot(angle) cs_rot_plate_between = cs_rot.get_line(pl_type = 0) cs_rot_i_along = cs_rot.get_i_along_tot(cs_rot_plate_between) cs_rot_i_along_red = cs_rot.get_i_along_red(cs_rot_plate_between) self.assertTrue(cs_rot_i_along/cs_y_i_y - 1 < 0.001) self.assertTrue(cs_rot_i_along_red/cs_y_i_y_red - 1 < 0.001)
from classes import plate_code as plcd from classes import merge from classes import crosssection as cs from proofs import global_plate_buckling as glb import data import math data.input_data.update({"M_Ed": -45000 * 10**6}) initial_cs = ics.create_initial_cs(4000, 3000, 2000, 10, 10, 5) stiffener_1 = st.create_stiffener_global(3, 1, -1000, 2000, math.pi, 200, 150, 100, 5) stiffener_2 = st.create_stiffener_global(3, 2, 1000, 2000, math.pi, 200, 150, 100, 5) stiffener_list = [stiffener_1, stiffener_2] final_cs = merge.merge(initial_cs, stiffener_list) final_cs = initial_cs point_a = pt.point(-1500, 2000) point_b = pt.point(1500, 2000) code = plcd.plate_code(3, 0, 3, 0, 0) plate = ln.line(code, point_a, point_b, 5) x_sec = ics.create_initial_cs(4000, 3000, 2000, 10, 10, 5) stiffened_plate = merge.merge(x_sec, stiffener_list) x_sec.lines.remove(x_sec.get_line(pl_position=1, pl_type=0)) x_sec.lines.remove(x_sec.get_line(pl_position=2, pl_type=0)) x_sec.lines.remove(x_sec.get_line(pl_position=4, pl_type=0)) glb.global_plate_buckling(final_cs, stiffened_plate)
import math pl_position = 0 st_number = 1 center_y = 0 center_z = 0 angle = 0 b_sup = 10000 b_inf = 8000 h = 5000 t = 20 #creation of cs horizontally cs_y = stiffener.create_stiffener_global(pl_position, st_number, center_y, center_z, angle, b_sup, b_inf, h, t) plate_between_code_y = plate_code.plate_code(0, 0, 1, 1, 1) plate_between_y = line.line(plate_between_code_y, copy.deepcopy(cs_y.get_line(st_pl_position=4).b), copy.deepcopy(cs_y.get_line(st_pl_position=2).a), t) cs_y.addline(plate_between_y) geometry_output.print_cs_red(cs_y) print("angle of cs_y:", plate_between_y.get_angle_y_true() / math.pi) cs_y_i_y = cs_y.get_i_y_tot() print("i_y of cs_y", cs_y_i_y) #creation of cs rotated angle = math.pi * 5 / 3 cs_rot = cs_y.get_cs_rot(angle) geometry_output.print_cs_red(cs_rot)
def merge(initial_cs, stiffener_list): assert len(initial_cs.lines ) == 4, "Merge does not accept crosssections with stiffeners" stiffeners1 = [] stiffeners2 = [] stiffeners3 = [] stiffeners4 = [] for stiffener in stiffener_list: pos = stiffener.lines[0].code.pl_position if pos == 1: stiffeners1.append(stiffener) elif pos == 2: stiffeners2.append(stiffener) elif pos == 3: stiffeners3.append(stiffener) elif pos == 4: stiffeners4.append(stiffener) #side 1 new_tpl_lines_1 = [] if stiffeners1 != []: stiffeners1 = sorted(stiffeners1, key=lambda st: st.lines[0].code.st_number) old_plate_1 = initial_cs.get_line(pl_position=1, pl_type=0) tpl_number_1_min = initial_cs.get_line(pl_position=1, pl_type=0).code.tpl_number initial_cs.lines.remove(initial_cs.get_line(pl_position=1, pl_type=0)) t_1 = old_plate_1.t side = 1 st_number_1_min = stiffeners1[0].lines[0].code.st_number st_number_1_max = st_number_1_min for stiffener in stiffeners1: this_st_number = stiffener.lines[0].code.st_number if this_st_number < st_number_1_min: st_number_1_min = this_st_number elif this_st_number > st_number_1_max: st_number_1_max = this_st_number i = st_number_1_min j = tpl_number_1_min next_tpl_a = None initial_point_1 = old_plate_1.a end_point_1 = old_plate_1.b while i <= st_number_1_max: new_plate_1_a = initial_point_1 new_plate_1_b = copy.deepcopy( stiffeners1[i - st_number_1_min].get_line(pl_position=side, st_pl_position=4).b) new_plate_2_a = copy.deepcopy(new_plate_1_b) new_plate_2_b = copy.deepcopy( stiffeners1[i - st_number_1_min].get_line(pl_position=side, st_pl_position=2).a) next_tpl_a = copy.deepcopy(new_plate_2_b) code_1 = plate_code.plate_code(side, 0, j, 0, 0) code_2 = plate_code.plate_code(side, 0, j + 1, i, 1) new_plate_1 = line.line(code_1, new_plate_1_a, new_plate_1_b, t_1) new_plate_2 = line.line(code_2, new_plate_2_a, new_plate_2_b, t_1) new_tpl_lines_1.append(new_plate_1) new_tpl_lines_1.append(new_plate_2) j += 2 i += 1 initial_point_1 = copy.deepcopy(new_plate_2_b) code_1 = plate_code.plate_code(side, 0, j, 0, 0) new_plate_1 = line.line(code_1, next_tpl_a, end_point_1, t_1) new_tpl_lines_1.append(new_plate_1) initial_cs.get_line(pl_position=2, pl_type=0).code.tpl_number = j + 1 initial_cs.get_line(pl_position=3, pl_type=0).code.tpl_number = j + 2 initial_cs.get_line(pl_position=4, pl_type=0).code.tpl_number = j + 3 #side 2 new_tpl_lines_2 = [] if stiffeners2 != []: stiffeners2 = sorted(stiffeners2, key=lambda st: st.lines[0].code.st_number) old_plate_2 = initial_cs.get_line(pl_position=2, pl_type=0) tpl_number_2_min = initial_cs.get_line(pl_position=2, pl_type=0).code.tpl_number initial_cs.lines.remove(initial_cs.get_line(pl_position=2, pl_type=0)) t_2 = old_plate_2.t side = 2 st_number_2_min = stiffeners2[0].lines[0].code.st_number st_number_2_max = st_number_2_min for stiffener in stiffeners2: this_st_number = stiffener.lines[0].code.st_number if this_st_number < st_number_2_min: st_number_2_min = this_st_number elif this_st_number > st_number_2_max: st_number_2_max = this_st_number i = st_number_2_min j = tpl_number_2_min next_tpl_a = None initial_point_2 = old_plate_2.a end_point_2 = old_plate_2.b while i <= st_number_2_max: new_plate_1_a = initial_point_2 new_plate_1_b = copy.deepcopy( stiffeners2[i - st_number_2_min].get_line(pl_position=side, st_pl_position=4).b) new_plate_2_a = copy.deepcopy(new_plate_1_b) new_plate_2_b = copy.deepcopy( stiffeners2[i - st_number_2_min].get_line(pl_position=side, st_pl_position=2).a) next_tpl_a = copy.deepcopy(new_plate_2_b) code_1 = plate_code.plate_code(side, 0, j, 0, 0) code_2 = plate_code.plate_code(side, 0, j + 1, i, 1) new_plate_1 = line.line(code_1, new_plate_1_a, new_plate_1_b, t_2) new_plate_2 = line.line(code_2, new_plate_2_a, new_plate_2_b, t_2) new_tpl_lines_2.append(new_plate_1) new_tpl_lines_2.append(new_plate_2) j += 2 i += 1 initial_point_2 = copy.deepcopy(new_plate_2_b) code_2 = plate_code.plate_code(side, 0, j, 0, 0) new_plate_2 = line.line(code_2, next_tpl_a, end_point_2, t_2) new_tpl_lines_2.append(new_plate_2) initial_cs.get_line(pl_position=3, pl_type=0).code.tpl_number = j + 1 initial_cs.get_line(pl_position=4, pl_type=0).code.tpl_number = j + 2 #side 3 new_tpl_lines_3 = [] if stiffeners3 != []: stiffeners3 = sorted(stiffeners3, key=lambda st: st.lines[0].code.st_number) old_plate_3 = initial_cs.get_line(pl_position=3, pl_type=0) tpl_number_3_min = initial_cs.get_line(pl_position=3, pl_type=0).code.tpl_number initial_cs.lines.remove(initial_cs.get_line(pl_position=3, pl_type=0)) t_3 = old_plate_3.t side = 3 st_number_3_min = stiffeners3[0].lines[0].code.st_number st_number_3_max = st_number_3_min for stiffener in stiffeners3: this_st_number = stiffener.lines[0].code.st_number if this_st_number < st_number_3_min: st_number_3_min = this_st_number elif this_st_number > st_number_3_max: st_number_3_max = this_st_number i = st_number_3_min j = tpl_number_3_min next_tpl_a = None initial_point_3 = old_plate_3.a end_point_3 = old_plate_3.b while i <= st_number_3_max: new_plate_1_a = initial_point_3 new_plate_1_b = copy.deepcopy( stiffeners3[i - st_number_3_min].get_line(pl_position=side, st_pl_position=4).b) new_plate_2_a = copy.deepcopy(new_plate_1_b) new_plate_2_b = copy.deepcopy( stiffeners3[i - st_number_3_min].get_line(pl_position=side, st_pl_position=2).a) next_tpl_a = copy.deepcopy(new_plate_2_b) code_1 = plate_code.plate_code(side, 0, j, 0, 0) code_2 = plate_code.plate_code(side, 0, j + 1, i, 1) new_plate_1 = line.line(code_1, new_plate_1_a, new_plate_1_b, t_3) new_plate_2 = line.line(code_2, new_plate_2_a, new_plate_2_b, t_3) new_tpl_lines_3.append(new_plate_1) new_tpl_lines_3.append(new_plate_2) j += 2 i += 1 initial_point_3 = copy.deepcopy(new_plate_2_b) code_3 = plate_code.plate_code(side, 0, j, 0, 0) new_plate_3 = line.line(code_3, next_tpl_a, end_point_3, t_3) new_tpl_lines_3.append(new_plate_3) initial_cs.get_line(pl_position=4, pl_type=0).code.tpl_number = j + 1 #side 4 new_tpl_lines_4 = [] if stiffeners4 != []: stiffeners4 = sorted(stiffeners4, key=lambda st: st.lines[0].code.st_number) old_plate_4 = initial_cs.get_line(pl_position=4, pl_type=0) tpl_number_4_min = initial_cs.get_line(pl_position=4, pl_type=0).code.tpl_number initial_cs.lines.remove(initial_cs.get_line(pl_position=4, pl_type=0)) t_4 = old_plate_4.t side = 4 st_number_4_min = stiffeners4[0].lines[0].code.st_number st_number_4_max = st_number_4_min for stiffener in stiffeners4: this_st_number = stiffener.lines[0].code.st_number if this_st_number < st_number_4_min: st_number_4_min = this_st_number elif this_st_number > st_number_4_max: st_number_4_max = this_st_number i = st_number_4_min j = tpl_number_4_min next_tpl_a = None initial_point_4 = old_plate_4.a end_point_4 = old_plate_4.b while i <= st_number_4_max: new_plate_1_a = initial_point_4 new_plate_1_b = copy.deepcopy( stiffeners4[i - st_number_4_min].get_line(pl_position=side, st_pl_position=4).b) new_plate_2_a = copy.deepcopy(new_plate_1_b) new_plate_2_b = copy.deepcopy( stiffeners4[i - st_number_4_min].get_line(pl_position=side, st_pl_position=2).a) next_tpl_a = copy.deepcopy(new_plate_2_b) code_1 = plate_code.plate_code(side, 0, j, 0, 0) code_2 = plate_code.plate_code(side, 0, j + 1, i, 1) new_plate_1 = line.line(code_1, new_plate_1_a, new_plate_1_b, t_4) new_plate_2 = line.line(code_2, new_plate_2_a, new_plate_2_b, t_4) new_tpl_lines_4.append(new_plate_1) new_tpl_lines_4.append(new_plate_2) j += 2 i += 1 initial_point_4 = copy.deepcopy(new_plate_2_b) code_4 = plate_code.plate_code(side, 0, j, 0, 0) new_plate_4 = line.line(code_4, next_tpl_a, end_point_4, t_4) new_tpl_lines_4.append(new_plate_4) for plate in new_tpl_lines_1: initial_cs.addline(plate) for plate in new_tpl_lines_2: initial_cs.addline(plate) for plate in new_tpl_lines_3: initial_cs.addline(plate) for plate in new_tpl_lines_4: initial_cs.addline(plate) for stiffener in stiffener_list: for i in range(len(stiffener.lines)): initial_cs.addline(stiffener.lines[i]) return initial_cs
def get_m_rd_pl_eff(total_cs): #remove side stiffeners cs = crosssection.crosssection(total_cs.b_sup, total_cs.b_inf, total_cs.h) for plate in total_cs.lines: if (plate.code.pl_position == 2 or plate.code.pl_position == 4) and plate.code.pl_type == 1: pass else: cs.addline(plate) total_area = cs.get_area_red(stress=True) convergence = defaults.convergence_limit_m_rd_pl_eff * total_area continue_iteration = True area_top = 10**12 area_btm = 0 start = True z_min = 0 z = cs.h / 2 z_max = cs.h code = plate_code.plate_code(-1, -1, -1, -1, -1) counter = 0 #interation loop to find position of plastic zero line while abs(area_top - area_btm) > convergence and continue_iteration == True: counter += 1 start = False top_part = crosssection.crosssection(0, 0, 0) bottom_part = crosssection.crosssection(0, 0, 0) for plate in cs.lines: #plate is entirely below assumed plastic zero line if plate.a.z >= z and plate.b.z >= z: bottom_part.addline(plate) #plate is entirely above plastic zero line elif plate.a.z <= z and plate.b.z <= z: top_part.addline(plate) #plate crosses plastic zero line, a on top elif plate.a.z <= z and plate.b.z >= z: #case 1: pzl crosses a-p1 if plate.a.z < z and plate.p1.z > z: share = (z - plate.a.z) / (plate.p1.z - plate.a.z) y = plate.a.y + share * (plate.p1.y - plate.a.y) point_middle = point.point(y, z) line_a = line.line(code, plate.a, point_middle, plate.t) top_part.addline(line_a) line_b1 = line.line(code, point_middle, plate.p1, plate.t) bottom_part.addline(line_b1) line_b2 = line.line(code, plate.p2, plate.b, plate.t) bottom_part.addline(line_b2) #case 2: pzl crosses p2-b elif plate.p2.z < z and plate.b.z > z: share = (z - plate.p2.z) / (plate.b.z - plate.p2.z) y = plate.p2.y + share * (plate.b.y - plate.p2.y) point_middle = point.point(y, z) line_a1 = line.line(code, plate.a, plate.p1, plate.t) top_part.addline(line_a1) line_a2 = line.line(code, plate.p2, point_middle, plate.t) top_part.addline(line_a2) line_b = line.line(code, point_middle, plate.b, plate.t) bottom_part.addline(line_b) #case 3 pzl crosses p1-p2 else: line_a = line.line(code, plate.a, plate.p1, plate.t) top_part.addline(line_a) line_b = line.line(code, plate.p1, plate.b, plate.t) bottom_part.addline(line_b) elif plate.a.z >= z and plate.b.z <= z: #case 1: pzl crosses b-p2 if plate.b.z < z and plate.p2.z > z: share = (z - plate.b.z) / (plate.p2.z - plate.b.z) y = plate.b.y + share * (plate.p2.y - plate.b.y) point_middle = point.point(y, z) line_b = line.line(code, plate.b, point_middle, plate.t) top_part.addline(line_b) line_a1 = line.line(code, point_middle, plate.p2, plate.t) bottom_part.addline(line_a1) line_a2 = line.line(code, plate.p1, plate.a, plate.t) bottom_part.addline(line_a2) #case 2: pzl crosses p1-a elif plate.p1.z < z and plate.a.z > z: share = (z - plate.p1.z) / (plate.a.z - plate.p1.z) y = plate.p1.y + share * (plate.a.y - plate.p1.y) point_middle = point.point(y, z) line_b1 = line.line(code, plate.b, plate.p2, plate.t) top_part.addline(line_b1) line_b2 = line.line(code, plate.p1, point_middle, plate.t) top_part.addline(line_b2) line_a = line.line(code, point_middle, plate.a, plate.t) bottom_part.addline(line_a) #case 3 pzl crosses p1-p2 else: line_b = line.line(code, plate.b, plate.p2, plate.t) top_part.addline(line_b) line_a = line.line(code, plate.p2, plate.a, plate.t) bottom_part.addline(line_a) area_top = top_part.get_area_red(stress=True) area_btm = bottom_part.get_area_red(stress=True) if area_top > area_btm: z_max = z z = 0.5 * (z + z_min) else: z_min = z z = 0.5 * (z + z_max) counter += 1 if counter > 10: continue_iteration = False z_s_top = abs(z - top_part.get_center_z_red(stress=True)) z_s_btm = abs(z - bottom_part.get_center_z_red(stress=True)) m_pl_rd_eff = (z_s_top * area_top + z_s_btm * area_btm) * data.constants.get( "f_y") / data.constants.get("gamma_M1") return m_pl_rd_eff
#this statement adds the project path to the path where the python interpreter looks #for packages to import #if we start the program from main, this should not be an issue import sys #just add the directory where the BA folder is on your computer sys.path.append('C:/Users/Nino/Google Drive/Studium/FS 2021/Bachelorarbeit/BA') #sys.path.append('C:/Users/Vinzenz Müller/Dropbox/ETH/6. Semester/BA') import initial_cs as ics from classes import crosssection as cs from classes import plate_code as plcd #assign input to variables b_sup = 4000 #data.input_data["b_sup"] b_inf = 2000 #data.input_data["b_inf"] h = 1500 #data.input_data["h"] #create initial cross section test_cs = ics.create_initial_cs(b_sup, b_inf, h) for line in test_cs.lines: line.t = 20 code = plcd.plate_code(2, 0, 0, 0, 0) test_cs.get_line(pl_position=code.pl_position, pl_type=code.pl_type, tpl_number=code.tpl_number, st_number=code.st_number, st_pl_position=code.st_pl_position) print(line.a.z, line.a.y)