Esempio n. 1
0
File: gui.py Progetto: muellvin/BA
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)
Esempio n. 2
0
File: gui.py Progetto: muellvin/BA
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)
Esempio n. 3
0
File: gui.py Progetto: muellvin/BA
def optimize_input_1():
    val = None
    try:
        b_sup = int(request.form['b_sup'])
        b_inf = int(request.form['b_inf'])
        h = int(request.form['h'])
        a = int(request.form['a'])
        L_e = int(request.form['L_e'])
        form_values.values = copy.deepcopy(form_values.default_cs)
        val = form_values.values
        val.update({"b_sup":b_sup, "b_inf":b_inf, "h":h, "a":a, "L_e":L_e})
    except KeyError:
        val = form_values.values

    first_cs = initial_cs.create_initial_cs(val.get("b_sup"), val.get("b_inf"), val.get("h"), 1,1,1)
    image = cs_to_html.print_cs(first_cs)
    return render_template('optimize_input.html', image = image, content = val)
Esempio n. 4
0
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
Esempio n. 5
0
File: gui.py Progetto: muellvin/BA
def optimize():
    form_values.values = copy.deepcopy(form_values.default_cs)
    val = form_values.values
    first_cs = initial_cs.create_initial_cs(val.get("b_sup"), val.get("b_inf"), val.get("h"), val.get("t_side"), val.get("t_deck"), val.get("t_btm"))
    image = cs_to_html.print_cs(first_cs)
    return render_template('optimize_input.html', image = image, content = val)
