MGBeamOnTwoCablesStaticsViaKaneLagrangeAugmentEmbedConstraints.html (MotionGenesis input/output).
(1) % File: MGBeamOnTwoCablesStaticsViaKaneLagrangeAugmentEmbedConstraints.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 TC % Tension in cable C (tension in cable A is non-contributing).
(19) %--------------------------------------------------------------------
(20) % Rotational kinematics relating Bx>, By>, Bz> to Nx>, Ny>, Nz>.
(21) B.RotateZ( N, q )
-> (22) B_N = [cos(q), sin(q), 0; -sin(q), cos(q), 0; 0, 0, 1]
-> (23) w_B_N> = q'*Bz>
(24) %--------------------------------------------------------------------
(25) % Position and velocity vectors (for partial velocities).
(26) Bo.SetPositionVelocity( No, x*Nx> + y*Ny> )
-> (27) p_No_Bo> = x*Nx> + y*Ny>
-> (28) v_Bo_N> = x'*Nx> + y'*Ny>
(29) Bcm.SetPositionVelocity( Bo, 0.5*LB*Bx> )
-> (30) p_Bo_Bcm> = 0.5*LB*Bx>
-> (31) v_Bcm_N> = 0.5*LB*q'*By> + x'*Nx> + y'*Ny>
(32) BC.SetPositionVelocity( Bo, LB*Bx> )
-> (33) p_Bo_Bc> = LB*Bx>
-> (34) v_Bc_N> = LB*q'*By> + x'*Nx> + y'*Ny>
(35) NC.SetPosition( No, LN*Nx> )
-> (36) p_No_Nc> = LN*Nx>
(37) %--------------------------------------------------------------------
(38) % Constraint relating cable lengths to magnitudes of position vectors.
(39) LengthConstraint[1] = LA^2 - Bo.GetDistanceSquared( No )
-> (40) LengthConstraint[1] = LA^2 - x^2 - y^2
(41) LengthConstraint[2] = LC^2 - Bc.GetDistanceSquared( Nc )
-> (42) LengthConstraint[2] = LC^2 + 2*LB*cos(q)*(LN-x) - LB^2 - y^2 - 2*LB*y*sin(q)
- (LN-x)^2
(43) %--------------------------------------------------------------------
(44) % Relevant forces on beam (to calculate generalized forces).
(45) % Note: Cable A's tension TA does not contribute to generalized forces
(46) % because LengthConstraint[1] is embedded, whereas cable C's tension TC does
(47) % contribute to generalized forces because LengthConstraint[2] is augmented.
(48) unitVectorBcToNc> = NC.GetPositionVector(Bc) / LC
-> (49) unitVectorBcToNc> = -LB/LC*Bx> + (LN-x)/LC*Nx> - y/LC*Ny>
(50) BC.AddForce( TC*unitVectorBcToNc> )
-> (51) Force_Bc> = -LB*TC/LC*Bx> + TC*(LN-x)/LC*Nx> - TC*y/LC*Ny>
(52) Bcm.AddForce( m*g*Ny> )
-> (53) Force_Bcm> = m*g*Ny>
(54) %--------------------------------------------------------------------
(55) % Use LengthConstraint[1] to solve for y in terms of x, q.
(56) % Differentiate LengthConstraint[1] to solve for y' in terms of x', q'.
(57) SolveQuadraticPositiveRootDt( LengthConstraint[1], y )
-> (58) y = sqrt(LA^2-x^2)
-> (59) y' = -x*x'/y
(60) %--------------------------------------------------------------------
(61) % Statics via Kane's augmented/embedded constraint method.
(62) % Embed LengthConstraint[1] and augment LengthConstraint[2].
(63) SetGeneralizedSpeed( x', q' )
(64) Statics = System.GetStaticsKane()
-> (65) Statics[1] = -m*g*x/y - TC*(LB*cos(q)-LN-LB*x*sin(q)/y)/LC
-> (66) Statics[2] = 0.5*LB*(m*g*cos(q)-2*TC*(y*cos(q)+sin(q)*(LN-x))/LC)
(67) %--------------------------------------------------------------------
(68) % Solve set of 3 nonlinear algebraic equations (with guess).
(69) Solve( [Statics; LengthConstraint[2]] = 0, x = 1 m, q = 15 deg, TC = m*g/2 )
-> (70) x = 0.8153669
-> (71) q = 0.2257464 % or q = 12.93432 deg.
-> (72) TC = 577.9024
(73) %--------------------------------------------------------------------
(74) % Post-process: Calculate distance between No and Bcm.
(75) distanceNoToBcm = EvaluateToNumber( Bcm.GetDistance(No) )
-> (76) distanceNoToBcm = 4.095517
(77) %--------------------------------------------------------------------
(78) % Save input and output responses.
Saved by Motion Genesis LLC. Copyright (c) 2009-2018 Motion Genesis LLC on command names and syntax. All rights reserved.