Programming For Civil and Building Engineers Using Matlab
Programming For Civil and Building Engineers Using Matlab
Canada
1. Mr Mervyn W Minett School of Architectural, Civil and Mechanical Engineering, Victoria University, PO Box 14428 Melbourne City , MC 8001, Australia Phone + 61 3 9919 4466, FAX +61 3 9919 4139, email [email protected] 2. Assoc Prof Chris Perera School of Architectural, Civil and Mechanical Engineering, Victoria University, PO Box 14428 Melbourne City , MC 8001, Australia Phone + 61 3 9919 4729, FAX +61 3 9919 4139, email [email protected] .
Page 1535
Joint International Conference on Computing and Decision Making in Civil and Building Engineering June 14-16, 2006 - Montral, Canada
INTRODUCTION There has been some reluctance in Australia to extensively use programming platforms to support the education of Civil and Building Engineers. This is probably been due to a propensity to use turnkey packages. Past experience at Victoria University shows, despite being a high degree of computer literacy amongst younger students, there is reluctance by students to engage fully in the programming environment. Abudayyeh, P. E. et_al, (2004) presented results of two surveys conducted by the American Society of Civil Engineers Task force Committee on Computing Education that assessed the computing components of the Civil Engineering curriculum. Key findings of the survey found that the use of spreadsheets, computer aided design and electronic communication was relatively high in importance where the use of equation solvers and programming were low in importance to practitioners and educators. Anecdotal evidence shows a similar situation in Australia. We know that programming skills can benefit the student as it encourages a more logical approach to problem solving. The following chapter describes a new approach that is being tried at VU to attempt to engage civil engineering students, in fact all engineering students in the art of programming, rather than using the traditional lecture/tutorial approach. PROBLEM BASED LEARNING (PBL) MODE To try to improve the participation rate in programming for civil engineering students and for other reasons starting in 2006 programming and computing in general will be taught to all first year undergraduate students in Problem Based Learning (PBL) mode. Boud & Feletti (1997) suggested that PBL provides a forum in which essential skills are developed. The basic principle is older than formal education, namely, learning is initiated by a posed problem or query that the learner wants to solve. It seems that if a student or group of students pose the computing problem them selves they will have a greater interest in solving that problem. It is proposed to integrate computing with measuring and experimental studies to provide the problem generation. Theoretical and professional practice aspects of the program will be delivered by involving small groups and team work in projects under the supervision of a facilitator and will be reinforced by introductory seminars, workshops, laboratory activities, assignments, reports and presentation sessions. The small group work, under the supervision of a facilitator, will specifically address the issues of interest and retention. The material will
Page 1536
Joint International Conference on Computing and Decision Making in Civil and Building Engineering June 14-16, 2006 - Montral, Canada
introduce students to the engineering computing and experimentation by means of a series of diverse, stimulating and practical activities drawn from major engineering discipline areas. Through this program students will acquire skills and knowledge related to small and large-scale measurements with use of instrumentation and laboratory equipment, experimental techniques and engineering analysis using computing and programming skills. Students will acquire skills in the analysis, simulation and presentation of engineering data measured in the laboratory using computing and programming techniques that is available in spreadsheets and Matlab. Matlab was the chosen programming platform mainly for its flexibility in data presentation and interactivity. It has been found that the Matlab environment is easy to use especially when results are required quickly. Matlab has a good array of graphic user interface tools and dialogue boxes that gives a professional approach. Students will be able to use the knowledge and self-learning techniques gained from this work to undertake effective project-based subjects, laboratory and measurement activities and report presentations for subjects at higher years of the course.
LEARNING OUTCOMES Upon completion of this program students will: Be able to research and analyze engineering problems and identify a range of appropriate solutions using computing and programming techniques. Have acquired skills in the analysis, simulation and presentation of engineering data measured in the laboratory using computing and programming techniques. Have developed independent, self- reflective learning and evaluation skills Demonstrate ability for other generic skills such as report writing and time management.
CONTENT Experimentation and measurement: The use of instrumentation, laboratory and technical procedures, report writing and oral presentation. Data analysis and presentation: Algorithm development, Introduction to Data types, Data file reading and writing, Graphing and analysis of experimental data and Graphic User Interfaces, curve fitting. Statistical and error analysis of experimental data, Solutions of equations, Numerical Integration and solutions of Differential equations
Page 1537
Joint International Conference on Computing and Decision Making in Civil and Building Engineering June 14-16, 2006 - Montral, Canada
TYPES OF PROBLEMS Problems using Data file reading techniques, Integration, Ordinary Differential equations, Root finding algorithms, Equation fitting, Simulations and Optimization. These techniques are used to solve problems on excavations, beam, column bending-deflection etc, fluid flow, distributions across plates and the analysis of engineering data. It is envisaged that students should solve these problems from first principles rather than just program in standard formulation. There is heavy emphasis on presentation of data and results (graphing) in a professional manner. Some examples and possible solutions are shown as follows:
EXAMPLE 1. FOR THIS PROJECT THE STUDENTS WILL DEVELOP A SCRIPT THAT WILL SOLVE POLYNOMIALS FOR ANY ORDER USING THE LEAST SQUARES METHOD. The theory without proof is shown in the following equation
k k xi i =1 k 2 xi i =1
xi
i =1 k
x
i =1 k
2 i
x
i =1
3 i
k 2 a x 1 i yi i =1 i =1 k k x i 3 a 2 = x i yi i =1 i =1 k k 2 4 xi x i yi a 3 i =1 i =1
k
The requirements are to write a Matlab function that will determine the coefficients of a polynomial fitted to experimental data. Try your function out on the data from the file flowd2.txt that contains flow data from a pumping system in a water plant. The program should be as general as possible and must be user friendly, possibly the program can include Graphic User Interfaces (GUI).
Page 1538
Joint International Conference on Computing and Decision Making in Civil and Building Engineering June 14-16, 2006 - Montral, Canada
Figure 1 shows a possible solution using a GUI based on the above equation set the programming code is not shown. The GUI allows input of the data file and the polynomial curve fit maximum order and the output consists of the best-fit coefficients and the order of the best fit and its R squared accuracy.
Page 1539
Joint International Conference on Computing and Decision Making in Civil and Building Engineering June 14-16, 2006 - Montral, Canada
EXAMPLE 2. FOR THIS PROJECT THE STUDENTS WILL DEVELOP A SCRIPT THAT WILL SOLVE ORDINARY DIFFERENTIAL EQUATIONS INITIAL AND BOUNDARY VALUE TYPES APPLIED TO LOADED BEAMS. The initial value type will be applied to a simple cantilever with load at the free end. The boundary value type will be applied to a simply supported beam with a load in any position. The theory of for the cantilever is taken from first principles as follows:
d2 y = M = F(x L) dx 2 L = cantilever length EI x = position F = end force E = Young's Modulus I = second moment of area
The 2nd order differential equation is solved using the ODE45 solver function from Matlab this is fact the well-known Runge-Kutta method. The syntax for this function is: [x,y]=ode45('function definition', domain, initial conditions, [], parameters); The function definition reflects the theoretical equation above. The domain is the beam length. The initial conditions include the slope and deflection at the fixed end. Parameters are properties such as Youngs Modulus and the Load. For the simply supported beam a similar approach can be used however it is difficult to ascertain from first principles the value of the slope. A reasonable method is to guess the slope at the left hand end then solve the equation to see if the answer satisfies the boundary conditions. In the case of a simply supported beam the deflection at each end should be zero. A common method to perform this is the Shooting Method. The approach is to convert the Boundary Value problem into an equivalent initial value problem. This then allows the use of the ODE45 method to solve for deflection. Diagramatically this shown in Figure 2.
Page 1540
Joint International Conference on Computing and Decision Making in Civil and Building Engineering June 14-16, 2006 - Montral, Canada
If y(L) is not zero the BV solution has not been produced. In order to bring yL(U) closer to zero we should reduce U. Then try the Runge-Kutta method again. If we look at the above diagram it looks like a ballistic problem, hence the name the shooting method. Basically what we doing here is to find a value of U in order that the boundary condition at x = L is satisfied. ie find the value of U such that
y L (U) = y(L) = 0 This is in fact a root finding exercise, and we can use the Bi-section or Secant methods. The Secant method is the best to use as it converges quickly. To start the Secant method two estimates are required then the following expression can be used.
y L (U1 ) [ yL (U1 ) yL (U 0 )] /(U1 U 0 )
U 2 = U1
After finding the new value of slope use the Runge-Kutta method again to see if the solution satisfies the boundary condition. The following Figure 3 to Figure 4 show GUI and dialogue boxes for this problem it has an input of type of beam, which calls other information, the answer shown is for the cantilevered beam only.
Page 1541
Joint International Conference on Computing and Decision Making in Civil and Building Engineering June 14-16, 2006 - Montral, Canada
Figure 3 GUI for Beam Solutions of Cantilever and Simply Supported Beam the graph shows the deflection.
Figure 4 Shows dialogue boxes to allow for material and geometry information input
Page 1542
Joint International Conference on Computing and Decision Making in Civil and Building Engineering June 14-16, 2006 - Montral, Canada
CONCLUSIONS
Despite some negativity from various quarters of the Civil Engineering profession Engineering Programming is an important tool in particular in solving problems out of the ordinary. It is still an important tool for developing skills in problem solving. It is believed that educating Civil and other engineering students in the Problem Based Learning mode will be beneficial in engaging students in the area of computing and programming. Some examples were shown to illustrate the types of solutions that can be obtained using the Matlab programming environment. The PBL mode will allow students to dictate how the engineering problem is formulated, which in turn will allow for a much more interesting approach to the solution.
REFERENCES
Abudayyeh, P. E. et_al, (2004). Assessment of the Computing Component of Civil Engineering Education. ASCE, J. of Computing in Civil Engineering., 18 (3) 187-195 July Issue. Boud, D. & Feletti, G. (1997). Changing Problem-based Learning. Introduction to the Second Edition, The Challenge of Problem-based Learning., 2nd Ed, Vol. Eds. D Boud & G. Feletti, Kogan-Page, London, pp. 1-14. Riley, W.F., and Zachary, L. (1989). Introduction to Mechanics of Materials. John Wiley & Sons.
Page 1543