# Example 2.3: Kinematic analysis of a quick-return mechanism

## Position analysis

The figure shows a 4-bar quick-return mechanism. At the instant when the crank forms an angle $\theta_2 = 20^{\circ}$ with the horizontal, calculate the relative position of the slider with respect to $O_4$, the angle that link 4 forms with the horizontal, and the coordinates of point B.

![figRR.jpg](./figs/figRR.jpg)

Data:

Link lengths, in meters: $\overline{O_2 A} = 1.0;\, \overline{O_4 B} = 3.0;\, \overline{O_2 O_4} = 3.0;$

---

## Position analysis: graphical method

The objective is to construct the mechanism to scale to measure the unknowns: the angle of link 4 ($\theta_4$), the position of slider A along link 4 (distance $\overline{O_4A}$), and the coordinates of point B.

### Construction Data:

*   **Link 1 (Frame):** $L_1 = \overline{O_2O_4} = 3.0 \text{ m}$
*   **Link 2 (Crank):** $L_2 = \overline{O_2A} = 1.0 \text{ m}$
*   **Link 4 (Slotted bar):** The total length is $L_4 = \overline{O_4B} = 3.0 \text{ m}$.
*   **Input Angle:** $\theta_2 = 20^\circ$.

### Construction Procedure:

1.  **Establish the frame:** Place the fixed pivot $O_2$ at the origin (0,0) and the fixed pivot $O_4$ at (3, 0).
2.  **Position the crank (Link 2):** From $O_2$, draw link 2 with its length $L_2 = 1.0 \text{ m}$ and angle $\theta_2 = 20^\circ$. The end is the position of pin A.
3.  **Determine the slotted bar (Link 4):** Draw a straight line passing through $O_4$ and A. This line defines the orientation of link 4.
4.  **Locate point B:** Extend the line from $O_4$ in the direction of A until it has the total length of link 4, $L_4 = 3.0 \text{ m}$. The end of this segment is point B.
5.  **Measurement of results:**
    *   Measure the angle of the line $O_4B$ with the horizontal to get $\theta_4$.
    *   Measure the distance of the segment $\overline{O_4A}$ to get the relative position of the slider.
    *   Read the coordinates of point B from the reference system.

---

## Position analysis: analytical method

Vector equations are used to find expressions for the unknowns ($\theta_4$, $d = \overline{O_4A}$, and coordinates of B).

### Vector Loop Formulation

We consider the loop formed by points $O_2, O_4, A$. The vector equation is:
$ \vec{R}_{O_2A} = \vec{R}_{O_2O_4} + \vec{R}_{O_4A} $
Rearranging to solve for the vector defining link 4:
$ \vec{R}_{O_4A} = \vec{R}_{O_2A} - \vec{R}_{O_2O_4} $
Where:
*   $\vec{R}_{O_2A} = L_2(\cos\theta_2 \hat{i} + \sin\theta_2 \hat{j})$
*   $\vec{R}_{O_2O_4} = L_1 \hat{i}$
*   $\vec{R}_{O_4A}$ is a vector whose direction gives us $\theta_4$ and whose magnitude is the distance $d = \overline{O_4A}$.

### Solving for $\theta_4$ and $d$

1.  **Decompose into components:**
    $ (x_A - x_{O_4}) \hat{i} + (y_A - y_{O_4}) \hat{j} = (L_2\cos\theta_2 - L_1) \hat{i} + (L_2\sin\theta_2) \hat{j} $
2.  **Calculate $\theta_4$:** The angle of link 4 is the angle of the vector $\vec{R}_{O_4A}$.
    $ \theta_4 = \arctan\left(\frac{L_2\sin\theta_2}{L_2\cos\theta_2 - L_1}\right) $
3.  **Calculate $d$ (slider position):** The distance is the magnitude of the vector $\vec{R}_{O_4A}$.
    $ d = |\vec{R}_{O_4A}| = \sqrt{(L_2\cos\theta_2 - L_1)^2 + (L_2\sin\theta_2)^2} $

### Calculation of the Coordinates of Point B

Point B is at the end of link 4. Its position vector is:
$ \vec{R}_B = \vec{R}_{O_4} + L_4 (\cos\theta_4 \hat{i} + \sin\theta_4 \hat{j}) $
*   $x_B = x_{O_4} + L_4\cos\theta_4$
*   $y_B = y_{O_4} + L_4\sin\theta_4$

