Exemplo n.º 1
0
def test_cvepet3():  # {{{1
    """3-point bending CVEPET3 panel"""
    L = 200  # mm
    B = 50  # mm
    h = 26  # mm
    t = 2.5  # mm
    E = 43820  # MPa
    G = 8 * 1.5  # MPa, schuim met siktsels
    P = -150  # N
    H = h + 2 * t
    Ix = B * (H**3 - h**3) / 12
    A = B * h
    results = bm.solve(L, (0, L), bm.Load(force=P, pos=L / 2),
                       np.ones(L + 1) * E * Ix,
                       np.ones(L + 1) * G * A,
                       np.ones(L + 1) * H / 2, -np.ones(L + 1) * H / 2, False)
    bending_bm = results.y[int(L / 2)]
    bending_formula = P * L**3 / (48 * E * Ix)
    results = bm.solve(L, (0, L), bm.Load(force=P, pos=L / 2),
                       np.ones(L + 1) * E * Ix,
                       np.ones(L + 1) * G * A,
                       np.ones(L + 1) * H / 2, -np.ones(L + 1) * H / 2, True)
    total_bm = results.y[int(L / 2)]
    total_formula = bending_formula + (1.5 * P / 2 * L / 2) / (G * A)
    reldiff = abs((bending_bm - bending_formula) / bending_formula)
    assert reldiff < 0.005
    reldifft = abs((total_bm - total_formula) / total_formula)
    assert reldifft < 0.02
Exemplo n.º 2
0
def test_supported_pointloads():  # {{{1
    """Ends supported beam with three equidistant point loads"""
    problem = {
        'length':
        L,
        'EI':
        np.ones(L + 1) * E * Ix,
        'GA':
        np.ones(L + 1) * G * A,
        'top':
        np.ones(L + 1) * H / 2,
        'bot':
        -np.ones(L + 1) * H / 2,
        'supports': (0, L),
        'shear':
        False,
        'loads': [
            bm.Load(force=P, pos=L / 4),
            bm.Load(force=P, pos=L / 2),
            bm.Load(force=P, pos=3 * L / 4)
        ]
    }
    bm.solve(problem)
    deflection_bm = problem['y'][int(L / 2)]
    deflection_formula = 19 * P * L**3 / (384 * E * Ix)
    reldiff = abs((deflection_bm - deflection_formula) / deflection_formula)
    assert reldiff < 0.005
Exemplo n.º 3
0
def test_load_goodargs():  # {{{1
    """beammech.Load with correct arguments"""
    A = bm.Load(kg=1, pos=200)
    assert A.size == -9.81
    assert A.pos == 200
    B = bm.Load(force=-20, pos=300)
    assert B.size == -20
    assert B.pos == 300
    C = bm.Load(kg="1", pos="200")
    assert C.size == -9.81
    assert C.pos == 200
Exemplo n.º 4
0
def test_supported_pointloads():  # {{{1
    """Ends supported beam with three equidistant point loads"""
    results = bm.solve(L, (0, L), [
        bm.Load(force=P, pos=L / 4),
        bm.Load(force=P, pos=L / 2),
        bm.Load(force=P, pos=3 * L / 4)
    ],
                       np.ones(L + 1) * E * Ix,
                       np.ones(L + 1) * G * A,
                       np.ones(L + 1) * H / 2, -np.ones(L + 1) * H / 2, False)
    deflection_bm = results.y[int(L / 2)]
    deflection_formula = 19 * P * L**3 / (384 * E * Ix)
    reldiff = abs((deflection_bm - deflection_formula) / deflection_formula)
    assert reldiff < 0.005
