10
159 Red sea university Journal of Basic and Applied Science Vol. 2 Special Issue (1) - March 2017 ISSN: 1858 -7690 (Online) ISSN: 1858 -7658 (Print) Excel Visual Basic Application ‘VBA’ for Beam problems Calculation Abdalla Eissa Abdelkarim 1 * , Department of Civil Engineering Red Sea University * [email protected] Abstract VBA “Visual Basic Application” program run on EXCEL was written to solve the simple beam problem which was divided into 100 segment to find shear, moment, slope and deflection at each point. User inputs information into program: span load, span length, material properties, concrete and steel strength. VBA program automatically calculates information and shows results in a table and graphs. Keywords: Excel VBA ,beam Bending,shear,slope deflection 1.Introduction In the past few years, spreadsheets have become a popular computational tool and a powerful platform for performing engineering calculations. Simplified program development and debugging,the use of named ranges and labels that enhance readability of formulas and ability to manipulate matrices aided this heightened popularity The specific engineering programs are licensed and hard to be installed in every computer. But there is EXCEL in every computer [1]. Spreadsheets are characterised by arrays of cells in which data is input either as numbers or text or as formulae. Comments on data in the cells can also be input and hidden if desirable. Because of the mathematical nature of engineering studies, the use in which spreadsheet allows for numerical computations and for creation of good charts makes it the favourite tool for engineers [2]. It is, therefore, not surprising that it has become useful and inevitable tool in engineering education. Many studies have been performed to show the applications of spreadsheets in

Excel Visual Basic Application ‘VBA’ for Beam problems ... · Excel Visual Basic Application ‘VBA’ for Beam problems Calculation Abdalla Eissa Abdelkarim 1 *, Department of

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Excel Visual Basic Application ‘VBA’ for Beam problems ... · Excel Visual Basic Application ‘VBA’ for Beam problems Calculation Abdalla Eissa Abdelkarim 1 *, Department of

159

Red sea university Journal of Basic and Applied ScienceVol. 2 Special Issue (1) - March 2017

ISSN: 1858 -7690 (Online)ISSN: 1858 -7658 (Print)

Excel Visual Basic Application ‘VBA’ for Beam problems Calculation

Abdalla Eissa Abdelkarim 1 *, Department of Civil Engineering Red Sea University

* [email protected]

Abstract

VBA “Visual Basic Application” program run on EXCEL was written to solve the simple beam

problem which was divided into 100 segment to find shear, moment, slope and deflection at

each point. User inputs information into program: span load, span length, material properties,

concrete and steel strength. VBA program automatically calculates information and shows

results in a table and graphs.

Keywords: Excel VBA ,beam Bending,shear,slope deflection

1.IntroductionIn the past few years, spreadsheets have become a popular computational tool and a powerful platform for performing engineering calculations. Simplified program development and debugging,the use of named ranges and labels that enhance readability of formulas and ability to manipulate matrices aided this heightened popularity The

specific engineering programs are

licensed and hard to be installed in

every computer. But there is EXCEL

in every computer [1]. Spreadsheets

are characterised by arrays of cells in which data is input either as numbers or text or as formulae. Comments on data in the cells can also be input and hidden if desirable. Because of the mathematical nature of engineering studies, the use in which spreadsheet allows for numerical computations and for creation of good charts makes it the favourite tool for engineers [2]. It is, therefore, not surprising that it has become useful and inevitable tool in engineering education. Many studies have been performed to show the applications of spreadsheets in

Page 2: Excel Visual Basic Application ‘VBA’ for Beam problems ... · Excel Visual Basic Application ‘VBA’ for Beam problems Calculation Abdalla Eissa Abdelkarim 1 *, Department of

160

Red sea university Journal of Basic and Applied ScienceVol. 2 Special Issue (1) - March 2017

ISSN: 1858 -7690 (Online)ISSN: 1858 -7658 (Print)

engineering. A special issue of the International Journal of Engineering Education published in 2004 was dedicated fully to different forms of application of spreadsheets in engineering education. A comprehensive and instructive review was done by S.A. Oke of the University of Lagos in 2004 [3]. He credits electrical engineers for pioneering the use of spreadsheets in engineering education. Examples of researchers and practitioners in electromagnetism, logic networks, antenna design, microprocessor systems, Fourier series for harmonics analysis, etc, are given. In general engineering, numerical analysis, differentiation, integration and solution of partial differential equations are highlighted.In addition to the features and functions of Excel, its programming capabilities, called visual basic for applications (VBA) are very powerful and can be used to solve complex civil engineering problems [4]. To create VBA code, or to examine existing code, you will need to use

the Visual Basic Editor. To access the Visual Basic Editor in Excel 2013, we will go to file, options,customize ribbon and then select developer after that we click Visual Basic Editor from the submenu. The Visual Basic Editor screen usually contains three important windows: the Project Explorer window, the Properties window and the Code window, as shown in Figure 1.a,1.b,and 1.c rispectivly. The Code window displays the active module sheet; each module sheet can contain one or several VBA procedures. To insert a module sheet, choose Module from the Insert menu. A folder icon labeled Modules will be inserted; if you click on this icon, the module sheet Module1 will be displayed. To insert a module sheet, choose Module from the Insert menu. A folder icon labeled Modules will be inserted; if you click on this icon, the module sheet Module1 will be displayed. The Properties window will also displayed.

Page 3: Excel Visual Basic Application ‘VBA’ for Beam problems ... · Excel Visual Basic Application ‘VBA’ for Beam problems Calculation Abdalla Eissa Abdelkarim 1 *, Department of

161

Red sea university Journal of Basic and Applied ScienceVol. 2 Special Issue (1) - March 2017

