Computer-Aided Analysis of Mechanisms Using ChExcel
Computer-Aided Analysis of Mechanisms Using ChExcel
Integration Engineering Laboratory Department of Mechanical and Aeronautical Engineering University of California Davis, California, 95616 Email: [email protected]
Abstract As computer CPU gets fast, script computing is increasingly popular. Script computing allows a computer program to be executed interpretively without tedious compilation and linking. It can be used for rapid prototyping, embedded scripting, mobile computing, teaching, and learning. Ch is an embeddedable C/C++ interpreter. It execute C/C++ programs as scripts interpretively without compilation. In this project, Ch and Ch Excel are used for mechanism design and analysis. Microsoft Excel is a user friendly software commonly used by engineers to solve many computational problems. Using Excel as a GUI front-end, many Excel features are readily available for applications and use Ch as backend to handle computations. A familiar structure programming paradigm in C can be used for scripts with capabilities of other software modules in Ch. Mechanism design and analysis modules developed in Ch, Ch Excel and Ch Mechanism Toolkit are ideal solutions with user friendly Excel interface for solving mechanism design and analysis problems.
Contents
1 Introduction 1.1 Compiler Vs Interpreter . . 1.2 Software and Mechanisms 1.3 Ch and Mechanism Toolkit 1.4 Spreadsheet . . . . . . . . 1.5 Scripting . . . . . . . . . . 3 3 4 4 5 5 7 7 7 8 8 9 9 9 9 10 10 10 11 11 13 14 14 15 15 16 16 18 20 23 24
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
2 Design and Analysis of Fourbar Linkage Using Ch and ChExcel 2.1 Ch Excel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 Plotting Variety . . . . . . . . . . . . . . . . . . . . . 2.2 Ch Mechanism ToolKit . . . . . . . . . . . . . . . . . . . . . 2.2.1 Kinematic Analysis . . . . . . . . . . . . . . . . . . . 2.2.1.1 Angular Position . . . . . . . . . . . . . . . 2.2.1.2 Angular Velocity . . . . . . . . . . . . . . . 2.2.1.3 Angular Acceleration . . . . . . . . . . . . 2.2.1.4 Dynamic Force Analysis . . . . . . . . . . 2.2.1.5 Animation . . . . . . . . . . . . . . . . . . 2.3 Excel Worksheet . . . . . . . . . . . . . . . . . . . . . . . . 2.3.1 Developement of Excel sheet . . . . . . . . . . . . . . 2.3.2 Description of Excel Work Sheet . . . . . . . . . . . . 2.3.3 Processing of Excel Work Sheet . . . . . . . . . . . . 2.3.4 Execution of fourbar position analysis.xls . . . . . . . 2.4 Position Analysis . . . . . . . . . . . . . . . . . . . . . . . . 2.4.1 Initialization . . . . . . . . . . . . . . . . . . . . . . 2.4.2 Feasibility of Fourbar Linkage Formation . . . . . . . 2.4.3 Angular Position . . . . . . . . . . . . . . . . . . . . 2.4.3.1 Range of Motion . . . . . . . . . . . . . . . 2.5 Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6 Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.7 Angular Velocity Analysis . . . . . . . . . . . . . . . . . . . 2.8 Angular Acceleration Analysis . . . . . . . . . . . . . . . . . 2.9 Dynamic Analysis . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
3 Analysis of Other Mechanism Using Ch and ChExcel 3.1 Position Analysis of Geared Fivebar Mechanism . . . . 3.2 Slider Position Analysis of Crank Slider Mechanism . 3.3 Position Analysis of Multi-Loop Six Bar Linkages . . 3.3.1 Position Analysis of Fourbar Slider Mechanism 3.3.2 Position Analysis of Watt Six-Bar(I) linkage . 3.3.3 Position Analysis of Watt Six-bar (II) Linkage 3.3.4 Stephenson Six-bar (I) Linkage . . . . . . . . 3.3.5 Stephenson Six-bar (III) Linkage . . . . . . . . 4 Conclusions
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
29 29 31 33 33 36 39 42 45 49
Chapter 1 Introduction
Todays global economy has raised the level of competition throughout the world. Globalisation removed physical boundaries between coutries leading to companies venturing all over the world. This increased level of competition and has forced companies to be lean, adaptable and responsive while maintaining the quality in order to stay in the market. The penetration of information technology into scientic eld has led to developement of various application specic software. This has led companies to look for more diversed people which made instructors to teach students with a variety of software and their application, but one of the major issue is choosing the environment in which students can get quick start in programming. Ch [1][2] was designed and implemented for novice and inexperienced users to get start with programming. Ch is a high-level language environment, it allows students to focus on program structure and algorithm instead of tedious compile link distraction. Due to the availability of various softwares specialising in particular eld, students and researchers may nd it difcult to procure different software for each application. This could prevent them in using the latest technology which can improve their efciency. Ch environment could become a useful tool in this scenario, where the software modules that has been integrated with this environment would prove helpful for engineers and scientist for learning and research purpose.
and space overhead can be neglected to some extent. The usage of interpreter by novice software developers who may have to frequently modify the code is a good choice as they dont have to compile every time they debug. Techniques like self-modifying code is easy to implement using interpreter and is also conceptually simpler and could be of great help to beginners.
given application. For example, Ch gives easy solution for mechanism animation, it could be the ideal environment to develope mechanism related animation. The user specic development in Ch can be done by adding small software module by the user, which serves their personal requirement. Once it has been inducted it remains in the environment for ever and can be used repetitively. This makes the task of developing and maintaining the software as simple as possible. Even though this mechanism toolkit has been developed for simple mechanisms, this can be expanded to other complicated mechanisms. Ch also has a well built toolkit to deal with control system design and analysis [13][14]. The development of modules of classes in this toolkit [14] makes it easier to develop a new control system. Ch can be used for CGI[15] which allows the user to access control [14] and mechanism [6] toolkit through the web. This mechanism toolkit is implemented as a module which can be utilized from various other softwares that has been embedded with Ch. ChExcel [16] is one among the newly developed application by which Ch can be accessed from Excel. In this work the utilization of this mechanism toolkit with Ch Excel has been demonstrated. Availability of demo programs along with this package helps novice designer to understand the process of using software in solving mechanical problems. They can also modify these programs to solve their own mechanism design and analysis problems. Chapters 2 and 3 explain in detail on how ChExcel has been used in analyzing various mechanisms.
1.4 Spreadsheet
Spreadsheet was originally created to help the accountants in their business applications. It was later used in educational purpose and is now being widely used in almost every eld. More recently, spreadsheet was used to simulate engineering system, such as logic networks, control systems and antenna array design [17]. The spreasheet modules has been used in the eld of machine design[18]. Spreadheet is also used to aid the designer in the approximation process [19]. There are various application of spreadsheet modules like design of worm gear geometry [20], determination of spur gear form factors [21] and various other applications. These research projects highlights the usage of Excel in analyzing various mechanisms.
1.5 Scripting
Most software systems are seldom developed starting from scratch, but rather built using the existing libraries [22] which led to recent sprout in development of scripting languages [23].To have various advantages over a compiled language a scripting language must provide two capabilities. First, developers must have a large number of software components readily available to be used in scripts. These components must support many application domains such as graphical user interfaces, internet communication or text processing [23]. Secondly, the scripting language environment must integrate seamlessly with software components and applications written in system programming languages. These advantages can be seen in Ch script, where a Ch script can access all the software that has been integrated to the Ch language environment and also integrate seamlessly with other software component. This research project presents the usage of ChExcel for analyzing various mechanisms. Excel 5
spreadsheets were developed for specic purpose which utilize Ch Mechanism Toolkit in back end to analyze the mechanisms. It also exposes various other software integrated to Ch to be accessed from Excel. The second part of this research project is focused on integration of Java with Ch for Windows version and Kaffe for Linux. The nal chapter illustrates application of ChJava in manipulating a mechatronic system in stand alone and in web-based application(client side and remote).
2.1 Ch Excel
Ch Excel was desgined and developed to use the computational power of Ch from Excel worksheets [16]. The availability of Add-In technique in Excel gives a seamless extension from Excel to Ch. Students and researchers who have been using Microsoft Excel to great extent would nd a programming language like Ch integrated with Excel can increase its usability many folds. For example, various user dened software modules that have been developed in Ch can be accessed from the worksheets. Excel being one of the widely used spreadsheet by engineers, adapting to new addition with Excel shall not be a difcult task for the user when Excel is used as front end while Ch does the computation at the back end [24]. The simple GUI front end in assembling the input and output cells makes interaction with the user easier. Excels ability to check the values entered in a cell is utilized in this work for preliminary decision making and the compilcated issues are handled by Ch running in the backend. As a general purpose programming language, the amount and the variety of work that Ch Excel could perform are almost unlimited.
Ch. This capability would play an important role when several people exchange information for their research.
2.2.1.1 Angular Position Given the link lengths of a four-bar linkages along with theta1 and theta2, the angular positions theta3 and theta4 can be solved using the function complexsolve(). In general, there are two sets of solutions of theta3 and theta4 for a given theta2, which corresponds to the two different circuit or two geometric inversions. The function angularPos in the class CFourbar is used in determining the two set of solutions. CFourbar::angularPos(theta_1, theta_2, theta_id) Where theta 1 and theta 2 are arrays which gets the two sets of solution returned from the function. 2.2.1.2 Angular Velocity The velocity analysis for a closed loop linkage can be carried out from its loop-closure equation. Given the lengths of all links and angles theta1 and theta2 the angular velocities of link 3 and link 4 can be found out using the function angularVel CFourbar::angularVel(theta, omega, omega_id) The other required angles can be found using the angularPos function decsribed earlier. theta and omega are arrays which contains the angle that every link makes with ground and the known angular velocity of the link. omega id represents the link number whose angular velocity is known. 2.2.1.3 Angular Acceleration The acceleration is the second derivative of the loop closure equation. A fourbar class member function angularAccel() calculates alpha3 and alpha4 when all the angle that the links make with ground and their angular velocity along with angular acceleration of link 2 is given. CFourbar:: angularAccel(theta, omega, alpha, alpha_id) The variables theta and omega have the angle and the angular velocity of the links in the mechanism. The variable alpha has the angular acceleration of the known link and its corresponding link number is sent to the function through the variable alpha id. 2.2.1.4 Dynamic Force Analysis Dynamic force analysis is performed based on DAlemberts principle. In this analysis we assume that the position, velocity and acceleration of each moving body in the system is already known. The user can also use the above explained methods to nd the required velocity and acceleration of each link. The method forceTorque dened in the CFourbar class, using which the forces acting on those links can be identied. CFourbar::forceTorque(theta, omega, alpha, tl, X) where tl is the input torque and X is the output array of all reaction forces that has been calculated in this function. 9
2.2.1.5 Animation One of the best advantages of using ChExcel is that the developer can use all the software modules that have been integrated to Ch. For example, qanimate which can be accessed from Ch can be used for developing a mechanism animation. This may not be possible if some one uses only Excel to analyze the mechanism. This animation is made possible by a method called animation() which is dened in the class CFourbar as CFourbar::animation(circuit no).
10
11
spreadsheet
of
fourbar
linkage
position
analysis
(four-
To call the Ch scripts from Excel, certain cells have been inducted with Ch APIs. The script le has to be executed in a predetemined sequence as script les used depend on the values determined by the previous script les . This being the case, the script les are arranged in the required order it has to be called. The user has to go through the cells one by one in column E in this example. To initiate the call the user has to press F2 which activates the command that executes the script le inducted in column E [16]. On execution of these function, depending up on its success or failure, the corresponding cells in coloumn E are returned with values either 0 upon success or #ERROR# upon failure. All the values that have been calculated in Ch are stored in a variable which are then called from Excel when it is needed. As all the variables are global, the values can be used by different script les. As the values are handled in terms of matrix, the results are easily distributed among the rows and columns as shown in Figure 2.3.
12
of
fourbar
linkage
position
analysis
(four-
in respected cells and is read and stored in the corresponding variable using ChPutMatrix() function. On completion of storing all the variables with the required input, script le is link() is executed. This script le is appended to the previous script by ChAppendScript(). ChAppendScript("is_link.ch") This le can be called every time the user changes the input contents. Similarly the program fb angularpos.ch is also appended to determine the angular position of the link. The initialization should not be performed in les that are appended, as it does not destroy the previously declared variables. So, there is a possibility of redeclaring a variable which may lead to syntax errors. Once the required calculations are performed, the output is displayed using function ChGetMatrix(). For example, to display the output in radians for rst solution, ChGetMatrix(D21:D24,"theta_1") which displays theta 1 in cells D21 through D24. The cells in column E has a value 0 throughout, which states that all the functions were succesfully called.
2.4.1 Initialization
The script fb pos initialization.ch is used in intialization of all the variables. The script includes the header les, declares and initializes variables that will be used. This le does not either declares or intializes the variables that has been declared in Excel because the same variable can be used in both Ch and Excel. For example the variable theta 1 is declared in Ch but is used in Excel and the variable r1 is declared and intialized in Excel but can be used as any other variable in Ch. The command ChPutMatrix(C4,r1) when exectued initialize the variable r1 and store the value entered in the cell C4.
14
#include <math.h> #include <fourbar.h> #include <chplot.h> #include <stdio.h> #include <windows.h> #define APP_NAME "Link Status" PCHAR string="This Link is not Possible\n"; PCHAR string1="This Link is Possible\n"; double theta_1deg[1:4], theta_2deg[1:4]; double theta_1[1:4], theta_2[1:4]; int fourbartype; double inputlimitmin[2], inputlimitmax[2], outputlimitmin[2], outputlimitmax[2]; int i; double retcurvex[51], retcurvey[51]; string_t islink; CFourbar fourbar; class CPlot plot;
Program 2.1: Initialization of variables used in position analysis of fourbar linkage (fb pos initialization.ch). The header le windows.h is included to utilize the message box. This le is called only once before refreshing the link between Ch and Excel. The initialization le is called using the Ch API ChRunScript which acts as both destructor and constructor.
sets of two values are stored in two seperate variables which are then displayed in Excel. The output is printed in Excel by the function ChGetMatrix(), using the same variable that was used in Ch.
theta1 = theta1*M_PI/180; theta_1[1] = theta1; theta_1[angleno] = angle * M_PI/180; theta_2[1] = theta1; theta_2[angleno] = angle * M_PI/180; beta = beta * M_PI/180; fourbar.setLinks(r1, r2, r3, r4, theta1); fourbar.setCouplerPoint(rp, beta); fourbar.angularPos(theta_1, theta_2, angleno); for(i=1;i<=4;i++) { theta_1deg[i] = theta_1[i]*180/M_PI; theta_2deg[i] = theta_2[i]*180/M_PI; }
Program 2.3: Angular position analysis of fourbar linkage (fb angularPos.ch). 2.4.3.1 Range of Motion The angular ranges of the input and output links are determined in this script le. This is done by using the funtion CFourbar::getJointLimits(). This gives the range of the input link and the output link in unit of radian which are later converted to degree explicitly. On analysing the given input details it was found to frame two circuits. The ranges for two circuits are calculated using the script le fb getJoinLimits.ch and output of this le is displayed in the corresponding cells on the Excel sheet as shown in Figure 2.3.
fourbar.setLinks(r1, r2, r3, r4, theta1); fourbartype = fourbar.getJointLimits(inputlimitmin, inputlimitmax, outputlimitmin, outputlimitmax); for(i = 0; i<=1; i++) { inputlimitmin[i]*= 180./M_PI; outputlimitmin[i]*= 180./M_PI; inputlimitmax[i]*= 180./M_PI; outputlimitmax[i]*= 180./M_PI; }
Program 2.4: The range for motion of fourbar linkage (fb getJointLimits.ch).
2.5 Animation
Animation feature of Ch was utilized in creating an animation sequence of the designed fourbar linkage. A seperate Excel spreadsheet was designed to demonstrate animation for the given set of links as shown in Figure 2.4. The various initialization is performed in the script le fb ani initialization.ch. This script is invoked by function ChRunScript(fb ani initialization.ch) ,which removes all previously declared variables and creates an array theta 1. All the other input values like the length of links, angles are obtained by function ChPutMatrix() from the Excel sheet. There are multiple branches for a fourbar linkage. The branch of a fourbar linkage animation is determined by the user using a drop down list in cell C15. The corresponding 16
branch number is stored in variable branchno. Script le fb animation.ch that has been inducted in cell E16 is then executed. The single line in the script that performs the animation is fourbar.animation(branchno), is one of the reason why Ch can be considered as an easy tool for learning purpose. The corresponding animation is displayed in another window as shown in Figure 2.5)
#include <math.h> #include <fourbar.h> double theta_1[1:4]; CFourbar fourbar;
Program 2.5: Initialization for animation of a fourbar linkage (fb ani initialization.ch).
fourbar.setLinks(r1, r2, r3, r4, theta1); fourbar.setCouplerPoint(rp, beta, TRACE_ON); fourbar.setNumPoints(50); fourbar.animation(branchno);
Figure 2.4: ChExcel spreadsheet for fourbar linkage animation. (fourbar animation analysis.xls).
17
2.6 Plotting
Ch has the option of 2D/3D plotting which can also be saved in different format like gif, postscript, png, etc. This feature is utilized in getting the plotting of coupler curve of a foubar linkage. As Excel spreadsheet was designed and developed to plot the coupler curve as shown in Figure 2.6 which has the comments on column A. The script le fb plot intialization.ch is invoked by the ChRunScript() which does the required initialization. The input values are entered in column C corresponding to the comment in column A, which are stored in variables using ChExcel function ChPutMatrix(). As this mechanism has two different branches for given set of input data, the user has been given an option of selecting the branch number from the drop down list from cell C15. On execution of script le fb curve.ch, it displays the selected branchs coupler curve as shown in Figure 2.7. The function that creates plotting is fourbar.plotCouplerCurve(), this shows the simplicity of using Ch.
#include <math.h> #include<fourbar.h> CFourbar fourbar; class CPlot plot;
for
plotting
of
coupler
curve
for
fourbar
linkage
18
Program 2.8: Plotting of coupler curve for fourbar linkage (fb curve.ch).
Figure 2.6: ChExcel spreadsheet for a fourbar linkage coupler curve. bar plotting analysis.xls).
(four-
19
As the script les are executed in the required order, every input value is passed to Ch script for calculations.
theta[1] = theta1*M_PI/180; theta[angleno]=angle*M_PI/180; omega_1[linkno]=velocity; theta_2[angleno]=theta[angleno]; fourbar.angularPos(theta, theta_2, angleno); omega_2[linkno] = omega_1[linkno]; if((fourbartype == FOURBAR_ROCKERCRANK)||(fourbartype == FOURBAR_ROCKERROCKER)) { fourbar.angularVel(theta, omega_1, linkno); fourbar.angularVel(theta_2, omega_2, linkno); } else { fourbar.angularVel(theta, omega_1, linkno); fourbar.angularVel(theta_2, omega_2, linkno); } for(i=1; i<=4; i++) { omega_1deg[i] = omega_1[i]*180/M_PI; omega_2deg[i] = omega_2[i]*180/M_PI; }
Program 2.9: Angular velocity analysis of a fourbar linkage (fb angularVel.ch). The fb angularVel.ch script calculates the angular velocity of all the other links. The output is displayed in both radians per second and degrees per second. ChGetMatrix(C24:C27,omega 1) in cell E24 displays the values stored in the array omega 1 from cells C24 through C27. This array has values in terms of rad per sec and variable omega 1deg in terms of deg per sec which are displayed in cells D24 through D27 using function ChGetMatrix(D24:D27, omega 1deg) which is inducted in cell E26.
21
Figure 2.8: ChExcel spreadsheet for a fourbar linkage velocity analysis. bar velocity analysis.xls).
(four-
22
23
Figure 2.9: ChExcel spreadsheet for a fourbar linkage acceleration analysis. bar acceleration analysis.xls).
(four-
method has been used in formulation and analysis of dynamics of four bar mechanism. To simplify the programming burden, computational arrays in Ch are used for dynamic analysis.
Figure 2.10: Free body diagram of fourbar linkage. An Excel spreadsheet shown in Figure 2.11 was developed to analyze the dynamics of fourbar linkage mechanism. The spreadsheet has several variables and script les that have to be intialized and executed, respectively, are arranged in the order of the requirement. The script le fb force initialization.ch does all required declaration and initialization of all the variables that are used in the force analysis. All the link lengths and angles theta1 and beta as shown in Figure 2.1 are initialized. All the necessary input data for this analysis are listed in the Excel sheet which also includes links moment of interia, angles that the corresponding links make with the ground. The other required parameters are the mass of links, magnitude of centre of gravity, deviation angles for center of gravity and the external load on joint of link1 and link4 as shown in Figure 2.10. The known angular velocity and angular acceleration of a link is given as input which can be selected from the drop down list. When fb forceTorque.ch is executed, the control goes to the Ch to perform the required calculations and the results are stored in form of array. It rst determines the various angular accelerations of all the links and uses the member function forceTorque() to determine the reaction force in the joints. The output is then passed on to the Excel sheet where it is displayed in the required cell as shown in Figure 2.12.
25
m2 = m3 = m4 = beta tl =
theta_1[1] = 0; theta_1[angleno]=angle*M_PI/180; theta_2[1] = 0; theta_2[angleno]=angle*M_PI/180; omega_1[linkno_vel] = velocity; alpha_1[linkno_accel] = acceleration; omega_2[linkno_vel] = velocity; alpha_2[linkno_accel] = acceleration; fourbar.setLinks(r1, r2, r3, r4, theta1); fourbar.setCouplerPoint(rp, beta); fourbar.setGravityCenter(rg2, rg3, rg4, delta2, delta3, delta4); fourbar.setInertia(ig2, ig3, ig4); fourbar.setMass(m2, m3, m4); fourbar.angularPos(theta_1, theta_2, FOURBAR_LINK2); fourbar.angularVel(theta_1, omega_1, FOURBAR_LINK2); fourbar.angularAccel(theta_1, omega_1, alpha_1, FOURBAR_LINK2); fourbar.forceTorque(theta_1, omega_1, alpha_1, tl, X_1); fourbar.angularVel(theta_2, omega_2, FOURBAR_LINK2); fourbar.angularAccel(theta_2, omega_2, alpha_2, FOURBAR_LINK2); fourbar.forceTorque(theta_2, omega_2, alpha_2, tl, X_2);
26
Figure 2.11: ChExcel spreadsheet for fourbar dynamic analysis. (fourbar force analysis.xls). 27
Figure 2.12: ChExcel spreadsheet for fourbar dynamic analysis. (fourbar force analysis.xls) (Contd.).
28
29
Figure 3.1: Geared vebar mechanism. The spreadsheet in Figure 3.2 has been designed to obtain the required input in predetermined order. The user may have to go in the same order to input the data and execute the commands in the order they are listed. The cg initialization.ch initializes all the variables that are used in determinig the angular positions of all links in a geared vebar linkage shown in Figure 3.1. The various equations are solved internally using complexsolve() function. The various inputs are obtained through the Excel sheet. The cg angularPos.ch uses the CGearedFivebar class and its member functions to do the required calculations and the results are then stored in a Ch variable. This Ch variable is directly called from Excel spreadsheet and displayed in the required cells as shown in Figure 3.2.
30
Figure 3.2: ChExcel spreadsheet for position analysis of a geared vebar mechanism (vebar analysis.xls).
31
Figure 3.3: Crank Slider Mechanism. Figure 3.4 shows the snap shot of Excel sheet that was developed to determine the position of the slider of a crank slider mechanism. The script le cs sp initialization. ch initializes the variables used in slider position analysis. The various input are entered in the corresponding cells, like the length of link, angles theta1, theta2 and beta as shown in Figure3.3. Script le cs sliderPos.ch determines the current position of slider for the given input data. It was also found that there is possiblity of two circuit being formed using the given input data and the position of slider for both circuits is identied and displayed in the required cells as shown in Figure 3.4.
32
Figure 3.4: ChExcel spreadsheet for the analysis of slider position of crank slider mechanism (slider position analysis.xls).
33
point positions, velocities and accelerations. This spread sheet (Figure 3.6, 3.7) analyze the angular positions of links.
Figure 3.5: Fourbar slider mechanism position analysis. The various input data such as the length of links and angles made by the link to the ground, and , the angle between the link 4 and link5 as shown in Figure 3.5 are given as input.The variables used in position analysis of crank slider mechanism are initilaized in cfs initialization.ch. All the input values are stored in variables that are shown in the corresponding ChPutMatrix() funtion argument. The script cfs angularPos.ch, when executed determines the angular positions of various links in the mechanism and stores them in an array. This array is displayed in Excel spreadsheet at the specied cells using the function ChGetMatrix().
34
Figure 3.6: ChExcel spreadsheet for position analysis of a fourbar slider mechanism (fourbarslider.xls).
35
Figure 3.7: ChExcel spreadsheet for position analysis of a fourbar slider mechanism (fourbarslider.xls)(contd.).
36
Figure 3.8: Watt (I) Six-Bar Mechanism. are the length of links as shown in Figure 3.8, where Rp3 indicates r3 in the gure, Rpp4 indicates r4 , Rp5 indicates r5 and Rpp6 indicates r6 in the Figure 3.8. The other values required are listed in the Excel sheet. The script ws1 angularPos.ch nds the angular positions of various links in the mechanism. It also determines the position in all the possible branches that can be formed with the given link specication. On analysis it was found to have four different branches for the given specication and all four different set of values are determined and returned to Excel spreadsheet as shown in Figure 3.10.
37
Figure 3.9: ChExcel spreadsheet for position analysis of Watt (I) six-bar mechanism(watt-16bar.xls).
38
Figure 3.10: ChExcel spreadsheet for position analysis of Watt (I) Six-Bar Mechanism (contd.).
G has function inducted in it, the cells in column H refers the function that has been inserted in the adjacent cell in column G. After restarting Ch, variables for the computation are initialized. Then all the required input values are entered in the corresponding cell. On executing cells in column G in Figure 3.12 corresponding scripts are executed. To perform computation, the script le ws2 angularPos.ch is executed. The output is shown in Figure 3.13, there are four different circuits possible for the given input data. The rst circuit is displayed by ChExcel function ChGetMatrix(D23:D30,theta deg1). The parameter D23:D30 species the cells in which the output are displayed which can be changed according to the user requirement and all other outputs are displayed in the same manner.
40
Figure 3.12: ChExcel spreadsheet for position analysis of watt (II) six-bar mechanism(watt-26bar.xls).
41
Figure 3.13: ChExcel spreadsheet for position analysis of watt (II) six-bar mechanism (watt-26bar.xls) (contd.).
42
Figure 3.14: Stephenson (I) six-bar mechanism. the two linkages. The class CStevSixbarI has been developed with member functions like angularPos() to determine the angular position of the links, angularVel() to determine the angular velocity of the links. An Excel spreadsheet was designed and developed to analyze the angular position of various links at a given instant. Figure 3.15 shows all the input values that are given to Ch through Excel spreadsheet cells. All inputs are given and the script le s1 angularPos. ch is executed, all the corresponding angles made by the links are identied. For the given set of values there are four possible circuits and the correspoding angles formed by the links in the respective circuits are determined and are stored in an array. This array is then displayed as output in the specied cells in Excel spreadsheet as shown in Figure 3.16.
43
Figure 3.15: ChExcel spreadsheet for position analysis of Stephenson (I) six-bar mechanism (stephen-1-6bar.xls).
44
Figure 3.16: ChExcel spreadsheet for position analysis of Stephenson (I) six-bar mechanism (stephen-1-6bar.xls)(contd.).
Figure 3.17: Stephenson (III) six-bar mechanism. The input values are entered in cells of column E which are read by the function inserted in cells of cloumn G. The script le s3 initialization.ch when executed initializes all the variables used in this analysis. All input values as shown in Figure 3.18 are stored in the variables using ChExcel function ChPutMatrix(). On executing the script le s3 angularPos.ch using ChExcel function ChAppendScript(), the angular position of various links are determined and are displayed in the specied cells using ChExcel function ChGetMatrix. For the given set of input values it was found that there is a possibility of four different circuits. The angular positions of all links for all the circuits dre etermined and stored in a Ch variable. This variable is called from Excel and its contents are displayed in spreadsheet as shown in Figure 3.19.
46
Figure 3.18: ChExcel spreadsheet for position analysis of Stephenson (III) six-bar mechanism (stephen-3-6bar.xls).
47
Figure 3.19: ChExcel spreadsheet for position analysis of Stephenson (III) six-bar mechanism (stephen-3-6bar.xls)(contd.).
48
Chapter 4 Conclusions
This research work is mainly focused on applying Ch to solve engineering problems. Ch Excel has been used to solve mechanism analysis and design problems. In this work, ChExcel was used for analysis of various mechanisms. It highlights the usage of computational power of Ch from Excel which acts as the front end for GUI whereas Ch at the back-end performs all the required computations. Because it is user friendly, Excel is commonly used software by engineers for various computational tasks. Ch scripts executed in the back end follow the well established programming paradigm in C. This provides a great exibility for developers in developing software modules. By using Ch, the developers can take advantage of other software modules, toolkits and packages in Ch. For example, in this project, QAnimate was used in generating animation for mechanisms. Instead of developing a new software module, the available components in Ch can be used for variety of purposes.
49
Bibliography
[1] Harry H. Cheng. Scientic Computing in the Ch Programming Language . Scientic Programming, 2(3):4975, 1993. [2] Harry H. Cheng. C99 for Engineers and Scientists. IEL , UCD, 2004. See also URL http://www.softintegration.com. [3] Heron Technologies. URL http://www.heron-technologies.com. [4] Parametric Technology Corporation,. URL http://www.ptc.com. [5] Artas,. URL http://www.artas.nl. [6] SoftIntegration. The Ch Mechanism Tool Kit Users Guide. SoftIntegration, Inc, 4.5 edition, 2004. See also URL http://www.softintegration.com. [7] SoftIntegration. The Ch Language Environment Embedded Ch SDK Users Guide. SoftIntegration, Inc, 4.5 edition, 2004. See also URL http://www.softintegration.com. [8] SoftIntegration. The Ch Language Environment SDK Users Guide. SoftIntegration, Inc, 4.5 edition, 2004. See also URL http://www.softintegration.com. [9] Third Party Solutions and User Contributed Code. URL http://www.softintegration.com/products/thirdparty//. [10] Interpretive OpenGL. URL http://iel.ucdavis.edu/projects/opengl/. [11] Kabileshkumar G Cheetancheri. Ch OpenAL package. URL http://chopenal.sourceforge.net/. [12] Ch XML Package for Oracle C/C++ XDK. URL http://iel.ucdavis.edu/projects/chxml/. [13] Harry H. Cheng Quingcang Yu, Bo Chen. Web-based control system design and analysis. IEEE Control Systems Magazine, 24(3):4557, 2004. [14] SoftIntegration. The Ch Control System Tool Kit Users Guide. SoftIntegration, Inc, 2.0 edition, 2004. See also URL http://www.softintegration.com.
50
[15] SoftIntegration. The Ch Language Environment CGI Toolkit Users Guide. SoftIntegration, Inc, 3.5.1 edition, 2004. See also URL http://www.softintegration.com. [16] Harry H. Cheng Joshua Liu. Ch Excel Users Guide. IEL, UC Davis, University of California, 2004. [17] Mohammed Al-Husseini Ali El-Hajj, Karim Y.Kabalan. Antenna Array Design Using Spreadsheets. IEEE Transactions on Education, 46(3):319324, August 2003. [18] Terry E. Shoup. Using Spreadsheet Modules to Augument Tolerance Dimensioning. In Proc. of DETC04, volume 2912, pages 3644, Salt Lake City, Utah, September-October 2004. ASME. [19] P. W. Khong and B. L. Lim. Spreadsheet application in aircraft structural analysis. Advances in Engineering Software, 17(3):1319, March 1993. [20] Terry E. Shoup. Using Spreadsheet Modules to Augument Design of Worm Gear. In Proc. of DETC03, volume 2912, pages 3644, Chicago, Illinois, September 2003. ASME. [21] Terry E. Shoup. Automated Determenaion of Spur Gear form factors. In Proc. of DETC99, volume 2912, pages 3644, Las Vega, Nevada, September 1999. ASME. [22] Didier Buchs Stanislav Chachkov. Interfacing Software Libraries from Nondeterministic Prototypes. Design automation for embedded systems, 8(4):327343, 2003. [23] Mathias W.Richter. Iava: yet another interpreter for scripting within the Java platform. Software - Practice and Experience, 30(2):81106, 2000. [24] Kabileshkumar G Cheetancheri. Computer aided mechanism design. http://iel.ucdavis.edu/projects/chexcel. URL
[25] Harry H. Cheng. Pedagogically Effective Programming Environment for Teaching Mechanism Design. Computer Applications in Engineering Education, 2(1):2339, 1994.
51