MGCableLengthsToKeepAircraftHorizontalFBD.html  (MotionGenesis input/output).
   (1) % MotionGenesis file:  MGCableLengthsToKeepAircraftHorizontalFBD.txt
   (2) % Copyright (c) 2018 Motion Genesis LLC.
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame  N                 % Earth / aircraft hanger, Nz> down.
   (5) RigidBody       C                 % Aircraft.
   (6) Point     N1(N), N2(N), N3(N)     % Cable end-points on N.
   (7) Point     C1(C), C2(C), C3(C)     % Cable end-points on C.
   (8) %--------------------------------------------------------------------
   (9) Constant  L1 = 20 m               % Cable length: N1 to C1.
   (10) Constant  dN = 30 m               % Distance between No and N1.
   (11) Constant  wN = 40 m               % Distance between No and N2.
   (12) Constant  dC = 30 m               % Distance between Co and C1
   (13) Constant  wC = 40 m               % Distance between Co and C2.
   (14) Constant dcm =  8 m               % Distance between Co and Ccm.
   (15) Constant  g = 9.8 m/s^2           % Earth's gravitational acceleration.
   (16) C.SetMass( m = 9000 kg )          % Affects cable tension, not position/orientation.
   (17) Variable  x,   y,   z             % Locates C1 from N1.
   (18) Variable  q                       % Aircraft rotation about Nz>
   (19) Variable  T1, T2, T3              % Tension in cables.
   (20) %--------------------------------------------------------------------
   (21) %   Rotational and translational kinematics.
   (22) C.SetRotationMatrixZ( N,  q )
-> (23) C_N = [cos(q), sin(q), 0;  -sin(q), cos(q), 0;  0, 0, 1]

   (24) C1.SetPosition( N1, x*Nx> + y*Ny> + z*Nz> )
-> (25) p_N1_C1> = x*Nx> + y*Ny> + z*Nz>

   (26) Co.SetPosition( C1,     -dC*Cx> )
-> (27) p_C1_Co> = -dC*Cx>

   (28) C2.SetPosition( Co, -0.5*wC*Cy> )
-> (29) p_Co_C2> = -0.5*wC*Cy>

   (30) C3.SetPosition( Co,  0.5*wC*Cy> )
-> (31) p_Co_C3> = 0.5*wC*Cy>

   (32) N1.SetPosition( N2,      dN*Nx> )
-> (33) p_N2_N1> = dN*Nx>

   (34) N3.SetPosition( N2,      wN*Ny> )
-> (35) p_N2_N3> = wN*Ny>

   (36) CCm.SetPosition( Co,     dcm*Cx> )
-> (37) p_Co_Ccm> = dcm*Cx>

   (38) %--------------------------------------------------------------------
   (39) %   Symbolic expressions for cable lengths L2 and L3.
   (40) L2 = C2.GetDistance( N2 )         % Cable length N2 to C2.
-> (41) L2 = 0.5*sqrt(wC^2+4*dC^2+4*y^2+4*z^2+4*(dN+x)^2+4*wC*sin(q)*(dN+x)-8*
        dC*y*sin(q)-4*wC*y*cos(q)-8*dC*cos(q)*(dN+x))

   (42) L3 = C3.GetDistance( N3 )         % Cable length N3 to C3.
-> (43) L3 = 0.5*sqrt(wC^2+4*dC^2+4*z^2+4*(dN+x)^2+4*(wN-y)^2+8*dC*sin(q)*(wN-y)
        -8*dC*cos(q)*(dN+x)-4*wC*sin(q)*(dN+x)-4*wC*cos(q)*(wN-y))

   (44) %--------------------------------------------------------------------
   (45) %   Constraint: Cable length N1 to C1 gives  x^2 + y^2 + z^2 = L1^2
   (46) CableConstraint = C1.GetDistanceSquared( N1 ) - L1^2
-> (47) CableConstraint = x^2 + y^2 + z^2 - L1^2

   (48) %--------------------------------------------------------------------
   (49) %   Add forces from gravity and tension.
   (50) Ccm.AddForce( m*g*Nz> )
-> (51) Force_Ccm> = m*g*Nz>

   (52) unitVectorToN1FromC1> = N1.GetPosition(C1) / L1
-> (53) unitVectorToN1FromC1> = -x/L1*Nx> - y/L1*Ny> - z/L1*Nz>

   (54) unitVectorToN2FromC2> = N2.GetPosition(C2) / L2
-> (55) unitVectorToN2FromC2> = dC/L2*Cx> + 0.5*wC/L2*Cy> - (dN+x)/L2*Nx>
        - y/L2*Ny> - z/L2*Nz>

   (56) unitVectorToN3FromC3> = N3.GetPosition(C3) / L3
-> (57) unitVectorToN3FromC3> = dC/L3*Cx> - 0.5*wC/L3*Cy> - (dN+x)/L3*Nx>
        + (wN-y)/L3*Ny> - z/L3*Nz>

   (58) C1.AddForce( N1,  T1 * unitVectorToN1FromC1>  )
