|
| 1 | + |
| 2 | +with(MBSymba_r6): |
| 3 | +with(LinearAlgebra): |
| 4 | + |
| 5 | +# GLOBAL APPROACH |
| 6 | +P0 := origin(ground): |
| 7 | +P011 := make_POINT(ground,x1,y1,0): |
| 8 | +P40 := make_POINT(ground,x4,y4,0): |
| 9 | + |
| 10 | +printf("\nReference frame 1"): |
| 11 | +RF1 := combine(translate(x0(t),y0(t),0).rotate('Z',theta0(t))): |
| 12 | +P01 := origin(%): |
| 13 | +Gact := make_POINT(RF1,(s(t)+L1)/2,0,0): |
| 14 | +P1 := make_POINT(RF1,s(t),0,0): |
| 15 | +P2 := make_POINT(RF1,s(t)+L1,0,0): |
| 16 | +print(RF1): |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +printf("\nReference frame 2"): |
| 21 | +RF2 := combine(translate(x2(t),y2(t),0).rotate('Z',theta1(t))): |
| 22 | +Gpod := origin(%): |
| 23 | +P22 := make_POINT(RF2,-LP/2,0,0): |
| 24 | +P3 := make_POINT(RF2, LP/2,0,0): |
| 25 | +print(RF2): |
| 26 | + |
| 27 | +printf("\nReference frame 3"): |
| 28 | +RF3 := combine(translate(x3(t),y3(t),0).rotate('Z',theta3(t))): |
| 29 | +P4 := origin(%): |
| 30 | +P3b := make_POINT(RF3,anc,0,0): |
| 31 | +P5 := make_POINT(RF3,LF,0,0): |
| 32 | +Gflap := make_POINT(RF3.rotate('Z',psi),LFb,0,0): |
| 33 | +print(RF3): |
| 34 | + |
| 35 | +# Constraint equations |
| 36 | +# Constraint equations : prismatic joint in P1 |
| 37 | +join_points(P011,P01): |
| 38 | +Phi1 := map(simplify,[comp_X(%,ground),comp_Y(%,ground)]): |
| 39 | + |
| 40 | +# Constraint equations : revolute joint in P2 |
| 41 | +join_points(P2,P22): |
| 42 | +Phi2 := map(simplify,[comp_X(%,ground),comp_Y(%,ground)]): |
| 43 | + |
| 44 | +# Constraint equations : revolute joint in P3 |
| 45 | +join_points(P3,P3b): |
| 46 | +Phi3 := map(simplify,[comp_X(%,ground),comp_Y(%,ground)]): |
| 47 | + |
| 48 | +# Constraint equations : revolute joint in P4 |
| 49 | +join_points(P4,P40): |
| 50 | +Phi4 := map(simplify,[comp_X(%,ground),comp_Y(%,ground)]): |
| 51 | + |
| 52 | +# Constraint equations: prismatic joint in RF1 |
| 53 | +Phi5 := [dot_prod(uvec_Y(RF1),uvec_X(ground))]: |
| 54 | + |
| 55 | +# Assembling the constraint equations |
| 56 | +printf("\nThe constraint equations are"): |
| 57 | +Phi := Phi1 union Phi2 union Phi3 union Phi4 union Phi5: print(<Phi>): |
| 58 | + |
| 59 | +# Define the list of variables |
| 60 | +printf("\nKinematics variables"): |
| 61 | +q_vars := {theta0(t),theta1(t),theta3(t),s(t),x0(t),y0(t),x2(t),y2(t),x3(t),y3(t)}: |
| 62 | +print(%): |
| 63 | +# Check the DOFs of the system |
| 64 | +# Check jacobian of constraints for consistency |
| 65 | +printf("\nCheck the consistency of the system (Implict function theorem)"): |
| 66 | +combine(jacobianF(Phi, q_vars)); Dimensions(%); |
| 67 | +combine(GaussianElimination(%%)); Dimensions(%); |
| 68 | + |
| 69 | +# the system is consistent so i can apply the general formula to compute the degree of freedom of a body |
| 70 | +; |
| 71 | +# Number of degree of freedom |
| 72 | +nq := nops(q_vars): |
| 73 | +nc := nops(Phi): |
| 74 | + |
| 75 | +printf("\nThe DOFs of the system are"): |
| 76 | +n_dof = nq - nc; |
| 77 | +# Analytic solution |
| 78 | +q_I := {theta3(t)}: |
| 79 | +q_D := q_vars minus q_I; |
| 80 | + |
| 81 | +printf("Analytic solution"): |
| 82 | +sol_kine_all := op(solve(Phi, convert(q_D,list), explicit=true)): <%>; |
| 83 | + |
| 84 | +printf("Let's find the right configuration, evaluating the solutions for %a=%f",theta3(t),flap_closed): |
| 85 | +evalf(subs(data,param_not_opt, theta3(t)=flap_closed, sol_kine_all[1])); |
| 86 | +evalf(subs(data,param_not_opt, theta3(t)=flap_closed, sol_kine_all[2])); |
| 87 | +evalf(subs(data,param_not_opt, theta3(t)=flap_closed, sol_kine_all[3])); |
| 88 | +evalf(subs(data,param_not_opt, theta3(t)=flap_closed, sol_kine_all[4])); |
| 89 | + |
| 90 | +sol_kine := sol_kine_all[1]: |
| 91 | +read("./lib/kinematics/OPTIMIZATION.maplet"): |
| 92 | +read("./lib/kinematics/PVAanalysis.maplet"): |
0 commit comments