Exemplo n.º 1
0
def set_stiffeners_bottom(cs, n_st_deck, n_st_side, amount, sigma_bottom_red,
                          i_along_bottom):
    if amount == 0:
        propositions = stiffeners_proposition.stiffeners_proposition()
        return propositions
    else:
        cs_b_inf = data.input_data.get("b_inf")
        st_b_sup = data.input_data.get("b_inf") / (2 * amount + 1)

        locations = []
        #where are the centers of the stiffeners
        #the location is the number of st_b_sup away from y = 0
        #1 st gives 0
        #2 st give -1, 1
        #3 st give -2, 0, 2 ...
        i = -amount + 1
        while i <= amount:
            locations.append(i)
            i += 2
        #change it to the convention of create_stiffener_global
        for l in range(amount):
            locations[l] = locations[l] * st_b_sup / cs_b_inf * 2
            print("locations bottom: ", locations[l])
        #print("sum of widths", amount*st_b_sup)

        #create the proposed_stiffeners
        if st_b_sup < 100:
            i_along = 10**5
        elif st_b_sup < 300:
            i_along = 10**6
        elif st_b_sup < 500:
            i_along = 10**7
        else:
            i_along = 5 * 10**7
        st_number_side1_max = 0
        for plate in cs.lines:
            if plate.code.pl_position == 1 and plate.code.st_number > st_number_side1_max:
                st_number_side1_max = plate.code.st_number

        propositions = stiffeners_proposition.stiffeners_proposition()
        st_number = n_st_deck + st_number_side1_max + n_st_side + 1
        for location in locations:
            proposition = proposed_stiffener.proposed_stiffener(
                3, st_number, location, i_along, st_b_sup)
            proposition.b_sup_corr = True
            propositions.add(proposition)
            st_number += 1
        #correct the st_numbers of side 4
        for plate in cs.lines:
            if plate.code.pl_type == 1 and plate.code.pl_position == 4:
                plate.code.st_number += amount

        propositions.stiffeners = sorted(propositions.stiffeners,
                                         key=lambda st: st.st_number)

        return propositions
Exemplo n.º 2
0
import initial_cs as ics
from output import geometry_output as go
from classes import stiffener as st

#assign input to variables
b_sup = 4000 #data.input_data["b_sup"]
b_inf = 2000 #data.input_data["b_inf"]
h = 1500 #data.input_data["h"]

#create initial cross section with t=20mm
test_cs = ics.create_initial_cs(b_sup, b_inf, h, 20, 20, 20)
for line in test_cs.lines:
    line.t = 20

#propose stiffeners, mimicking input from optimizer
prop_1 = ps.proposed_stiffener(2, 1, 0.7, 10**7)
prop_2 = ps.proposed_stiffener(2, 2, 0.15, 10**7)
prop_3 = ps.proposed_stiffener(3, 3, -0.6, 10**7)
prop_4 = ps.proposed_stiffener(3, 4, -0.3, 10**7)
prop_5 = ps.proposed_stiffener(3, 5, 0, 10**7)
prop_6 = ps.proposed_stiffener(3, 6, 0.3, 10**7)
prop_7 = ps.proposed_stiffener(3, 7, 0.6, 10**7)
prop_8 = ps.proposed_stiffener(4, 8, 0.15, 10**7)
prop_9 = ps.proposed_stiffener(4, 9, 0.7, 10**7)