---

### Numerical Calculation for the Example

*   **Initial Data:**
    *   Lengths: $L_1=3.0 \text{ m}, L_2=1.0 \text{ m}, L_4=3.0 \text{ m}$
    *   Input angle: $\theta_2 = 20^\circ$

*   **Calculation of $\theta_4$ and $d$:**
    First, we calculate the components of the vector $\vec{R}_{O_4A}$:
    *   x-component: $L_2\cos\theta_2 - L_1 = 1.0\cos(20^\circ) - 3.0 = 0.9397 - 3.0 = -2.0603 \text{ m}$
    *   y-component: $L_2\sin\theta_2 = 1.0\sin(20^\circ) = 0.3420 \text{ m}$
    
    Now, we calculate the angle and magnitude:
    $ \theta_4 = \arctan\left(\frac{0.3420}{-2.0603}\right) = 170.56^\circ $
    $ d = \sqrt{(-2.0603)^2 + (0.3420)^2} = \sqrt{4.2448 + 0.1170} = 2.0885 \text{ m} $

*   **Calculation of Coordinates of B:**
    We use $\theta_4 = 170.56^\circ$ and $L_4 = 3.0 \text{ m}$.
    *   $x_B = 3.0 + 3.0\cos(170.56^\circ) = 3.0 + 3.0(-0.9865) = 3.0 - 2.9595 = 0.0405 \text{ m}$
    *   $y_B = 0 + 3.0\sin(170.56^\circ) = 3.0(0.1640) = 0.4920 \text{ m}$

*   **Final Position Results:**
    *   Slider position A: $\mathbf{d = \overline{O_4A} = 2.089 \text{ m}}$
    *   Angle of link 4: $\mathbf{\theta_4 = 170.56^\circ}$
    *   Coordinates of B: **(0.0405, 0.4920) m**

## Velocity analysis

