Content Preview

Copyright © 1998, 1999, 2000 by Prentice Hall, Inc.
NOT FOR DISTRIBUTION


 

Computer Analyses

Objectives

  • Examine the role of the computer in engineering design.
  • Learn when and when not to use the computer.
  • Discuss several examples of computer use for analysis, data collection, and real-time control.

When engineers design something for the first time, they often build simplified prototypes to test the basic operating principles of the device. In many cases, simple hand calculations are all that are needed as a prelude to building a working prototype. At other times, however, more complex calculations are required to verify the feasibility of a design concept. Computers can be an important part of this verification process. Simulationis one major task that computers perform extremely well, and numerous software programs exist that help engineers simulate everything from bridges to electronic circuits. Examples of popular simulation programs include PSpice (electrical and electronic circuits), Pro-Engineer™ and Solidworks™ (solid modeling), Simulink™ (engineering systems), Ansoft™ (structural and field analysis), and Supreme™ (semiconductor devices).

General mathematical programs, such as MATLAB™, Mathcad™, and Mathematica™ are also extremely useful in the analysis of engineering problems. In the example to follow, a computer is used to perform an analysis related to a design competition. The analysis steps are illustrated using the MATLAB programming language. Although this specific software environment has been chosen for the example, the methodology illustrated is universal and could be used with any computer language or software program capable of performing numerical calculations. Other math packages, including Mathcad, Mathematica, or the computer languages C, C++, JAVA, or Fortran, for example, could be used with equal ease.

EXAMPLE
Calculating the Trajectory of a Flying Harpoon

This example describes the efforts of two students, Tina and Juan, who have entered an engineering design competition called “Peak Performance.” The objective of the competition is to build a small, self-propelled vehicle capable of climbing one side of a two-sided ramp within a 15-second time interval while an opposing vehicle attempts to climb the other side. The vehicle closest to the top of the ramp after 15 seconds is declared the winner.

During a previous brainstorming session, Tina came up with the idea of launching a barbed harpoon over the top of the ramp in the path of the opposing vehicle as a way of blocking its path to the top. In this example, the two students explore their flying harpoon idea in more detail to assess its feasibility. Tina and Juan have wisely decided to build a prototype before finalizing their design. The prototype will consist of a launch tube, retractable rubber band, and harpoon that has a notched trailing end, as illustrated in Figure 13. One approach to building the prototype would be to throw together something that “seemed about right” from whatever rubber bands, rods, and tubes might be lying around. The students could then test the prototype to see if it worked and fiddle with it to optimize its performance. This method certainly would draw upon their engineering intuition and any previous practical experience in the construction of projectiles. Indeed, it probably would be fun to march ahead and try to build a working harpoon without first performing any kind of analysis. But a better approach, and one more likely to succeed, would be to test the feasibility of the launching mechanism first by simulating its operation on a computer. By so doing, the best values for key design parameters could be determined before actual construction. Parameters to be set might include the weight, diameter, and length of the harpoon, the force constant and retraction range of the rubber band, and the angle of inclination of the launch tube. Other constraints include the dimensions of the ramp (fixed by the design competition rules) and the maximum allowed size of the vehicle (30 cm × 30 cm × 30 cm). These last dimensions determine the maximum length of the harpoon which must fit within the allowed boundaries of the vehicle.


13. Launch tube, stretched rubber band, and harpoon for Peak Performance offensive strategy.

One possible trajectory for the harpoon is illustrated in Figure 14. Juan recalls from his physics class that if aerodynamic forces are negligible, the harpoon will follow the trajectory of a parabola. The choice for the harpoon's landing point, however, is arbitrary and becomes part of the students' offensive strategy. If they aim for a landing spot that lies past, but too close, to the top of the ramp, their opponent may be able to push the harpoon the short distance needed to reach the top of the ramp. If the harpoon's landing spot is over but too far down the opposite ramp, their opponent may be able to travel past the landing spot before the harpoon can be launched. Also, the farther away the landing spot is from the launch point, the greater the chance that small lateral (sideways) errors in launch angle will be amplified downstream over the harpoon's trajectory. These lateral errors might cause the harpoon to go over the edge of the ramp and land on the floor.


