Esempio n. 1
0
def print_best_proof():
    i = 1
    for cs in cs_collector.get_best():
        #clear the txt file
        file = open("user_interface/output/cs_analysis.txt", "w+")
        file.close()

        #reset the cross-section so that the proof can be performed
        cs.reset()
        name = "cs_" + str(i)
        cs = buckling_proof.buckling_proof(cs)
        txt_to_pdf(cs,
                   name,
                   location="user_interface/output/best_crosssections/")

        i += 1
Esempio n. 2
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. 3
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. 4
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. 5
0
        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)

line1 = "\n\nResults:"
line2 = "\n   EI: " + str(ei) + "Nm^2"
line3 = "\n   interaction side 2: " + str(interaction_2)
line4 = "\n   interaction side 3: " + str(interaction_3)
line5 = "\n   interaction side 4: " + str(interaction_4)
line6 = "\n   cost: " + str(cost) + "CHF/m"

string = line1 + line2 + line3 + line4 + line5 + line6