class RootLink(Link): """TODO """ def __init__(self, linkage): super(RootLink, self).__init__(linkage, 'root') # TODO rename to avoid name conflicts, or inform the user that 'N' is # taken. self._frame = ReferenceFrame('N') self._origin = Point('NO') self._origin.set_vel(self._frame, 0) # TODO need to set_acc? self._origin.set_acc(self._frame, 0)
R_Mm: 2.0e6, omega_E: 2e-7, omega_M: 24e-7, omega_e: 12e-4, omega_m: 10e-4 } # reference frames S = ReferenceFrame('S') Q = S.orientnew('Q', 'axis', [0, S.x]) E = Q.orientnew('E', 'axis', [0, S.x]) M = E.orientnew('M', 'axis', [0, S.x]) frames = [S, Q, E, M] pS = Point('S') pS.set_acc(S, 0) pQ = Point('Q') pQ.set_acc(Q, 0) pE = Point('E') pE.set_acc(E, 0) pM = Point('M') pM.set_acc(M, 0) pe = Point('e') pm = Point('m') points = [pS, pQ, pE, pM, pe, pm] # v = ω*R, a = ω**2 * R pQ.set_acc(S, omega_E**2 * R_SQ * S.x) pE.set_acc(Q, omega_E**2 * R_QE * S.x) pM.set_acc(E, omega_M**2 * R_EM * S.x) pe.set_acc(E, omega_e**2 * R_Ee * S.x)
omega_E, omega_M, omega_e, omega_m = symbols('ω_E ω_M ω_e ω_m', positive=True) symbol_values = {R_SQ: 4.5e5, R_QE: 1.5e11, R_EM: 4.0e8, R_Ee: 7.0e6, R_Mm: 2.0e6, omega_E: 2e-7, omega_M: 24e-7, omega_e: 12e-4, omega_m:10e-4} # reference frames S = ReferenceFrame('S') Q = S.orientnew('Q', 'axis', [0, S.x]) E = Q.orientnew('E', 'axis', [0, S.x]) M = E.orientnew('M', 'axis', [0, S.x]) frames = [S, Q, E, M] pS = Point('S') pS.set_acc(S, 0) pQ = Point('Q') pQ.set_acc(Q, 0) pE = Point('E') pE.set_acc(E, 0) pM = Point('M') pM.set_acc(M, 0) pe = Point('e') pm = Point('m') points = [pS, pQ, pE, pM, pe, pm] # v = ω*R, a = ω**2 * R pQ.set_acc(S, omega_E**2 * R_SQ * S.x) pE.set_acc(Q, omega_E**2 * R_QE * S.x) pM.set_acc(E, omega_M**2 * R_EM * S.x) pe.set_acc(E, omega_e**2 * R_Ee * S.x)
C = B.orientnew('C', 'Axis', [q[1], B.y]) # Enclosure frame C.set_ang_vel(B, u[1]*B.y) D = C.orientnew('D', 'Axis', [q[2], C.z]) # Flywheel frame D.set_ang_vel(C, u[2]*C.z) Ixx, Iyy, Izz = symbols('Ixx Iyy Izz') # Enclosure inertia scalars I_enclosure = inertia(C, Ixx, Iyy, Izz) # Inertia tensor of enclosure IFxx, IFyy, IFzz = symbols('IFxx IFyy IFzz') # Flywheel inertia scalars I_flywheel = inertia(D, IFxx, IFyy, IFzz) # Inertia tensor of flywheel O = Point('O') # Mass center, assumed to be O.set_vel(A, 0) # on gimbal axis so it has zero O.set_acc(A, 0) # velocity and acceleration # Define rigid body objects Enclosure = RigidBody('Enclosure', O, C, 0, (I_enclosure, O)) Flywheel = RigidBody('Flywheel', O, D, 0, (I_flywheel, O)) body_list = [Enclosure, Flywheel] # List of forces and torques tau = symbols('tau') # Gimbal torque scalar torque_force_list = [(O, m*g*A.z), # Gravitational force (B, -tau*B.y), # Gimbal reaction torque (C, tau*B.y)] # Gimbal torque # Form equations of motion KM = KanesMethod(A, q, u, kindiffs)