Exemple #1
0
def pos(phi1, AB=0.15, AC=0.1, CD=0.15, DF=0.4, AG=0.3):

    rA = 0
    rB = kA.toExp(AB, phi1)
    rC = AC * 1j
    rD = rC + kA.toExp(CD, np.angle(rC - rB))
    rF = rC + kA.toExp(DF - CD, np.angle(rB - rC))
    rG = kA.toExp(AG, np.angle(rD))

    return rA, rB, rC, rD, rF, rG
def pos(theta1, AB, AD, BC, CD):

    rB = kA.toExp(AB, theta1)
    rDB = AD - rB

    # find angle of rCB, rDC
    res1, res2 = kA.CPA4(BC, CD, rDB)
    CB_angle1 = res1[0]
    CB_angle2 = res2[0]
    rC1 = kA.toExp(BC, CB_angle1) + rB
    rC2 = kA.toExp(BC, CB_angle2) + rB
    return (rB, rC1), (rB, rC2)
def pos(phi1, case):

    AB, AC, BD, DE, EF, a, b = case[:-2]
    rB, rC, rF = kA.toExp(AB, phi1), -AC, (a - AC) + b * 1j

    # find rBD
    rBD = kA.toExp(BD, np.angle(rB - rC))
    rD = rB - rBD

    # find rDE and rE
    angle_DE = kA.CPA4(EF, DE, rD - rF)[1][1]
    rDE = kA.toExp(DE, angle_DE)
    rE = rD - rDE

    return rB, rC, rD, rE, rF
def pos(phi1, case):
    
    AB, AD, BC, a = case[:-2]
    CD_max = np.sqrt((AB/AD*(a+AD))**2 + (a+AD)**2)
    rB, rD = kA.toExp(AB, phi1), AD
    rBD = rB - rD
    # rCD + rBC = rBD
    rCD_max, rCD = kA.toExp([CD_max, np.abs(rBD)+BC], np.angle(rBD))
    rD_max = rD - (rCD_max-rCD)
    
    rC = rD + rCD
    rE = -a + np.imag(rC)*1j
    
    rC_max = rE + a
    return rB, rC, rD, rD_max, rE, rC_max
def pos(phi, AC=.15, BC=.2, AD=0.35):

    rC = AC
    BA1, C_angle1 = kA.CPA2(phi, BC, rC)[0]
    BA2, C_angle2 = kA.CPA2(phi, BC, rC)[1]
    rB1, rB2 = kA.toExp(BA1, phi), kA.toExp(BA2, phi)
    rBC1, rBC2 = -kA.toExp(BC, C_angle1), -kA.toExp(BC, C_angle2)

    # BA must be positive and the angle ABC has to be smaller than 90 deg
    if np.abs(np.angle(rBC1) - np.angle(rB1)) < np.pi / 2 and BA1 > 0:
        rB, rBC = rB1, rBC1
    else:
        rB, rBC = rB2, rBC2
    rD = kA.toExp(AD, np.angle(rB))
    return rB, rD, rBC
Exemple #6
0
def pos(phi1, case):
    
    AB, BC, CE, CD, EF, a, b, c = case[:8]
    rB, rD = kA.toExp(AB, phi1), a + b*1j

    # rC-rD + rB-rC = rBD
    CD_angle = kA.CPA4(CD, BC, rB-rD)[0][0]    
    rC = rD + kA.toExp(CD, CD_angle)
    rE = rC + kA.toExp(CE, np.angle(rC-rB))
    
    # find rFA', rE-rF
    res1, res2 = kA.CPA2(0, EF, rE-c*1j)
    
    # rF1 = rD + rFD1
    rF = case[7]*1j + kA.toExp(res2[0], 0)
    
    return rB, rC, rD, rE, rF
def pos(theta1, case):

    rB = kA.toExp(case[0], theta1)
    rD = case[5] + case[6] * 1j
    rBD = rB - rD

    # rCD + rBC = rBD
    CD_angle = kA.CPA4(case[2], case[1], rBD)[0][1]
    rCD = kA.toExp(case[2], CD_angle)
    rED = kA.toExp(case[2] + case[3], CD_angle)
    rC, rE = rD + rCD, rD + rED

    res1, res2 = kA.CPA2(np.pi / 2, case[4], case[7] + rD + rED)
    r0F_1, rFE_1 = kA.toExp(res1[0], np.pi / 2), kA.toExp(case[4], res1[1])
    r0F_2, rFE_2 = kA.toExp(res2[0], np.pi / 2), kA.toExp(case[4], res2[1])

    return (rB, rC, rD, rE, rCD, rED, r0F_1, rFE_1), \
           (rB, rC, rD, rE, rCD, rED, r0F_2, rFE_2)
def pos(phi1, AB=1, BC=1):
    """
    Calculate displacements
    """

    rB = kA.toExp(AB, phi1)
    B_angle1 = kA.CPA2(0, BC, rB)[0][1]
    B_angle2 = kA.CPA2(0, BC, rB)[1][1]
    rBC1 = kA.toExp(BC, B_angle1)
    rBC2 = kA.toExp(BC, B_angle2)
    rC1 = rB - rBC1
    rC2 = rB - rBC2

    if AB == BC:
        if np.real(rB) > 0:
            return rB, rC2, rBC2
        if np.real(rB) < 0:
            return rB, rC1, rBC1

    return (rB, rC1, rBC1), (rB, rC2, rBC2)
