Design of a Fourbar Linkage Mechanism

Using Ch mechanism toolkit and the code available from this website

Problem Statement

With the specifications for the mechanism given here, plot the coupler curve of the point x versus point y traced by the coupler point and display an animation of the mechanism in action. the links have the following lengths:
r1 = 4 ft,   r2 = 12 ft,   r3= 7 ft,   r4 = 10 ft,   rp = 5 ft
The ground link, r1, will be at 0°. The angle beta would be 20°.

Fourbar linkage mechanism

Design specifications

To solve the problem we'll use the CFourbar class that was developed to analyze this type of mechanism. It has member functions to enter the mechanism specifications and others that present the output to the user. The code shown below uses this class.

#include <fourbar.h> int main() { double r1 = 4, r2 = 12, r3 = 7, r4 = 10; double theta1 = 0; double rp = 5, beta = 20*M_PI/180; class CPlot pl; CFourbar fourbar; int num_range; double RetCurvex[50], RetCurvey[50]; fourbar.setLinks(r1, r2, r3, r4, theta1); fourbar.setCouplerPoint(rp, beta); fourbar.setNumPoints(50); fourbar.plotCouplerCurve(&pl,1); }

Below we describe how the code interacts with the member functions in the class. The first line of the program

#include <fourbar.h>

includes the header file fourbar.h which defines the CFourbar class, macros, and prototypes of member functions. Like all C/C++ programs, the program is started with the main() function. The next three lines

double r1 = 4, r2 = 12, r3 = 7, r4 = 10; double theta1 = 0; double rp = 5, beta = 20*M_PI/180;

define the link lengths, ground and input link angles (in rad), of the fourbar linkage mechanism. The lines

CFourbar fourbar; class CPlot pl;

construct an object of the CFourbar class for the calculations and the CPlot class to display the output. The following three lines

fourbar.setLinks(r1, r2, r3, r4, theta1); fourbar.setCouplerPoint(rp, beta);

set the dimensions of each link, phase angle for link 1, and the length of coupler rod and the angle it make with link3. A single line

fourbar.setNumPoints(360);

is needed to set the number of points to be used for plotting. The line

fourbar.plotCouplerCurve(&pl,1);

plots the coupler curve, the movement of coupler point . The figure below shows the coupler curve generated by the above program. The last line

fourbar.animation();

creates an animation shown below. Fewer points are used because the animation doesn't need as many as a plot to create decent output.

The results of running the above program are displayed below. The first is the coupler curve and the adjacent figure is the animation generated.

Coupler Curve Fourbar Animation

Try the code yourself on your own computer using Excel as front end and Ch as backend.

To try out this analysis using Excel and Ch, create an Excel as shown in figure below.

Coupler Curve
Follow the procedures given in the ChExcel documentation to create the Excel spreadsheet embedded with Ch API's.

The script files used in this example are shown below. The following code is from "fb_plot_initialization.ch".

#include<fourbar.h> CFourbar fourbar; class CPlot pl;

The following code is from "fb_curve.ch".

fourbar.setLinks(r1,r2,r3,r4, theta1); fourbar.setCouplerPoint(rp, beta); fourbar.setNumPoints(50); fourbar.plotCouplerCurve(&pl,branchno);

The following code is from "fb_animation.ch".

fourbar.setLinks(r1, r2, r3, r4, theta1); fourbar.setCouplerPoint(rp, beta, TRACE_ON); fourbar.setNumPoints(50); fourbar.animation(branchno);

On executing the above Excel spreadsheet with Ch scripts embedded in it, the user can get the required results like the coupler curve and animation generated by Ch from Excel.

Main Page


Powered by Ch