-> (59) Force_C1_N1> = -T1*x/L1*Nx> - T1*y/L1*Ny> - T1*z/L1*Nz>

   (60) C2.AddForce( N2,  T2 * unitVectorToN2FromC2>  )
-> (61) Force_C2_N2> = dC*T2/L2*Cx> + 0.5*wC*T2/L2*Cy> - T2*(dN+x)/L2*Nx>
        - T2*y/L2*Ny> - T2*z/L2*Nz>

   (62) C3.AddForce( N3,  T3 * unitVectorToN3FromC3>  )
-> (63) Force_C3_N3> = dC*T3/L3*Cx> - 0.5*wC*T3/L3*Cy> - T3*(dN+x)/L3*Nx>
        + T3*(wN-y)/L3*Ny> - T3*z/L3*Nz>

   (64) %--------------------------------------------------------------------
   (65) %   Form Nx>, Ny>, Nz> measures of resultant (net) force on C.
   (66) ResultantForce> = C.GetResultantForce()
-> (67) ResultantForce> = dC*(T2/L2+T3/L3)*Cx> + 0.5*wC*(T2/L2-T3/L3)*Cy>
        + (-T1*x/L1-T2*(dN+x)/L2-T3*(dN+x)/L3)*Nx> + (T3*(wN-y)/L3-T1*y/L1-T2*y
        /L2)*Ny> + (m*g-T1*z/L1-T2*z/L2-T3*z/L3)*Nz>

   (68) Fx = Dot( ResultantForce>, Nx> )
-> (69) Fx = dC*cos(q)*(T2/L2+T3/L3) - T1*x/L1 - T2*(dN+x)/L2 - T3*(dN+x)/L3
        - 0.5*wC*sin(q)*(T2/L2-T3/L3)

   (70) Fy = Dot( ResultantForce>, Ny> )
-> (71) Fy = T3*(wN-y)/L3 + dC*sin(q)*(T2/L2+T3/L3) + 0.5*wC*cos(q)*(T2/L2-T3/L3)
        - T1*y/L1 - T2*y/L2

   (72) Fz = Dot( ResultantForce>, Nz> )
-> (73) Fz = m*g - T1*z/L1 - T2*z/L2 - T3*z/L3

   (74) %--------------------------------------------------------------------
   (75) %   Form Cx>, Cy>, Cz> measures of resultant (net) moment on C about Co.
   (76) ResultantMoment> = C.GetMomentOfForces(Co)
-> (77) ResultantMoment> = 0.5*wC*z*(T2/L2-T3/L3)*Cx> + (dC*T1*z/L1-m*dcm*g)*Cy>
        + 0.5*dC*wC*(T2/L2-T3/L3)*Cz> + (dC*T1*(x*sin(q)-y*cos(q))/L1+0.5*wC*
        T3*(cos(q)*(dN+x)-sin(q)*(wN-y))/L3-0.5*wC*T2*(y*sin(q)+cos(q)*(dN+x))/L2)*Nz>

   (78) Mx = Dot( ResultantMoment>, Cx> )
-> (79) Mx = 0.5*wC*z*(T2/L2-T3/L3)

   (80) My = Dot( ResultantMoment>, Cy> )
-> (81) My = dC*T1*z/L1 - m*dcm*g

   (82) Mz = Dot( ResultantMoment>, Cz> )
-> (83) Mz = dC*T1*(x*sin(q)-y*cos(q))/L1 + 0.5*dC*wC*(T2/L2-T3/L3) + 0.5*wC*
        T3*(cos(q)*(dN+x)-sin(q)*(wN-y))/L3 - 0.5*wC*T2*(y*sin(q)+cos(q)*(dN+x))
        /L2

   (84) %--------------------------------------------------------------------
   (85) %   For statics: Resultant force and moment on aircraft is zero.
   (86) StaticsWithConstraints = [Fx, Fy, Fz, Mx, My, Mz, CableConstraint]
-> (87) StaticsWithConstraints = [Fx, Fy, Fz, Mx, My, Mz, CableConstraint]

   (88) %--------------------------------------------------------------------
   (89) %   Static analysis:  Since equations are nonlinear, solution requires a guess.
   (90) Solve( StaticsWithConstraints = 0,   q=0 deg,  x = dN/2 m,  y=0 m,  z = L1 m,  &
                                     T1 = m*g/2 N,  T2 = m*g/4 N,  T3 = m*g/4 N )
-> (91) q = -0.2449787       %  or  q = -14.03624 deg.
-> (92) x = -0.656865
-> (93) y = 9.330883
-> (94) z = 17.67776
-> (95) T1 = 26609.71
-> (96) T2 = 33811.54
-> (97) T3 = 34436.25

   (98) %--------------------------------------------------------------------
   (99) %   Numerical values for cable lengths L2 and L3.
   (100) L2value = EvaluateToNumber( L2 )
-> (101) L2value = 18.48214

   (102) L3value = EvaluateToNumber( L3 )
-> (103) L3value = 18.82362

   (104) %--------------------------------------------------------------------
Saved by Motion Genesis LLC.   Command names and syntax: Copyright (c) 2009-2019 Motion Genesis LLC. All rights reserved.