An Interactive Learning Environment for Engineering

bahrainiancrimsonΛογισμικό & κατασκευή λογ/κού

13 Νοε 2013 (πριν από 3 χρόνια και 5 μήνες)

123 εμφανίσεις

An Interactive Learning Environment for Engineering
Project Report submitted in support of the degree of
Master of Engineering
Katie Breakspear
April 5,2007
When an engineer is selecting a beam for any given purpose,it is imperative that they
can calculate certain properties of the beam,such as its shear force,bending moment
and deflection profiles.A useful tool would therefore be a computer program that would
output diagrams of these three values for the entirety of the beams length.This would
allow an engineer to spend time on more important calculations than the complex algebra
involved in creating these diagrams.
Educationally,it is important for an inexperienced engineer to build up intuition about
how these diagrams will look for a beam with any given loading or supporting.Although
many commercial structural analysis programs exist to calculate shear force,bending mo-
ment and beam deflection,these programs are not build in a way to optimise learning for
student engineers.Therefore,a computer program that calculated these three diagrams
and was build with the objective of helping inexperienced engineers would be useful in
order for these student engineers to familiarise themselves with different beam situations.
This report details the making of such a computer program.
1 Introduction 4
1.1 Background..................................
1.2 Project plan..................................
1.3 Project objectives...............................
1.4 Problems encountered............................
1.5 Structure of the report............................
2 Analysis and Design 9
2.1 Defining project requirements........................
2.2 Defining program requirements.......................
2.3 Designing the program............................
2.4 Choice of programming language......................
2.5 Visual design of the program.........................
2.6 Designing the actual code and creating an implementation plan.....
3 Mathematical Reasoning 16
3.1 Defining shear,bending moment and beam deflection...........
3.2 Details to consider..............................
3.3 Calculating shear,bending moment and beam deflection.........
4 Implementation 26
4.1 A simple scenario...............................
4.2 Building the program’s complexity.....................
4.3 Creating a usable program..........................
4.4 The help file..................................
5 Testing 35
5.1 Testing for errors...............................
5.2 Random testing................................
5.3 Testing by sample users...........................
6 Conclusions 38
6.1 Suggestions for future development.....................
6.2 Conclusion...................................
Bibliography and References 40
Appendices 42
A Help File 42
B Questionnaire on Beam Program 43
List of Figures
1.1 Original and redesigned versions of the program..............
2.1 The design of the point load form......................
2.2 Design of the Main Menu...........................
3.1 Types of statically determinate beams...................
3.2 Example of a free-body diagram.......................
3.3 Example of a shear force illustration....................
3.4 An example of a bending moment illustration...............
3.5 Another example of a bending moment illustration............
4.1 A simple scenario...............................
4.2 The completed library form.........................
4.3 Examples of forms needing user inputs...................
4.4 Code defining a data structure........................
4.5 Example of the ‘on-screen’ free-body diagram...............
4.6 An example of an error message.......................
4.7 Figure to show a fixed support form and its editable version.......
Chapter 1
A beam is a structural element which carries a transverse but not an axial load.It can
be difficult to tell without calculation what the graphs of shear force,bending moment
and beam deflection for a given beam might look like.In engineering,the maximum and
minimum magnitudes of both the bending moment and shear force are used as primary
considerations when selecting a beam.
This report will detail the creation of a computer programthat will calculate these values
1.1 Background
Within the course Engineering Physics EMAT1005,taught at the University of Bristol,
shear force,bending moment and deflection of beams are taught to first year Engineering
Mathematics students.This type of teaching is reflected country wide in similar degree
courses.At present,students are expected to understand these concepts quickly and
develop intuition about how different beams deform after a relatively small amount of
teaching and practice.Often,students will not complete the sufficient number of examples
necessary to gain a full understanding of these concepts.Additionally miscalculation can
result in false intuition being developed.This can be due to the detailed algebra necessary
for each problem,and therefore the time it takes to solve every situation.Consequently a
computational tool has been suggested to help students studying this degree course.This
tool is intended to allow students to spend time improving their understanding rather
than completing detailed,time consuming algebra.
Whilst programs already exist on the internet to perform these types of calculation,
they have not been tailored to suit this degree course.Of the programs found,many
concentrate only on the results and when requesting inputs from the user can become
confusing.In a teaching situation where young,engineers are assimilating many new
ideas it is important to provide a program that is as clear as possible since these concepts
are being learnt for the first time and confusion at this point could be very detrimental.
The aim of this project is therefore to produce a comprehensive user-friendly program
which will compute the diagrams of the bending moment,shear force and beamdeflection
for a beam with any given loading and supporting.
1.2 Project plan
This project was intended to run a total of 20 weeks with the final deadline in March
2007.Originally,it had been planned that the implementation of the project would be
finished by week 14 leaving ample time for testing and making changes to the program,as
well as being able to complete the written report by week 20.However,with the change
of programming language (as detailed in section 1.4) and the change in implementation
strategy (as detailed in section in section 1.4) the project plan was rewritten many times.
The final program implemented was started in week 13 and testing was not completed
until the final week.
1.3 Project objectives
The main objectives of the project are:

To write a program that is as user-friendly as possible,with no room for user error.

