Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. from sympy.physics.vector import ReferenceFrame, dot, cross
  2. from sympy import *
  3. import sympy.vector as vector
  4. t, a1, c1, a2, a3, b4, c4, m45, A45,B45, C45, g = sympy.symbols("t a1 c1 a2 a3 b4 c4 m_(45) A_(45) B_(45) C_(45) g")
  5. theta1 = Function("theta1")(t)
  6. theta2 = Function("theta2")(t)
  7. theta3 = Function("theta3")(t)
  8. theta4 = Function("theta4")(t)
  9. N = ReferenceFrame("N_s")
  10. x_s, y_s, z_s = N.x, N.y, N.z
  11. x1, y1, z1 = cos(theta1)*x_s + sin(theta1)*y_s, cos(theta1)*y_s - sin(theta1)*x_s, z_s
  12. x2, z2 = cos(theta2)*x1 - sin(theta2)*z1, cos(theta2)*z1 + sin(theta2)*x1
  13. x3, z3 = cos(theta3)*x2 - sin(theta3)*z2, cos(theta3)*z2 + sin(theta3)*x2
  14. x4, z4 = cos(theta4)*x3 - sin(theta4)*z3, cos(theta4)*z3 + sin(theta4)*x3
  15. Omega_4 = (theta2 + theta3 +theta4)*y1 + theta1*z_s
  16. OO3 = a1*x1 + c1*z1 + a2*x2 + a3*x3
  17. OO4 = OO3 - b4*y1 - c4*z4
  18. O3O4 = OO4 - OO3
  19. VO3 = OO3.diff(t, N)
  20. VO4 = OO4.diff(t, N)
  21. kinetic_angular_momentum_O4 = A45*dot(x4, Omega_4)*x4 + B45*dot(y1, Omega_4)*y1 + C45*dot(z4, Omega_4)*z4 + m45*cross(O3O4, VO4)
  22. dynamic_angular_momentum_scalar_y1 = dot(y1, kinetic_angular_momentum_O4.diff(t, N)) + m45 * dot(y1, cross(VO3, VO4))
  23. g_torque = -m45*g*cross(O3O4, z_s)
  24. Motor_couple = dynamic_angular_momentum_scalar_y1 - dot(y1, g_torque)
  25. init_printing()
  26. simplify(Motor_couple)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement