dynamic analysis software was introduced.This chapterfocuses on other forms ofcomputer approaches to mechanism analysis.These other forms include using spreadsheetsand creating routines using programming languages.
8.2SPREADSHEETS
Spreadsheets,such as Microsoft
®
Excel,are very popular in theprofessional environment for a variety oftasks.Spreadsheetshave numerous builtin functions,ease ofplotting results,andthe ability to recognize formulas.These analytical featuresprompted widespread use ofspreadsheets for more routinemechanism problems.Spreadsheets have been used in variousproblem solutions in this text.This section outlines the basicsofusing spreadsheets.Ofcourse,the specific software manuals should be consulted for further details.A spreadsheet is arranged in a large array ofcolumnsand rows.The number ofcolumns and rows varies amongthe different software products.Column headings arelettered from A to Z,then from AA to AZ,then BA to BZ,and so on.Row headings are numbered 1,2,3,and so on.The top corner ofa general spreadsheet is shown in Figure 8.1.
OBJECTIVES
Upon completion ofthis chapter,the student will be able to:
1.Understand the basics ofa general spreadsheet.2.Understand the strategy for using a general spreadsheetfor mechanism analysis.3.Create computer routines for determining kinematicproperties ofeither fourbar or slidercrank mechanisms.
COMPUTERAIDED MECHANISM ANALYSIS
8.1INTRODUCTION
Throughout the text,both graphical and analytical techniquesofmechanism analysis are introduced.As the more accurate,analytical solutions are desired for several positions ofamechanism,the number ofcalculations can becomeunwieldy.In these situations,the use ofcomputer solutions isappropriate.Computer solutions are also valuable whenseveral design iterations must be analyzed.In Section 2.2,“Computer Simulation ofMechanisms,”the use ofdedicated
215
CHAPTER
EIGHT
FIGURE 8.1
General spreadsheet.
216
CHAPTER EIGHT
The intersection ofa column and a row is called a cell.Eachcell is referred to by a cell address,which consists ofthecolumn and row that define the cell.Cell D3 is defined by thefourth (D) column and the third row.The cursor canbemoved among cells with either the keyboard (arrow keys)or a mouse.The value ofa spreadsheet lies in storing,manipulating,and displaying data contained in a cell.This datacommonly consists ofeither text,numbers,or formulas.The spreadsheet shown in Figure 8.2has text entered intocells A1,F1,and F2 and numbers entered into cells A2through A24,G1,and G2.Although subtle differences may exist in the syntax among the spreadsheet programs,the logic behind creatingformulas is identical.The syntax given here is applicable toMicrosoft Excel.The user’s manual ofanother productshould be consulted for the details on any differences insyntax.Entering a formula into a cell begins with an equal sign (=).The actual formula is then constructed using values,operators(+,–,*,/),cell references (e.g.,G2),and functions (e.g.,SIN,AVERAGE,ATAN,and RADIANS).Formulas for kinematicanalysis can get rather complex.As an example,a simpleformula can be placed in cell A8:
(8.1)
Although the actual cell contents would contain this formula,the spreadsheet would visually show the number 60 in cellA8.The calculation would be automatically performed.Foranother example,the following expression can be insertedinto cell B2:
(8.2)
=
ASIN(G1* SIN(A2* PI()/180)/G2) * 180/PI()
=
A7
+
10This expression represents the angle between theconnecting rod and the sliding plane for an inline slidercrank mechanism.It was presented as equation (4.3) inChapter 4:
(4.3)
The spreadsheet formula assumes that the followingvalues have been entered:
θ
2
in cell A2
L
2
in cell G1
L
3
in cell G2It should be noted that as with most computer functions,any reference to angular values must be specified inradians.Notice that A2,an angle in degrees,is multipliedby
π
/180 to convert it to radians.After using the inversesine function,ASIN,the resulting value also is an angle inradians.Therefore,it is converted back to degrees by multiplying by 180/
π
.Excel has predefined RADIANS andDEGREES functions that can be convenient in conversions.Equation (4.3) can alternatively be inserted into a cell B2 of a spreadsheet with:
(8.3)
Ifexpression (8.1) were typed into A8 and expression(8.2) or (8.3) were typed into B2,the resulting spreadsheetwould appear as depicted in Figure 8.3.It is important toremember that as a cell containing input data is changed,all results are updated.This allows design iterations to becompleted with ease.
=
DEGREES(ASIN(G1 * SIN(RADIANS(A2))/G2))
u
3
=
sin

1
a
L
2
L
3
sin
u
2
b
FIGURE 8.2
Spreadsheet with text and numbers entered into cells.
ComputerAided Mechanism Analysis
217
FIGURE 8.3
Spreadsheet with formulas entered into A8 and B2.Another important feature ofa spreadsheet is the copy and paste feature.The contents ofa cell can be duplicated andplaced into a new cell.The copy and paste feature eliminatesredundant input ofequations into cells.Cell references in a formula can be either relative orabsolute.Relative references are automatically adjustedwhen a copy ofthe cell is placed into a new cell.Consider thefollowing formula entered in cell A8:The cell reference A7 is a relative reference to the cell directly above the cell that contains the formula,A8.Ifthis equationwere copied and placed into cell A9,the new formula wouldbecomeAgain,the cell reference A8 is a relative one;therefore,thespreadsheet would automatically adjust the formula.An absolute address does not automatically adjust thecell reference after using the copy and paste feature.However,to specify an absolute reference,a dollar symbolmust be placed prior to the row and column.For example,an absolute reference to cell G1 must appear as $G$1.Consider expression (8.2) being placed into cell B2.Tobe most efficient,this formula should be slightly modifiedto read:In this manner,only the angle in cell A2 is a relative address.Ifthe formula were copied to cell B3,the new formula wouldbecome
=
ASIN($G$1 * (SIN(A3 * PI()/180)/$G$2)) * 180PI()
=
ASIN($G$1 * (SIN (A2 * PI()/180)/$G$2)) * 180/PI()
=
A8
+
10
=
A7
+
10Notice that the address ofcell A2 has been automatically adjusted to read “A3.”The connecting rod angle is calculatedfor the crank angle specified in cell A3.To continue with an analysis ofa mechanism,thefollowing formula can be typed into cell C2:This formula,shown in Figure 8.4,calculates the interiorangle between the crank and connecting rod (equation 4.4):
(4.4)
Because the angles are simply added,and a function is notcalled,a radian equivalent is not required.Also,the following formula can be typed into cell D2:This formula calculates the distance from the crank pivot tothe slider pin joint (equation 4.5):
(4.5)
Ifthese two formulas were typed into C2 and D2,and textdescriptions were typed into cells B1,C1,and D1,theresulting spreadsheet would appear as depicted in Figure 8.4.Finally,because much care was taken with using absoluteand relative cell addresses in creating the formulas in B2,C2,and D2,they can be copied into the cells down their respective columns.The user’s manual should be consulted for theactual steps needed to copy the data into the remaining cells,which is usually a simple two or threestep procedure.Theresulting spreadsheet is shown in Figure 8.5.
L
4
=
3
L
22
+
L
32

2(
L
2
)(
L
3
)cos
g
(2* $G$1 * $G$2 * COS(C2 * PI()/180)))
=
SQRT(($G$1)
¿
2
+
($G$2)
¿
2

g
=
180°

(
u
2
+
u
3
)
=
180

(A2
+
B2)