MGCableLengthToKeepBeamHorizontal.html  (MotionGenesis input/output).
   (1) %    File: MGCableLengthToKeepBeamHorizontal.txt
   (2) % Problem: Determine length of cable C to keep beam horizontal.
   (3) %    Note: MotionGenesis script with student blanks at
   (4) %          www.MotionGenesis.com -> TextbookResources
   (5) %------------------------------------------------------------------------------
   (6) NewtonianFrame N        % Building with Nx> horizontally right, Ny> vertically upward.
   (7) RigidBody      B        % Beam with endpoints Bo and Bc.
   (8) Point          Nc( N )  % Point of N attached to cable C.
   (9) Point          Bc( B )  % Point of B attached to cable C.
   (10) %------------------------------------------------------------------------------
   (11) Constant  LN = 15 m     % Distance between No and NC.
   (12) Constant  LB =  7 m     % Distance between Bo and BC (length of beam).
   (13) Constant  LA =  7 m     % Length of cable A (connects Bo to No).
   (14) Variable  LC            % Length of cable C (connects BC to NC).
   (15) Variable  qA            % Angle for cable A, from Ny> to BoNo> with positive sense +Nz>.
   (16) %------------------------------------------------------------------------------
   (17) %   Position vectors.
   (18) NC.SetPosition( No,  LN*Nx> )
-> (19) p_No_Nc> = LN*Nx>

   (20) Bo.SetPosition( No,  LA*sin(qA)*Nx> - LA*cos(qA)*Ny> )
-> (21) p_No_Bo> = LA*sin(qA)*Nx> - LA*cos(qA)*Ny>

   (22) BC.SetPosition( Bo,  LB*Nx> )
-> (23) p_Bo_Bc> = LB*Nx>

   (24) Bcm.SetPosition( Bo,  0.25*LB*Nx> )
-> (25) p_Bo_Bcm> = 0.25*LB*Nx>

   (26) %------------------------------------------------------------------------------
   (27) %   Geometry relates length of cable C to magnitude of position vector from Bc to Nc.
   (28) p> = Nc.GetPosition( Bc )
-> (29) p> = (LN-LB-LA*sin(qA))*Nx> + LA*cos(qA)*Ny>

   (30) LengthConstraint = LC^2 - Dot( p>, p> )           % LengthConstraint = 0.
-> (31) LengthConstraint = LC^2 - LA^2*cos(qA)^2 - (LN-LB-LA*sin(qA))^2

   (32) %------------------------------------------------------------------------------
   (33) %   Statics is necessary to solve this problem.
   (34) Variable  TA, TC         % Tensions in cables A and C.
   (35) B.SetMass( m = 100 kg )  % Mass does not affect answer for LC, but affects tensions.
   (36) Constant  g = 9.8 m/s^2  % Gravity does not affect answer for LC, but affects tensions.
   (37) %------------------------------------------------------------------------------
   (38) %   Forces on beam.
   (39) unitVectorFromBoToNo> = No.GetPositionVector(Bo) / LA
-> (40) unitVectorFromBoToNo> = -sin(qA)*Nx> + cos(qA)*Ny>

   (41) unitVectorFromBcToNc> = NC.GetPositionVector(Bc) / LC
-> (42) unitVectorFromBcToNc> = (LN-LB-LA*sin(qA))/LC*Nx> + LA*cos(qA)/LC*Ny>

   (43) Bo.AddForce( TA * unitVectorFromBoToNo> )
-> (44) Force_Bo> = -TA*sin(qA)*Nx> + TA*cos(qA)*Ny>

   (45) BC.AddForce( TC * unitVectorFromBcToNc> )
-> (46) Force_Bc> = TC*(LN-LB-LA*sin(qA))/LC*Nx> + LA*TC*cos(qA)/LC*Ny>

   (47) Bcm.AddForce( -m*g*Ny> )
-> (48) Force_Bcm> = -m*g*Ny>

   (49) %------------------------------------------------------------------------------
   (50) %   Static equilibrium for beam B.
   (51) Statics[1] = Dot( Nx>,  B.GetResultantForce()    )  % Net force on B in Nx> direction is zero.
-> (52) Statics[1] = TC*(LN-LB-LA*sin(qA))/LC - TA*sin(qA)

   (53) Statics[2] = Dot( Ny>,  B.GetResultantForce()    )  % Net force on B in Ny> direction is zero.
-> (54) Statics[2] = TA*cos(qA) + LA*TC*cos(qA)/LC - m*g

   (55) Statics[3] = Dot( Nz>,  B.GetResultantMoment(Bo) )  % Moment on B about Bo in Nz> direction is zero.
-> (56) Statics[3] = -0.25*LB*(m*g-4*LA*TC*cos(qA)/LC)

   (57) %------------------------------------------------------------------------------
   (58) %   Solve set of nonlinear algebraic equations (with guess).
   (59) Solve( [LengthConstraint; Statics] = 0,   qA = 30 degrees,  TA = m*g/2, TC = m*g/2, LC = LA )
-> (60) qA = 0.2897517       %  or  qA = 16.60155 degrees.
-> (61) TA = 766.9713
-> (62) TC = 328.702
-> (63) LC = 9

   (64) %------------------------------------------------------------------------------
   (65) %   Note: This problem can also be solved graphically by observing B is a 3-force member.
   (66) %         Hence there is a single point (below the beam) at which the lines of actions of
   (67) %         all 3 forces intersect.  This fact and geometry suffices to solve this problem.
   (68) %------------------------------------------------------------------------------
Saved by Motion Genesis LLC.   Command names and syntax: Copyright (c) 2009-2019 Motion Genesis LLC. All rights reserved.