예제 #1
0
def test_partial_velocity():
    q1, q2, q3, u1, u2, u3 = dynamicsymbols('q1 q2 q3 u1 u2 u3')
    u4, u5 = dynamicsymbols('u4, u5')
    r = symbols('r')

    N = ReferenceFrame('N')
    Y = N.orientnew('Y', 'Axis', [q1, N.z])
    L = Y.orientnew('L', 'Axis', [q2, Y.x])
    R = L.orientnew('R', 'Axis', [q3, L.y])
    R.set_ang_vel(N, u1 * L.x + u2 * L.y + u3 * L.z)

    C = Point('C')
    C.set_vel(N, u4 * L.x + u5 * (Y.z ^ L.x))
    Dmc = C.locatenew('Dmc', r * L.z)
    Dmc.v2pt_theory(C, N, R)

    vel_list = [Dmc.vel(N), C.vel(N), R.ang_vel_in(N)]
    u_list = [u1, u2, u3, u4, u5]
    assert (partial_velocity(vel_list,
                             u_list) == [[-r * L.y, 0, L.x], [r * L.x, 0, L.y],
                                         [0, 0, L.z], [L.x, L.x, 0],
                                         [
                                             cos(q2) * L.y - sin(q2) * L.z,
                                             cos(q2) * L.y - sin(q2) * L.z, 0
                                         ]])
예제 #2
0
def test_partial_velocity():
    q1, q2, q3, u1, u2, u3  = dynamicsymbols('q1 q2 q3 u1 u2 u3')
    u4, u5 = dynamicsymbols('u4, u5')
    r = symbols('r')

    N = ReferenceFrame('N')
    Y = N.orientnew('Y', 'Axis', [q1, N.z])
    L = Y.orientnew('L', 'Axis', [q2, Y.x])
    R = L.orientnew('R', 'Axis', [q3, L.y])
    R.set_ang_vel(N, u1 * L.x + u2 * L.y + u3 * L.z)

    C = Point('C')
    C.set_vel(N, u4 * L.x + u5 * (Y.z ^ L.x))
    Dmc = C.locatenew('Dmc', r * L.z)
    Dmc.v2pt_theory(C, N, R)

    vel_list = [Dmc.vel(N), C.vel(N), R.ang_vel_in(N)]
    u_list = [u1, u2, u3, u4, u5]
    assert (partial_velocity(vel_list, u_list) == [[- r*L.y, 0, L.x],
            [r*L.x, 0, L.y], [0, 0, L.z], [L.x, L.x, 0],
                [cos(q2)*L.y - sin(q2)*L.z, cos(q2)*L.y - sin(q2)*L.z, 0]])
예제 #3
0
u_s1 = [dot(pP1.vel(A), A.x), dot(pP1.vel(A), A.y), q3d]
u_s2 = [dot(pP1.vel(A), E.x), dot(pP1.vel(A), E.y), q3d]
u_s3 = [q1d, q2d, q3d]

# f1, f2 are forces the panes of glass exert on P1, P2 respectively
R1 = f1 * B.z + C * E.x - m1 * g * B.y
R2 = f2 * B.z - C * E.x - m2 * g * B.y

ulist = [u1, u2, u3]
for uset in [u_s1, u_s2, u_s3]:
    # solve for u1, u2, u3 in terms of q1d, q2d, q3d and substitute
    kinematic_eqs = [u_i - u_expr for u_i, u_expr in zip(ulist, uset)]
    soln = solve(kinematic_eqs, [q1d, q2d, q3d])
    vlist = subs([pP1.vel(A), pP2.vel(A)], soln)

    v_r_Pi = partial_velocity(vlist, ulist, A)
    F1, F2, F3 = [
        simplify(
            factor(
                sum(dot(v_Pi[r], R_i) for v_Pi, R_i in zip(v_r_Pi, [R1, R2]))))
        for r in range(3)
    ]

    print("\nFor generalized speeds [u1, u2, u3] = {0}".format(msprint(uset)))
    print("v_P1_A = {0}".format(vlist[0]))
    print("v_P2_A = {0}".format(vlist[1]))
    print("v_r_Pi = {0}".format(v_r_Pi))
    print("F1 = {0}".format(msprint(F1)))
    print("F2 = {0}".format(msprint(F2)))
    print("F3 = {0}".format(msprint(F3)))
예제 #4
0
파일: Ex8.1.py 프로젝트: 3nrique/pydy
    pP1.vel(A), pP2.vel(A)))

# three sets of generalized speeds
u_s1 = [dot(pP1.vel(A), A.x), dot(pP1.vel(A), A.y), q3d]
u_s2 = [dot(pP1.vel(A), E.x), dot(pP1.vel(A), E.y), q3d]
u_s3 = [q1d, q2d, q3d]

# f1, f2 are forces the panes of glass exert on P1, P2 respectively
R1 = f1*B.z + C*E.x - m1*g*B.y
R2 = f2*B.z - C*E.x - m2*g*B.y

ulist = [u1, u2, u3]
for uset in [u_s1, u_s2, u_s3]:
    # solve for u1, u2, u3 in terms of q1d, q2d, q3d and substitute
    kinematic_eqs = [u_i - u_expr for u_i, u_expr in zip(ulist, uset)]
    soln = solve(kinematic_eqs, [q1d, q2d, q3d])
    vlist = subs([pP1.vel(A), pP2.vel(A)], soln)

    v_r_Pi = partial_velocity(vlist, ulist, A)
    F1, F2, F3 = [simplify(factor(
        sum(dot(v_Pi[r], R_i) for v_Pi, R_i in zip(v_r_Pi, [R1, R2]))))
        for r in range(3)]

    print("\nFor generalized speeds [u1, u2, u3] = {0}".format(msprint(uset)))
    print("v_P1_A = {0}".format(vlist[0]))
    print("v_P2_A = {0}".format(vlist[1]))
    print("v_r_Pi = {0}".format(v_r_Pi))
    print("F1 = {0}".format(msprint(F1)))
    print("F2 = {0}".format(msprint(F2)))
    print("F3 = {0}".format(msprint(F3)))
예제 #5
-1
def test_partial_velocity():
    q1, q2, q3, u1, u2, u3 = dynamicsymbols("q1 q2 q3 u1 u2 u3")
    u4, u5 = dynamicsymbols("u4, u5")
    r = symbols("r")

    N = ReferenceFrame("N")
    Y = N.orientnew("Y", "Axis", [q1, N.z])
    L = Y.orientnew("L", "Axis", [q2, Y.x])
    R = L.orientnew("R", "Axis", [q3, L.y])
    R.set_ang_vel(N, u1 * L.x + u2 * L.y + u3 * L.z)

    C = Point("C")
    C.set_vel(N, u4 * L.x + u5 * (Y.z ^ L.x))
    Dmc = C.locatenew("Dmc", r * L.z)
    Dmc.v2pt_theory(C, N, R)

    vel_list = [Dmc.vel(N), C.vel(N), R.ang_vel_in(N)]
    u_list = [u1, u2, u3, u4, u5]
    assert partial_velocity(vel_list, u_list) == [
        [-r * L.y, 0, L.x],
        [r * L.x, 0, L.y],
        [0, 0, L.z],
        [L.x, L.x, 0],
        [cos(q2) * L.y - sin(q2) * L.z, cos(q2) * L.y - sin(q2) * L.z, 0],
    ]