Exemplo n.º 5
0
def test_cvepet3():  # {{{1
    """3-point bending CVEPET3 panel"""
    L = 200  # mm
    B = 50  # mm
    h = 26  # mm
    t = 2.5  # mm
    E = 43820  # MPa
    G = 8 * 1.5  # MPa, schuim met siktsels
    P = -150  # N
    H = h + 2 * t
    Ix = B * (H**3 - h**3) / 12
    A = B * h
    problem = {
        'length': L,
        'EI': np.ones(L + 1) * E * Ix,
        'GA': np.ones(L + 1) * G * A,
        'top': np.ones(L + 1) * H / 2,
        'bot': -np.ones(L + 1) * H / 2,
        'supports': (0, L),
        'shear': False,
        'loads': bm.Load(force=P, pos=L / 2)
    }
    bm.solve(problem)
    bending_bm = problem['y'][int(L / 2)]
    bending_formula = P * L**3 / (48 * E * Ix)
    problem["shear"] = True
    bm.solve(problem)
    total_bm = problem['y'][int(L / 2)]
    total_formula = bending_formula + (1.5 * P / 2 * L / 2) / (G * A)
    reldiff = abs((bending_bm - bending_formula) / bending_formula)
    assert reldiff < 0.005
    reldifft = abs((total_bm - total_formula) / total_formula)
    assert reldifft < 0.02
Exemplo n.º 6
0
def test_supported_central_pointload():  # {{{1
    """Ends supported beam with central point load"""
    results = bm.solve(L, (0, L), bm.Load(force=P, pos=L / 2),
                       np.ones(L + 1) * E * Ix,
                       np.ones(L + 1) * G * A,
                       np.ones(L + 1) * H / 2, -np.ones(L + 1) * H / 2, False)
    deflection_bm = results.y[int(L / 2)]
    deflection_formula = P * L**3 / (48 * E * Ix)
    reldiff = abs((deflection_bm - deflection_formula) / deflection_formula)
    assert reldiff < 0.005
Exemplo n.º 7
0
def test_clamped_pointload():  # {{{1
    """Clamped beam with point load at end"""
    results = bm.solve(L, None, bm.Load(force=P, pos=L),
                       np.ones(L + 1) * E * Ix,
                       np.ones(L + 1) * G * A,
                       np.ones(L + 1) * H / 2, -np.ones(L + 1) * H / 2, False)
    deflection_bm = results.y[L]
    deflection_formula = P * L**3 / (3 * E * Ix)
    reldiff = abs((deflection_bm - deflection_formula) / deflection_formula)
    assert reldiff < 0.005
Exemplo n.º 8
0
def test_supported_central_pointload():  # {{{1
    """Ends supported beam with central point load"""
    problem = {'length': L, 'EI': np.ones(L+1)*E*I, 'GA': np.ones(L+1)*G*A,
               'top': np.ones(L+1)*H/2, 'bot': -np.ones(L+1)*H/2,
               'supports': (0, L), 'shear': False,
               'loads': bm.Load(force=P, pos=L/2)}
    bm.solve(problem)
    deflection_bm = problem['y'][L/2]
    deflection_formula = P*L**3/(48*E*I)
    reldiff = abs((deflection_bm-deflection_formula)/deflection_formula)
    assert reldiff < 0.005
Exemplo n.º 9
0
def test_clamped_pointload():  # {{{1
    """Clamped beam with point load at end"""
    problem = {'length': L, 'EI': np.ones(L+1)*E*I, 'GA': np.ones(L+1)*G*A,
               'top': np.ones(L+1)*H/2, 'bot': -np.ones(L+1)*H/2,
               'shear': False, 'supports': None,
               'loads': bm.Load(force=P, pos=L)}
    bm.solve(problem)
    deflection_bm = problem['y'][L]
    deflection_formula = P*L**3/(3*E*I)
    reldiff = abs((deflection_bm-deflection_formula)/deflection_formula)
    assert reldiff < 0.005
Exemplo n.º 10
0
def test_load_badargs():  # {{{1
    """beammech.Load with faulty arguments"""
    with pytest.raises(KeyError):
        bm.Load()  # All required arguments missing
    with pytest.raises(KeyError):
        bm.Load(kg=-20)  # Required “pos” argument missing
    # Required “force” or “kg” argument missing
    with pytest.raises(KeyError):
        bm.Load(pos=231)
    # Required “force” argument misspelt
    with pytest.raises(KeyError):
        bm.Load(forse=-200, pos=300)
    # Argument “pos” or “force” cannot be converted to float
    with pytest.raises(ValueError):
        bm.Load(force=-120, pos="end")
    with pytest.raises(ValueError):
        bm.Load(force="-q", pos=200)