Exemple #1
0
def test_apply_support():
    E = Symbol('E')
    I = Symbol('I')

    b = Beam(4, E, I)
    b.apply_support(0, "cantilever")
    b.apply_load(20, 4, -1)
    M_0, R_0 = symbols('M_0, R_0')
    b.solve_for_reaction_loads(R_0, M_0)
    assert b.slope() == (80*SingularityFunction(x, 0, 1) - 10*SingularityFunction(x, 0, 2)
                + 10*SingularityFunction(x, 4, 2))/(E*I)
    assert b.deflection() == (40*SingularityFunction(x, 0, 2) - 10*SingularityFunction(x, 0, 3)/3
                + 10*SingularityFunction(x, 4, 3)/3)/(E*I)

    b = Beam(30, E, I)
    b.apply_support(10, "pin")
    b.apply_support(30, "roller")
    b.apply_load(-8, 0, -1)
    b.apply_load(120, 30, -2)
    R_10, R_30 = symbols('R_10, R_30')
    b.solve_for_reaction_loads(R_10, R_30)
    assert b.slope() == (-4*SingularityFunction(x, 0, 2) + 3*SingularityFunction(x, 10, 2)
            + 120*SingularityFunction(x, 30, 1) + SingularityFunction(x, 30, 2) + S(4000)/3)/(E*I)
    assert b.deflection() == (4000*x/3 - 4*SingularityFunction(x, 0, 3)/3 + SingularityFunction(x, 10, 3)
            + 60*SingularityFunction(x, 30, 2) + SingularityFunction(x, 30, 3)/3 - 12000)/(E*I)

    P = Symbol('P', positive=True)
    L = Symbol('L', positive=True)
    b = Beam(L, E, I)
    b.apply_support(0, type='fixed')
    b.apply_support(L, type='fixed')
    b.apply_load(-P, L/2, -1)
    R_0, R_L, M_0, M_L = symbols('R_0, R_L, M_0, M_L')
    b.solve_for_reaction_loads(R_0, R_L, M_0, M_L)
    assert b.reaction_loads == {R_0: P/2, R_L: P/2, M_0: -L*P/8, M_L: L*P/8}
Exemple #2
0
def test_apply_support():
    E = Symbol('E')
    I = Symbol('I')

    b = Beam(4, E, I)
    b.apply_support(0, "cantilever")
    b.apply_load(20, 4, -1)
    M_0, R_0 = symbols('M_0, R_0')
    b.solve_for_reaction_loads(R_0, M_0)
    assert b.slope() == (80*SingularityFunction(x, 0, 1) - 10*SingularityFunction(x, 0, 2)
                + 10*SingularityFunction(x, 4, 2))/(E*I)
    assert b.deflection() == (40*SingularityFunction(x, 0, 2) - 10*SingularityFunction(x, 0, 3)/3
                + 10*SingularityFunction(x, 4, 3)/3)/(E*I)

    b = Beam(30, E, I)
    b.apply_support(10, "pin")
    b.apply_support(30, "roller")
    b.apply_load(-8, 0, -1)
    b.apply_load(120, 30, -2)
    R_10, R_30 = symbols('R_10, R_30')
    b.solve_for_reaction_loads(R_10, R_30)
    assert b.slope() == (-4*SingularityFunction(x, 0, 2) + 3*SingularityFunction(x, 10, 2)
            + 120*SingularityFunction(x, 30, 1) + SingularityFunction(x, 30, 2) + 4000/3)/(E*I)
    assert b.deflection() == (4000*x/3 - 4*SingularityFunction(x, 0, 3)/3 + SingularityFunction(x, 10, 3)
            + 60*SingularityFunction(x, 30, 2) + SingularityFunction(x, 30, 3)/3 - 12000)/(E*I)
