MGFourBarStaticsFBD.html  (MotionGenesis input/output).
```   (1) % MotionGenesis file:  MGFourBarStaticsFBD.txt
(3) %--------------------------------------------------------------------
(4) NewtonianFrame  N                 % Ground link.
(5) RigidBody       A, B, C           % Crank, coupler, rocker links.
(6) Point           BC( B )           % Point of B connected to C.
(7) Point           CB( C )           % Point of C connected to B.
(8) %--------------------------------------------------------------------
(9) Constant   LN = 1 m,  LA = 1 m    % Length of ground link, crank link.
(10) Constant   LB = 2 m,  LC = 2 m    % Length of coupler link, rocker link.
(11) Constant   g = 9.81 m/s^2         % Earth's gravitational acceleration.
(12) Constant   H = 200 Newtons        % Horizontal force at point CB.
(13) Variable   qA,  qB,  qC           % Link angles (relative to ground).
(14) Variable   FCx, FCy               % Contact forces on C from B.
(15) %--------------------------------------------------------------------
(16) A.SetMass( mA = 10 kg )
(17) B.SetMass( mB = 20 kg )
(18) C.SetMass( mC = 20 kg )
(19) %--------------------------------------------------------------------
(20) %   Rotational kinematics.
(21) A.RotateZ( N,  qA )
-> (22) A_N = [cos(qA), sin(qA), 0;  -sin(qA), cos(qA), 0;  0, 0, 1]

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

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

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

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

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

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

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

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

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

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

(45) %--------------------------------------------------------------------
(47) System.AddForceGravity(  g * Nx>  )
-> (48) Force_Acm> = mA*g*Nx>
-> (49) Force_Bcm> = mB*g*Nx>
-> (50) Force_Ccm> = mC*g*Nx>

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

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

(55) %--------------------------------------------------------------------
(56) %   Form statics equations ("cut" linkage at CB/BC).
(57) Statics[1] = Dot( Nz>,  System(A,B).GetStatics(Ao) )
-> (58) 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)

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

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

(63) %--------------------------------------------------------------------
(64) %   Loop (configuration) constraint.
(65) Loop> = LA*Ax>  +  LB*Bx>  -  LC*Cx>  -  LN*Ny>
-> (66) Loop> = LA*Ax> + LB*Bx> - LC*Cx> - LN*Ny>

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

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

(71) %--------------------------------------------------------------------
(72) %   Solve statics with constraints (nonlinear algebraic equations need a guess for its solution).
(73) StaticSolution = Solve( [Statics; Loop] = 0,  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.
-> (74) StaticSolution = [0.3488373;  1.250738;  0.6688954;  77.92883;  -60.85662]

(75) %--------------------------------------------------------------------
(76) %   Save input together with program responses
```