MGFourBarStaticsFBD.html  (MotionGenesis input/output).
   (1) % MotionGenesis file:  MGFourBarStaticsFBD.txt
   (2) % Copyright (c) 2009 Motion Genesis LLC.  All rights reserved.
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame  N
   (5) RigidBody       A, B, C
   (6) Point           BC(B), CB(C)
   (7) %--------------------------------------------------------------------
   (8) Constant   LA = 1 m,  LB = 2 m,  LC = 2 m,  LN = 1 m
   (9) Constant   g = 9.81 m/s^2         % Earth's gravity.
   (10) Variable   qA,  qB,  qC           % Link angles.
   (11) Specified  H = 200                % Horizontal force on CB.
-> (12) H = 200

   (13) Variable   FCx, FCy               % Contact forces on C from B.
   (14) %--------------------------------------------------------------------
   (15) A.SetMass( mA = 10 kg )
   (16) B.SetMass( mB = 20 kg )
   (17) C.SetMass( mC = 20 kg )
   (18) %---------------------------------------------------------------
   (19) %       Rotational kinematics.
   (20) A.RotateZ( N,  qA )
-> (21) A_N = [cos(qA), sin(qA), 0;  -sin(qA), cos(qA), 0;  0, 0, 1]

   (22) B.RotateZ( N,  qB )
-> (23) B_N = [cos(qB), sin(qB), 0;  -sin(qB), cos(qB), 0;  0, 0, 1]

   (24) C.RotateZ( N,  qC )
-> (25) C_N = [cos(qC), sin(qC), 0;  -sin(qC), cos(qC), 0;  0, 0, 1]

   (26) %--------------------------------------------------------------------
   (27) %       Translational kinematics.
   (28) Ao.SetPosition(   No,          0> )
-> (29) p_No_Ao> = 0>

   (30) Acm.SetPosition(  Ao,  0.5*LA*Ax> )
-> (31) p_Ao_Acm> = 0.5*LA*Ax>

   (32) Bo.SetPosition(   Ao,      LA*Ax> )
-> (33) p_Ao_Bo> = LA*Ax>

   (34) Bcm.SetPosition(  Bo,  0.5*LB*Bx> )
-> (35) p_Bo_Bcm> = 0.5*LB*Bx>

   (36) BC.SetPosition(   Bo,      LB*Bx> )
-> (37) p_Bo_BC> = LB*Bx>

   (38) Co.SetPosition(   No,      LN*Ny> )
-> (39) p_No_Co> = LN*Ny>

   (40) Ccm.SetPosition(  Co,  0.5*LC*Cx> )
-> (41) p_Co_Ccm> = 0.5*LC*Cx>

   (42) CB.SetPosition(   Co,      LC*Cx> )
-> (43) p_Co_CB> = LC*Cx>

   (44) %--------------------------------------------------------------------
   (45) %       Add relevant forces.
   (46) System.AddForceGravity( g*Nx> )
-> (47) Force_Acm> = mA*g*Nx>
-> (48) Force_Bcm> = mB*g*Nx>
-> (49) Force_Ccm> = mC*g*Nx>

   (50) CB.AddForce( H*Ny> )
-> (51) Force_CB> = H*Ny>

   (52) CB.AddForce( BC,  FCx*Nx> + FCy*Ny> )   % "Cut" linkage at CB/BC
-> (53) Force_CB_BC> = FCx*Nx> + FCy*Ny>

   (54) %--------------------------------------------------------------------
   (55) %       Form statics equations ("cut" linkage at CB/BC).
   (56) Statics[1] = Dot( Nz>,  System(A,B).GetStatics(Ao) )
-> (57) Statics[1] = LA*FCx*sin(qA) + LB*FCx*sin(qB) - LA*FCy*cos(qA) - LB*FCy*cos(qB)
        - mB*g*LA*sin(qA) - 0.5*mA*g*LA*sin(qA) - 0.5*mB*g*LB*sin(qB)

   (58) Statics[2] = Dot( Nz>,            B.GetStatics(Bo) )
-> (59) Statics[2] = 0.5*LB*(2*FCx*sin(qB)-2*FCy*cos(qB)-mB*g*sin(qB))

   (60) Statics[3] = Dot( Nz>,            C.GetStatics(Co) )
-> (61) Statics[3] = 0.5*LC*(2*H*cos(qC)+2*FCy*cos(qC)-2*FCx*sin(qC)-mC*g*sin(
        qC))

   (62) %--------------------------------------------------------------------
   (63) %       Configuration constraints.
   (64) Loop> = LA*Ax> + LB*Bx> - LC*Cx> - LN*Ny> 
-> (65) Loop> = LA*Ax> + LB*Bx> - LC*Cx> - LN*Ny>

   (66) Loop[1] = Dot( Loop>, Nx> )
-> (67) Loop[1] = LA*cos(qA) + LB*cos(qB) - LC*cos(qC)

   (68) Loop[2] = Dot( Loop>, Ny> )
-> (69) Loop[2] = LA*sin(qA) + LB*sin(qB) - LN - LC*sin(qC)

   (70) %--------------------------------------------------------------------
   (71) %       Augment statics with constraints and solve nonlinear algebraic equations.
   (72) StaticSolution = Solve( [Statics; Loop],  qA = 10 deg,  qB = 50 deg,  qC = 30 deg,  FCx = 0 N,  FCy = 0 N )
->   %  Note: qA = 0.3488373  was converted from  qA = 19.98691 deg.
->   %  Note: qB = 1.250738  was converted from  qB = 71.66202 deg.
->   %  Note: qC = 0.6688954  was converted from  qC = 38.32489 deg.
-> (73) StaticSolution = [0.3488373;  1.250738;  0.6688954;  77.92883;  -60.85662]

   (74) %--------------------------------------------------------------------
   (75) %       Save input together with program responses
Saved by Motion Genesis LLC.   Portions copyright (c) 2009-2017 Motion Genesis LLC. Rights reserved. Only for use with MotionGenesis.