Exemple #3
0
from sympy.physics.continuum_mechanics.beam import Beam
from sympy import symbols
R1, R2 = symbols('R1, R2')
E, I = symbols('E, I')
b = Beam(50, 20, 30)
b.apply_load(10, 2, -1)
b.apply_load(R1, 10, -1)
b.apply_load(R2, 30, -1)
b.apply_load(90, 5, 0, 23)
b.apply_load(10, 30, 1, 50)
b.apply_support(50, "pin")
b.apply_support(0, "fixed")
b.apply_support(20, "roller")
p = b.draw()
p
# Plot object containing:
# [0]: cartesian line: 25*SingularityFunction(x, 5, 0) - 25*SingularityFunction(x, 23, 0)
# + SingularityFunction(x, 30, 1) - 20*SingularityFunction(x, 50, 0)
# - SingularityFunction(x, 50, 1) + 5 for x over (0.0, 50.0)
# [1]: cartesian line: 5 for x over (0.0, 50.0)
p.show()
Exemple #4
0
from sympy import symbols
from sympy.physics.continuum_mechanics.beam import Beam
E, I = symbols('E, I')
R_0, R_8 = symbols('R_0, R_8')
b = Beam(12, E, I)
b.apply_support(0, 'roller')
b.apply_support(8, 'roller')
b.solve_for_ild_reactions(1, R_0, R_8)
b.solve_for_ild_moment(4, 1, R_0, R_8)
b.ild_moment
# Piecewise((-x/2, x < 4), (x/2 - 4, x > 4))
b.plot_ild_moment()
# Plot object containing:
# [0]: cartesian line: Piecewise((-x/2, x < 4), (x/2 - 4, x > 4)) for x over (0.0, 12.0)
Exemple #5
0
def computeBeam(E_mod, I_inertia, blen, sup_types, sup_locs, pl_forces,
                pl_locs, mom_moments, mom_locs, dl_loads, dl_orders, dl_starts,
                dl_stops):
    print("debug: ", debug)
    global s1
    s1 = time.time()
    if (debug):
        print("S1: ", s1, time.time() - s1)
    E, I = symbols('E, I')
    E = E_mod
    I = I_inertia
    print(blen, E, I)
    b = Beam(blen, E, I)  #creating beam object

    #support conditions
    if (len(sup_types) > 0):
        for index in range(0, len(sup_types)):
            location = float(sup_locs[index])
            sup = sup_types[index]
            b.apply_support(
                location,
                sup.lower())  #sup is in the form 'Fixed' or 'Roller' or 'Pin'

    #applying point loads
    if (pl_forces != ['']):
        for index in range(0, len(pl_forces)):
            b.apply_load(float(pl_forces[index]), float(pl_locs[index]), -1)

    #applying moments
    if (mom_moments != ['']):
        for index in range(0, len(mom_moments)):
            b.apply_load(float(mom_moments[index]), float(mom_locs[index]), -2)

    #applying distributed loads
    if (dl_loads != ['']):
        for index in range(0, len(dl_loads)):
            w = float(dl_loads[index])
            start = float(dl_starts[index])
            stop = float(dl_stops[index])
            order = int(dl_orders[index])

            b.apply_load(w, start, order, end=stop)

    #-------------------------------------------------------------------------------------------------------------------------
    # at this stage we have a beam object with all the support and loading conditions finalized. Time to calculate...
    #-------------------------------------------------------------------------------------------------------------------------

    #dictionary with all the reaction load variables
    load_func = str(b.load)
    if (debug):
        print("\nTIME:", time.time() - s1)
        print("LOAD FUNC: ", load_func)
    reactions = getReactionVarsDict(load_func)

    #preparing parameters to pass to b.solve_for_reaction_loads()
    params = ''
    for key in reactions:
        params = params + "reactions['" + key + "'],"

    params = params.rstrip(',')

    #creating command to solve for reaction loads
    solve_for_reacs = "b.solve_for_reaction_loads(" + params + ")"
    eval(solve_for_reacs)

    #-------------------------------------------------------------------------------------------------------------------------
    # at this stage all the calculations are done and the beam is solved. Time to extract the results...
    #-------------------------------------------------------------------------------------------------------------------------
    maxflag = False
    if (len(pl_forces) < 2 and len(mom_moments) < 2 and dl_loads[0] == ''
            and len(sup_types) == 1):
        maxflag = True

    load_func = str(b.load)
    if (debug):
        print("\nTIME:", time.time() - s1)
        print("\nload_func: ", load_func)
    reactions = str(b.reaction_loads)

    sf, max_sf_loc, max_sf = getShearForce(b, maxflag)

    bm, max_bm_loc, max_bm = getBendingMoment(b, maxflag)

    defl, max_defl_loc, max_defl = getDeflection(b, maxflag)

    #Shear Force and Bending Moment Functions
    sf_func = str(sf)
    if (debug):
        print("\nProblem 5:", time.time() - s1)
        print("\nsf_func: ", sf_func)
    bm_func = str(bm)
    if (debug):
        print("\nTIME:", time.time() - s1)
        print("\nbm_func: ", bm_func)

    slope_func = str(getSlope(b))
    if (debug):
        print("\nTIME:", time.time() - s1)
        print("\nslope_func: ", slope_func)

    defl_func = str(defl)
    if (debug):
        print("\nTIME:", time.time() - s1)
        print("\defl_func: ", defl_func)

    getDrawing(b)
    tot_time = time.time() - s1

    #final results
    res_beam = SolvedBeam(E, I, blen, load_func, reactions,\
        sf_func, max_sf, max_sf_loc,\
        bm_func,max_bm, max_bm_loc,\
        slope_func,\
        defl_func, max_defl, max_defl_loc, tot_time)

    return res_beam