0% found this document useful (0 votes)
132 views13 pages

GUI Program For 2D-Truss Analysis: Developed in MATLAB 7.0

This document describes a GUI program developed in MATLAB to analyze 2D truss structures. It provides an overview of the finite element method procedures used in the program, including defining element and node properties, applying constraints and loads, and calculating and displaying results. The program structure section describes the global variables used and the main callback functions, including those for defining nodes and elements, applying constraints and loads, and solving the analysis. The user's guide explains how to use the main interface to define a truss model and view the results.

Uploaded by

Fabiola Gi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views13 pages

GUI Program For 2D-Truss Analysis: Developed in MATLAB 7.0

This document describes a GUI program developed in MATLAB to analyze 2D truss structures. It provides an overview of the finite element method procedures used in the program, including defining element and node properties, applying constraints and loads, and calculating and displaying results. The program structure section describes the global variables used and the main callback functions, including those for defining nodes and elements, applying constraints and loads, and solving the analysis. The user's guide explains how to use the main interface to define a truss model and view the results.

Uploaded by

Fabiola Gi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 13

2D-Truss GUI Report by YAN LUO & STEPHEN ASARE

GUI Program for 2D-Truss Analysis

Developed in MATLAB 7.0

Name: ASARE STEPHEN & YAN LUO

Date: MAY 2009

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.

Try to get the value of force and displacement at each node.


3 0 0 lb U 4
U 6

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

Figure 2.2 Procedures of this GUI Program (2)

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)

3.2 Main Callbacks & Functions


function btn_NN_Minus_Callback(hObject, eventdata, handles)
global NN
global NXY
global NodeCon
global NodeForce
global NodeForceStatus

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.

function btn_NN_Plus_Callback(hObject, eventdata, handles)


global NN
global NXY
global NodeCon
global NodeForce
global NodeForceStatus

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.

function btn_EN_Minus_Callback(hObject, eventdata, handles)


global EFromTo
global EN
global E
global A

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.

function btn_EN_Plus_Callback(hObject, eventdata, handles)


global EFromTo
global EN
global E
global A

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.

function btn_Node_Callback(hObject, eventdata, handles)


global E % Material's E
global A % the cross section area of elements
global NN; % the number of Nodes
global EN; % the number of Elements
global NXY; % Coordinates of Nodes
global EFromTo; % Element Direction (construct elements)
global NodeCon; % constrain of nodes
global NodeForce; % forces applied on Nodes
global NodeForceStatus; % the node force status (1 -- known, 0 -- unknown)

This function is to define the geometric parameters of nodes and display these nodes.

function btn_Element_Callback(hObject, eventdata, handles)


global E % Material's E
global A % the cross section area of elements
global NN; % the number of Nodes
global EN; % the number of Elements
global NXY; % Coordinates of Nodes
global EFromTo; % Element Direction (construct elements)
global NodeCon; % constrain of nodes
global NodeForce; % forces applied on Nodes
global NodeForceStatus; % the node force status (1 -- known, 0 -- unknown)

This function is to define the parameters of elements and display these elements.

function btn_MAT_Callback(hObject, eventdata, handles)


global E % Material's E
global A % the cross section area of elements
global NN; % the number of Nodes
global EN; % the number of Elements
7
2D-Truss GUI Report by YAN LUO & STEPHEN ASARE

global NXY; % Coordinates of Nodes


global EFromTo; % Element Direction (construct elements)
global NodeCon; % constrain of nodes
global NodeForce; % forces applied on Nodes
global NodeForceStatus; % the node force status (1 -- known, 0 -- unknown)

This function is to define the material parameters of elements, E and Area.

function btn_NodeCon_Callback(hObject, eventdata, handles)


global E % Material's E
global A % the cross section area of elements
global NN; % the number of Nodes
global EN; % the number of Elements
global NXY; % Coordinates of Nodes
global EFromTo; % Element Direction (construct elements)
global NodeCon; % constrain of nodes
global NodeForce; % forces applied on Nodes
global NodeForceStatus; % the node force status (1 -- known, 0 -- unknown)

This function is to define the constrain conditions of nodes.

function btn_NodeForce_Callback(hObject, eventdata, handles)


global E % Material's E
global A % the cross section area of elements
global NN; % the number of Nodes
global EN; % the number of Elements
global NXY; % Coordinates of Nodes
global EFromTo; % Element Direction (construct elements)
global NodeCon; % constrain of nodes
global NodeForce; % forces applied on Nodes
global NodeForceStatus; % the node force status (1 -- known, 0 -- unknown)

This function is to define the force conditions of nodes.

function pushbutton3_Callback(hObject, eventdata, handles)


This function is the most important function, which use finite element method to calculation the
stiffness matrix, displacement forces, stress and strain of nodes or 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

3.3 Relative Files


There are FOUR files which have existed or will be produced during calculation.

Truss.fig % the main files


Truss.m % the m file of Truss.fig
DefinedPara.mat % the defined parameters are saved in this file, which will be opened during
calculation. 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)

Results.mat % the calculation results will be saved in this file. They are:

K_Final % final stiffness matrix


U_Final % final displacement vector
R_Final % final reaction force vector
Element_U % local displacement of elements
Element_Stress % stress vector of elements
Element_Strain % strain vector of elements

9
2D-Truss GUI Report by YAN LUO & STEPHEN ASARE

4. User’s Manual
4.1 Main Interface of the Program

Figure 4.1 Main Interfaces and Explanation

4.2 How to Use It


Follow the steps shown in the main interface in the program.
1. Define the number of nodes and elements;
2. Define the coordinates of nodes;
10
2D-Truss GUI Report by YAN LUO & STEPHEN ASARE

3. Define the connectivity or direction of elements (from node I to node J);


4. Define the material parameters E and the Areas of elements;
5. Define the constrain conditions of nodes;
6. Define the forces of nodes;
7. Run the program
Check the results in MATLAB windows or load the ‘Results.mat’ file.

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.

We get the following answers:

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

U_Final R_Final Element_U Element_Stress Element_Strain


0 -15833 0 0.0271 20000 0.00067797
0 3125 0 -0.0222 -21875 -0.00074153
0.0271 20000 0 -0.0088 -5208.3 -0.00017655
0 21875 0 0.0056 4166.7 0.00014124
0.0056 0
-0.0222 -25000
0 -4166.7
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

You might also like