Esempio n. 6
0
def optimize():
    cs_collector.reset()
    b_sup = data.input_data["b_sup"]
    b_inf = data.input_data["b_inf"]
    h = data.input_data["h"]
    t_deck = data.input_data["t_deck"]
    t_range = defaults.t_range_opt
    I_range = defaults.I_range
    counter = 1
    bottom_max = defaults.num_bottom_stiffeners_max
    side_max = defaults.num_side_stiffeners_max
    st_prop_deck = deck.deck(b_sup, True)
    num_top_stiffeners = len(st_prop_deck.stiffeners)
    m_ed = data.input_data.get("M_Ed")
    sign = math.copysign(1, m_ed)

    #no side stiffener block
    num_side_stiffeners = 0
    if num_side_stiffeners <= side_max:
        for t_side in t_range:
            for t_bottom in t_range:
                base_cs = initial_cs.create_initial_cs(b_sup, b_inf, h, t_side,
                                                       t_deck, t_bottom)
                for num_btm_stiffeners in range(bottom_max + 1):
                    #no side stiffeners cs
                    if num_side_stiffeners == 0:
                        #without bottom stiffeners
                        if num_btm_stiffeners == 0:
                            print(
                                "\n-------------------------------------------------------------------------------------------------------"
                            )
                            print(
                                "------------------------------------ CS" +
                                str(counter) +
                                "---------------------------------------------------------------"
                            )
                            counter += 1
                            print("#Side Stiffeners " +
                                  str(num_side_stiffeners))
                            print("#Btm Stiffeners " + str(num_btm_stiffeners))
                            print("t_bottom:" + str(t_bottom))
                            print("t_side:" + str(t_side))
                            test_cs = copy.deepcopy(base_cs)
                            st_prop = stiffeners_proposition.stiffeners_proposition(
                            )
                            st_prop.stiffeners = st_prop_deck.stiffeners
                            st_prop.stiffeners = sorted(
                                st_prop.stiffeners,
                                key=lambda proposed_stiffener:
                                proposed_stiffener.st_number)
                            test_cs = add_stiffeners.add_stiffener_set(
                                base_cs, st_prop, "b")
                            if test_cs != False:
                                #proof
                                end_cs = buckling_proof.buckling_proof(test_cs)
                                st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                )
                                if end_cs.proven():
                                    print("PASS!")
                                    cs_collector.into_collector(end_cs)
                                else:
                                    print("FAIL!")
                        #with bottom stiffeners
                        else:
                            for I_btm in I_range:
                                print(
                                    "\n-------------------------------------------------------------------------------------------------------"
                                )
                                print(
                                    "------------------------------------ CS" +
                                    str(counter) +
                                    "---------------------------------------------------------------"
                                )
                                counter += 1
                                print("#Side Stiffeners " +
                                      str(num_side_stiffeners))
                                print("#Btm Stiffeners " +
                                      str(num_btm_stiffeners))
                                print("I_Bottom " + str(I_btm))
                                st_prop = stiffeners_proposition.stiffeners_proposition(
                                )
                                st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                )
                                for num in range(num_btm_stiffeners):
                                    loc_btm = -1 + 2 / (num_btm_stiffeners +
                                                        1) * (num + 1)
                                    st_number = num_top_stiffeners + num_side_stiffeners + num + 1
                                    st = proposed_stiffener.proposed_stiffener(
                                        pl_position=3,
                                        st_number=st_number,
                                        location=loc_btm,
                                        i_along=I_btm)
                                    st_prop_rest.stiffeners.append(st)
                                st_prop.stiffeners = st_prop_deck.stiffeners + st_prop_rest.stiffeners
                                st_prop.stiffeners = sorted(
                                    st_prop.stiffeners,
                                    key=lambda proposed_stiffener:
                                    proposed_stiffener.st_number)
                                test_cs = add_stiffeners.add_stiffener_set(
                                    base_cs, st_prop, "b")
                                if test_cs != False:
                                    #proof
                                    end_cs = buckling_proof.buckling_proof(
                                        test_cs)
                                    st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                    )
                                    st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                    )
                                    if end_cs.proven():
                                        cs_collector.into_collector(end_cs)
                                        print("PASS!")
                                    else:
                                        print("FAIl!")

    #one side stiffener block
    num_side_stiffeners = 1
    if num_side_stiffeners <= side_max:
        for t_side in t_range:
            for t_bottom in t_range:
                base_cs = initial_cs.create_initial_cs(b_sup, b_inf, h, t_side,
                                                       t_deck, t_bottom)
                for num_btm_stiffeners in range(bottom_max + 1):
                    if num_side_stiffeners == 1:
                        #without bottom stiffeners
                        if num_btm_stiffeners == 0:
                            locations_side = get_locations_side(
                                num_side_stiffeners, sign)
                            for loc_side in range(len(locations_side)):
                                for I_side in I_range:
                                    print(
                                        "\n-------------------------------------------------------------------------------------------------------"
                                    )
                                    print(
                                        "------------------------------------ CS"
                                        + str(counter) +
                                        "---------------------------------------------------------------"
                                    )
                                    counter += 1
                                    print("#Side Stiffeners " +
                                          str(num_side_stiffeners))
                                    print("#Btm Stiffeners " +
                                          str(num_btm_stiffeners))
                                    print("I_Side " + str(I_side))
                                    st_prop = stiffeners_proposition.stiffeners_proposition(
                                    )
                                    st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                    )
                                    for num in range(num_side_stiffeners):
                                        #create side stiffeners
                                        loc = locations_side[loc_side][num]
                                        assert loc != -1, "Error!"
                                        st_number_right = num_top_stiffeners + num + 1
                                        st_number_left = num_top_stiffeners + num_btm_stiffeners + 2 * num_side_stiffeners - num
                                        st_right = proposed_stiffener.proposed_stiffener(
                                            pl_position=2,
                                            st_number=st_number_right,
                                            location=loc,
                                            i_along=I_side)
                                        st_left = proposed_stiffener.proposed_stiffener(
                                            pl_position=4,
                                            st_number=st_number_left,
                                            location=loc,
                                            i_along=I_side)
                                        st_prop_rest.stiffeners.append(
                                            st_right)
                                        st_prop_rest.stiffeners.append(st_left)
                                    st_prop.stiffeners = st_prop_deck.stiffeners + st_prop_rest.stiffeners
                                    st_prop.stiffeners = sorted(
                                        st_prop.stiffeners,
                                        key=lambda proposed_stiffener:
                                        proposed_stiffener.st_number)
                                    test_cs = add_stiffeners.add_stiffener_set(
                                        base_cs, st_prop, "b")
                                    if test_cs != False:
                                        #proof
                                        end_cs = buckling_proof.buckling_proof(
                                            test_cs)
                                        st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                        )
                                        if end_cs.proven():
                                            cs_collector.into_collector(end_cs)
                                            print("PASS!")
                                        else:
                                            print("FAIL!")
                        #with bottom stiffeners
                        else:
                            for I_side in I_range:
                                locations_side = get_locations_side(
                                    num_side_stiffeners, sign)
                                for loc_side in range(len(locations_side)):
                                    for I_btm in I_range:
                                        print(
                                            "\n-------------------------------------------------------------------------------------------------------"
                                        )
                                        print(
                                            "------------------------------------ CS"
                                            + str(counter) +
                                            "---------------------------------------------------------------"
                                        )
                                        counter += 1
                                        print("#Side Stiffeners " +
                                              str(num_side_stiffeners))
                                        print("#Btm Stiffeners " +
                                              str(num_btm_stiffeners))
                                        print("I_Side " + str(I_side))
                                        print("I_Btm " + str(I_btm))
                                        st_prop = stiffeners_proposition.stiffeners_proposition(
                                        )
                                        st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                        )
                                        for num in range(num_side_stiffeners):
                                            #create side stiffeners
                                            loc = locations_side[loc_side][num]
                                            assert loc != -1, "Error!"
                                            st_number_right = num_top_stiffeners + num + 1
                                            st_number_left = num_top_stiffeners + num_btm_stiffeners + 2 * num_side_stiffeners - num
                                            st_right = proposed_stiffener.proposed_stiffener(
                                                pl_position=2,
                                                st_number=st_number_right,
                                                location=loc,
                                                i_along=I_side)
                                            st_left = proposed_stiffener.proposed_stiffener(
                                                pl_position=4,
                                                st_number=st_number_left,
                                                location=loc,
                                                i_along=I_side)
                                            st_prop_rest.stiffeners.append(
                                                st_right)
                                            st_prop_rest.stiffeners.append(
                                                st_left)
                                            #create bottom siffeners
                                        for num in range(num_btm_stiffeners):
                                            loc_btm = -1 + 2 / (
                                                num_btm_stiffeners +
                                                1) * (num + 1)
                                            st_number = num_top_stiffeners + num_side_stiffeners + num + 1
                                            st = proposed_stiffener.proposed_stiffener(
                                                pl_position=3,
                                                st_number=st_number,
                                                location=loc_btm,
                                                i_along=I_btm)
                                            st_prop_rest.stiffeners.append(st)
                                        st_prop.stiffeners = st_prop_deck.stiffeners + st_prop_rest.stiffeners
                                        st_prop.stiffeners = sorted(
                                            st_prop.stiffeners,
                                            key=lambda proposed_stiffener:
                                            proposed_stiffener.st_number)
                                        test_cs = add_stiffeners.add_stiffener_set(
                                            base_cs, st_prop, "b")
                                        if test_cs != False:
                                            #proof
                                            end_cs = buckling_proof.buckling_proof(
                                                test_cs)
                                            st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                            )
                                            if end_cs.proven():
                                                cs_collector.into_collector(
                                                    end_cs)
                                                print("PASS!")
                                            else:
                                                print("FAIL!")

    #two side stiffeners block
    num_side_stiffeners = 2
    if num_side_stiffeners <= side_max:
        for t_side in t_range:
            for t_bottom in t_range:
                base_cs = initial_cs.create_initial_cs(b_sup, b_inf, h, t_side,
                                                       t_deck, t_bottom)
                for num_btm_stiffeners in range(bottom_max + 1):
                    if num_side_stiffeners == 2:
                        #without bottom stiffeners
                        if num_btm_stiffeners == 0:
                            for I_side_btm in I_range:
                                for I_side_top in I_range:
                                    I_collection = [I_side_top, I_side_btm]
                                    locations_side = get_locations_side(
                                        num_side_stiffeners, sign)
                                    for loc_side in range(len(locations_side)):
                                        print(
                                            "\n-------------------------------------------------------------------------------------------------------"
                                        )
                                        print(
                                            "------------------------------------ CS"
                                            + str(counter) +
                                            "---------------------------------------------------------------"
                                        )
                                        counter += 1
                                        print("#Side Stiffeners " +
                                              str(num_side_stiffeners))
                                        print("#Btm Stiffeners " +
                                              str(num_btm_stiffeners))
                                        print("I_Side_Top " + str(I_side_top))
                                        print("I_Side_Bottom " +
                                              str(I_side_btm))
                                        st_prop = stiffeners_proposition.stiffeners_proposition(
                                        )
                                        st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                        )
                                        for num in range(num_side_stiffeners):
                                            #create side stiffeners
                                            loc = locations_side[loc_side][num]
                                            assert loc != -1, "Error!"
                                            st_number_right = num_top_stiffeners + num + 1
                                            st_number_left = num_top_stiffeners + num_btm_stiffeners + 2 * num_side_stiffeners - num
                                            st_right = proposed_stiffener.proposed_stiffener(
                                                pl_position=2,
                                                st_number=st_number_right,
                                                location=loc,
                                                i_along=I_collection[num])
                                            st_left = proposed_stiffener.proposed_stiffener(
                                                pl_position=4,
                                                st_number=st_number_left,
                                                location=loc,
                                                i_along=I_collection[num])
                                            st_prop_rest.stiffeners.append(
                                                st_right)
                                            st_prop_rest.stiffeners.append(
                                                st_left)
                                        st_prop.stiffeners = st_prop_deck.stiffeners + st_prop_rest.stiffeners
                                        st_prop.stiffeners = sorted(
                                            st_prop.stiffeners,
                                            key=lambda proposed_stiffener:
                                            proposed_stiffener.st_number)
                                        test_cs = add_stiffeners.add_stiffener_set(
                                            base_cs, st_prop, "b")
                                        if test_cs != False:
                                            #proof
                                            end_cs = buckling_proof.buckling_proof(
                                                test_cs)
                                            st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                            )
                                            if end_cs.proven():
                                                cs_collector.into_collector(
                                                    end_cs)
                                                print("PASS!")
                                            else:
                                                print("FAIL!")
                        #with bottom stiffeners
                        else:
                            for I_side_btm in I_range:
                                for I_side_top in I_range:
                                    I_collection = [I_side_top, I_side_btm]
                                    locations_side = get_locations_side(
                                        num_side_stiffeners, sign)
                                    for loc_side in range(len(locations_side)):
                                        for I_btm in I_range:
                                            print(
                                                "\n-------------------------------------------------------------------------------------------------------"
                                            )
                                            print(
                                                "------------------------------------ CS"
                                                + str(counter) +
                                                "---------------------------------------------------------------"
                                            )
                                            counter += 1
                                            print("#Side Stiffeners " +
                                                  str(num_side_stiffeners))
                                            print("#Btm Stiffeners " +
                                                  str(num_btm_stiffeners))
                                            print("I_Side_Top " +
                                                  str(I_side_top))
                                            print("I_Side_Bottom " +
                                                  str(I_side_btm))
                                            print("I_Btm " + str(I_btm))
                                            st_prop = stiffeners_proposition.stiffeners_proposition(
                                            )
                                            st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                            )
                                            for num in range(
                                                    num_side_stiffeners):
                                                #create side stiffeners
                                                loc = locations_side[loc_side][
                                                    num]
                                                assert loc != -1, "Error!"
                                                st_number_right = num_top_stiffeners + num + 1
                                                st_number_left = num_top_stiffeners + num_btm_stiffeners + 2 * num_side_stiffeners - num
                                                st_right = proposed_stiffener.proposed_stiffener(
                                                    pl_position=2,
                                                    st_number=st_number_right,
                                                    location=loc,
                                                    i_along=I_collection[num])
                                                st_left = proposed_stiffener.proposed_stiffener(
                                                    pl_position=4,
                                                    st_number=st_number_left,
                                                    location=loc,
                                                    i_along=I_collection[num])
                                                st_prop_rest.stiffeners.append(
                                                    st_right)
                                                st_prop_rest.stiffeners.append(
                                                    st_left)
                                                #create bottom siffeners
                                            for num in range(
                                                    num_btm_stiffeners):
                                                loc_btm = -1 + 2 / (
                                                    num_btm_stiffeners +
                                                    1) * (num + 1)
                                                st_number = num_top_stiffeners + num_side_stiffeners + num + 1
                                                st = proposed_stiffener.proposed_stiffener(
                                                    pl_position=3,
                                                    st_number=st_number,
                                                    location=loc_btm,
                                                    i_along=I_btm)
                                                st_prop_rest.stiffeners.append(
                                                    st)
                                            st_prop.stiffeners = st_prop_deck.stiffeners + st_prop_rest.stiffeners
                                            st_prop.stiffeners = sorted(
                                                st_prop.stiffeners,
                                                key=lambda proposed_stiffener:
                                                proposed_stiffener.st_number)
                                            test_cs = add_stiffeners.add_stiffener_set(
                                                base_cs, st_prop, "b")
                                            if test_cs != False:
                                                #proof
                                                end_cs = buckling_proof.buckling_proof(
                                                    test_cs)
                                                st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                                )
                                                if end_cs.proven():
                                                    cs_collector.into_collector(
                                                        end_cs)
                                                    print("PASS!")
                                                else:
                                                    print("FAIL!")

    #three side stiffeners block
    num_side_stiffeners = 3
    if num_side_stiffeners <= side_max:
        for t_side in t_range:
            for t_bottom in t_range:
                base_cs = initial_cs.create_initial_cs(b_sup, b_inf, h, t_side,
                                                       t_deck, t_bottom)
                for num_btm_stiffeners in range(bottom_max + 1):
                    if num_side_stiffeners == 3:
                        #without bottom stiffeners
                        if num_btm_stiffeners == 0:
                            for I_side_btm in I_range:
                                for I_side_middle in I_range:
                                    for I_side_top in I_range:
                                        I_collection = [
                                            I_side_top, I_side_middle,
                                            I_side_btm
                                        ]
                                        locations_side = get_locations_side(
                                            num_side_stiffeners, sign)
                                        for loc_side in range(
                                                len(locations_side)):
                                            print(
                                                "\n-------------------------------------------------------------------------------------------------------"
                                            )
                                            print(
                                                "------------------------------------ CS"
                                                + str(counter) +
                                                "---------------------------------------------------------------"
                                            )
                                            counter += 1
                                            print("#Side Stiffeners " +
                                                  str(num_side_stiffeners))
                                            print("#Btm Stiffeners " +
                                                  str(num_btm_stiffeners))
                                            print("I_Side_Top " +
                                                  str(I_side_top))
                                            print("I_Side_Bottom " +
                                                  str(I_side_btm))
                                            print("I_Side_Middle" +
                                                  str(I_side_middle))
                                            st_prop = stiffeners_proposition.stiffeners_proposition(
                                            )
                                            st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                            )
                                            for num in range(
                                                    num_side_stiffeners):
                                                #create side stiffeners
                                                loc = locations_side[loc_side][
                                                    num]
                                                assert loc != -1, "Error!"
                                                st_number_right = num_top_stiffeners + num + 1
                                                st_number_left = num_top_stiffeners + num_btm_stiffeners + 2 * num_side_stiffeners - num
                                                st_right = proposed_stiffener.proposed_stiffener(
                                                    pl_position=2,
                                                    st_number=st_number_right,
                                                    location=loc,
                                                    i_along=I_collection[num])
                                                st_left = proposed_stiffener.proposed_stiffener(
                                                    pl_position=4,
                                                    st_number=st_number_left,
                                                    location=loc,
                                                    i_along=I_collection[num])
                                                st_prop_rest.stiffeners.append(
                                                    st_right)
                                                st_prop_rest.stiffeners.append(
                                                    st_left)
                                            st_prop.stiffeners = st_prop_deck.stiffeners + st_prop_rest.stiffeners
                                            st_prop.stiffeners = sorted(
                                                st_prop.stiffeners,
                                                key=lambda proposed_stiffener:
                                                proposed_stiffener.st_number)
                                            test_cs = add_stiffeners.add_stiffener_set(
                                                base_cs, st_prop, "b")
                                            if test_cs != False:
                                                #proof
                                                end_cs = buckling_proof.buckling_proof(
                                                    test_cs)
                                                st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                                )
                                                if end_cs.proven():
                                                    cs_collector.into_collector(
                                                        end_cs)
                                                    print("PASS!")
                                                else:
                                                    print("FAIL!")
                        #with bottom stiffeners
                        else:
                            for I_side_btm in I_range:
                                for I_side_top in I_range:
                                    for I_side_middle in I_range:
                                        I_collection = [
                                            I_side_top, I_side_middle,
                                            I_side_btm
                                        ]
                                        locations_side = get_locations_side(
                                            num_side_stiffeners, sign)
                                        for loc_side in range(
                                                len(locations_side)):
                                            for I_btm in I_range:
                                                print(
                                                    "\n-------------------------------------------------------------------------------------------------------"
                                                )
                                                print(
                                                    "------------------------------------ CS"
                                                    + str(counter) +
                                                    "---------------------------------------------------------------"
                                                )
                                                counter += 1
                                                print("#Side Stiffeners " +
                                                      str(num_side_stiffeners))
                                                print("#Btm Stiffeners " +
                                                      str(num_btm_stiffeners))
                                                print("I_Side_Top " +
                                                      str(I_side_top))
                                                print("I_Side_Middle " +
                                                      str(I_side_middle))
                                                print("I_Side_Bottom " +
                                                      str(I_side_btm))
                                                print("I_Btm " + str(I_btm))
                                                st_prop = stiffeners_proposition.stiffeners_proposition(
                                                )
                                                st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                                )
                                                for num in range(
                                                        num_side_stiffeners):
                                                    #create side stiffeners
                                                    loc = locations_side[
                                                        loc_side][num]
                                                    assert loc != -1, "Error!"
                                                    st_number_right = num_top_stiffeners + num + 1
                                                    st_number_left = num_top_stiffeners + num_btm_stiffeners + 2 * num_side_stiffeners - num
                                                    st_right = proposed_stiffener.proposed_stiffener(
                                                        pl_position=2,
                                                        st_number=
                                                        st_number_right,
                                                        location=loc,
                                                        i_along=I_collection[
                                                            num])
                                                    st_left = proposed_stiffener.proposed_stiffener(
                                                        pl_position=4,
                                                        st_number=
                                                        st_number_left,
                                                        location=loc,
                                                        i_along=I_collection[
                                                            num])
                                                    st_prop_rest.stiffeners.append(
                                                        st_right)
                                                    st_prop_rest.stiffeners.append(
                                                        st_left)
                                                    #create bottom siffeners
                                                for num in range(
                                                        num_btm_stiffeners):
                                                    loc_btm = -1 + 2 / (
                                                        num_btm_stiffeners +
                                                        1) * (num + 1)
                                                    st_number = num_top_stiffeners + num_side_stiffeners + num + 1
                                                    st = proposed_stiffener.proposed_stiffener(
                                                        pl_position=3,
                                                        st_number=st_number,
                                                        location=loc_btm,
                                                        i_along=I_btm)
                                                    st_prop_rest.stiffeners.append(
                                                        st)
                                                st_prop.stiffeners = st_prop_deck.stiffeners + st_prop_rest.stiffeners
                                                st_prop.stiffeners = sorted(
                                                    st_prop.stiffeners,
                                                    key=lambda
                                                    proposed_stiffener:
                                                    proposed_stiffener.
                                                    st_number)
                                                test_cs = add_stiffeners.add_stiffener_set(
                                                    base_cs, st_prop, "b")
                                                if test_cs != False:
                                                    #proof
                                                    end_cs = buckling_proof.buckling_proof(
                                                        test_cs)
                                                    st_prop_rest = stiffeners_proposition.stiffeners_proposition(
                                                    )
                                                    if end_cs.proven():
                                                        cs_collector.into_collector(
                                                            end_cs)
                                                        print("PASS!")
                                                    else:
                                                        print("FAIL!")
    printing.print_best_proof()
    printing.print_best()
    return