The slider represents the expansion movement of a cylinder (e.g., a truck's hydraulic cylinder) at a constant velocity of $0.1$ m/s. At the instant when the crank forms an angle $\theta_2 = 20^{\circ}$ with the horizontal, calculate the velocity of point B and the angular velocities of links 2 and 4.

Data:

Link lengths, in meters: $\overline{O_2 A} = 1.0;\, \overline{O_4 B} = 3.0;\, \overline{O_2 O_4} = 3.0$.
Angle of link 4 with the horizontal, from the position analysis: $\theta_4 = 170.56^{\circ}$.
Position of slider A relative to $O_4$: $d = \overline{O_4 A} = 2.089$ m.

### Resolution

The mechanism has one degree of freedom, which corresponds to the relative velocity of the slider with respect to link 4, $\vec{v}_{A3/A4} = \vec{v}_{A2/A4}$. We use this known data to calculate the angular velocities of links 2 and 4 by applying the relative velocity equation, knowing that at the analyzed instant, points $A_2$, $A_3$, and $A_4$ coincide. It's worth remembering that $A_2$ and $A_3$, being connected by a revolute joint, have the same absolute velocity, which must be perpendicular to link 2. Meanwhile, 3 and 4 are joined by a prismatic joint, and between $A_3$ and $A_4$ there is a relative velocity in the direction of link 4, which is precisely the data provided. With this, we have:

$\vec{v}_{A_2} = \vec{v}_{A_4} + \vec{v}_{A_2/A_4}$

where each term can be expressed as:

$\vec{v}_{A_2} = \vec{\omega}_2 \times \vec{r}_{O2A}$
```matlab
clear, clc
syms w2k real
rO2A = [cosd(20) sind(20) 0];
w2 = [0 0 w2k];
vA2 = cross(w2, rO2A);
```

$\vec{v}_{A_4} = \vec{\omega}_4 \times \vec{r}_{O4A}$
```matlab
syms w4k real
rO4A = 2.089 * [cosd(170.56) sind(170.56) 0];
w4 = [0 0 w4k];
vA4 = cross(w4, rO4A);
```

$\vec{v}_{A_2/A_4} = 0.1(\cos 170.56^{\circ} \hat{i} + \sin 170.56^{\circ} \hat{j})$
```matlab
vA2_A4 = 0.1 * [cosd(170.56) sind(170.56) 0];
```

Now we can solve the relative velocity equation:

```matlab
eq1 = vA2 == vA4 + vA2_A4;
sol_v1 = solve(eq1, w2k, w4k);
w2k = double(sol_v1.w2k);
w4k = double(sol_v1.w4k);
fprintf('w2k=%0.3f w4k=%0.3f\n', w2k, w4k)
```

```matlabTextOutput
w2k=0.203 w4k=-0.085
```

Finally, we calculate the velocity of point B now that we know $\vec{\omega}_4$:

```matlab
rO4B = 3 * [cosd(170.56) sind(170.56) 0];
vB = subs(cross(w4, rO4B));
fprintf('|vB|=%0.3f\n', norm([vB(1) vB(2)]))
```

```matlabTextOutput
|vB|=0.254
```

### Velocity Cinema

The velocity cinema for this example is not provided, but it can be created using the same principles demonstrated in previous examples.

## Acceleration analysis

The slider moves at the same constant velocity of $0.1$ m/s. At the instant when the crank forms an angle $\theta_2 = 20^{\circ}$ with the horizontal, calculate the acceleration of point B and the angular accelerations of links 2 and 4.

Data:

Link lengths, in meters: $\overline{O_2 A} = 1.0;\, \overline{O_4 B} = 3.0;\, \overline{O_2 O_4} = 3.0$.
Angle of link 4 with the horizontal (from position analysis): $\theta_4 = 170.56^{\circ}$ and position of slider A relative to $O_4$: $d = \overline{O_4 A} = 2.089$ m.
Angular velocities (from velocity analysis): $\vec{\omega}_2 = 0.203\hat{k}$ rad/s; $\vec{\omega}_4 = -0.085\hat{k}$ rad/s.

### Resolution

The procedure for calculating the mechanism's accelerations is similar to that for velocities, taking into account that this time the Coriolis acceleration is involved:

$\vec{a}_{A_2} = \vec{a}_{A_4} + \vec{a}_{A_2/A_4} + \vec{a}_{Cor}$

where each term can be expressed as:

$\vec{a}_{A_2} = \vec{\omega}_2 \times (\vec{\omega}_2 \times \vec{r}_{O2A}) + \vec{\alpha}_2 \times \vec{r}_{O2A}$
```matlab
syms af2k real
af2 = [0 0 af2k];
aA2 = cross(w2, cross(w2, rO2A)) + cross(af2, rO2A);
```

$\vec{a}_{A_4} = \vec{\omega}_4 \times (\vec{\omega}_4 \times \vec{r}_{O4A}) + \vec{\alpha}_4 \times \vec{r}_{O4A}$
```matlab
syms af4k real
af4 = [0 0 af4k];
aA4 = cross(w4, cross(w4, rO4A)) + cross(af4, rO4A);
```

$\vec{a}_{A_2/A_4} = 0$ (constant expansion velocity)

```matlab
aA2_A4 = [0 0 0];
```

$\vec{a}_{Cor} = 2\vec{\omega}_4 \times \vec{v}_{A2/A4}$
```matlab
aCor = 2 * cross(w4, vA2_A4);
```

Now we can solve the relative acceleration equation:

```matlab
eq2 = aA2 == aA4 + aA2_A4 + aCor;
sol_a1 = solve(eq2, af2k, af4k);
af2k = double(subs(sol_a1.af2k));
af4k = double(subs(sol_a1.af4k));
fprintf('af2k=%0.3f af4k=%0.3f\n', af2k, af4k)
```

```matlabTextOutput
af2k=-0.104 af4k=0.061
```

Finally, we calculate the acceleration of point B now that we know $\vec{\alpha}_4$:

```matlab
aB = double(subs(cross(w4, (cross(w4, rO4B))) + cross(af4, rO4B)));
fprintf('aBi=%0.3f aBj=%0.3f\n', aB(1), aB(2))
```

```matlabTextOutput
aBi=-0.009 aBj=-0.185
```

```matlab
fprintf('|aB|=%0.3f\n', norm([aB(1) aB(2)]))
```

```matlabTextOutput
|aB|=0.185
```

### Acceleration Cinema

The acceleration cinema for this example is not provided, but it can be created using the same principles demonstrated in previous examples.
