Exemple #1
0
def reactions(phi1,
              omg1,
              alp1,
              ms,
              Is,
              M5_ext,
              g=-9.807j,
              AB=0.15,
              AC=0.1,
              CD=0.15,
              DF=0.4,
              AG=0.3):

    rA, rB, rC, rD, rF, rG = pos(phi1, AB, AC, CD, DF, AG)
    M5_ext = -np.sign(vel(phi1, omg1, AB, AC, CD, DF, AG)[-1]) * M5_ext
    a2, a3_T, a5_T, a4, aF, aG, alp3, alp5 = acc(phi1, omg1, alp1, AB, AC, CD,
                                                 DF, AG)
    aGs = np.array([a2 / 2, a2, (a4 + aF) / 2, a4, aG / 2])
    Gs, FGs = ms * g, ms * aGs

    # find F45, F05 with matrix solve AX=B
    # moment equation, force equation, dot product of F45 and rD = 0
    A = dA.mat([
        dA.moment(rD - rG / 2),
        dA.moment(rA - rG / 2), [1, 0, 1, 0], [0, 1, 0, 1],
        [np.real(rD), np.imag(rD), 0, 0]
    ], (4, 4))
    b = dA.mat([[Is[-1] * alp5 - M5_ext], kA.toList(FGs[-1] - Gs[-1]), [0]], 4)
    F45, F05 = kA.toComplexes(np.linalg.solve(A, b))

    # find F34
    F34 = FGs[-2] - (Gs[-2] + (-F45))

    # find F03, F23 with matrix solve AX=B
    # moment equation, force equation, dot product of F23 and rF-rC = 0
    rG3 = (rD + rF) / 2

    A = dA.mat([
        dA.moment(rC - rG3),
        dA.moment(rB - rG3), [1, 0, 1, 0], [0, 1, 0, 1],
        [0, 0, np.real(rB - rG3), np.imag(rB - rG3)]
    ], (4, 4))
    b = dA.mat([[Is[2] * alp3 - dA.toCross(rD - rG3, -F34)],
                kA.toList(FGs[2] - Gs[2] - (-F34)), [0]], 4)
    F03, F23 = kA.toComplexes(np.linalg.solve(A, b))

    # find F12, F01
    F12 = FGs[1] - Gs[1] - (-F23)
    F01 = FGs[0] - Gs[0] - (-F12)
    M_eq = Is[0] * alp1 - dA.toCross(rB / 2, -F12) - dA.toCross(-rB / 2, F01)
    return F05, F45, F34, F03, F23, F12, F01, M_eq
def reactions(theta1,
              omg1,
              alp1,
              ms,
              Is,
              M_ext,
              AB,
              AD,
              BC,
              CD,
              g=-9.807j,
              variation=0):
    rB, rC = pos(theta1, AB, AD, BC, CD)[variation]
    aB, aC, alp2, alp3 = acc(theta1, omg1, alp1, AB, AD, BC, CD, variation)
    aGs = np.array([aB / 2, (aB + aC) / 2, aC / 2])

    M_ext *= -np.sign(vel(theta1, omg1, AB, AD, BC, CD, variation)[3])
    Gs, FGs = ms * g, ms * aGs

    # find F03, F12 using dyad method (link 2-3)
    # equilibrium equations,
    A = dA.mat([[1, 0, 1, 0], [0, 1, 0, 1],
                dA.moment(AD - rC), [0, 0], [0, 0],
                dA.moment(rB - rC)], (4, 4))
    b = dA.mat([
        kA.toList(FGs[1] + FGs[2] - Gs[1] - Gs[2]),
        [
            Is[2] * alp3 + dA.toCross((AD - rC) / 2, FGs[2] - Gs[2]) - M_ext,
            Is[1] * alp2 + dA.toCross((rB - rC) / 2, FGs[1] - Gs[1])
        ]
    ], 4)
    F03, F12 = kA.toComplexes(np.linalg.solve(A, b))

    # find F23, F01
    F23 = FGs[2] - Gs[2] - F03
    F01 = FGs[0] - Gs[0] - (-F12)

    # find drive moment
    M_eq = Is[0] * alp1 - (dA.toCross(rB / 2, -F12) + dA.toCross(-rB / 2, F01))
    return F03, F23, F12, F01, M_eq
    aC, aE = kA.acc(rC - rD, omg3, alp3), kA.acc(rE - rD, omg3, alp3)
    a5_T, alp4 = kA.aCPA2(-aE, rF - rD, rF - rE, omg2=omg4, v1_T=v5_T)
    aF = kA.acc(rF - rD, v_T=v5_T, a_T=a5_T)
    return aB, aC, aE, aF, alp2, alp3, alp4


