Hi,
I saw the example for the simple pendulum on pydy's github repository (https://github.com/pydy/pydy/blob/master/examples/simple_pendulum/run.py).
I wanted to go from the simple pendulum shown in figure below case (a) to the pendulum with the acceleration on u2, case(b).
Looking at the code, I thought that the solution was adding acceleration to point 'O':
(O.set_acc(N, att * N.y)
But this does not seem to work.
Can someone point me in the right direction?
Thank you!
--
You received this message because you are subscribed to the Google Groups "PyDy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pydy+unsubscribe@googlegroups.com.
To post to this group, send email to py...@googlegroups.com.
Visit this group at https://groups.google.com/group/pydy.
For more options, visit https://groups.google.com/d/optout.
| # This code requires sympy 1.0 to run | |
| from sympy import * | |
| from sympy.physics.mechanics import LagrangesMethod, Lagrangian | |
| from sympy.physics.mechanics import ReferenceFrame, Particle, Point | |
| from sympy.physics.mechanics import dynamicsymbols | |
| # System state variables | |
| theta = dynamicsymbols('theta') | |
| thetad = dynamicsymbols('theta', 1) | |
| # Other system variables | |
| m, l, g, a = symbols('m l g a') | |
| # Set up the reference frames | |
| # Reference frame A set up in the plane perpendicular to the page containing | |
| # segment OP | |
| N = ReferenceFrame('N') | |
| A = N.orientnew('A', 'Axis', [theta, N.z]) | |
| # Set up the points and particles | |
| O = Point('O') | |
| P = O.locatenew('P', l * A.x) | |
| Pa = Particle('Pa', P, m) | |
| # Set up velocities | |
| A.set_ang_vel(N, thetad * N.z) | |
| O.set_vel(N, 0) O.set_acc(N, a * N.y) # ----------------------------------------------------------------> Added line | |
| P.v2pt_theory(O, N, A) P.a2pt_theory(O, N, A) # ----------------------------------------------------------------> Added line | |
| # Set up the lagrangian | |
| L = Lagrangian(N, Pa) | |
| # Create the list of forces acting on the system | |
| fl = [(P, g * m * N.x)] | |
| # Create the equations of motion using lagranges method | |
| l = LagrangesMethod(L, [theta], forcelist=fl, frame=N) | |
| pprint(l.form_lagranges_equations()) |
Matrix([[g*l*m*sin(theta(t)) + l**2*m*Derivative(theta(t), t, t)]])
Which is the simple pendulum's equation of motion, so nothing has changed (was expecting an extra term - m*a* l*cos𝜃)I thought that maybe I had to change something with the reference frame, but I could not find a solution.Thanks for the help!Att,Raphael
--
You received this message because you are subscribed to a topic in the Google Groups "PyDy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pydy/MQOcTJqd1VI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pydy+unsubscribe@googlegroups.com.
To post to this group, send email to py...@googlegroups.com.
Visit this group at https://groups.google.com/group/pydy.
For more options, visit https://groups.google.com/d/optout.