#add all propositions to a list
prop_list = st_prop.stiffeners_proposition()
prop_list.add(prop_1)
prop_list.add(prop_2)
prop_list.add(prop_3)
Exemplo 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
Exemplo n.º 4
0
def input_to_prop(num_top, num_side, num_btm):
    cont = form_values.content
    st_list = stiffeners_proposition.stiffeners_proposition()
    side_st_data = []
    btm_st_data = []

    #side stiffeners
    for i in range(num_side):
        location = cont.get("location" + str(i + 1))
        b_sup = cont.get("b_sup" + str(i + 1))
        b_inf = cont.get("b_inf" + str(i + 1))
        h = cont.get("h" + str(i + 1))
        t = cont.get("t" + str(i + 1))
        st_data = [location, b_sup, b_inf, h, t]
        side_st_data.append(st_data)

    side_st_data = sorted(side_st_data, key=lambda st: st[0])

    for i in range(num_side):
        location = side_st_data[i][0]
        b_sup = side_st_data[i][1]
        b_inf = side_st_data[i][2]
        h = side_st_data[i][3]
        t = side_st_data[i][4]
        i_along = add_stiffeners.get_i_along_stiffener(b_sup, b_inf, h, t)
        stiffener_right_i = proposed_stiffener.proposed_stiffener(2, int(num_top + num_side - i), location, \
        i_along, b_sup, b_inf, h, t)
        st_list.add(stiffener_right_i)
        stiffener_left_i = proposed_stiffener.proposed_stiffener(4, int(num_top + num_side + num_btm + i + 1), location, \
        i_along, b_sup, b_inf, h, t)
        st_list.add(stiffener_left_i)

    #bottom stiffeners
    middle_value = math.ceil(num_btm / 2)
    for i in range(middle_value):
        location = cont.get("location" + str(i + 31))
        b_sup = cont.get("b_sup" + str(i + 31))
        b_inf = cont.get("b_inf" + str(i + 31))
        h = cont.get("h" + str(i + 31))
        t = cont.get("t" + str(i + 31))
        st_data = [location, b_sup, b_inf, h, t]
        btm_st_data.append(st_data)

    btm_st_data = sorted(btm_st_data, key=lambda st: st[0])

    for i in range(middle_value):
        location = btm_st_data[i][0]
        b_sup = btm_st_data[i][1]
        b_inf = btm_st_data[i][2]
        h = btm_st_data[i][3]
        t = btm_st_data[i][4]
        i_along = add_stiffeners.get_i_along_stiffener(b_sup, b_inf, h, t)
        if num_btm % 2 == 1 and i == 0:
            stiffener_bottom_middle = proposed_stiffener.proposed_stiffener(3, int(num_top +num_side + middle_value), location, \
            i_along, b_sup, b_inf, h, t)
            st_list.add(stiffener_bottom_middle)
        elif num_btm % 2 == 1 and i != 0:
            stiffener_bottom_right_i = proposed_stiffener.proposed_stiffener(3, int(num_top + num_side + middle_value - i), -location, \
            i_along, b_sup, b_inf, h, t)
            st_list.add(stiffener_bottom_right_i)
            stiffener_bottom_left_i = proposed_stiffener.proposed_stiffener(3, int(num_top + num_side + middle_value + i), location, \
            i_along, b_sup, b_inf, h, t)
            st_list.add(stiffener_bottom_left_i)
        elif num_btm % 2 == 0:
            stiffener_bottom_right_i = proposed_stiffener.proposed_stiffener(3, int(num_top + num_side + num_btm/2-i), -location, \
            i_along, b_sup, b_inf, h, t)
            st_list.add(stiffener_bottom_right_i)
            stiffener_bottom_left_i = proposed_stiffener.proposed_stiffener(3, int(num_top + num_side + num_btm/2 + 1 + i), location, \
            i_along, b_sup, b_inf, h, t)
            st_list.add(stiffener_bottom_left_i)

    st_list.stiffeners = sorted(st_list.stiffeners,
                                key=lambda st: st.st_number)
    data.stiffener_data = {}
    data.stiffener_data = st_list
    return
def set_stiffeners(number_st_top):
    stiffeners = stiffeners_proposition.stiffeners_proposition()
    print("\nHow many stiffeners an each side? =", end='')
    number_side = int(input())
    print("\nHow many stiffeners an bottom side? =", end='')
    number_bottom = int(input())

    #set the side ones
    st_list = stiffeners_proposition.stiffeners_proposition()
    i = 1
    while i <= number_side:
        if i == 1:
            if number_side == 1:
                print("\nSide Stiffener: ", end='')
            else:
                print("\nSide stiffeners from bottom to top", end='')
        print("\nstiffener ", str(i), end='')
        print("\nlocation [height ratio from bottom 0 to top 1] =", end='')
        location = float(input())
        print("\nDo you want to use defaults? y/n: ", end='')
        string = str(input())
        if string == "y":
            b_sup = defaults.st_b_sup
            b_inf = defaults.st_b_inf
            h = defaults.st_h
            t = defaults.st_t
        else:
            print("\nb_sup [mm] =", end='')
            b_sup = float(input())
            print("\nb_inf [mm] =", end='')
            b_inf = float(input())
            print("\nh [mm] =", end='')
            h = float(input())
            print("\nt [mm] =", end='')
            t = float(input())
        i_along = add_stiffenersget_i_along_stiffener(b_sup, b_inf, h, t)

        stiffener_right_i = proposed_stiffener.proposed_stiffener(2, int(number_st_top + number_side + 1 - i), location, \
        i_along, b_sup, b_inf, h, t)
        print(stiffener_right_i.st_number)
        st_list.add(stiffener_right_i)
        stiffener_left_i = proposed_stiffener.proposed_stiffener(4, int(number_st_top + number_side + number_bottom + i), location, \
        i_along, b_sup, b_inf, h, t)
        print(stiffener_left_i.st_number)
        st_list.add(stiffener_left_i)
        i += 1

    i = 1
    if number_bottom % 2 == 1:
        iterations = int(number_bottom / 2) + 1
    else:
        iterations = number_bottom / 2
    while i <= iterations:
        if i == 1:
            if iterations == 1:
                print("\nBottom stiffener: ", end='')
            else:
                print("\nBottom stiffeners from inside to the outside", end='')
        print("\nstiffener ", str(i), end='')
        if i == 1 and number_bottom % 2 == 1:
            location = 0
        else:
            print("\nlocation [width ratio 0 middle 1 corner] =", end='')
            location = float(input())
        print("\nDo you want to use defaults? y/n: ", end='')
        string = str(input())
        if string == "y":
            b_sup = defaults.st_b_sup
            b_inf = defaults.st_b_inf
            h = defaults.st_h
            t = defaults.st_t
        else:
            print("\nb_sup [mm] =", end='')
            b_sup = float(input())
            print("\nb_inf [mm] =", end='')
            b_inf = float(input())
            print("\nh [mm] =", end='')
            h = float(input())
            print("\nt [mm] =", end='')
            t = float(input())
        i_along = add_stiffenersget_i_along_stiffener(b_sup, b_inf, h, t)

        if number_bottom % 2 == 1 and i == 1:
            print("middle: ", iterations)
            stiffener_bottom_middle = proposed_stiffener.proposed_stiffener(3, int(number_st_top +number_side + iterations), location, \
            i_along, b_sup, b_inf, h, t)
            st_list.add(stiffener_bottom_middle)
        elif number_bottom % 2 == 1 and i != 1:
            print("right", iterations - int(number_bottom / 2) - 2 + i)
            stiffener_bottom_right_i = proposed_stiffener.proposed_stiffener(3, int(number_st_top + number_side + iterations -int(number_bottom/2)-2 + i), -location, \
            i_along, b_sup, b_inf, h, t)
            st_list.add(stiffener_bottom_right_i)
            print("left", iterations + int(number_bottom / 2) + 2 - i)
            stiffener_bottom_left_i = proposed_stiffener.proposed_stiffener(3, int(number_st_top + number_side + iterations +int(number_bottom/2)+2 - i), location, \
            i_along, b_sup, b_inf, h, t)
            st_list.add(stiffener_bottom_left_i)
        elif number_bottom % 2 == 0:
            print("right", i)
            stiffener_bottom_right_i = proposed_stiffener.proposed_stiffener(3, int(number_st_top + number_side + iterations + 1 - i), -location, \
            i_along, b_sup, b_inf, h, t)
            st_list.add(stiffener_bottom_right_i)
            print("left", number_bottom + 1 - i)
            stiffener_bottom_left_i = proposed_stiffener.proposed_stiffener(3, int(number_st_top + number_side+ iterations + i), location, \
            i_along, b_sup, b_inf, h, t)
            st_list.add(stiffener_bottom_left_i)
        i += 1

    st_list.stiffeners = sorted(st_list.stiffeners,
                                key=lambda st: st.st_number)
    for st in st_list.stiffeners:
        print(st.st_number)
    data.stiffener_data = st_list