14. Desired parabolic trajectory and landing site for the harpoon.

A computer can easily help Tina and Juan solve for the harpoon's trajectory. Variables of relevance include the harpoon's weight, the initial energy stored in the rubber band, and the angle of inclination of the launching tube. Before writing a computer program, however, they realize that they must understand the basic physics governing the harpoon's trajectory so that they can correctly code the program. Assuming that the rubber band, when released, will impart an initial velocity vo to the harpoon, the harpoon's equation of motion after ejection will be determined by Newton's law of motion:

Here, F is the total force on the harpoon, and a is the harpoon's acceleration. In this case, F acts in the y-direction only; hence, to the extent that aerodynamic forces can be ignored, the x- and y-components of Newton's law can be integrated to yield

and

Here, xo and yo define the position of the center of gravity of the harpoon at t = 0, and vxo and vyo describe the initial x- and y-components, respectively, of the harpoon's initial velocity.1 The quantity m is the mass of the harpoon, and g is the gravitational constant. The product mg is the magnitude of the vertical force due to gravity. Note that gravity does not affect the value of x; the harpoon's horizontal velocity is constant in time.

The harpoon's exit velocity at t = 0 will be determined by the potential energy stored in the stretched rubber band. The latter can be computed from the band's force equation. For a rubber band exhibiting a linear restoring force, the force equation is given by

Here, Fband is the force produced by the stretched band, k is the band's spring constant in newtons per meter (N/m), and the stretch s is the length that the band has been elongated from its unstretched position. The potential energy EP stored in the stretched band can be found by integrating the force equation as a function of s, yielding

When the harpoon exits the launch tube, all of the potential energy stored in the rubber band will be converted to kinetic energy of the moving harpoon (assuming that frictional losses in the launch mechanism are negligible). The kinetic energy of the harpoon can be expressed as

where vois the harpoon's initial velocity. Equating EP to EK results in an expression for vo as a function of the band retraction s:

The horizontal and vertical components of this exit velocity can be expressed by

and

where is the angle of inclination of the launch tube. Using Eqs. (4-11), (4-12), (4-17), and (4-18), one can calculate the evolution of the trajectory (x,y) in closed algebraic form to find the exact landing spot on the ramp. Given the complicated shape of the ramp, such a calculation would be very tedious to perform by hand. An alternative method is simply to use a computer to plot the harpoon's trajectory and to observe where it lands on the ramp. Although this second method will not provide as accurate an answer as the first one, it has visual appeal and is well suited for implementation on a computer.

Before any simulation can be performed, Tina and Juan must determine the various fixed parameters of the harpoon and the launching system. They've selected a weight of 100 gm (0.1 kg) for the harpoon (about the weight of one hundred paper clips). This choice represents an arbitrary starting point that can be changed later if necessary. The students next determine the spring constant of their rubber band. Several methods exist for measuring k. Tina and Juan decide to hang weights of various known values on the rubber band and measure its elongation, as shown in Figure 15. This simple experiment produces the data shown in Table 4-1. Of particular interest are the ratios of the vertical force F to the displacement y. These ratios are equivalent to the spring constant of the rubber band, because k =F/y. Tina and Juan rightfully ignore the values produced by the largest weights, because the rubber band is stretched beyond its elastic limit for these very large excursions. The values in Table 4-1 lying below the elastic limit yield an average k value of about 75 N/m. The data also suggest that Tina and Juan should confine their stretching excursions of the rubber band to about 10 cm or less in order to stay within the elastic limit. At this point, their calculation parameters consist of the values shown in Table 4-2.

Force-Displacement Test Data for Rubber Band

Weight (kG) Force) F (Newtons) Stretch y (cm) F/y
)F=mg, where m is the mass and g=9.8 N/kg is the gravitational constant.
))The probable elastic limit lies just above this point.
0.5 4.9 0.66 745
1.0 9.8 1.3 754
1.5 14.7 2.0 735
2.0 19.6 2.6 754
2.5 24.5 3.3 742
3.0 29.4 3.5 754
3.5 34.3 4.5 762
4.0 39.2 5.2 754
5.0 49.0 6.4 766
6.0 57.8 7.8 741
7.0 68.6 9.2 746
8.0 78.4 10.0 784))
9.0 88.2 10.1 873
10.0 98.0 10.2 961


