% MotionGenesis file: MGFourBarDynamicsWithKaneEmbedded.txt % Copyright (c) 2009 Motion Genesis LLC. All rights reserved. %-------------------------------------------------------------------- % Physical objects. NewtonianFrame N RigidBody A, B, C Point BC(B), CB(C) %-------------------------------------------------------------------- % Mathematical declarations. Constant LA = 1 m, LB = 2 m, LC = 2 m, LN = 1 m Constant g = 9.81 m/s^2 % Gravity Specified H = 200 % Horizontal force Variable qA'', qB'', qC'' % Angles SetGeneralizedSpeed( qA' ) %-------------------------------------------------------------------- A.SetMassInertia( mA = 10 kg, 0, IA = mA*LA^2/12, IA ) B.SetMassInertia( mB = 20 kg, 0, IB = mB*LB^2/12, IB ) C.SetMassInertia( mC = 20 kg, 0, IC = mC*LC^2/12, IC ) %-------------------------------------------------------------------- % Rotational kinematics A.RotateZ( N, qA ) B.RotateZ( N, qB ) C.RotateZ( N, qC ) %-------------------------------------------------------------------- % Translational kinematics Ao.Translate( No, 0> ) Acm.Translate( Ao, 0.5*LA*Ax> ) Bo.Translate( Ao, LA*Ax> ) Bcm.Translate( Bo, 0.5*LB*Bx> ) BC.Translate( Bo, LB*Bx> ) Co.Translate( No, LN*Ny> ) Ccm.Translate( Co, 0.5*LC*Cx> ) CB.Translate( Co, LC*Cx> ) %-------------------------------------------------------------------- % Forces - replaces gravity forces with equivalent set. Bo.AddForce( 0.5*(mA+mB)*g*Nx> ) CB.AddForce( 0.5*(mB+mC)*g*Nx> + H*Ny> ) %-------------------------------------------------------------------- % Configuration constraints and time-derivatives Loop> = LA*Ax> + LB*Bx> - LC*Cx> - LN*Ny> Loop[1] = Dot( Loop>, Nx> ) Loop[2] = Dot( Loop>, Ny> ) %-------------------------------------------------------------------- % Solve constraints with given constants and initial value of qA. Input qA = 30 deg, qA' = 0 rad/sec SolveSetInputDt( Loop, qB = 60 deg, qC = 20 deg ) %-------------------------------------------------------------------- % Equations of motion - with Kane's method. Zero = System.GetDynamicsKane() Solve( Zero, qA'' ) %-------------------------------------------------------------------- % Integration parameters and quantities to be output from ODE. Input tFinal = 7 sec, tStep = 0.02 sec, absError = 1.0E-07 OutputPlot t sec, qA deg, qB deg, qC deg ODE() MGFourBarDynamicsWithKaneEmbedded %-------------------------------------------------------------------- Save MGFourBarDynamicsWithKaneEmbedded.html Quit