Exemplo n.º 6
0
def set_stiffeners_side(cs, n_st_deck, amount, n_st_bottom, sigma_top_red,
                        sigma_bottom_red, i_along_side):
    if amount == 0:
        propositions = stiffeners_proposition.stiffeners_proposition()
        return propositions
    else:
        #all tension?
        if sigma_top_red < 0 and sigma_bottom_red < 0:
            propositions = stiffeners_proposition.stiffeners_proposition()
            return propositions

        #where is the higher pressure
        if sigma_top_red > sigma_bottom_red:
            higher_top = True
            sigma_max = sigma_top_red
        else:
            higher_top = False
            sigma_max = sigma_bottom_red

        #the max stress and if all pressure than also the small one
        if sigma_top_red > 0 and sigma_bottom_red > 0:
            if higher_top == True:
                sigma_min = sigma_bottom_red
            else:
                sigma_min = sigma_top_red
        else:
            sigma_min = 0

        psi = min(sigma_top_red, sigma_bottom_red) / max(
            sigma_top_red, sigma_bottom_red)
        h = data.input_data.get("h")

        #h_c height that is under pressure length of whole triangle
        h_c = h / (1 - psi)

        #h_min is the height under pressure that exceeds h
        #h_0 is the height under tension of h
        if h_c < h:
            h_min = 0
            h_0 = h - h_c
        else:
            h_min = h_c - h
            h_0 = 0

        #pressure gradient m
        m = sigma_max / h_c
        #eqpressure means all single plates get the same total force F
        F = (m * h_c**2 / 2 - m * h_min**2 / 2) / (2 * amount + 1)

        #now to find the distances between the welding points
        distances = []
        i = 1
        sigma_i_before = sigma_min
        #distance is
        #from sigma_min to sigma_max find the distances using m and F
        while i <= 2 * amount + 1:
            #F = 1/2 * (sigma_before + sigma_before + m * distance_i) * distance_i
            #= = m*distance_i**2 + 2*sigma_before*distance_i -2*F
            distance_i = 1 / (2 * m) * ((-2) * sigma_i_before + math.sqrt(
                (2 * sigma_i_before)**2 - 4 * m * (-2 * F)))
            #print("distance_i: "+str(distance_i))
            distances.append(distance_i)
            sigma_i_before = sigma_i_before + m * distance_i
            i += 1

        #sanity check
        #print("h_0", h_0)
        #print("+ sum(distances)", sum(distances))
        #print("= ", math.floor(h_0 + sum(distances)))
        #print("should be ", h)
        assert abs(h - (h_0 + sum(distances))) <= 5, "distances are wrong"

        #locations_abs are the centers between the welding points
        #the first is in distances[1]
        locations_abs = []
        b_sup_list = []
        i = 2
        locations_abs.append(h_0 + copy.deepcopy(distances[0]) +
                             copy.deepcopy(distances[1]) / 2)
        b_sup_list.append(copy.deepcopy(distances[1]))
        locations_abs_last = copy.deepcopy(locations_abs[0])
        print("")
        print("widths_side: " + str(round(b_sup_list[0])))
        while i <= amount:
            locations_abs_i = locations_abs_last + distances[
                2 * i - 2] / 2 + distances[2 * i -
                                           2] + distances[2 * i - 1] / 2
            locations_abs.append(locations_abs_i)
            locations_abs_last = copy.deepcopy(locations_abs_i)
            width_i = copy.deepcopy(distances[2 * i - 1])
            print("widths_side: " + str(round(width_i)))
            b_sup_list.append(width_i)
            i += 1

        print("")
        print("there are " + str(len(locations_abs)) + " in locations_abs")

        #correct to relative height
        locations_side = []
        for locations_abs_i in locations_abs:
            locations_side.append(locations_abs_i / h)
            print("locations_side: " + str(locations_abs_i / h))

        i_alongs = [i_along_side]
        i = 2
        i_along_before = i_along_side
        #the i_alongs are scaled propotionally to the pressure gradient starting from i_along argument being the smallest
        while i <= amount:
            #2*i -1 is the width of the stiffener i
            i_along_next = i_along_before * (locations_abs[i - 1] - h_0) / (
                locations_abs[i - 2] - h_0)
            i_alongs.append(i_along_next)
            i_along_before = i_along_next
            i += 1

        #create the proposed_stiffeners
        #find the highest st number on the deck plate the bottom plate has no stiffener yet
        st_number_side1_max = 0
        for plate in cs.lines:
            if plate.code.pl_position == 1 and plate.code.st_number > st_number_side1_max:
                st_number_side1_max = plate.code.st_number

        propositions = stiffeners_proposition.stiffeners_proposition()

        if higher_top == True:

            #propositions are created from bottom to top
            for i in range(amount):
                proposition_right_i = proposed_stiffener.proposed_stiffener(
                    2, n_st_deck + st_number_side1_max + amount - i,
                    locations_side[i], i_alongs[i], b_sup_list[i])
                proposition_right_i.b_sup_corr = True
                propositions.add(proposition_right_i)
                proposition_left_i = proposed_stiffener.proposed_stiffener(
                    4, n_st_deck + st_number_side1_max + n_st_bottom + amount +
                    i + 1, locations_side[i], i_alongs[i], b_sup_list[i])
                proposition_left_i.b_sup_corr = True
                propositions.add(proposition_left_i)
                i += 1
        else:
            for i in range(len(locations_side)):
                locations_side[i] = 1 - locations_side[i]
            #propositions are created from top to bottom
            for i in range(amount):
                proposition_right_i = proposed_stiffener.proposed_stiffener(
                    2, n_st_deck + st_number_side1_max + 1 + i,
                    locations_side[i], i_alongs[i], b_sup_list[i])
                proposition_right_i.b_sup_corr = True
                propositions.add(proposition_right_i)
                proposition_left_i = proposed_stiffener.proposed_stiffener(
                    4, n_st_deck + st_number_side1_max + n_st_bottom +
                    2 * amount - i, locations_side[i], i_alongs[i],
                    b_sup_list[i])
                proposition_left_i.b_sup_corr = True
                propositions.add(proposition_left_i)
                i += 1

        propositions.stiffeners = sorted(propositions.stiffeners,
                                         key=lambda st: st.st_number)

        return propositions