ISSN: 1858 -7690 (Online)ISSN: 1858 -7658 (Print)

Figure: 1.a. The Visual Basic Editor window.

Figure: 1.b The VBE Project Explorer window.

Page 4: Excel Visual Basic Application ‘VBA’ for Beam problems ... · Excel Visual Basic Application ‘VBA’ for Beam problems Calculation Abdalla Eissa Abdelkarim 1 *, Department of

162

Red sea university Journal of Basic and Applied ScienceVol. 2 Special Issue (1) - March 2017

ISSN: 1858 -7690 (Online)ISSN: 1858 -7658 (Print)

Figure: 1.c The Properties window.

2.Method and procedureFirst of all in the workbook sheet (Fig. 2), user input the distributive load “w” in KN, span length in “m”, the beam breadth “B” in mm , the

beam overall depth “H” in mm , the reinforcement cover “C” in mm , the conctrte strength “fcu” in N/mm2,the reinforcement strength “fy” in N/mm2.

Page 5: Excel Visual Basic Application ‘VBA’ for Beam problems ... · Excel Visual Basic Application ‘VBA’ for Beam problems Calculation Abdalla Eissa Abdelkarim 1 *, Department of

163

Red sea university Journal of Basic and Applied ScienceVol. 2 Special Issue (1) - March 2017

ISSN: 1858 -7690 (Online)ISSN: 1858 -7658 (Print)

Figure: .2 Beam input informations and table form

The VBA program figure (3) will use

this information to calculate forces,

deformations and reinforcement area

from start point “x” which is “0” to

the end point which is “L” and internal

points in between “98” points.

Figure: 3.a VBA program part 1

Page 6: Excel Visual Basic Application ‘VBA’ for Beam problems ... · Excel Visual Basic Application ‘VBA’ for Beam problems Calculation Abdalla Eissa Abdelkarim 1 *, Department of

164

Red sea university Journal of Basic and Applied ScienceVol. 2 Special Issue (1) - March 2017

ISSN: 1858 -7690 (Online)ISSN: 1858 -7658 (Print)

Figure: 3.b VBA program part 2

The user click the calculate button to run the VBA program or information button to get more

informations about the program as shown in figure 4

Figure: 4 Information and calculated buttons

The calculated values of shear force V(x) , bending moment M(x) ,beam slope ϴ(x) and deflection

Y(x) are then tabulated as shown in figure 5.a, 5.b

Page 7: Excel Visual Basic Application ‘VBA’ for Beam problems ... · Excel Visual Basic Application ‘VBA’ for Beam problems Calculation Abdalla Eissa Abdelkarim 1 *, Department of

165

Red sea university Journal of Basic and Applied ScienceVol. 2 Special Issue (1) - March 2017

ISSN: 1858 -7690 (Online)ISSN: 1858 -7658 (Print)

Figure: 5.a Tabulated results after depugging start from 0

Figure: 5.b Tabulated results after depugging end at L

The program also show the result in graphical state as shown in figures 6.a,6.b.6.c,6.d and 6.e

Page 8: Excel Visual Basic Application ‘VBA’ for Beam problems ... · Excel Visual Basic Application ‘VBA’ for Beam problems Calculation Abdalla Eissa Abdelkarim 1 *, Department of

166

Red sea university Journal of Basic and Applied ScienceVol. 2 Special Issue (1) - March 2017

ISSN: 1858 -7690 (Online)ISSN: 1858 -7658 (Print)

Figure: 6.a shear force diagram

Figure: 6.b bending moment diagram

Page 9: Excel Visual Basic Application ‘VBA’ for Beam problems ... · Excel Visual Basic Application ‘VBA’ for Beam problems Calculation Abdalla Eissa Abdelkarim 1 *, Department of

167

Red sea university Journal of Basic and Applied ScienceVol. 2 Special Issue (1) - March 2017

ISSN: 1858 -7690 (Online)ISSN: 1858 -7658 (Print)

Figure: 6.c beam slope diagram

Figure: 6.d beam deflection diagram

ConclusionProgram shows the beam bending

calculation procedure of simply

supported problem very well. It

shows how to calculate beam forces

and deformations at 100 points beside

calculating steel reinforcement

according to BS8110 -97 along the

beam and compare it by minimum

area of steel that provided by the code

to get the maximum one .

Page 10: Excel Visual Basic Application ‘VBA’ for Beam problems ... · Excel Visual Basic Application ‘VBA’ for Beam problems Calculation Abdalla Eissa Abdelkarim 1 *, Department of

168

Red sea university Journal of Basic and Applied ScienceVol. 2 Special Issue (1) - March 2017

ISSN: 1858 -7690 (Online)ISSN: 1858 -7658 (Print)

References[1] Krudtong,S: Moaveni, S (2015)Teaching Tool: Finite Element Analysis of 2D Truss

Problem by VBA Program IJC, Vol.23 No.3 , pp. 89-91 90

[2]Bloch, S.C., EXCEL for Engineers and Scientists. John Wiley & Sons, Inc. (2003).

[3]Oke, S.A., Spreadsheet applications in engineering education: a review. Inter. J. of

Engng. Educ., 20, 6, 893-901(2004).

[4] E. Zaneldin, and B. El-Ariss, “Using Spreadsheets and VBA for Teaching Civil

Engineering Concepts,” J. Educat., Informatics and Cybernetics, Vol. 2, No. 1, 2011,

pp. 28-36.

[5] E. Joseph Billo, Excel for Scientists and Engineers Numerical Methods, John Wiley &

Sons,

2007.

[6] W.H.Mosley, J.H.Bungey. Reinforced concrete design, fourth edition , MACMILLAN

EDUCATION LTD,1990