def reactions(phi1, case, ms, Is, F_ext, g=-9.807j):

    rB, rC, rD, rE, rF = pos(phi1, case)
    aB, aC, aE, aF, alp2, alp3, alp4 = acc(phi1, case)
    F = F_ext * -np.sign(np.real(vel(phi1, case)[1]))
    Gs, FGs = ms * g, ms * np.array(
        [aB / 2, (aB + aC) / 2, (aC + aE) / 2, (aE + aF) / 2, aF])

    # find F05, F34 using dyad method
    A = dA.mat([[1, 0, 1, 0], [0, 1, 0, 1], [0, 0],
                dA.moment(rE - rF), [1, 0, 0, 0]], (4, 4))
    b = dA.mat([
        kA.toList(FGs[3] + FGs[4] - Gs[3] - Gs[4] - F),
        [Is[3] * alp4 + dA.toCross((rE - rF) / 2, FGs[3] - Gs[3]), 0]
    ], 4)
    F05, F34 = kA.toComplexes(np.linalg.solve(A, b))
    # find F45
    F45 = FGs[4] - Gs[4] - F05 - F

    # find F03, F12 using dyad method, moment at C
    rG3, rG2 = (rE + rC) / 2, (rB + rC) / 2
    A = dA.mat([[1, 0, 1, 0], [0, 1, 0, 1],
                dA.moment(rD - rC), [0, 0], [0, 0],
                dA.moment(rB - rC)], (4, 4))
    b = dA.mat([
        kA.toList(FGs[2] + FGs[1] - Gs[2] - Gs[1] - (-F34)),
    aE = kA.acc(rE - rF, omg5, alp5)
    return aB, aD, aE, alp2, alp4, alp5


def reactions(phi1, case, ms, Is, M_ext, g=-9.807j):

    rB, rC, rD, rE, rF = pos(phi1, case)
    aB, aD, aE, alp2, alp4, alp5 = acc(phi1, case)
    M_ext *= -np.sign(vel(phi1, case)[-2])

    aGs = np.array([aB / 2, (aB + aD) / 2, 0, (aE + aD) / 2, aE / 2])
    Gs, FGs = ms * g, ms * aGs

    # find F05, F34 using dyad method, moment at E
    A = dA.mat([[1, 0, 1, 0], [0, 1, 0, 1],
                dA.moment(rF - rE), [0, 0], [0, 0],
                dA.moment(rD - rE)], (4, 4))
    b = dA.mat([
        kA.toList(FGs[3] + FGs[4] - Gs[3] - Gs[4]),
        [
            Is[4] * alp5 + dA.toCross((rF - rE) / 2, FGs[4] - Gs[4]) - M_ext,
            Is[3] * alp4 + dA.toCross((rD - rE) / 2, FGs[3] - Gs[3])
        ]
    ], 4)
    F05, F24 = kA.toComplexes(np.linalg.solve(A, b))

    # find F45
    F45 = FGs[4] - Gs[4] - F05

    # find F03, F12 using dyad method, moment at C
    rG2 = (rB + rD) / 2
    aE = aC_max = np.imag(aC)*1j
    aD_max = kA.acc(rD_max-rD, omg2, alp2, v2_T, a2_T)
    return aB, aC, aE, aD_max, aC_max, alp2, a2_T

def reactions(phi1, case, ms, Is, F_ext, g=-9.807j):
    
    rB, rC, rD, rD_max, rE, rC_max = pos(phi1, case)
    aB, aC, aE, aD_max, aC_max, alp2, a2_T = acc(phi1, case)
    F = F_ext*-np.sign(vel(phi1, case)[2])
    aGs = np.array([aB/2, (aD_max+aC)/2, 0, aC, (aE+aC_max)/2])
    Gs, FGs = ms*g, ms*aGs
    
    # find F05, F24 using dyad method, moment at C
    rG5 = (rE+rC_max)/2
    A = dA.mat([[1, 0, 1, 0],
                [0, 1, 0, 1],
                dA.moment(rE-rC), [0, 0],
                [0, 0, 1, 0]], (4, 4))
    b = dA.mat([kA.toList(FGs[3]+FGs[4]-Gs[3]-Gs[4]-F),
                [dA.toCross(rG5-rC, FGs[4]-Gs[4]), 0]], 4)
    F05, F24 = kA.toComplexes(np.linalg.solve(A, b))
        
    # find F45
    F45 = FGs[4] - Gs[4] - F05 - F
    
    # find F32, F12 using dyad method, moment at D
    rG2 = (rC+rD_max)/2
    A = dA.mat([[1, 0, 1, 0],
                [0, 1, 0, 1],
                kA.toList(rB-rD), [0, 0],
                [0, 0], dA.moment(rB-rD)], (4, 4))
    b = dA.mat([kA.toList(FGs[1]-Gs[1]-(-F24)),