To use the same mathematical methods for calculating these graphs as engineers
already use but in a more structured manner.

To display three graphs,one showing beamdeflection,one showing bending moment
and one showing shear force.

To be able to load and save data.

To be able to print the results.

To be able to show a free body diagram as an engineer would draw.
1.4 Problems encountered
During the course of this project,we encountered a number of problems.In October,
when the original choice of programming language was considered,we decided to write
the programusing the computing package ‘Bordland JBuilder 9 Developer’.The decision
to use this language was made after careful consideration as to which the most useful
and effective language for this type of program (see section 2.4).
However,after struggling with JBuilder for many weeks,limitations of the language were
apparent.More and more obstacles were posed until finally progress seemed to reach a
complete stand still.The difficulty of ‘dragging-and-dropping’ from one panel to another
proved too hard a problem to solve in the given time (if a tangible output was to be
created).The choice of programming language was reconsidered and ‘Delphi 7’ was then
chosen to continue the project.Delphi 7 was chosen due to its renowned IDE (Integrated
Development Environment) and graphics package and the fact that it was a language
known to the project supervisor.This is the language that the final project is written in.
Whilst the program may have been started in an altogether different language to the one
that the final project was written in,we have not found that using this first language was
a complete waste of time.Using a computing package similar to Delphi helped in the
simplest stages of programming,even though the syntax for both languages is entirely
different.This was simply due to having created a very similar program already.It also
helped organisation of the code within the simpler parts of programming.
Not long after changing programming language,it became clear that the difficulty found
in using JBuilder was partly due to the design of the program not being ideal for the
language in which it was being written.Again,many programming issues were manifest,
the most apparent still being the difficulty of ‘dragging-and-dropping’ from one panel to
another.This proved to be a problem for the design originally envisaged and planned
for.Whilst this was the case for both programming languages used,the decision was
made to carry on using the language ‘Delphi 7’ and adapt the design of the program so
that it could be accommodated by Delphi.This amendment needed to occur without any
detrimental effect to the user-friendly interface which had been designed in the earlier
plan.The two designs can be seen in figure 1.1.Whilst the original program had the
advantage of being self contained in one window,an MDI(Multiple Document Interface)
application,the use of many windows in the redesigned version was carefully planned in
order to avoid confusion.
(a) Original design
(b) Redesigned view of the program
Figure 1.1:Original and redesigned versions of the program
This report will detail only the final program,which has been written using ‘Delphi 7’.
1.5 Structure of the report
In order to create a program that would fulfil the specifications of the project,it was
important to follow a full software development life cycle.For this reason,the report has
been broken down into the main parts of this life cycle:

Analysis - this section explains what the program intends to achieve,both in com-
puting and non-computing terms.

Design - The choice of programming language,design and organisation of the pro-
gram as well as the project is addressed here.The organisation of data structures
within the programas well as the overall user-friendliness are particularly important
points to be discussed.

Implementation - The actual implementation is discussed including problems found
and solved,or avoided.This chapter includes screen shots of the program as it was
implemented illustrating the written points.

Testing - In order to produce a working program,it is necessary to test all compo-
nents in a program for boundary conditions and misuse as well as using a random
testing process.Feedback is needed in order for improvements to be made.

Deployment - this is the part of the life cycle where the user has the software.A
developer must provide for the maintenance and updating of this software as well
as producing documentation about the program including help files (which will be
described in section 4.4).
Although this report is part of the documentation to accompany the program cre-
ated,it does not give details about the program that the user would ultimately
deploy,instead it merely describes the process of its development.Due to time
constraints,there is no documentation to go alongside the program,and for this
reason we will not include a section on deployment within this report.
Although the above five areas can often be fuzzy and blend into one another,it is neces-
sary to follow such a life cycle in order to produce an optimal final program.
Chapter 2
Analysis and Design
Within the software development life cycle,the analysis (or specification) of the problem
and the design of the solution are considered paramount to the success of the program.
Whilst an efficient program can be written without either a specification or a written
design,the result will rarely be what was originally intended,even if the end user is also
the developer who will implement the code.Before the implementation of the program
can occur,it is import for a developer to know exactly what is expected from their
program.This process must be undertaken when creating a program in order for a
developer to learn exactly what the objectives and specifications of the project will be.If
the analysis and design components of the software life cycle are not completed,the end
programwill often performthe main task intended but do so inefficiently.Also secondary
functions intended for the program may be sacrificed due to poor planning.The design
and specification of this project are outlined in this chapter.
2.1 Defining project requirements
This project is intended to show a user certain properties of a loaded beam and help
them to develop engineering intuition about how beams react under different loading
conditions.For this reason it is important to be as clear as possible and to be careful to
avoid any possible confusion within both the design of the programand the user interface.
As an educational tool,this is key to the success of the product.Many design features
will come from this specification.Thus the need to have simple windows,easy data input
and an accessible help file.The project’s main requirement is to act as a useful tool for
the course Engineering Physics EMAT10005 undertaken as part of the degree Engineering
Mathematics,studied at the University of Bristol.However,it is also intended to be of
use as a professional aid.This could,for example,be in industry,as a tool for an engineer
who wants to find out the properties of a beam without the need for long calculations.
2.2 Defining program requirements
This program is designed to be used by engineers with many different levels of experi-
ence,both in terms of the mathematical content as well as computing experience.It
is therefore important to keep the program as simple as possible whilst provide a user
friendly interface accessible to the most inexperienced computer users.We must also be
careful not to frustrate more experienced users.The programming language chosen will
be a RAD (Rapid Application Development) application,allowing the program a fast
run-time,with an IDE (Integrated Development Environment) and GUI (Graphical User
Interface),(see section 2.4).
Within this program,many inputs are required fromthe user.Auser must specify exactly
how the beam is supported and loaded.This will take place within a number of separate
windows.In order to make this as clear and accessible as possible,we intend to have
a number of different ways to input data.Within each window,the position of a load
or support on the beam is determined either by percentage,actual distance or through
using a visual aid.Exactly what this aid will be is dependent on what programming
package will be used.Since this program is intended to be entirely interactive,we have
decided that there should be drag-and-drop facilities within the free-body diagram part
of the program.This means that a user can move a load or support with no need to
open a separate window which makes the program as concise as possible.Another way
of doing this is for a user to be able to double click on a load or support which calls a
window of all the values to do with that entity.This will be useful if the user wishes to
edit or delete a support.It is also important for users to be steered in the right direction
as far as input is required,therefore error messages will appear if a wrong type of input
is entered.
2.3 Designing the program
In the initial discussion about the project,it was decided that in order for the program
to meet the specifications outlined in section 2.2 and we must:

