## Tim Anthony and Kyle Vance

## Picture of Mechanism

## Project Description

The assigned project was to pick any mechanism, whether real or fictional, and develop a MATLAB program to analyze the forces based on position, velocity, and acceleration data at a given input for the mechanism. For our project, we chose to analyze the forces on the members of a common engine hoist with a load (engine) applied on the hook at the end of the top member.

The first step was deriving the loop and constraint equations, and then we input the equations into MATLAB. For the force analysis, if we treat the hydraulic cylinder as a 2 force member, we have 9 equations and 9 unknowns; the matrix method of solving simultaneous equations works best for this application.

## Projected Results

From some rough hand calculations, at an engine load of 800 pounds, we should expect to see around 650 pounds on the front wheels (Fby) and 150 pounds on the rear wheels (Fay).

## MATLAB Code

function [theta3,theta4,flag]=two_uk_angles(r1,r2,r3,r4,r5,theta1,theta2,theta5,branch)

% Solve a loop equation for 2 unknown angles

%step 0: rk_vec = r1_vec + r2_vec + r5_vec

rkx = r1*cos(theta1) + r2*cos(theta2) + r5*cos(theta5);

rky = r1*sin(theta1) + r2*sin(theta2) + r5*sin(theta5);

rk = sqrt(rkx^2 + rky^2);

thetak = atan2(rky,rkx);

%step 4: define a, b, c

a = r3^2 - r4^2 - rk^2 + 2*r4*rk*cos(thetak);

b = -4*r4*rk*sin(thetak);

c = r3^2 - r4^2 - rk^2 - 2*r4*rk*cos(thetak);

if ((b^2-4*a*c)>=0)

flag = 0;

%step 5: solve t

t = (-b + branch*sqrt(b^2-4*a*c))/(2*a);

%step 6: solve theta4:

theta4 = 2*atan(t);

%step 7: solve theta3:

theta3 = atan2( (-r4*sin(theta4)-rk*sin(thetak))/r3 , …

(-r4*cos(theta4)-rk*cos(thetak))/r3);

else

flag = 1;

theta3 = nan;

theta4 = nan;

end

%Solve loop with 2 unknown angles

clc

clear all

dtr = pi/180.0;

%initialize variables

%assume loop eqation: r1 + r2 + r3 = 0

%with theta2, theta3 unknown angles

%vectors r1, r2 known

r1 = 36;%in.

theta1 = 105*dtr;

r2 = 12;

r3 = 35;%input

r3_dot = 0;%input in/s

r3_ddot = 0;%input in/s^2

r4 = 34;

r23 = 14.8;

[theta2,theta3,flag]=two_uk_angles(r1,0,r2,r3,0,theta1,0,0,+1);

theta2/dtr;

theta2_p = theta2;

theta3_p = theta3;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Velocity

A = [-r2*sin(theta2_p), -r3*sin(theta3_p), 0, 0

r2*cos(theta2_p), r3*cos(theta3_p), 0, 0

(r2 +r4)*sin(theta2_p), 0, 1, 0

(r2 +r4)*cos(theta2_p), 0, 0, 1];

B = [cos(theta3_p)

sin(theta3_p)

0

0];

x = inv(A)*B*r3_dot;

theta2_dot = x(1);

theta3_dot = x(2);

Vpx = x(3);

Vpy = x(4);

Vp = sqrt(Vpx^2 + Vpy^2)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Acceleration

C = [-r2*sin(theta2_p), -r3*sin(theta3_p), 0, 0, 0, 0

r2*cos(theta2_p), r3*cos(theta3_p), 0, 0, 0, 0

(r2 +r4)*sin(theta2_p), 0, 1, 0, 0, 0

(-r2 -r4)*cos(theta2_p), 0, 0, 1, 0, 0

(r2 +r23)*sin(theta2_p), 0, 0, 0, 1, 0

(-r2 -r23)*cos(theta2_p), 0, 0, 0, 0, 1];

D = [r2*((theta2_dot)^2)*cos(theta2_p) + r3*((theta3_dot)^2)*cos(theta3_p)

r2*((theta2_dot)^2)*sin(theta2_p) + r3*((theta3_dot)^2)*sin(theta3_p)

-r2*((theta2_dot)^2)*cos(theta2_p) - r4*((theta2_dot)^2)*cos(theta2_p)

-r2*((theta2_dot)^2)*sin(theta2_p) - r4*((theta2_dot)^2)*sin(theta2_p)

-r2*((theta2_dot)^2)*cos(theta2_p) - r23*((theta2_dot)^2)*cos(theta2_p)

-r2*((theta2_dot)^2)*sin(theta2_p) - r23*((theta2_dot)^2)*sin(theta2_p)];

E = [-cos(theta3_p)

-sin(theta3_p)

0

0

0

0];

z = inv(C)*D + inv(C)*E*r3_ddot;

theta2_2dot = z(1);

theta3_2dot = z(2);

Apx = z(3);

Apy = z(4);

Ag2x = z(5)

Ag2y = z(6)

Ap = sqrt(Apx^2 + Apy^2)

Ag2 = sqrt(Ag2x^2 + Ag2y^2)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Force Analysis

P = 800;%lb

g = 386.4;%in/s^2

r1a = 22.1;

r1b = 51.63;

theta1a=225.5*dtr;

theta1b=342.5*dtr;

theta12=105*dtr;

r12 = 36;

r2x = r2*cos(theta2_p);

r2y = r2*sin(theta2_p);

r3x = r3*cos(theta3_p);

r3y = r3*sin(theta3_p);

r4x = r4*cos(theta2_p);

r4y = r4*sin(theta2_p);

r12x = r12*cos(theta12);%in.

r12y = r12*sin(theta12);

r1ax = r1a*cos(theta1a);

r1ay = r1a*sin(theta1a);

r1bx = r1b*cos(theta1b);

r1by = r1b*sin(theta1b);

m1 = 0;%slug

m2 = 0;

Ig1 = 688.22;%slug*in^2

Ig2 = 244.7;

Ag1x = 0;

Ag1y = 0;

alpha1 = 0;

alpha2 = 0;

AF = [1 0 0 0 cos(theta3_p) 0 1 0 0

0 1 0 0 sin(theta3_p) 0 0 1 1

-r12y r12x 0 0 0 0 -r1ay r1ax r1bx

0 0 1 0 cos(theta3_p) 0 0 0 0

0 0 0 1 0 sin(theta3_p) 0 0 0

0 0 r2y -r2x 0 0 0 0 0

1 0 1 0 0 0 0 0 0

0 1 0 1 0 0 0 0 0

0 0 0 0 1 1 0 0 0];

CF = [0

0

Ig1*alpha1

0

P

Ig2*alpha2-r4x*P

0

0

0];

y = inv(AF)*CF;

F21x = y(1)

F21y = y(2)

F12x = y(3)

F12y = y(4)

F23 = y(5)

F32 = y(6)

Fax = y(7)

Fay = y(8)

Fb = y(9)

## Results

Currently, there is a bug in the way we have this set up that results in forces that are not feasible. We could not resolve this issue by the time this project was due.