def vel(phi, omg1, AC=0.15, BC=0.2, AD=0.35):  # AC < BC

    "find rB, rC, rD"
    rA, rC = 0, AC
    rB, rD, rBC = pos(phi, AC, BC, AD)

    "find velocities"
    # find vD
    vD, vB1 = kA.toVel(rD, omg1), kA.toVel(rB, omg1)

    # find vB2=vB3, omg2=omg3
    # vB2 =     vB1 +       vB2B1
    # _|_BC     _|_AB       //AB
    # omg2?     known       |VB2B1|?
    vB2_coeff = kA.toExp(rB - rC, np.pi / 2)
    # using vB2 = vB1 + vB2B1 and the fact that vB2B1 only has 2 directions:
    # one moving along rBC and the other is along rCB, we get the following
    # code:
    omg2, vB2B1 = kA.solve_w_angle(vB1, vB2_coeff, np.angle(rB))
    vB2B1 = kA.toExp(vB2B1, np.angle(rB))
    vB2 = vB3 = omg2 * vB2_coeff
    return vD, vB1, vB2, vB2B1, omg2
def pos(phi1, case):

    AB, BC, CD, DE, EF, a, b, c = case[:8]
    rB, rD = kA.toExp(AB, phi1), -a + b * 1j
    rBD = rB - rD

    # rCD + rBC = rBD
    CD_angle = kA.CPA4(CD, BC, rBD)[0][0]
    rCD = kA.toExp(CD, CD_angle)
    rED = -kA.toExp(DE, np.angle(rCD))

    rC, rE = rD + rCD, rD + rED
    # translate the origin b+c unit along y axis, find rE'
    rEc = rE - (b + c) * 1j

    # find rFA', rEF
    res1, res2 = kA.CPA2(np.pi, EF, rEc)
    rEF, rcF = kA.toExp(EF, res2[1]), kA.toExp(res2[0], 0)

    # rF1 = rD + rFD1
    rF = rE - rEF

    return (rB, rC, rD, rE, rF, rcF)
def acc(phi1, omg1, alp1, AC=0.15, BC=0.2, AD=0.35):
    "find accelerations"
    # find aD
    rA, rC = 0, AC
    rB, rD, rBC = pos(phi1, AC, BC, AD)
    vB2B1, omg2 = vel(phi1, omg1, AC, BC, AD)[-2:]
    aD = -omg1**2 * rD

    # find aB1, aB2=aB3, alp2=alp3
    # aB2n +    aB2t =      aB1 +   aB2B1c +    aB2B1r
    # //BC      _|_BC       known   _|_vB2B1    //AB
    # known     alp2?       known   known       |aB2B1r|?
    aB1 = kA.totAcc(rB, omg1, alp1)
    aB2n = -omg2**2 * (rB - rC)
    aB2B1c = 2 * omg2 * kA.toExp(vB2B1, np.pi / 2)
    # b = [np.real(aB1 + aB2B1c - aB2n), np.imag(aB1 + aB2B1c - aB2n)]
    # print(aB2B1c)
    aB2t_coeff = kA.toExp(rB - rC, np.pi / 2)
    # aB2B1r_angle = phi1 + np.pi/2
    # # print(aB2B1r_coeff)
    # for i in range(2):
    #     A = [[np.real(aB2t_coeff), -np.cos(aB2B1r_angle)[i]],
    #          [np.imag(aB2t_coeff), -np.sin(aB2B1r_angle)[i]]]
    #     alp2, norm_aB2B1r = np.linalg.solve(A, b)
    #     # aB2_check = aB1 + aB2B1c + np.exp(1j*aB2B1r_angle[i])*norm_aB2B1r
    #     # print(aB2, aB2_check)
    #     # if aB2 == aB2_check: break
    #     if np.abs(np.linalg.solve(A, b)[0])>10e-4:
    #         alp2, norm_aB2B1r = np.linalg.solve(A, b)
    #     #     print(norm_aB2B1r)
    #         break
    alp2, aB2B1r = kA.solve_w_angle(aB1 + aB2B1c - aB2n, aB2t_coeff,
                                    np.angle(rB))
    aB2B1r = kA.toExp(aB2B1r, np.angle(rB))
    aB2 = aB2n + alp2 * aB2t_coeff
    # print(aB2)
    return aB1, aD, aB2, alp2
def pos(phi1, case):

    rB = kA.toExp(case[0], phi1)
    rD = case[5] + case[6] * 1j

    # rCD + rBC = rBD
    CD_angle = kA.CPA4(case[2], case[1], rB - rD)[0][0]
    rC = rD + kA.toExp(case[2], CD_angle)
    rE = rD + kA.toExp(case[3], np.pi + CD_angle)

    res1, res2 = kA.CPA2(0, case[4], rE - rD)
    rFD = kA.toExp(res2[0], 0)
    rF = rD + rFD

    return rB, rC, rD, rE, rF