Create a simple non-MDI program with a main window where the ‘drawing of the
problem will take place.A separate window will exist alongside the main window,
acting as a library for all the loads and supports offered

Create an interactive design with drag and drop facilities.Ideally an engineer will
drag a load or support along the beam within the ‘drawing’ which will refresh the
graphs automatically

Develop a menu bar with many options,including File,Create and Help options.
The ‘create’ option will take the user to a sub-menu where they can choose which
graphs they want to create.

Allow printing,outputting the beam diagram,as well as the three graphs of shear
force,bending moment and beam deflection

Display the three final graphs in separate windows with labels showing the positions
of the supports and the extremal values of shear,bending and beam displacement
2.4 Choice of programming language
During the initial discussion regarding this project,it was important to determine which
programming language would be most suitable for the task in hand.It was paramount
to look for a program with a good graphics package,ideally with an easy to use IDE
(interactive development platform) in order to aid programming as much as possible.
Only RAD (Rapid Application Development) packages were considered since these types
of programs allow programmers to quickly build working programs,ideal for this type
of application to be input,where a developer is inexperienced.RAD programs are also
known to have a large emphasis on simplicity and usability and offer a number of tools
to help build graphical user interface quickly and easily often with the help of a GUI
(Graphical user interface) themselves.With these objectives in mind there were three
obvious choices:

Borland Delphi 7
This program uses a base language of Pascal.Delphi is the most well established
of the programs considered.Its’ most popular use is for development of desktop
applications.The main disadvantage is that there are few books published on this
language as it is not as popular as C++ or Java,however,it is a language known
to the project supervisor.

Borland C++ Builder
This programhas a base language of C++.This is an environment also produced by
the CodeGear subsidiary of Borland and is very similar to Delphi.Most components
developed in Delphi can be used in C++ Builder with no modification,although
the reverse is not true.C++ Builder was developed simply as a modified version
of Delphi with the different base language.

Borland JBuilder 9 Developer
This program has a base language of java.JBuilder is a java IDE from Borland.It
has won several awards as the most powerful IDE for professional java programming.
The first version of the system was mostly written in Delphi,excluding the form
designer and the component library.JBuilder is a constantly developing software
which can work with multiple application servers and can be used for developing
web services.
The advantages and disadvantages of the three languages were compared and we decided
to proceed with Delphi.We had already attempted to use JBuilder for this program
and encountered major problems (as detailed in section 1.4).Because C++ and Delphi
are so similar,we considered it better to opt for the program which the developers had
originally built,rather than one which had been modified to use another base language.
2.5 Visual design of the program
We designed the program on paper before implementation.The most important aspect
of the design is to ensure that all the correct information is requested in the correct form
from a user.Figure 2.1 shows an example of one of the designs drawn.
Figure 2.1:The design of the point load form
The aim when designing forms is to make the windows as simple as possible,whilst al-
lowing the user freedom of input so that the program will be able to do exactly what
the user wants,within the given constraints.The main window is not designed on paper
before implementation since this window would appear blank until data was input,and
even then would be a simple as possible.The main window,however,is going to be the
one from which all procedures are called,once the initial loading of the beam has been
determined,therefore this is the only window with a menu.The items that this menu
will include can be seen in figure 2.2.
Figure 2.2:Design of the Main Menu
2.6 Designing the actual code and creating an im-
plementation plan
It is very important to design how the program will actually work in terms of where
procedures are called from and how and where information is saved.All forms are
designed to be called from either the main form or the library form.This is because
these are the only forms from which a user can determine what the program should do
next.The mathematical procedures are to take place within the relevant forms,even
though sometimes the same code is used in more than one form,for example when
calculating reaction forces.Thus,each form will be as self contained as possible.The
data to be input by the user is intended to be saved in a data structure.Data structures
are a very important part of any program and allow data to be saved in order to be
used again within the program.Data structures can also be set up in order to only save
certain parts of the data.Data structures are also very useful for loading and saving
data.Which data structure will be used will depend on the type of input.Initially,we
plan three main data structures:

The first data structure holds all the necessary information about each support.

The second data structure holds all the necessary information about each load.

The third data structure contains all the information encompassed in the previous
two structures,as well as any other information entered about the beam.
It is possible that other data structures will be needed when programming but these have
not been planned for as they are not an integral part of the code.
Since Delphi has been chosen to programin,only this relatively small amount of planning
has occurred prior to the implementation of the code.This is partly due to the RAD
nature of Delphi.We intend to design a simple working program and build up from this.
Further code will be designed at each obvious point when making the program more
complex and thus we decide,that our aimis to develop a programthat can become bigger
and more complex.Another reason for this approach is because neither the program nor
the programming language being used are known,therefore it will not be clear exactly
how the program works until programming has started.The implementation plan is
therefore just to start coding for the simplest case and build up the program from there.
First,we aim to input a complete range of loads and supports and compute the results.
Then,we will refine the program by adding other features such as a printing option and
help file.
Chapter 3
Mathematical Reasoning
At present,many engineers use a standard ‘intuitive’ way of calculating bending moments,
shear forces and deflections of beams.This is done through studying free body drawings of
the beam with all loads and supports detailed.After this,sets of simultaneous equations
are determined by taking moments around a support or load.
However,there are many problems with this method of calculation.Not only is it time
consuming but the algebra involved can get very complex and errors can creep in.This
could put an entire project in jeopardy.Errors may also occur with this method of cal-
culation within the free-body diagram.With a complexly loaded beam,the free body
diagram can become very confusing and therefore all loads or supports may not be ac-
counted for when making calculations.
Within this project,only statically determinate beams have been considered.Statically
indeterminate beams involve more complex algebra and have not be described below.
In this chapter,we will show the mathematics behind how to create shear force,bending
moment and beam deflection diagrams.
3.1 Defining shear,bending moment and beam de-
In order to draw diagrams of shear,bending and deflection we must first discuss exactly
what these words mean.
Shear force,V,can be described as “The force that tends to cause atoms of a structure
to slide past each other” [1].
Put simply,shear force is an internal force which acts in a direction perpendicular to
the beams longitude in order to keep the beam remaining in equilibrium for all values of
displacement along the beam.
The bending moment,M (or internal torque) of a beam,is intrinsically linked with the
shear force (as is the beam deflection which will be discussed later).Mathematically,it
can be described as the “algebraic sum of moments about the neutral axis of any cross
section of a beam” [2].and can be denoted by:
M =
V (x)dx
where x = distance from the origin of coordinates
Beam deflection,ν,is the distance that a beam moves from it’s equilibrium value in the plane
perpendicular to its longitude at any given point and can be found by combining expressions
for curvature,κ,as shown in equations 3.2 and 3.3.A beam deflection diagram gives an
image of exactly how the beam will bend and therefore look under different loading/supporting
κ ≈
κ =
where EI is known as the structural rigidity
Therefore,by combining equations 3.2 and 3.3 and integrating,we get that:
ν =
￿ ￿
where υ =
and L = length of the beam
For the purpose of this computer program,as well as the mathematical reasoning,equation 3.4
is scaled in order for ν not to be dependent on EI.Therefore equation 3.4 becomes:
υ =
￿ ￿
The value of deflection,υ,we are now calculating is just a scaled version of the actual deflection.
Each diagram that is to be drawn,plots the relevant value (i.e.shear,bending or deflection)
against x,the distance along the beam from the origin of coordinates.
3.2 Details to consider
Since we are only considering statically determinate beams,the loads allowed will be:

a concentrated (point) load

a linearly distributed load

a non-linearly distributed load - this has not be input and therefore will not be described
in this chapter
The supports allowed will be:

a fixed support (cantilever) - this will not allow translation or rotation in any direction

a pin support - allows rotation but not translation