15. Measuring the elastic constant k of a rubber band.

Calculation Parameters for Numerical Simulation

k = 750 N/m elastic constant of rubber band
m = 0.1 kg mass of harpoon
g = 9.8 N/kg gravitational acceleration
smax = 10 cm maximum retraction distance for rubber band

1 Plotting Trajectories Using MATLAB

MATLAB is a versatile and comprehensive programming environment particularly suited for engineering problems. MATLAB is similar in syntax to the programming language C, but it also provides commands that enable programmers to plot and organize data, manipulate matrices, observe variables, solve systems of linear equations, and solve differential equations. The strength of MATLAB lies in its ability to manipulate large amounts of data while allowing those data to be plotted and graphed. Tips on getting started in MATLAB can be found in any of several references. For example, one of the modules of the engineering series published by Prentice Hall (of which this book is a member) outlines the use of MATLAB in considerable detail.

In this example, a program that implements Juan and Tina's simulation using MATLAB is illustrated. Their trajectory program also could be written in any of several programming languages including C, C++, Java, Fortran, MathCad, or Mathematica.

One possible version of the code in MATLAB is shown below. Comment lines are preceded by percent signs (%). The program first plots a proportionately correct side view of the ramp, then prompts the user for values of the launch tube inclination angle and the amount of stretch of the rubber band. The program increments t by dt for each pass through the while loop. The looping continues as long as x and y remain within the boundaries y > 0 and x < H. After each position calculation, the program extends the trajectory plot from the most recently calculated (x,y) position to the newly calculated position. Visual inspection of the plot reveals whether the trajectory hits the ramp at the desired location. This program was, in fact, the one used to produce the plots shown in Figure 16.


16. Several calculated trajectories for rubber band elongation values s = 6, 7, and 8 cm and launch angle = 40°.

The best values for angle and band stretch distance s are found by trial and error. Figure 16 illustrates a sampling of trajectories for the test values s=6 cm, 7 cm, and 8 cm at = 40°. The simulation indicates that no value of s at this launch angle results in a harpoon that both clears the top of the ramp and lands on the other side. Figure 17 shows the same simulation at a launch angle of 70°. In this case, a rubber band retraction of 8 cm and launch angle of 70° lands the harpoon in a good spot: just over the top of the hill on the opponent's side of the ramp.


17. Repeat of simulation at a launch angle of = 70°.%%%%% MATLAB PROGRAM CODE %%%%%%%%

H=5;V=2; %set boundaries of the problem in meters

k=750; %elastic constant of rubber band in N/m

smax=10; %maximum allowed s in cm

m=0.1; %mass of harpoon in kg

g=9.8; %gravitational acceleration in m/s2

s=input('ENTER AMOUNT OF RUBBER BAND STRETCH IN cm: ');

angle=input('ENTER ANGLE OF LAUNCH in DEGREES: ');

while (s>smax)

%Check to make sure that s is less than smax

disp('Value of s must be less than 7 cm');

s=input('ENTER AMOUNT OF RUBBER BAND STRETCH IN cm: ');

end

while (angle > 90 & angle < 0)

%Check to make sure that 0 < angle < 90

disp('Angle must be less than 90 and greater than zero');

angle=input('ENTER ANGLE OF LAUNCH in DEGREES: ');

end

%SET AXES FOR MAKING PLOT ON SCREEN:

axis([0 H 0 H]);

hold on

%DRAW RAMP ON THE SCREEN AS A DOTTED LINE:

plot([0 2.22 2.52 4.75],[0 1.02 1.02 0], '--');

%PREPARE TO CALCULATE AND PLOT

s=s/100; %convert stretch from cm to meters

angle=angle*pi/180;%convert angle to radians

vo=sqrt(k/m)*s; %compute initial velocity

