Professional Documents
Culture Documents
Programacion Con Matrices en Excel
Programacion Con Matrices en Excel
SUMMARY: This paper reports on using Microsoft Excel coupled with Visual Basic for
Application (VBA) in teaching two courses for the students in the Civil & Environmental
Engineering Department in United Arab Emirates University. The first course covers the use of
the stiffness matrix method for the analysis of 2D trusses, beams and frames. The latter has a more
advanced content by focusing on 2D solid elements, plates and shells. Throughout the offering of
both courses, the authors, with the aid of hands-on sessions and multimedia, guide their students
to develop different user-defined VBA functions in Excel, which are used to derive the solution of
different structural and stress analysis problems. The paper also proposes a new method in Excel
that may be used to eliminate possible cheating (e-cheating) when students exchange files using
email, Bluetooth or any other means. The proposed method has been utilised by the authors to
minimise potential e-cheating and copying among students.
INTRODUCTION
36
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
LITERATURE SURVEY
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
37
General-purpose spreadsheets
38
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
Figure 1:
DEVELOPED USER-DEFINED
VBA FUNCTIONS
0
ke EA
L
EA
EA
(1)
Matrix operations.
Mathematical operation
Excel formula
= Matrix_A + Matrix_B
= Matrix_A Matrix_B
Multiplication: [A][B]
= mmult(Matrix_A, Matrix_B)
Inversion: [A]1
= minverse(Matrix_A)
Transpose: [A]T
= transpose(Matrix_A)
= mmult(minverse(Matrix_A), Matrix_B)
Vol 16 No 1
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
Figure 3:
39
sin( )
cos( )
cos( )
sin( )
sin( )
cos( )
0
[Kxy] = [T]T[ke][T]
(2)
(3)
(4)
40
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
Figure 4:
Figure 5:
b1
B 0
c1
b2
b3
c1
c2
b1
c2
b2
c3
0
c3
b3
(5)
1
y j yk
2 Ae
and
ci
1
xk x j
2 Ae
(6)
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
(7)
Figure 6:
41
INSTRUCTIONAL STRATEGY
Vol 16 No 1
42
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
PLAGIARISM CONTROL
43
44
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
Figure 7:
Figure 8:
Disabling simultaneous
access to two workbooks
6.3
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
45
Figure 9:
Australasian Journal
Engineering Education
7. of
ASSESSMENT
OF STUDENT PERFORMANCE
The assessment covers both individual and team work. Individual work assessment is simply
Vol 16 No 1
46
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
theanswer
past,blindly
the course
Matrix
The major part of athat
typical
examis(about
60%
to In the
collaboration
something
and reporting
is something
else.Structural Analysis
70%) consists of practical questions that require had been offered and taught using the traditional
significant involvement of using Excel and the manual calculation method. Over the last four years,
The shown truss has been analyzed and the following results have been obtained:
3
3
18 ft
1
20 ft
4.167
0
F
kips,
4
.
167
4.167
3.75
3
F
kips,
4.167
3.75
20 ft
4.167
0
F
kips,
4
.
167
0
6. 0
4
F
kips,
0
6.0
19.167
17.25
5
F
kips
19.167
17.5
a) Calculate and show magnitudes and directions of the reactions at the supports
b) Check the equilibrium of member 3
Figure 11:
Sample of the
exam
requires
manual
hand calculations.
Figure
11:questions
Sample of that
the Exam
Questions
that Requires
Manual Hand Calculations
Vol 16 No 1
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
47
Vol 16 No 1
48
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
Table 3:
Average
response
Q1: Using laptops (not PC labs) is essential for the success of this course.
Authors comments: The students response does not give a clear cut answer. The authors believe that using laptops
does not essentially have advantages over using PC labs. However, It may add extra flexibility and convenience
for the students.
2.7
Q2: Using Excel capabilities in designing the course template is simple and is clearly introduced.
Authors comments: During offering the courses, the authors noticed that the students were very receptive to using
advanced features of Excel to design their course templates, which is reflected in the high score of this question.
In addition, few students informed the instructor that they have used their newly learned skills in other courses,
especially senior students in their graduation project.
4.5
Q3: Programming using VBA (in Excel) is introduced gradually until the concepts become straight forward.
Authors comments: It is clear that the students feedback reflect some inconvenience in programming using VBA.
Although all the students have passed the course Introduction to Programming using Visual Basic, they showed some
inconvenience when starting to use VBA in Excel. By the help of the instructor, this barrier is overcome gradually. At
the end of the course, the students succeeded to add their own VBA user-defined functions to handle the advanced
topics they were requested to research.
3.9
Q4: Using Excel did not distract you form understanding the basic concepts
Authors comments: Based on the high score shown by the students response, it is clear that they feel that Excel
did not distract them from understanding the main concepts. This is also validated by the authors after looking
at the good grades achieved in specific assignments and exams questions that are designed to measure students
understanding of main engineering concepts through either manual calculations or interpretation of Excel results.
4.6
3.1
Q6: Some questions in the assignments and exams are practical and, mostly, cannot be solved using manual
calculations
Authors comments: The high student response to this question reveals that the students, after solving some smallscale simplified problems manually, realised that many other problems in the assignments and exams are practical,
but complicated, and required significant amount of calculations that is made possible by using the Excel template.
4.6
4.5
Q8: Automation of involved calculations helps in achieving higher levels of physical understanding by allowing for
quick and efficient parametric analyses.
Authors comments: The high agreement shown by the students feedback confirms the achievement of a major
objective intended from utilisation of the Excel/VBA tools in teaching the course. The authors believe that
implementing the Excel/VBA tools allows the instructor to provide better explanation of physical structural behaviour
through conducting in-depth parametric analyses of complex real life models.
4.5
Q9: Using commercial software adds an extra skill that is highly required by the job market.
Authors comments: The authors believe that any course, if possible, should add practical experience to the students.
This is achieved in the considered courses by training the students on using one of the commercial software, which
is highly appreciated by the students, especially those who have used the software later in their graduation projects.
4.6
Q10: Team research of a new subject improves your team-work skills and self confidence.
Authors comments: The high agreement between the students reflects their appreciation to being exposed to the
teamwork environment. In addition, the authors believe that the team projects and their accompanied research on
topics, which have not been discussed in class, add other aspects to the teamwork skills and students self confidence.
4.3
Q11: Using the security option in the Excel template provides good grounds for fair evaluations of the students work.
Authors comments: The student response reflects high agreement. Although few students may illegally benefit from
e-cheating, many others would like to receive fair evaluations for their work. Most probably, those students voted
positively for the security option in the Excel template. The authors believe that the security option has controlled
the e-cheating since no cases have been observed after using the plagiarism control method.
4.0
3.5
Vol 16 No 1
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
49
# Field of comparison
Solving questions targeting
1 understanding of main concepts
(sometimes with no calculations)
Average grade
traditional method (based on
grades of 3 years)
Average grade
proposed method (based
on grades of 4 years)
75%
77%
73%
72%
74%
N/A
(Excel is used instead, see
comparison item #4)
N/A
(not valid due to the associated
high level of complexity)
76%
(Calculations are
conducted using Excel)
75%
(Calculations are
conducted using Excel)
74%
76%
Vol 16 No 1
50
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
CONCLUSIONS
REFERENCES
Apple, D. K., et al. 1995, Foundations of Learning,
Pacific Crest Software, Corvallis, Ore.
Arfiadi, Y. & Hadi, M. N. S. 2002, Development of
matrix method based structural analysis toolbox in
Matlab, Proceedings of International Conference on
Computational Structures Technology, pp. 13-14.
Bricklin, D. 2010, Dan Bricklin: The personal web
site of the co-creator of VisiCalc, www.bricklin.com.
Casas, A. & Oppenheim, I. J. 1987, Spreadsheet
programming for structural design, Computer
Applications in Concrete Technology, ACI SP-98, pp.
233-247.
Chandrupatla, T. R. & Belegundu, A. D. 2002,
Introduction to Finite Elements in Engineering, 3rd
edition, Prentice Hall, Upper Saddle River, NJ, USA.
Vol 16 No 1
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
51
Vol 16 No 1
52
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
APPENDIX:
LISTING
OF VBA
USED
IN THE
OF Trusses
2D TRUSSES
Appendix
1: Listing
of UDFS
VBA UDFs
Used
in theANALYSIS
Analysis of 2D
Function Truss_ke(E As Single, A As Single, L As Single) As Variant
' This function calculates the element stiffness matrix [ke]
' defined in the local axes and based on the element's Young's
' modulus E, cross-sectional area A, and Length L.
' Define variables
Dim arr(1 To 4, 1 To 4) As Single, Tmp As Single, _
I As Integer, J As Integer
' Check for correct length
If L = 0 Then
Truss_ke = "Member has zero length"
Exit Function
End If
' Initialize the matrix [arr]
For I = 1 To 4
For J = 1 To 4
arr(I, J) = 0#
Next J
Next I
' Calculate
Tmp = E * A
arr(1, 1) =
arr(1, 3) =
arr(3, 1) =
arr(3, 3) =
29
Vol 16 No 1
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
53
'========================================================================
Function Truss_Kxy(E As Single, A As Single, L As Single, Theta As Single) _
As Variant
' This function calculates the element global stiffness matrix [Kxy]
' based on the element's Young's modulus E, cross-sectional area A,
' Length L, and inclination angle "Theta" measured counter-clockwise
' from the +ve horizontal x-axis.
' Define variables
Dim T As Variant, ke As Variant
' Check for correct length
If L = 0 Then
Truss_Kxy = "Member has zero length"
Exit Function
End If
' Get the local stiffness matrix [ke]
ke = Truss_ke(E, A, L)
' Get the transformation matrix [T]
T = Truss_T_Mat(Theta)
'
T
' Calculate [kxy] = [T] [k] [T]
With Application.WorksheetFunction
Truss_Kxy=.MMult(.MMult(.Transpose(T),ke), T)
End With
End Function
'=========================================================================
Public Function Kxy2S(Kxy As Range, LV As Range, S_Size As Integer) _
As Variant
' This function fills the global structural stiffness matrix [S]
' with values of the given element stiffness matrix [Kxy] based
' on it location vector {LV}. The size of the global stiffness
' matrix is S_Size.
' Define variables. Note that [S] is a dynamic array
Dim I As Integer, J As Integer, S() As Single
' Re-dimension [S] matrix with the right size
ReDim S(1 To S_Size, 1 To S_Size)
' Zero the [s] matrix
For I = 1 To S_Size
For J = 1 To S_Size
S(I, J) = 0#
Next J
Next I
' Fill the [S] matrix with [Kxy] entries
For I = 1 To Kxy.Rows.Count
For J = 1 To Kxy.Columns.Count
If LV.Cells(I)<>0 And LV.Cells(J)<>0 Then
S(LV(I), LV(J)) = S(LV(I), LV(J)) + Kxy.Cells(I, J)
End If
Next J
Next I
' Return [S]
Kxy2S = S
End Function
30
Vol 16 No 1
54
Innovative use of computer tools in teaching structural engineering applications El-Sawy & Sweedan
KHALED EL-SAWY
Dr Khaled M El-Sawy joined the Department of Civil and Environmental
Engineering at the United Arab Emirates University (UAEU) in August 1997 as
an Assistant Professor in the area of Structural Engineering. He is currently an
Associate Professor in the Civil and Environmental Engineering Department
and the Director, Unit of Research Support and Services. Khaled earned his
PhD in the area of soil-structure interaction from the Department of Civil
Engineering, University of Western Ontario, Canada, in 1996. He received
his MSc from the same university in 1992 in the area of structural dynamics.
Before joining UAEU, Khaled worked as a senior civil engineer in ENPPI, Cairo,
Egypt. During the period of 1992 to present, Khaled has authored/co-authored
about 40 technical research publications and technical reports in the areas of
trenchless rehabilitation, stability of steel members and plates, and education.
He has taught many engineering and civil engineering courses. His teaching
interests include the teaching of Introduction to Programming, Computer Aided
Drawing for Civil Engineering, Statics, Mechanics of Materials, Reinforced
Concrete Design, Design of Steel Structures, and Matrix Structural Analysis.
AMR SWEEDAN
Dr Amr MI Sweedan joined the Department of Civil and Environmental
Engineering at the United Arab Emirates University (UAEU) in August 2005 as
an Assistant Professor of Structural Engineering. He earned his PhD in Structural
Dynamics from the University of Western Ontario, Canada, in October 2003. He
received his MSc and BSc degrees in Structural Engineering from Ain Shams
University, Cairo, Egypt in 1998 and 1992, respectively. Before joining UAEU,
Amr held the position of a Senior Engineer at the head office of Rowan Williams
Davies & Irwin Inc., Consulting Engineers and Scientists, in Guelph, Ontario,
Canada. Amr is an active member of several professional associations, including
the Association of Professional Engineers of Ontario, the American Society of
Civil Engineers and the Structural Engineering Institute. He is a recipient of
several research awards from Natural Science and Engineering Research Council
in Canada, Ministry of Training in Canada, Colleges and Universities in Canada.
He is also the recipient of several research grants from the Research Affairs
Sector at UAEU. Amr authored and co-authored over 30 technical publications
in refereed journals, conference proceedings and project reports on structural
dynamics, fluid-structure interaction and finite element modelling of steel,
masonry, and cardboard building and non-building structures.
Vol 16 No 1