Esempio n. 7
0
def opt_eqpressure():
    cs_collector.reset()
    b_sup = data.input_data["b_sup"]
    b_inf = data.input_data["b_inf"]
    h = data.input_data["h"]
    t_deck = data.input_data["t_deck"]
    t_values = defaults.t_range_opt
    i_along_values = defaults.I_range
    n_st_side_max = defaults.num_side_stiffeners_max
    n_st_bottom_max = defaults.num_bottom_stiffeners_max

    cs_fresh = initial_cs.create_initial_cs(b_sup, b_inf, h, 1, t_deck, 1)
    st_prop_deck = deck.deck(b_sup, True)
    n_st_deck = len(st_prop_deck.stiffeners)

    assert data.input_data.get(
        "M_Ed") < 1, "Optimizer A does not work for positive bending moments"

    for t_side in t_values:
        print("888888888888888888888888888888888  SIDE T = ", t_side,
              "888888888888888888888888888888888")
        for t_bottom in t_values:
            print("888888888888888888888888888888888  BOTTOM T = ", t_bottom,
                  "888888888888888888888888888888888")

            empty_cs = set_t_side(copy.deepcopy(cs_fresh), t_side)
            empty_cs = set_t_bottom(empty_cs, t_bottom)

            cs_temp = add_stiffeners.add_stiffener_set(copy.deepcopy(empty_cs),
                                                       st_prop_deck, "a")
            cs_temp = buckling_proof.buckling_proof(copy.deepcopy(empty_cs))
            sigma_top_red = get_sigma_top_red(cs_temp)
            sigma_bottom_red = get_sigma_bottom_red(cs_temp)

            #the optimizer loop does not loop i_along, as this should be set optimally by the set functions
            n_st_side = 0
            while n_st_side <= n_st_side_max:
                print("\n888888888888888888888888888888888  ITERATION SIDE ",
                      n_st_side, "888888888888888888888888888888888")

                if n_st_side == 0:
                    i_along_values_side = [1]
                else:
                    i_along_values_side = i_along_values
                for i_along_side in i_along_values_side:
                    print(
                        "\n&&&&&&&&&&&&&&&&&&&&&&&&& ITERATION I_ALONG_SIDE = ",
                        str(i_along_side / 10**5),
                        " &&&&&&&&&&&&&&&&&&&&&&&&&&&")

                    n_st_bottom = 0
                    while n_st_bottom <= n_st_bottom_max:
                        print(
                            "\n888888888888888888888888888888888  ITERATION BOTTOM ",
                            n_st_bottom, "888888888888888888888888888888888")

                        if n_st_bottom == 0:
                            i_along_values_bottom = [1]
                        else:
                            i_along_values_bottom = i_along_values
                        for i_along_bottom in i_along_values_bottom:
                            print(
                                "\n&&&&&&&&&&&&&&&&&&&&&&&&& ITERATION I_ALONG_BOTTOM = ",
                                str(i_along_bottom / 10**5),
                                " &&&&&&&&&&&&&&&&&&&&&&&&&&&")

                            #do it twice; the stresses now are the ones calculated for the same amount of stiffeners (but different place (could do more))
                            for times in range(2):
                                st_prop_side = set_stiffeners_side(
                                    copy.deepcopy(empty_cs), n_st_deck,
                                    n_st_side, n_st_bottom, sigma_top_red,
                                    sigma_bottom_red, i_along_side)
                                st_prop_bottom = set_stiffeners_bottom(
                                    copy.deepcopy(empty_cs), n_st_deck,
                                    n_st_side, n_st_bottom, sigma_bottom_red,
                                    i_along_bottom)
                                st_prop = stiffeners_proposition.stiffeners_proposition(
                                )
                                st_prop.stiffeners = copy.deepcopy(
                                    st_prop_deck.stiffeners) + copy.deepcopy(
                                        st_prop_side.stiffeners
                                    ) + copy.deepcopy(
                                        st_prop_bottom.stiffeners)
                                st_prop.stiffeners = sorted(
                                    st_prop.stiffeners,
                                    key=lambda st: st.st_number)

                                stiffened_cs = add_stiffeners.add_stiffener_set(
                                    copy.deepcopy(empty_cs), st_prop, "a")
                                assert stiffened_cs != True, "cs is bool True"
                                assert stiffened_cs != False, "cs is bool False"
                                stiffened_cs = buckling_proof.buckling_proof(
                                    copy.deepcopy(stiffened_cs))

                                #stresses at the top and bottom corner
                                sigma_top_red = get_sigma_top_red(stiffened_cs)
                                sigma_bottom_red = get_sigma_bottom_red(
                                    stiffened_cs)

                            if stiffened_cs.proven():
                                cs_collector.into_collector(stiffened_cs)

                        #terminate i_along_bottom
                        n_st_bottom += 1
                    #terminate n_st_bottom
                    #terminate else
                #terminate i_along _side
            #terminate n_st_side
                n_st_side += 1
        #terminate t bottom
    #terminate t_side
    printing.print_best()
    printing.print_best_proof()
Esempio n. 8
0
#sys.path.append('C:/Users/Vinzenz Müller/Dropbox/ETH/6. Semester/BA')
#crosssection input and creation (only trapezoid plates)

if defaults.do_print_to_txt == True:
    file = open("user_interface/output/cs_analysis.txt", "w+")
    file.close()
defaults.do_deck_as_prop = True
cs_analysis_tool_terminal_input.set_defaults()
printing.printing(data.constants_tostring(), terminal=True)

cs_analysis_tool_terminal_input.set_cs_geometry()
#data.check_input_data_complete()
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"))

printing.printing(data.input_data_tostring(), terminal=True)

#add the deck stiffeners
st_list_deck = deck.deck(data.input_data.get("b_sup"))
number_st_top = len(st_list_deck.stiffeners)
st_list_deck = substantiate.substantiate(cs, st_list_deck)

#add all other stiffeners
cs_analysis_tool_terminal_input.set_stiffeners(number_st_top)
st_list_rest = []
for st in data.stiffener_data.stiffeners:
    y, z = cs.get_coordinates(st.location, st.pl_position)