a roller support - allows translation in one direction but not rotation
this has not be input and therefore will not be described in this chapter
As has been mentioned before,the only types of beam being considered in this approach are
statically determinate ones which means that there are only relatively few ways of supporting
the beam.These can be seen in figure 3.1.
Figure 3.1:Types of statically determinate beams
When considering a distributed load,it is necessary to ask more information of a user than
for a point load.The start and end point of the load must be known as must the equation
of linearity.This can either be deduced by asking for the load at the start and end points,or
as a function of intensity in equation format.In our program the start and end load will be
3.3 Calculating shear,bending moment and beam
The method of calculation detailed is considered as if looking at a prismatic bar with constant
cross section throughout its length.To investigate internal stresses such as shear and bending
moment,an imaginary cut is made perpendicular to the to the longitudinal axis of the bar.
Shear Force
Section 3.1 showed that in order to calculate bending moment and beam deflection,we first
need to find the shear force.In order to solve this problem,an engineer often draws a free-body
diagram.This is where a simple,two-dimensional diagram is drawn showing exactly how the
beam will be supported and loaded (for example,see figure 3.2).
Figure 3.2:Example of a free-body diagram
As figure 3.2 shows,every support has a reaction force.These reaction forces can be determined
through using two simple equations,see equation 3.7 and 3.6.
M = 0
L = 0
where L = load value
Once all the forces and reactions on the beamare known,then it is simple to calculate the shear
An engineer will often calculate shear force in sections where in each section the properties of
the beam change.For the program,a loop will run,calculating the shear force for every unit
along the beams length.The description below explains how shear force.
The value for shear force changes throughout the beam,since as the beam’s properties change,
greater or smaller internal forces are needed in order to keep the beam from shearing.
Firstly an imaginary cut takes place along the beam’s length and an illustration is drawn of
what remains between this point and the origin of coordinates (for example,see figure 3.3).
Figure 3.3:Example of a shear force illustration
From this diagram,we can deduce that for this case:
V = R−L
or in general
V =
When the illustration become more complicated,for example,including distributed loads,the
calculations become more difficult as equations 3.9 and 3.10 show.
Equation 3.9 shows how to calculate shear force if the value of displacement,x,falls between
the start and end points of a shear load.
V =