vox=vo*cos(angle);%compute x-component of initial velocity

voy=vo*sin(angle);%compute y-component of initial velocity

dt=H/(vox*100);%specify a time increment

xo=0.001; x=xo %set initial value of x

yo=0.001; y=yo %set initial value of y

t=0 %set initial time to zero

%--------------------------------------------------------

while (y>0 & x<H)%calculate until trajectory goes out of bounds

t = t+dt %increment the time

xnew = xo + vox*t %compute new position x

ynew = yo + voy*t - 0.5*g*(t^2); %compute new position y

plot ( [x xnew] , [y ynew] ); %plot latest segment of trajectory

drawnow; %put segment on the screen

x=xnew; y=ynew %update values of x and y

end

 

Practice!

  1. Compute by hand the trajectory of Figure 16 for a 40° launch angle and rubber-band elongation of 8 cm. Verify that the projectile lands about 5 meters from its starting point on the other side of the ramp.
  2. A rubber band has an elastic constant of 100 N/m. How much force will be required to elongate the band by 5 cm?
  3. What is the potential energy stored in a spring that has a restoring force of 1 kN/m and has been stretched by 1 cm?
  4. What is the potential energy stored in a spring that has a restoring force of 500 N/mm and has been compressed by 5 mm?
  5. Compute the initial velocity of a 100-gm projectile that is launched by stretching a rubber band by 10 cm. The rubber band has an elastic constant of 50 N/m.
  6. What launch angle will result in a harpoon that travels the farthest distance in Example 4.5. Assume that the harpoon's launch velocity and angle will cause it to travel over the top of the ramp and land somewhere on the other side.
  7. Draw the flowchart of a program designed to compute the path of a bowling ball after it leaves a bowler's hand.
  8. Draw the flowchart of a program designed to compute the height of a helium-filled balloon after it has been released from sea level.

 

 

Professional Success: The Role of Computers in Society

Computers have become so enmeshed in our lives that it's hard to imagine what society was like without them. Computers are used in business, commerce, government, education, finance, medicine, avionics, social service, and, of course, engineering. Computers have even become a form of recreation. One can debate the merit of computers and their effect on human relationships (Is an AOL chat better than a phone conversation?), but in the world of engineering, computers are indispensable. Like most people, engineers use computers for communication, information retrieval, data processing, word processing, electronic mail, and Web browsing. But the true worth of the computer to the engineer lies in its ability to perform calculations extremely rapidly. A computer can be programmed to perform all sorts of numerical calculations. Commercial programs for simulation, spreadsheets, and graphing enable engineers to determine everything from the stresses on mechanical parts and the operation of complicated electronic circuits to the force loads on building frames and theoretical predictions of rocket launches. The availability of the computer and the abundance of software tools greatly enhance the productivity of engineers in all disciplines.

EXAMPLE
Method of Numerical Iteration by Computer

The field of micro-electromechanical systems, or MEMS, has become increasingly important over the past several years. MEMS devices are tiny micro-scale machines made from silicon, metals, or other materials. They are fabricated using tools borrowed from integrated-circuit manufacturing: photolithography, pattern masking, deposition, and etching. MEMS devices are beginning to find their way into mainstream engineering design solutions. The sensors used to deploy safety airbags in most automobiles, for example, are built around tiny MEMS accelerometers that are on the order of a square millimeter in size.

One technique for fabricating MEMS devices is called surface micromachining. The basic steps involved in surface micromachining are shown in Figure 18. A silicon substrate is patterned with alternating layers of polysilicon and oxide thin films that are used to build up a desired mechanical structure. The oxide films serve as sacrificial layers that support the polysilicon layers during fabrication but are removed in the final steps of fabrication. This construction technique is analogous to the way that arches of stone buildings were made in ancient times. Sand was used to support stone pieces and was removed when the building could support itself, leaving the finished structure.


18. Fabrication sequence for a simple MEMS actuator: (a) Begin with a silicon wafer substrate; (b) deposit an insulating layer of silicon nitride; (c) deposit a thick layer of silicon dioxide (“oxide”); (d) pattern and etch the oxide using photolithography and masking techniques; (e) deposit a layer of polysilicon that will become the actuator bridge; (f) remove the oxide, leaving an air gap between the actuator and the substrate.

