7.2 Project Prototype
Kinematic Analysis
We modified the given animation script to create our simulation. The script relies on various kinematic and geometric principles to calculate the positions, velocities, and accelerations of a four-bar linkage. Here’s a more detailed breakdown of the math behind the simulation:
1. Kinematic Equations and Geometry
The four-bar linkage consists of four links and four joints. The system is characterized by its link lengths (stored in self.l_vec) and the angular positions of the links, denoted by θ1, θ2, θ3, and θ4. The linkage operates in a two-dimensional plane, and the goal is to compute the positions of the joints and the velocities of the links at any given time.
Linkage Position Calculation (fourbarpos)
To solve for the angular positions of the links, the script uses a geometric approach known as the loop closure equation. This is based on the idea that, for a four-bar mechanism, the sum of the displacements of the joints (linked by the bars) must be zero, forming a closed loop.
The constants used in the calculations, such as K1, K2, and others, are derived from the link lengths and represent the ratios that simplify the loop closure equations. These constants are used to form quadratic equations that relate the angles between the links.
The quadratic equations are:
A=−K1−K2cos(θ2)+K3+cos(θ2)A=−K1−K2cos(θ2)+K3+cos(θ2)
B=−2sin(θ2)B=−2sin(θ2)
C=K1−K2cos(θ2)+K3−cos(θ2)C=K1−K2cos(θ2)+K3−cos(θ2)
D=cos(θ2)−K1+K4cos(θ2)+K5D=cos(θ2)−K1+K4cos(θ2)+K5
E=−2sin(θ2)E=−2sin(θ2)
F=K1+(K4−1)cos(θ2)+K5F=K1+(K4−1)cos(θ2)+K5
These quadratic equations are solved using the quadratic formula to find the joint angles θ3 and θ4 given θ1 and θ2. The solution involves calculating the discriminants (disc_4 and disc_3) to ensure real, non-imaginary solutions for the angles. If the discriminants are negative, it indicates an invalid configuration.
Velocity and Acceleration Calculation (fourbarvel)
Once the positions of the joints are known, the script calculates the velocities and accelerations of the links using standard kinematic relationships:
The angular velocity of each link is related through the geometry of the mechanism.
For example, the angular velocities of the links are calculated using the following formula, which is derived from the law of sines:
ω3=ω2L2L3⋅sin(θ4−θ2)sin(θ3−θ4)ω3=ω2L3L2⋅sin(θ3−θ4)sin(θ4−θ2)
Similarly, for the angular velocity of link 4:
ω4=ω2L2L4⋅sin(θ2−θ3)sin(θ4−θ3)ω4=ω2L4L2⋅sin(θ4−θ3)sin(θ2−θ3)The linear velocities of points A, B, and the point on the frame are determined by multiplying the angular velocities of the links by the lengths of the links. For example, the velocity of point A is given by:
VA=L2⋅ω2⋅[−sin(θ2),cos(θ2)]VA=L2⋅ω2⋅[−sin(θ2),cos(θ2)]Acceleration is calculated using the centripetal acceleration formula, which depends on the square of the angular velocity and the link length:
a=ω2⋅La=ω2⋅L
The script calculates the accelerations at various points using the positions and velocities, and resolves them into components along the x and y axes.
Acceleration at Points A and B
To compute the accelerations at points A and B, the script uses the velocities and the relationship between them. The accelerations are found by solving the following equations derived from the forces and torques acting on the system:
acc4=(C⋅E)−(B⋅F)(A⋅E)−(B⋅D)acc4=(A⋅E)−(B⋅D)(C⋅E)−(B⋅F)acc3=(C⋅D)−(A⋅F)(A⋅E)−(B⋅D)acc3=(A⋅E)−(B⋅D)(C⋅D)−(A⋅F)
These formulas use the angular velocities and link lengths to compute the accelerations at different points in the mechanism.
2. Animation and Simulation
The animate function simulates the motion of the four-bar linkage over time. The angular velocity (ω2) is varied across the frames to create the desired motion. The motion is broken into several phases:
Phase 1: The velocity is constant.
Phase 2: The velocity gradually slows down.
Phase 3: The velocity speeds up again.
By calculating the angular velocity at each time step and updating the positions of the joints and links, the animation captures the motion of the linkage. The velocities and accelerations of the links are also displayed in the plot as arrows to visually represent the dynamics of the system.
Finally, the FuncAnimation function from matplotlib is used to generate the animation and save it as a GIF, providing a visual representation of how the four-bar linkage moves and how the velocities and accelerations evolve over time.
Draft Bill of Materials
Dice Shaker Preliminary Bill of Materials | ||||
Line Item | Part Name | Quantity | Material | Source |
1 | Joint Bearings | 10 | - | Class box/online |
2 | Rails for Axles | 5 | Steel | Class box |
3 | Bolts for axles and mounting | 8 | Stainless Steel | Class box |
4 | Plywood | 2’ x 4’ | Plywood | TIW Laser cut |
5 | L brackets | 4 | PLA/PETG | TIW 3DP |
6 | Dice shaking box | 1 | PLA/PETG | TIW 3DP |
Representative CAD assembly of the geared input 4-bar linkage
‘Slip Gear’ to initiate shaking and drop
Output gear with 4 bar linkage
Iteration Documentation
This was our only iteration.