Exemplo n.º 7
0
def deck(b_deck, as_prop):
    #get the minimal required inertial moment according to EC 3-2
    min_Iy = min_inertial_mom()
    #choose correct value according to EC 3-2, C.1.2.2. in the defaults
    t_deck = defaults.t_deck
    #set maximum default values and step size for range
    h_max = defaults.h_maximal
    h_step = defaults.h_step
    h_min = defaults.h_minimal

    #must be >6mm according to EC 3-2, C.1.2.2.
    t_range = [8,10,12,15,16,18,20]

    #b_sup, b_inf, h, t, mass
    best = [0,0,0,0,10**8]

    best_i = 0
    #iterate through all the possible solutions, in order to find viable ones
    for t in t_range:
        b_sup_theor = min(25*t_deck, 300)
        num_of_plates = math.ceil(b_deck / b_sup_theor)
        if num_of_plates % 2 == 0:
            num_of_plates += 1
        assert num_of_plates % 2 == 1, "Number of Deck plates Error!"
        num_of_stiffeners = (num_of_plates-1)/2
        b_sup = b_deck / num_of_plates

        #assume the stiffener angle to be 75°
        for h in range(h_min, h_max, h_step):
            b_inf = b_sup - 2*h / math.tan(defaults.max_angle)
            #arbitrary value for evaluation
            if b_inf > 3*t:
                deck_stiffener = create_deck_stiffener_local(b_sup, b_inf, h, t, t_deck)
                I_a = deck_stiffener.get_i_y_tot()
                if I_a > min_Iy:
                    m = num_of_stiffeners*deck_stiffener.get_area_tot()
                    if m < best[4]:
                        best = [b_sup, b_inf, h, t, m]
                        best_i = I_a

    b_sup = best[0]
    b_inf = best[1]
    h = best[2]
    t = best[3]
    assert best[4] != 10**8, "Value of a too big to find deck stiffeners."



    #For the optimizer: return stiffeners as propositions
    if as_prop == True:
        deck_st_prop = stiffeners_proposition.stiffeners_proposition()
        num_of_plates = round(b_deck / b_sup)
        num_of_stiffeners = (num_of_plates-1)/2

        for i in range(int(num_of_stiffeners)):
            center_y = (0.5*b_deck - (2*i+1.5)*b_sup)/b_deck*2
            st_prop = proposed_stiffener.proposed_stiffener(1, i+1, center_y, min_Iy, b_sup, b_inf, h, t)
            st_prop.deck_st = True
            deck_st_prop.add(st_prop)
        return deck_st_prop

    #For the Analysis Tool: return stiffeners as stiffeners
    elif as_prop == False:
        #create a list of deck stiffeners
        deck_stiffener_list = []
        num_of_plates = round(b_deck / b_sup)
        num_of_stiffeners = (num_of_plates-1)/2
        for i in range(int(num_of_stiffeners)):
            center_y = (0.5*b_deck - (2*i+1.5)*b_sup)
            stiffener_cs = add_stiffeners.create_stiffener_global(1, i+1, center_y, 0, 0, b_sup, b_inf, h, t)
            deck_stiffener_list.append(stiffener_cs)
        return deck_stiffener_list