(x −x
) −
)(x −x
where L
= point load,L
= the load value at the left hand side of a distributed load,L
= the load value at the right hand side of a distributed load,x
= the position of the left
hand side of a distributed load,x
= the position of the right hand side of a distributed load,
x = displacement along the beam
Equation 3.10 shows how to calculate shear if the value of displacement falls outside the bounds
of a distributed load.
V =

(x −x
) −
)(x −x
(x −x
) +
)(x −x
In order to plot the shear force diagram,the shear force (calculated by drawing a simple shear
force diagram and using equations 3.9 and 3.10 accordingly with the forces seen on the illustra-
tion) is plotted against displacement.
Bending Moment
Once shear force has been calculated,the bending moment can be determined.This is done
using equation 3.1.
In order to calculate bending moment,we integrate equation 3.1 to give equation 3.11.
M = V x +C
where C = a constant
This constant,C,is different for each value of displacement,x.
An engineer will often find it easier to take moments about the neutral axis,using equation 3.6
in order to find the bending moment.This is done in the following way.
Firstly,a bending moment illustration is drawn in much the same way as the shear force illus-
tration was drawn,see figure 3.4.
Figure 3.4:An example of a bending moment illustration
Then,using equation 3.6,taking moments about the neutral axis,we can deduce that for this
M +V x −Lx
= 0
M = Lx
−V x
where x
= the position of the load on the beam
For a more general case:
M =

−V x
Again for a distributed load,the algebra becomes slightly more complex,the easiest way of
calculation now involves using integration of shear,since C=0 since one support must be at
displacement,x=0 for a statically determinate load.No equation has been shown here,since
equation3.1 is used which has been seen previously.
As we have shown,if a beam is loaded complexly then it is necessary to user 3.1,therefore we
shall always use this equation in future calculations.
If a fixed support is used for the beam then the calculation includes one more variable,this is
because another moment,M
,associates itself with a fixed support.This is easiest to show
pictorially and an example of a bending moment can be seen in figure 3.5
Figure 3.5:Another example of a bending moment illustration
Mathematically,this does not make the bending moment any harder to find but before any
calculations can occur,M
must be calculated by taking moments over the entirety of the
beam.The bending moment for any displacement value can be determined after this,for
example (with no distributed loads,using the first method discussed),using equation 3.13.
M = M

−V x
or for a more general case:
M = M
V dx
where M
= 0 for a pin support
Using equations 3.14 as shown,we find bending moment for each value of displacement,x,and
plot on a diagram.This is how we create the bending moment diagram.
Beam Deflection
Beam deflection is the most difficult of the three values to calculate.In for this value to be
calculated,equation 3.5 must be evaluated.This involves integrating twice and gives equation
υ =
x +C
where C
and C
are constants
We know that at a fixed support,both curvature of the beam as well as deflection are equal to
0 therefore,C
and C
are equal to 0 for the beams length.The constants do not change since
there is only one support acting on the beam for such statically determinate examples.
However,constants C
and C
can be difficult to find for situations when the beam is supported
by pin supports.Sometimes it is necessary for an engineer to solve dozens of simultaneous
calculations in order to find values for these constants.
It was discovered that for the case of two pin supports,equation 3.16 gives the beam deflection
for all cases along the beam.
υ = θ
x +
￿ ￿
where θ
is a constant which can be calculated by using equation 3.17
= −
￿ ￿
where the x value used is the displacement of the second support from the origin of coordinates
and there are no constants
We have shown howto calculate beamdeflection and this value is plotted again the displacement,
x in order to create the beam deflection diagram.
Chapter 4
This section was the most time-consuming part of the project.Firstly,it was important to
become familiar with the IDE used and Delphi as a program,whilst also learning the language
‘Pascal’,the base language of Delphi.
The quickest way to learn how to use Delphi was to build very simple applications to see how
the program worked.This involved creating ‘Hello World’ type applications and building them
up in order to use more and more different objects,or example buttons,as well as using more
than one form within an application and seeing how procedures could interact over a number
of forms.
Following an initial period spent learning how to use Delphi,the program was slowly built up
into its final version.
4.1 A simple scenario
Within this problem,a simple scenario of a loaded beam is a beam supported by pin supports
at either end with one point load in the middle (as seen in figure 4.1).
Figure 4.1:A simple scenario
In order to start building this scenario,the main window including the menu and the library
window is set up.Next,the library form is set up as a canvas,so pictures of the loads and
supports can be drawn,in order to direct the user into inputting the correct data.After ‘drawing
these pictures and placing buttons next to them,the library form is complete,see figure 4.2.
Figure 4.2:The completed library form
Both of these forms are configured with a ‘bssingle’ border style,meaning they cannot be resized
(this is something that can be addressed at a later date if project requirements dictate.This
is line with our aim of a program that can develop and grow to meet future needs).All other
forms are created with this type of border style in order to give the program continuity.
The next step is to allow the buttons shown on the library form to link to other forms where
the appropriate inputs will be requested.In order to do this,template forms are implemented,
as similar as possible to the designs previously produced (for example,those shown in figure 2.1
in section 2.5).Code for each button is then written creating a new form each time a button
is activated.This means that every time a point load is added,it will be added on a different
form to the previous load input.The creating of a new form for every new load or support is
completed for ease of making changes to the values of the load or the distance along the beam,
which can be implemented at a later date.
In this simple case scenario,the point load is the first load (and button) to have a formassociated
with it.The finished form can be seen in figure 4.3(a) alongside the finished pin support form
(see figure 4.3(b)) which has been implemented in much the same way.
(a) Form to input point loads
(b) Form to input pin supports
Figure 4.3:Examples of forms needing user inputs
As seen in the screenshot of this form,the user is given a number of different ways to enter the
data.The load can be input normally,or using the ‘updown option,which means that a user
can input the value using these buttons to choose an integer value for the load.This can be
either negative or positive.The position along the beam can be entered in one of four ways;
either by position along the beam,approximate percentage along the beam (which can be done
manually or by use of another ‘updown’ option) or by placing the load using the track bar.The
track bar is seen in terms of the position along the beam,as shown by the value at the end of
the track bar which will change for different beam lengths.Operating the cancel button means
that none of the inputs are saved.However,the ‘OK’ button has been set up in order to save
the inputs specified.
The next step in order to create this simple scenario is to set up a number of data structures to
save the inputs provided by the user.These data structures are configured within the library
form since this is where the load and support forms are called from.These data structures are
known in Delphi as records.One such record can be seen in figure 4.4.
Figure 4.4:Code defining a data structure
Within this snippet of code,TLoad has been declared as a record (or a data structure) in
which certain parameters can be saved.These are the load type,load values,positions along
the beam and the values that would define polynomial loading conditions (for use with non-
uniformly distributed loads).This data structure is used within the program every time data
about a load is saved.An array of type TLoad and of length max
loads exists in which all the
values for each load are stored.This data structure is then ordered after every input so that
the first load will be the one closest to the left hand side of the beam.The loads after this will
be in order of their displacement across the beam.Similar data structures were implemented
for the supports as well as for the beam in general.Thus the data can be easily saved.
Every time the main form is in view,the ‘paint’ procedure is called.This procedure draws
the saved loads and supports on the beam,accessing the data from arrays of type TLoad and
TSupport.These arrays are called my
supports and my
loads.An example of a beam with
these supports and loads ‘painted’ on can be seen in fig 4.5.
Figure 4.5:Example of the ‘on-screen’ free-body diagram
Once the free body diagram has been drawn,the next step is to create a form showing the shear
force diagram.In order to create this,the mathematical calculations shown in Chapter 3 must
be input.
Firstly the reactions at the two ends are calculated using equations 4.1 and 4.2:
L = 0
where L = load value
M = 0
where M = Moment
A set of axes is drawn on a new form and then shear value is plotted for each value of the
displacement,x.The bending moment diagram is drawn in a similar way.Finally,the beam
deflection diagram is drawn.This proves to be more difficult than either of the previous dia-
grams due to calculations of constants.Whilst the simple case that we are looking at is easy
to calculate,we need to generate generic code that can work for many loads of this type.
Our simple case scenario for the program is now running and ready to use.
4.2 Building the program’s complexity
Now the simple program is working correctly,it is important to create a program that is of
use for a more general case.However,it is important to do this in an ordered way.Since only
statically determinate beams are being considered,there are relatively few inputs to consider.
The first new support to be input was the fixed support.This can be fixed on either the right
end of the beam or the left,dependant on user input.The calculations of shear force for this
type of beam are very simple since there is only one reaction force to be calculated in the
simple statically determined set.However,the moment around this fixed support needs to be
calculated when considering bending moment.Since the beam is fixed at one end there are
no constants to consider in the beam deflection diagram and these three diagrams are created
fairly quickly without error.
The case of using two simple pin supports is expanded in order that one support can move from
the end point of the beam.Computing the shear and bending moment are no harder than in
the simple case shown in section 4.1.
After this,we decide that a linearly distributed load will be input.This has already proved to be
a problem whilst designing the form on paper and is just as difficult to create computationally.
We discover that it is not possible to implement a double track bar within Delphi.Therefore the
formis created as designed but without the track bar.This is in order to preserve simplicity and
continuity of design within the program.Drawing this type of load on the free-body diagram
proves to be more taxing than any of the previous drawings.This is due to the difficult visual
nature of the load which requires a large amount of space.It is difficult to preserve clarity in the
free-body diagram whilst this type of load is being shown.In the end,we decide to only place
the beginning and end points of the load on the beam with a line joining them to show a user
that this is a distributed load.This type of load provides a greater challenge when calculating
shear,bending moment and beam deflection.However,the code is input in a similar way to
that of the simple point load.
4.3 Creating a usable program
Whilst this programruns fairly well,it is noted that there are many small problems which makes
the program difficult to run and does not allow the user an enjoyable computing experience.It
is important for a program to be as user friendly as possible,whilst giving no room for error,
although it is widely known that creating a totally error free program is near impossible.
A system for catching incorrect inputs such as punctuation or letters in the numeric boxes is
created,showing the user an error box with an easy to understand message (for example,see
figure 4.6).
Figure 4.6:An example of an error message
Since,the system is also designed so that only statically determined beams are be allowed,if a
user tries to enter a statically indeterminate beam,the system outputs an error message and
does not allow them to do so.An error message is also output if a user enters more than one
support or load in the same position (including more than one load with exactly the same start
and end points for a distributed load).
To make the program more user friendly,we make the free-body diagram in the main window
editable,so that when a support or load is double-clicked it brings up the values input in the
original form so that they can be changed or deleted.This results in some slight changes in the
form,with the cancel box becoming a delete box,for an example see fig 4.7.
(a) An input form for a fixed support
(b) An input form to edit a fixed support
Figure 4.7:Figure to show a fixed support form and its editable version
Another change is to the shear,bending and beamdeflection diagrams.The outputs are scaled in
order for themto fit within their windows and on the axes drawn and labels are created showing
the displacement along the beam of the supports as well as the maximum and minimum values
along the y-axis (indicating shear,bending moment or beam displacement).Whilst working on
these forms,an additional label is input in the top left hand corner of the screen.This label
tracks the mouse position and displays the co-ordinates at the point on the graph where the
mouse is.At the point along the axis where the mouse is placed,the shear,bending moment
or displacement of the beam is be calculated and displayed.
Within the design plan,we stated that only once the programwas running,would we implement
other features such as printing,loading data or saving data.These features are then added in
order to make the program as helpful to a user as possible.The added features are mainly to
do with the menu on the main screen and consist of:

Using the open/save and save as facility

Creating all three force diagrams at once

Allowing the program to restart if a user decides to change the loading and supporting
of a beam entirely

Exiting the program via a menu option

Printing/which uses a ‘print screen’ method where the program creates a form with all
the possible data diagram,shear stress diagram,bending moment diagram
and beam deflection diagram.This form is then be seen by the computer,saved as a
bitmap and printed with the default printer.
After this final bit of implementation,the only obvious part of the program missing is the help
4.4 The help file
After implementing the program,we decide that a help file is very beneficial to a user.This
will explain how to use the program as well as exactly what it can do.The benefits of writing
either a manual or including an ‘on-line help file to attach to the program are considered and
we decide that writing an ‘on-line file is better.In an on-line file,a user will be able to access
the entire help file without leaving their desk and it will be more flexible than a written aid.
However,since creating such a help file will involve learning yet another computing package,a
simple written overview for the program is completed instead with a view to creating an on-line
help file at a later date (see Appendix A).
Chapter 5
Once the program is complete,it is tested to make sure it gives correct answers.Parts of the
testing happened continuously throughout the implementation process in order to make sure the
program was progressing as planned and the given functions were yielding the correct results.
However,within the software development cycle,outlined in section 1.5,it is necessary to allow
for a certain amount of time on testing the program when the developer first believes it to be
complete.The program is tested mainly to detect what it can do and to make sure it will not
stop working due to errors.It is also necessary to test how user-friendly the interface is and see
how useful this program is deemed to be.This is discussed in section 5.3.
5.1 Testing for errors
It is necessary for this program to be tested with boundary conditions as well as by inputting
incorrectly formatted data.We also try to make the program fail in other possible ways such
as miskeying.Testing is done in this way as extensively as possible,so that it is as error free
as possible.We aim to identify errors,amend the program and produce a truly viable output.
Table 5.1 shows the tests completed when testing for errors for each formrequiring a user input.
Type of test
Error Box shown as expected?
Inputting a letter into a load edit box
Inputting punctuation into a position edit box
Inputting a negative value into a position edit box
Inputting two loads/supports in the same position
Inputting two ‘minus’ signs in a load edit box
Inputting a distributed load with the start
position further along the beam than the end position
Allowing a beam with three supports
Allowing a different type of statically indeterminate
beam,e.g.a fixed support and a pin support
Entering a percentage greater than 100% in the
No error box appears,
percentage box
however the program
resets this value to 100%
Deleting the value in the load box
No error box needed
Deleting the value in the position or percentage box
Error box provided
by Delphi
Table 5.1:Table to show the results of error testing
An error box also appears if a user tries to create a diagramwhen the beamis not in equilibrium.
5.2 Random testing
Sample questions from previous Engineering Physics examination papers are input into the
program and the output is compared against the sample answer sheets for the relevant ex-
aminations.We also test the program extensively using many other different combinations of
loads and supports to make sure the diagrams output are correct.In order to make sure these
are correct,manual calculations are made and the diagrams drawn from these calculations are
compared to the diagrams output by the program.
Table 5.2 shows the results of the tests carried out
Loads Included
Supports Included
Results as expected
Linearly Distributed
Table 5.2:Table to show the results of random testing
5.3 Testing by sample users
Once the error testing and random testing had taken place it was intended that we would ask
first year students from the degree Engineering Mathematics who were completing the course
Engineering Physics EMAT10005 and who are studying this type of bending moment,shear
force although and beam deflection to participate in a testing and evaluation session for the
program.They would be asked to complete a number of problems on the program and then
complete a short questionnaire about their experiences using the program.This questionnaire
would ask how user friendly the student found the program as well as asking for any comments
or problems that they may have found in using the program and ways in which it might be
improved or be made more user friendly.The research found by this would be collated in order
to make improvements.This questionnaire can be seen in Appendix B.
Chapter 6
We have developed a computer program that outputs diagrams of shear force,bending moment
and beamdeflection for statically determinate beams.Whilst certain modifications to the design
were made after learning the possibilities and limitations of Delphi (for example,not being able
to drag and drop on the free-body diagramleading to the loads and supports only being editable
through a double-click method),the program produced works and outputs correct results.
6.1 Suggestions for future development
Using results collated through testing as well as experience gained through completing this
project,it is possible to suggest ways in which the program could be improved.
Initially,we intended to create a program that would run for a beam with any possible type of
support or loading.At present,the program works for statically.determinate beams.Ideally
we would also program situations where the beam becomes statically indeterminate.
This program does not currently allow non-linearly distributed loads to be input.This would
involved significantly more programming time and we have therefore not progressed this appli-
We can develop this program further,for example,being allowed to determine how many loads
can be input (the default is set to be 10),or the length of the beam.A more comprehensive help
file would improve the program as would being able to toggle whether to see the load values
and load and support positions on the free-body diagram,or to leave it purely as a diagram.
Improvement on all of the above points could be made in time,but a great deal more testing
on a wide range of users would need to be completed in order to maximise its effectiveness.
6.2 Conclusion
A successful program is one that has been shown to meet the needs of the specification as well
as the objectives (outlined in section 1.3).This program:

Is user-friendly,with no user error

Uses the same structured mathematical methods as engineers currently use (see Chapter

Displays three graphs showing beam deflection,bending moment and shear force.

Is not yet able to load and save data.However,since all the data to be saved to file is
ordered and saved within the program in three data structures,inputting load and save
options would be a relatively easy addition.

Can print results.

Shows a free-body diagram
This list shows that all except one of the objectives (detailed in section 1.3) have been met.
Whilst all testing has proved the program to give the correct outputs,only extensive use of the
program will really show if it is entirely error-free.Further testing,as detailed in section 5.3 is
needed in order to do this as well as to further refine the program.
Overall,the program created,has met expectations of the program envisaged and would be a
useful tool for an engineer.
Foundations of Engineering Foundations of Engineering:Glossary
Retrieved from:
UniStates UniStates RMT Glossary
Retrieved from:
Author:James M.Gere,Stephen P.Timoshenko
Title:Mechanics of materials
Publisher:Brooks Cole
Delphi Help Files
Author:Kent Reisdorph
Title:Sams teach yourself Borland Delphi 4 in 21 days
Author:Marco Cant
Title:Mastering Delphi 7
Publisher:Sybex Inc.
Title:Mastering JBuilder
Publisher:John Wiley & Sons Inc
About:Delphi Programming Getting Started with Delphi
Retrieved from:
EMAT10005 Engineering Physics EMAT10005 Engineering Physics
Soft4Structures General information
Retrieved from:
Appendix A
Help File
Beam Program Overview
In order to begin using the program please insert a load or a support from the library seen to
the left of the main window.
Input the position of this support or load and if a load has been input then it’s value also.
Click OK to proceed or Cancel to go back to the main form without saving.
Insert more loads/supports in this manner.
If you need to edit or delete a load or support,just double click,and an editable box will appear.
When the beam is drawn as intended,choose a menu option to perform another task.
To exit the program,choose File then Exit,or click the ‘x’ in the top right corner of the main
Appendix B
Questionnaire on Beam Program
I am currently developing a computer program to solve algebraic problems for shear,bending
moment and beam deflection and would very much appreciate your views on the program I
have created.Please use the program provided to complete a number of example problems
from Chapter 4 (Shear Forces and Bending Moments) and Chapter 9 (Deflection of Beams) of
“Mechanics of Materials” (Gere,Timoshenko) [3].
Did the program give the correct result?
Was the program easy to use?
Does this program save time compared with your normal method of calculation?
Are you confident with the result it produces?
Would you use this program in future if it was made available?
Please use the space below to make any comments on improvements you would like to see.