ParticlePendulumKane.html (MotionGenesis input/output).
(1) % MotionGenesis file: ParticlePendulumKane.txt
(2) % Problem: Particle pendulum with air resistance.
(3) % Copyright (c) 2009 Motion Genesis LLC. All rights reserved.
(4) %------------------------------------------------------------
(5) NewtonianFrame N % Earth.
(6) RigidFrame B % Massless cable.
(7) Particle Q % Particle at end of cable.
(8) %------------------------------------------------------------
(9) Q.SetMass( m = 100 kg )
(10) Constant g = 9.8 m/s^2 % Earth's gravitational acceleration.
(11) Constant L = 50 m % Cable length.
(12) Constant bAir = 2.0 N*s/m % Air-resistance constant.
(13) Variable theta'' % Pendulum swing angle.
(14) Variable Tension % Tension in cable.
(15) %------------------------------------------------------------
(16) % Rotational and translational kinematics.
(17) B.RotateZ( N, theta )
-> (18) B_N = [cos(theta), sin(theta), 0; -sin(theta), cos(theta), 0; 0, 0, 1]
-> (19) w_B_N> = theta'*Bz>
-> (20) alf_B_N> = theta''*Bz>
(21) Q.Translate( No, -L*By> )
-> (22) p_No_Q> = -L*By>
-> (23) v_Q_N> = L*theta'*Bx>
-> (24) a_Q_N> = L*theta''*Bx> + L*theta'^2*By>
(25) %------------------------------------------------------------
(26) % Contact and distance forces on Q.
(27) airResistance> = -bAir * Q.GetVelocity(N)
-> (28) airResistance> = -bAir*L*theta'*Bx>
(29) Q.AddForce( -m*g*Ny> + Tension*By> + airResistance> )
-> (30) Force_Q> = -bAir*L*theta'*Bx> + Tension*By> - m*g*Ny>
(31) %------------------------------------------------------------
(32) % Form equations of motion with Kane's method.
(33) % Advantage: Tension is a "constraint force", automatically eliminated by Kane's method.
(34) SetGeneralizedSpeed( theta' )
(35) KaneDynamics = System.GetDynamicsKane()
-> (36) KaneDynamics = [L*(m*g*sin(theta)+bAir*L*theta'+m*L*theta'')]
(37) Solve( KaneDynamics = 0, theta'' )
-> (38) theta'' = -(m*g*sin(theta)+bAir*L*theta')/(m*L)
(39) %------------------------------------------------------------
(40) % Initial values and numerical integration parameters.
(41) Input theta = 60 deg, theta' = 0 deg/sec
(42) Input tFinal = 120 sec, tStep = 0.2 sec
(43) %------------------------------------------------------------
(44) % List output quantities and solve ODEs.
(45) Output t sec, theta degrees
(46) ODE() ParticlePendulumKane
(47) %------------------------------------------------------------
Saved by Motion Genesis LLC. Command names and syntax: Copyright (c) 2009-2020 Motion Genesis LLC. All rights reserved.