GUI Program For 2D-Truss Analysis: Developed in MATLAB 7.0
GUI Program For 2D-Truss Analysis: Developed in MATLAB 7.0
0
2D-Truss GUI Report by YAN LUO & STEPHEN ASARE
Content
1. Task.................................................................................................................................................2
2. Overview.........................................................................................................................................3
3. Program Structure...........................................................................................................................5
3.1 Global Variables....................................................................................................................5
3.2 Main Callbacks & Functions................................................................................................5
3.3 Relative Files........................................................................................................................8
4. User’s Guide...................................................................................................................................9
4.1 Main Interface of the Program..............................................................................................9
4.2 How to Use It........................................................................................................................9
4.3 Example..............................................................................................................................10
1
2D-Truss GUI Report by YAN LUO & STEPHEN ASARE
1. Task
Develop a GUI program in MATLAB to solve the following question. Meanwhile, the program
can allow users to change the parameters in order to solve other general truss analysis problems.
5 0 0 lb U 3
(2 ) 00 U 5
(0 ,4 0 ) (4 0 ,4 0 ) 2 (0 ,4 0 ) 3 (4 0 ,4 0 )
Y, V
6
E 1 = E 2 = 1 0 lb / i n . 2
X , U
450
(1 )
A 1 = A 2 = 1 . 5 in . 2 U 2
U 1
(0 ,0 ) 1 (0 ,0 )
2
2D-Truss GUI Report by YAN LUO & STEPHEN ASARE
2. Overview
In a truss, it’s required that all loads and reactions are applied only at the joints and that all
members are connected together at their ends by frictionless pin joints. The finite element method
is applicable to statically determinate or indeterminate structures alike. The finite element method
also provides joint deflections. Effects of temperature changes and support settlements can also be
routinely handled.
The following FEM calculation algorithm (or procedures) has been used in this GUI program.
Figure 2.1 Procedures of this GUI Program (1)
Define elemental characteristics of element(s)
Define
number of
nodes &
element(s)
Define
coordinates
of nodes
Define Plot
nodal Display
Define constrains window
direction of
element(s)
Define
nodal
constrains
3
2D-Truss GUI Report by YAN LUO & STEPHEN ASARE
4
2D-Truss GUI Report by YAN LUO & STEPHEN ASARE
Start P ro gram
D e f in e N u m b e r o f
N o d e s a n d E le m e n t
D e f in e t h e
C o o r d in a t e s o f N o d s
D e f in e E le m e n t s
(F ro m N o de I to
N o de J)
D e f in e t h e A r e a a n d
E o f E a c h E le m e n t
D e f in e C o n s t r a in s
o n E ach N o de
D e f in e F o r c e s o n
E ach N o de
( in c lu d in g k n o w o r
un k n o w n >
C a lc u la t e & S h o w
R e su lt s
End
5
2D-Truss GUI Report by YAN LUO & STEPHEN ASARE
3. Program Structure
3.1 Global Variables
There are 9 global variables defined in the program. They are:
E % Material's E
A % the cross section area of elements
NN % the number of nodes
EN % the number of elements
NXY % store the coordinates of nodes {X1 Y1 X2 Y2 X3 Y3}
EFromTo % store the direction of elements (the node-order of each element) {1 3 2 3}
NodeCon % contrain of nodes {U1 U2 U3 U4 U5 U6} (1 -- constrained, 0 -- unconstrained)
NodeForce % force of nodes {R1 R2 R3 R4 R5 R6} --- value
NodeForceStatus % the status of the force of nodes (1 -- known, 0 -- unknown)
This function is to decrease the number of nodes, and some items relative to it will change
together, such as Node Coordinates, Node Constrains, Node Force, Node Force Status.
This function is to add the number of nodes, and some items relative to it will change together,
such as Node Coordinates, Node Constrains, Node Force, Node Force Status.
6
2D-Truss GUI Report by YAN LUO & STEPHEN ASARE
This function is to decrease the number of elements, and some items relative to it will change
together, such as Direction of Elements, E and Areas of Elements.
This function is to add the number of elements, and some items relative to it will change together,
such as Direction of Elements, E and Areas of Elements.
This function is to define the geometric parameters of nodes and display these nodes.
This function is to define the parameters of elements and display these elements.
This function is used to change the button’s color after it’s pressed. In this case, this is for the right
button group and btn_BAM_11.
8
2D-Truss GUI Report by YAN LUO & STEPHEN ASARE
E % Material's E
A % the cross section area of elements
NN % the number of nodes
EN % the number of elements
NXY % store the coordinates of nodes {X1 Y1 X2 Y2 X3 Y3}
EFromTo % store the direction of elements (the node-order of each element) {1 3 2 3}
NodeCon % contrain of nodes {U1 U2 U3 U4 U5 U6} (1 -- constrained, 0 -- unconstrained)
NodeForce % force of nodes {R1 R2 R3 R4 R5 R6} --- value
NodeForceStatus % the status of the force of nodes (1 -- known, 0 -- unknown)
Results.mat % the calculation results will be saved in this file. They are:
9
2D-Truss GUI Report by YAN LUO & STEPHEN ASARE
4. User’s Manual
4.1 Main Interface of the Program
a)First Step
The first panel has two edit boxes and two sets of push buttons with which the user can input the
node numbers as well as the number of elements. This can be done by adding to or subtracting
from the default node and element numbers. The resulting numbers are seen in the edit box
b)Second Step
The second panel has a pop -up menu which contains the number of nodes entered in the first step.
The panel also has edit boxes for both x and y entries where the values of the positions or
coordinates of the nodes in space are entered. The push button named ‘confirm ‘is pressed to set
the entered values.
c)Third Step
The third panel also has a pop-up menu from which the element number is selected. The way the
elements are connected by the nodes can be defined in the edit boxes by typing the node number.
The confirm push button is pressed again to register the values
d)Fourth Step
In the fourth panel the element properties are entered by selecting the element number and
subsequently their properties like area, moment of inertia and modulus of elasticity are entered. If
all the elements have the same properties, the check box is clicked after which the values are
entered and then confirmed.
e) Fifth Step
The fifth panel has a pop-up with two check boxes that enable one to select a particular node and
constrain it in any direction as encountered in the problem. So for example, if node one is
constrained in only the x-axis but is free to move in the y-axis, then from the pop-up, the number
one is dropped down followed by checking the X box leaving the Y box after which the entries are
confirmed. This is done for all the nodes.
f) Sixth Step
The sixth panel has a pop-up, two check boxes, two edit boxes and also a push button. The element
or node number is selected from the pop-up and the forces are checked and entered if they are
known. If the forces are not known, the check box is left as default and confirmed.
g) Seventh step
The final button, which is the ‘run’ push button, is pressed for the program to give results and
display graphs or figures.
11
2D-Truss GUI Report by YAN LUO & STEPHEN ASARE
4.3 Example
An example in the book ‘Introduction to Finite Elements in Engineering’ (Example
4.1, Page 107) has been used to verify the correctness of this program.
K_Final
1.1151e+006 2.832e+005 -7.375e+005 0 -3.776e+005 -2.832e+005 0 0
2.832e+005 2.124e+005 0 0 -2.832e+005 -2.124e+005 0 0
-7.375e+005 0 7.375e+005 0 0 0 0 0
0 0 0 9.8333e+005 0 -9.8333e+005 0 0
-3.776e+005 -2.832e+005 0 0 1.1151e+006 2.832e+005 -7.375e+005 0
-2.832e+005 -2.124e+005 0 -9.8333e+005 2.832e+005 1.1957e+006 0 0
0 0 0 0 -7.375e+005 0 7.375e+005 0
0 0 0 0 0 0 0 0
We can find that the results verify that this GUI program is a correct and effective tool.
Disadvantages of this GUI program
Involves many computations since the GUI program is general and can solve all
2 dimension truss problems
Results are only accurate approximations
12