One simple MEMS device used in numerous applications is shown in Figure 19. This double-cantilevered actuator consists of a bridge supported on two ends and situated over an underlying, fixed activation electrode. A side view is shown in Figure 19. The bridge has the shape of a square when viewed from the top. The bridge sits atop an insulating layer and silicon substrate. When a voltage is applied between the bridge and the substrate, the electrostatic force of attraction causes the bridge to deflect downward. This vertical motion can be used to move other parts or to perform useful functions. For example, the deflecting bridge can open and close tiny valves, change the direction of reflected light, pump fluids, or mix chemicals in small micromixing chambers. A MEMS designer must know the relationship between the voltage applied to the bridge and its deflection. For a given applied voltage V, the electrostatic force will be given approximately by the following equation:


19. Applying a voltage between the actuator and the substrate causes deflection of the actuator bridge. This mechanical motion can be used to move other devices, change the direction of reflected light, pump liquids and gases, or perform other operations on a microscopic scale.

Here, y is the bridge deflection, A is the area of the bridge as seen from the top, and g is the gap spacing between the bridge and the electrode at zero deflection. The permittivity constant 0 is equal to 8.85 × 10-12 F/m for air (farads per meter). Note that the electrostatic force increases with increasing deflection and becomes infinite for y=g (i.e., when the net gap spacing becomes zero). This increase in force with deflection would cause the bridge to collapse completely when any voltage was applied were it not for the counteracting mechanical restoring force of the elastic polysilicon used to make the bridge. To first order, the restoring force will be proportional to the bridge deflection and can be expressed by the simple equation

This force is exactly analogous to that of the rubber band used to power the harpoon in Example 4.5, in that it increases in proportion to the deflection. In the case of the MEMS device of Figure 19, the mechanical restoring force prevents the bridge from collapsing completely when a voltage is applied. As the deflection increases, the restoring force increases also. At some value of deflection, the mechanical force becomes equal to the electrostatic force, allowing no further deflection. A MEMS designer is extremely interested in this equilibrium point, because it determines the bridge deflection for a given applied voltage.

The equilibrium deflection point y that results from a given applied voltage is difficult to determine from hand calculations only. In principle, one can find it by equating the magnitudes of the electrostatic and mechanical forces given by Eqs. (4-19) and (4-20), yielding the following cubic equation:

Solving this force balance equation by hand is difficult. (Try it!) The calculation is well suited, however, for solution on a computer using the method of numerical iteration. In this latter method, the computer tries many different values of y until it finds one for which both sides of Eq. (4-21) match. One can instruct the computer, for example, to begin with some very small value of y and then increase it by small amounts until the solution point is found. This iterative method is ideal for implementation on a computer, because it typically involves many repetitive calculations that would be time-consuming if performed by hand.

The flowchart of Figure 20 illustrates the steps needed to find the equilibrium point by the method of iteration. The program begins with a small value of y, then successively increases y by dy until the left-hand and right-hand sides of Eq. (4-21) agree to within some residually small value set by the programmer.


20. Flowchart for the iterative solution of Eq. (4-21).

The circles in Figure 21 show the results of the computation for several values of applied voltage and the parameters listed in Table 4-3. The dotted curve shows the complete analytical solution for comparison. The latter was plotted by solving Eq. (4-21) for numerous values of y and V, storing the data points, and then using the “plot” command in MATLAB to graph the data points as a smooth curve.


21. Deflection versus voltage curve resulting from the simulation of Fig1.

Parameters Used in the Iterative Calculations

Quantity Variable Value
Restoring force of polysilicon structure k 30 N/m
Size of bridge actuator side 250 m
Gap spacing gap 5 m
Permittivity of air 0 8.85 × 1012 F/m

Above about 45 volts, the restoring force is no longer capable of holding back the electrostatic force, and the deflection becomes “infinite,” i.e., the bridge collapses all the way to its underlying electrode. This phenomenon is called snap through in the world of MEMS. Snap through commonly occurs at a deflection of about one-third of the zero-voltage gap spacing.

