def cs_analysis(): form_values.content = copy.deepcopy(form_values.default_cs) cont = form_values.content data.input_data.update({"a":cont.get("a")}) first_cs = initial_cs.create_initial_cs(cont.get("b_sup"), cont.get("b_inf"), cont.get("h"), cont.get("t_side"), cont.get("t_deck"), cont.get("t_btm")) deck_stiffeners = deck.deck(cont.get("b_sup"), False) form_values.stiffeners = [] form_values.stiffeners += deck_stiffeners end_cs = merge.merge(first_cs, form_values.stiffeners) image = cs_to_html.print_cs(end_cs) return render_template('geometry_input.html', image = image, content = cont)
def cs_analysis_input_1(): cont = None try: b_sup = int(request.form['b_sup']) b_inf = int(request.form['b_inf']) h = int(request.form['h']) t_side = int(request.form['t_side']) t_btm = int(request.form['t_btm']) num_side = int(request.form['num_side']) num_btm = int(request.form['num_btm']) a = int(request.form['a']) L_e = int(request.form['L_e']) form_values.content = copy.deepcopy(form_values.default_cs) cont = form_values.content cont.update({"b_sup":b_sup, "b_inf":b_inf, "h":h, "t_side":t_side, "t_btm":t_btm, "num_side":num_side, "num_btm":num_btm, "a":a, "L_e":L_e}) for i in range(num_side): code = ["location" + str(i+1), "b_sup" + str(i+1), "b_inf" + str(i+1), "h" + str(i+1), "t" + str(i+1)] location_st = float(request.form[code[0]]) b_sup_st = float(request.form[code[1]]) b_inf_st = float(request.form[code[2]]) h_st = float(request.form[code[3]]) t_st = float(request.form[code[4]]) cont.update({code[0]:location_st, code[1]:b_sup_st, code[2]:b_inf_st, code[3]:h_st, code[4]:t_st}) sym = math.ceil(num_btm/2) for i in range(30, 30+sym, 1): code = ["location" + str(i+1), "b_sup" + str(i+1), "b_inf" + str(i+1), "h" + str(i+1), "t" + str(i+1)] #try except clause because of disabled field try: location_st = float(request.form[code[0]]) except KeyError: location_st = 0 b_sup_st = float(request.form[code[1]]) b_inf_st = float(request.form[code[2]]) h_st = float(request.form[code[3]]) t_st = float(request.form[code[4]]) cont.update({code[0]:location_st, code[1]:b_sup_st, code[2]:b_inf_st, code[3]:h_st, code[4]:t_st}) except KeyError: cont = form_values.content a = cont.get("a") first_cs = initial_cs.create_initial_cs(cont.get("b_sup"), cont.get("b_inf"), cont.get("h"), cont.get("t_side"), cont.get("t_deck"), cont.get("t_btm")) data.input_data.update({"a":a}) deck_stiffeners = deck.deck(cont.get("b_sup"), False) num_top = len(deck_stiffeners) cont.update({"num_top":num_top}) form_values.stiffeners = [] form_values.stiffeners += deck_stiffeners stiffener_transform.input_to_prop(cont.get("num_top"), cont.get("num_side"), cont.get("num_btm")) rest_stiffeners = stiffener_transform.prop_to_draw(first_cs) form_values.stiffeners += rest_stiffeners end_cs = merge.merge(first_cs, form_values.stiffeners) image = cs_to_html.print_cs(end_cs) return render_template('geometry_input.html', content = cont, image = image)
def cs_analysis_gui(): #initialize file file = open("user_interface\output\cs_analysis.txt", "w+") file.close() #deck and initial_cs block cs = initial_cs.create_initial_cs(data.input_data.get("b_sup"), data.input_data.get("b_inf"), data.input_data.get("h"), data.input_data.get("t_side"), data.input_data.get("t_deck"), data.input_data.get("t_bottom")) st_list_deck = deck.deck(data.input_data.get("b_sup"), False) #assembly block st_list_rest = [] for st in data.stiffener_data.stiffeners: y,z = cs.get_coordinates(st.location, st.pl_position) if st.pl_position == 2: angle = math.pi + cs.get_angle(2) if st.pl_position == 3: angle = math.pi if st.pl_position == 4: angle = math.pi - cs.get_angle(2) stiffener_i = add_stiffeners.create_stiffener_global(st.pl_position, st.st_number, y, z, angle, \ st.b_sup, st.b_inf, st.h, st.t) st_list_rest.append(stiffener_i) stiffener_list = st_list_deck + st_list_rest stiffener_list = sorted(stiffener_list, key = lambda st: st.lines[0].code.st_number) cs = merge.merge(cs, stiffener_list) #proof block cs = buckling_proof.buckling_proof(cs) #user interface preparation results = {"eta_1": round(cs.eta_1,2), "eta_3_side_1":round(cs.eta_3_side_1,2), "interaction_1": round(cs.interaction_1,2), "eta_3_side_2":round(cs.eta_3_side_2,2), \ "interaction_2": round(cs.interaction_2,2), "eta_3_side_3":round(cs.eta_3_side_3,2), "interaction_3": cs.interaction_3, "eta_3_side_4":round(cs.eta_3_side_4,2), "interaction_4": round(cs.interaction_4,2)} image = cs_to_html.print_cs_red(cs) results.update({"image": image}) #create the output pdf printing.txt_to_pdf(cs, "cs") return results
def add_stiffener_set(initial_cs, proposition, optimizer): iterations = 0 stiffener_list = None geometry_ok = False assert optimizer == "a" or optimizer == "b", "Wrong input for optimizer." if proposition.stiffeners == []: return initial_cs if optimizer == "a": stiffener_list = substantiate.substantiate(initial_cs, proposition, optimizer) if stiffener_list == False: print("\n\n Substantiate finished with FALSE") return False if optimizer == "b": while geometry_ok == False and iterations <= 1: iterations += 1 stiffener_list = substantiate.substantiate(initial_cs, proposition, optimizer) if stiffener_list == False: print("\n\n Substantiate finished with FALSE") return False proposition, geometry_ok = check_geometry.check_geometry( initial_cs, stiffener_list, proposition) if geometry_ok == False: print("\n\n Geometry_ok is FALSE") return False next_cs = merge.merge(copy.deepcopy(initial_cs), stiffener_list) next_cs.st_props = proposition print("\n\n Geometry_ok is TRUE") return next_cs
st_list_rest = [] for st in data.stiffener_data.stiffeners: y, z = cs.get_coordinates(st.location, st.pl_position) if st.pl_position == 2: angle = math.pi + cs.get_angle(2) if st.pl_position == 3: angle = math.pi if st.pl_position == 4: angle = math.pi - cs.get_angle(2) stiffener_i = add_stiffener.create_stiffener_global(st.pl_position, st.st_number, y, z, angle, \ st.b_sup, st.b_inf, st.h, st.t) st_list_rest.append(stiffener_i) stiffener_list = st_list_deck + st_list_rest stiffener_list = sorted(stiffener_list, key=lambda st: st.lines[0].code.st_number) cs = merge.merge(cs, stiffener_list) geometry_output.print_cs_red(cs) #set the cross-sectional forces cs_analysis_tool_terminal_input.set_forces() #buckling proof cs = buckling_proof.buckling_proof(cs) ei = round(cs.get_ei() / 1000 / 1000 / 1000) interaction_2 = cs.interaction_2 interaction_3 = cs.interaction_3 interaction_4 = cs.interaction_4 cost = optimization_value.cost(cs)