Exemplo n.º 8
0
defaults.set_cs_defaults()
defaults.set_forces_defaults()

cs = initial_cs.create_initial_cs(data.input_data.get("b_sup"),
                                  data.input_data.get("b_inf"),
                                  data.input_data.get("h"), 20, 20, 20)
geometry_output.print_cs_red(cs)
deck_stiffeners = deck.deck(data.input_data.get("b_sup"))
cs = merge.merge(cs, deck_stiffeners)
geometry_output.print_cs_red(cs)

prop_list = stiffeners_proposition.stiffeners_proposition()
#propose stiffeners, mimicking input from optimizer

prop_1 = proposed_stiffener.proposed_stiffener(2, 1, 0.5, 10**7)
prop_list.add(prop_1)

#prop_2 = ps.proposed_stiffener(2, 2, 0.3, 10**7)
#prop_list.add(prop_2)
prop_3 = proposed_stiffener.proposed_stiffener(3, 2, -0.7, 10**7)
prop_list.add(prop_3)
prop_4 = proposed_stiffener.proposed_stiffener(3, 3, 0.7, 10**7)
prop_list.add(prop_4)
#prop_5 = ps.proposed_stiffener(4, 5, 0.3, 10**7)
#prop_list.add(prop_5)
prop_5 = proposed_stiffener.proposed_stiffener(4, 4, 0.5, 10**7)
prop_list.add(prop_5)

cs = stiffener.add_stiffener_set(cs, prop_list)
geometry_output.print_cs_red(cs)
Exemplo n.º 9
0
t_side = 10
t_deck = 10
t_bottom = 10

#create initial cross section with t=20mm
test_cs = ics.create_initial_cs(b_sup, b_inf, h, t_side, t_deck, t_bottom)
for line in test_cs.lines:
    line.t = 20

deck_stiffeners = deck.deck(b_sup)
test_cs = merge.merge(test_cs, deck_stiffeners)

prop_list = st_prop.stiffeners_proposition()
#propose stiffeners, mimicking input from optimizer

prop_1 = ps.proposed_stiffener(2, 1, 0.8, 10**7)
prop_list.add(prop_1)

#prop_2 = ps.proposed_stiffener(2, 2, 0.3, 10**7)
#prop_list.add(prop_2)
#prop_3 = ps.proposed_stiffener(3, 3, -0.8, 10**7)
#prop_list.add(prop_3)
#prop_4 = ps.proposed_stiffener(3, 4, 0.8, 10**7)
#prop_list.add(prop_4)
#prop_5 = ps.proposed_stiffener(4, 5, 0.3, 10**7)
#prop_list.add(prop_5)
prop_5 = ps.proposed_stiffener(4, 2, 0.8, 10**7)
prop_list.add(prop_5)