The iteration leading to Figure 21 can be performed using any number of available software programs. Sample program code listings written in C++ and MATLAB that produce the desired results are provided below. The C++program can be turned into a C program by simply changing the header files and the functions used for reading and writing variables. The programs prompt the user for an applied value of voltage, calculate the corresponding deflection y, and display the result.

%%% --------------------------------------------------%%%

%%% MATLAB PROGRAM CODE LISTING %%

% Lines preceded by a percent sign (%) are comment lines

% This program finds the deflection of a MEMS bridge actuator

% for a given applied voltage.

k = 30;%elastic restoring force in N/m

eo = 8.85e-12;%electric permittivity of air

side = 250e-6;%dimension of each side of actuator

Area = side^2%compute area of actuator

gap = 5e-6; %spacing between actuator and activation electrode

dy = gap/100%incremental deflection to be used in iteration



%Prompt user for value of voltage:

V=input('Enter value of voltage applied to actuator: ')

y=0; %initialize deflection to zero

Fm = k*y; %Compute magnitude of mechanical force

Fe = eo*Area*V^2/2(gap-y)^2;%Compute magnitude of electrostatic force

%--------------------------------------------------------

while Fm < Fe;

y = y + dy; %Try a slightly larger deflection

Fm = k*y; %Recompute magnitude of mechanical force

Fe = eo*Area*V^2/2(gap-y)^2;%Recompute magnitude of electrostatic force

end

% Display result:

disp('Deflection in microns when Fe = Fm: ' y*1e6)

%%% --------------------------------------------------%%%



/*-----------------------------------------------------*/

/* C++ PROGRAM CODE LISTING */

/* Program to simulate MEMS actuator position versus voltage curve */

#include<stdio.h>

#include<math.h>

int main() {

int k = 30;

float eo = 8.85e-12,

side = 250e-6,

area,

gap = 5e-6,

dy;

float v,

y,

Fm,

Fe;

/*Square "side" to get area (raise side to the power 2) */

area = pow(side,2);

dy = gap/100;

/* Prompt user for value of voltage */

cout << "Enter value of voltage applied to actuator: ";

cin >> v;

y = 0;

Fm = k * y;

Fe = (eo * area * pow(v,2)) / pow(gap y,2);

while(Fm < Fe) {

y = y + dy;

Fm = k * y;

Fe = (eo * area * pow(v, 2)) / pow(gap y, 2);

}

cout << "Deflection in microns when Fe=Fm: " << y*1e6 << endl;

return 0;

}

/*-----------------------------------------------------*/

 

Professional Success: Garbage In, Garbage Out

The computer has become an indispensable tool for engineers. It can perform calculations much more rapidly than can a human. It's superb for storing and retrieving data and producing graphical images. But the computer is no substitute for thinking. A computer should be used to enhance the capabilities of an engineer, not replace them. A computer will faithfully follow its program code but is unable to pass judgment on the worth of the results. It's up to the engineer to provide the computer with information and program statements that are meaningful and relevant. If you program a computer to calculate the weight of structural steel for a bridge, it can do so flawlessly. But it never can tell you whether such a bridge is feasible, whether the stress-strain equations that it used in its program are correct, or whether the bridge should be built at all. Only an engineer with experience and good judgment can make those determinations.

When a computer crunches numbers that have little meaning due to programmer error, or when it operates with faulty data that was erroneously entered, the computer operates in a “garbage in, garbage out” (GIGO) mode. GIGO refers to a situation in which bad input data or bad program code lead to a computationally correct but meaningless output. A GIGO condition can be prevented by testing a program on simple, well-known examples for which the solution can be easily computed by hand. If the computer can provide correct answers to numerous simple problems, then it's probably programmed correctly and is ready to be used on more complex problems.

1 When an object is propelled by an impulse force, it will acquire nearly instantaneously a velocity at t = 0. The horizontal component of velocity will remain fixed, while the vertical component will be subject to an acceleration due to gravity. This effect leads to a parabolic trajectory.


Footer