MGBeamOnTwoCablesStaticsViaFBD.html  (MotionGenesis input/output).
   (1) %    File: MGBeamOnTwoCablesStaticsViaFBD.txt
   (2) % Problem: Static configuration of a beam supported by two cables.
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N         % Ceiling with Nx> horizontally right, Ny> vertically down
   (5) RigidBody      B         % Beam with Bx> pointing from Bo to Bc and Bz> = Nz>.
   (6) Point          Nc( N )   % Point of N attached to cable C.
   (7) Point          Bc( B )   % Point of B attached to cable C.
   (8) %--------------------------------------------------------------------
   (9) Constant  LN = 6 m       % Distance between No and NC.
   (10) Constant  LB = 4 m       % Distance between Bo and BC.
   (11) Constant  LA = 2.7 m     % Length of cable A (connects Bo to No).
   (12) Constant  LC = 3.7 m     % Length of cable C (connects BC to NC).
   (13) Constant  g = 9.8 m/s^2  % Earth's gravitational acceleration.
   (14) B.SetMass( m = 120 kg )
   (15) %--------------------------------------------------------------------
   (16) Variable  x, y           % Nx> and Ny> measures of Bo's position vector from No.
   (17) Variable  q              % Angle from Nx> to Bx> with positive sense +Nz>.
   (18) Variable  TA, TC         % Tensions in cables A and C.
   (19) %--------------------------------------------------------------------
   (20) %   Rotation matrix relating  Bx>, By>, Bz>  to  Nx>, Ny>, Nz>.
   (21) B.SetRotationMatrixZ( N,  q )
-> (22) B_N = [cos(q), sin(q), 0;  -sin(q), cos(q), 0;  0, 0, 1]

   (23) %--------------------------------------------------------------------
   (24) %   Position vectors.
   (25) Bo.SetPosition( No,  x*Nx> + y*Ny> )
-> (26) p_No_Bo> = x*Nx> + y*Ny>

   (27) Bcm.SetPosition( Bo,  0.5*LB*Bx> )
-> (28) p_Bo_Bcm> = 0.5*LB*Bx>

   (29) BC.SetPosition( Bo,  LB*Bx> )
-> (30) p_Bo_Bc> = LB*Bx>

   (31) NC.SetPosition( No,  LN*Nx> )
-> (32) p_No_Nc> = LN*Nx>

   (33) %--------------------------------------------------------------------
   (34) %   Constraint relating cable lengths to magnitudes of position vectors.
   (35) LengthConstraint[1] = LA^2 - Bo.GetDistanceSquared( No )
-> (36) LengthConstraint[1] = LA^2 - x^2 - y^2

   (37) LengthConstraint[2] = LC^2 - Bc.GetDistanceSquared( Nc )
-> (38) LengthConstraint[2] = LC^2 + 2*LB*cos(q)*(LN-x) - LB^2 - y^2 - 2*LB*y*sin(q)
        - (LN-x)^2

   (39) %--------------------------------------------------------------------
   (40) %   Forces on beam.
   (41) unitVectorBoToNo> = No.GetPositionVector(Bo) / LA
-> (42) unitVectorBoToNo> = -x/LA*Nx> - y/LA*Ny>

   (43) unitVectorBcToNc> = NC.GetPositionVector(Bc) / LC
-> (44) unitVectorBcToNc> = -LB/LC*Bx> + (LN-x)/LC*Nx> - y/LC*Ny>

   (45) Bo.AddForce( TA*unitVectorBoToNo> )
-> (46) Force_Bo> = -TA*x/LA*Nx> - TA*y/LA*Ny>

   (47) BC.AddForce( TC*unitVectorBcToNc> )
-> (48) Force_Bc> = -LB*TC/LC*Bx> + TC*(LN-x)/LC*Nx> - TC*y/LC*Ny>

   (49) Bcm.AddForce( m*g*Ny> )
-> (50) Force_Bcm> = m*g*Ny>

   (51) %--------------------------------------------------------------------
   (52) %   Statics for B via FBD (free-body-diagram).
   (53) Statics[1] = Dot( Nx>,  B.GetStatics()   )  % Net force on B in Nx> direction is zero.
-> (54) Statics[1] = TC*(LN-x-LB*cos(q))/LC - TA*x/LA

   (55) Statics[2] = Dot( Ny>,  B.GetStatics()   )  % Net force on B in Ny> direction is zero.
-> (56) Statics[2] = m*g - TA*y/LA - TC*(y+LB*sin(q))/LC

   (57) Statics[3] = Dot( Nz>,  B.GetStatics(Bo) )  % Moment on B about Bo in Nz> direction is zero.
-> (58) Statics[3] = 0.5*LB*(m*g*cos(q)-2*TC*(y*cos(q)+sin(q)*(LN-x))/LC)

   (59) %--------------------------------------------------------------------
   (60) %   Solve set of 5 nonlinear algebraic equations (with guess).
   (61) %   Note: Configuration does not depend on mass or gravity (but cable tensions do).
   (62) Solve( [Statics; LengthConstraint] = 0,   x = 1 m,  y = 3 m,  q = 15 deg,  TA = m*g/2, TC = m*g/2 )
-> (63) x = 0.8153669
-> (64) y = 2.573942
-> (65) q = 0.2257464       %  or  q = 12.93432 deg.
-> (66) TA = 665.1907
-> (67) TC = 577.9024

   (68) %--------------------------------------------------------------------
   (69) %   Post-process: Calculate distance between No and Bcm.
   (70) distanceNoToBcm = EvaluateToNumber(  Bcm.GetDistance(No)  )
-> (71) distanceNoToBcm = 4.095517

   (72) %--------------------------------------------------------------------
   (73) %   Save input and output responses.
Saved by Motion Genesis LLC.   Command names and syntax: Copyright (c) 2009-2019 Motion Genesis LLC. All rights reserved.