You are on page 1of 20

A MINI PROJECT REPORT

ON

2D TRUSS USING MATLAB


Submitted by
P HEMANTH SAI VINAY
NIRANJAN GODAGE
SHAIK SANA SULTANA
MOHD.ARBAAZ PARVEZ

Under the Guidance of


SWAJIT SINGH GOUD
Lecturer

International Institute of Information Technology


Hyderabad

ACKNOWLEDGEMENT:-

After successful completion of the project, we would like to express our gratitude
towards those people, without theres help this project would not have been
possible.
We sincerely express our gratitude to our Guide SWAJIT SINGH GOWD
(Lecturer) , International Institute of Information and Technology for encouraging
us and providing valuable advice and support which made us complete our project
on time.
Our sincere thanks to our Teaching Assistants Sunkara Bhavana for providing us
guidance and encouragement throughout the project and giving us their valuable
time and advice. We are extremely grateful to them for their support. Though they
had their assignments and busy schedule they took time for us and were always
available in the case lab to solve our doubts and queries.
We are thankful to and fortunate enough to get constant help and support from all
our classmates which helped us for successfully completing our project work.

CONTENTS:TOPICS
1. INTRODUCTION
1.1 Objective
1.2 SCOPE
1.3 What is MATLAB
1.4 GUI-Graphical user interface
1.5 GUI tools development
1.6 Various components of MATLAB used in development of a GUI
2. INTRODUCTION OF THE TRUSSES
2.1 Vertical truss
2.2 Pratt truss
2.3 Sloped truss
3. ALGORITHM
3.1 For sloped and vertical truss
3.2 For Pratt truss
4. LIMITATIONS
5. CONCLUSIONS
6. REFERENCES

1.INTRODUCTION
1.1 Objective:
Plotting the truss in generalized form by using Graphic User Interface (GUI) as a tool.

1.2 Scope:
Plotting trusses in MATLAB using Graphic User Interface (GUI) as a tool. Every member in the
truss is given nodal address, element connecting matrix, support condition, loading condition,
which is used in Finite element method. The GUI also enable the user to obtain all the address
easily and plot the truss according to input given.

1.3WhatisMATLAB:
MATLAB is a high-performance language for technical computing. It
integrates computation, visualization, and programming in an easy-to-use environment where
problems and solutions are expressed in familiar mathematical notation. Developed by
MathWorks, typical uses include:
Math and computation
Algorithm development
Modeling, simulation, and prototyping
Data analysis, exploration, and visualization
Scientific and engineering graphics,
Application development, including Graphical User Interface building
Using MATLAB, you can analyze data, plot functions and data, and create
models and applications. The language, tools, and built-in math functions enable you to explore
multiple approaches and reach a solution faster than with spreadsheets or traditional
programming languages, such as C/C++ or Java.

1.4 GUI GRAPHIC USER INTERFACE:

What is GUI?
A graphical user interface (GUI) is a graphical display in one or more windows containing
controls, called components that enable a user to perform interactive tasks. The user of the GUI
does not have to create a script or type commands at the command line to accomplish the tasks.
Unlike coding programs to accomplish tasks, the user of a GUI need not understand the details of
how the tasks are performed.
GUI components can include menus, toolbars, push buttons, radio buttons, list boxes, and sliders
just to name a few. GUIs created using MATLAB tools can also perform any type of
computation, read and write data files, communicate with other GUIs, and display data as tables

or as plots.

Salient Features of GUI:


1. Least mouse movement a. All the input parameters are located on the Left hand side of the window so as to
make least mouse movements.
2. Error display for text input instead of numeric inputIf a non-numeric input is given in place of numeric input, the software automatically resets to
default value and displays the error message.

3. Display of Imagesa. After selection of beam type and the loading on beam, the figure is automatically
displayed so as to make the user input easier and faster.
4. Default Valuesa. For analyzing the beam, default values are stored so as to analyze beam quickly.
5. For the same loading conditions different beams can be analyzed.
6. Reset button resets all the values so as to create a clean sheet for user input.
7. User can give input in CGS system or SI system.

How Does a GUI Work?


Most GUIs wait for their user to manipulate a control, and then respond to each action in turn.
Each control, and the GUI itself, has one or more user-written routines (executable MATLAB
code) known as callbacks, named for the fact that they c all back to MATLAB to ask it to do
things. The execution of each callback is triggered by a particular user action such as pressing a
screen button, clicking a mouse button, selecting a menu item, typing a string or a numeric value,
or passing the cursor over a component. The GUI then responds to these events. You, as the
creator of the GUI, provide callbacks which define what the components do to handle events.

1.5 GUI Tool Development:


DesignMethodology
The development of the GUI tool was carried out in following stages1. Interface Design
2. Linking of Input Parameters.
3. Coding for analysis
4. Display results
MATLAB Graphical User Interface, or GUI includes an image window, various buttons which
have their own usage, text, graphics etc., which a user can manipulate interactively. There are
two main steps in creating a GUI:
Designing the layout of GUI to add in all the necessary features for making it user
interactive.
Writing callback functions that perform the predefined operations to meet the requirements
of the user and provide him with necessary outputs.
MATLAB provides an interactive tool called GUIDE that greatly simplifies the task of building
a GUI.
1. Designing the GUI Interface:
A graphical user interface (GUI) is a system of graphical elements that allow a user to interact
with software using mouse operations. There are three ways to make graphical user interfaces
1. Use graphical elements that serve no other purpose than to allow the user to interact
using virtual buttons, switches, knobs, sliders, popup menus, and so on.
2. Use graphical elements that perform a dual function: display data and interaction. For
example, a plotted line can both display data and can alter data when a user clicks on
the line and drags it to a new position.
3. Use mouse-downs, drags, and mouse-ups anywhere within the Figure to perform
an action.
1.6 Various Components of MATLAB used in development of a GUI:
MATLAB has a facility called GUIDE (Graphical User Interface Development Environment) for
creating and implementing GUIs. It, provides a set of tools for creating graphical user interfaces
(GUIs). These tools greatly simplify the process of laying out and programming GUIs. GUIDE
generates two files that save and launch the GUI: a FIG-file and an application M-file.

The FIG-file comprises a complete description of the GUI figure, i.e. whatever uicontrols
and axes are needed for graphical interface.

The application M-file (the file you run to launch the GUI) comprises the functions
required to launch and control the GUI. The application M-file does not include the code
that lays out the GUI components; this information is saved in the FIG-file.

Callbacks
Callbacks are statements that get executed in the MATLAB workspace (the command window)
when a user interface element is activated. The GUI is controlled largely by means of callback
functions, which are sub functions in the application M-file. The type of action to be performed
by a command window can be declared by activating a uicontrol and by setting its CallBack
property.

Handles: The handles of all GUI components are fields in the handles structure in the
application M-file. These handles are available to all callback sub functions and enable to
find and change components properties.

Different Button Styles:


The button-style uicontrols (pushbuttons, radio buttons, and checkboxes) are used by simply
clicking on them with the mouse. Others need more interaction; it can be an item from a list (list
boxes or popup menus) or specify a numeric value (sliders) or type in text (edit boxes).
The operation of each of these uicontrols is listed below in brief:
Push Button:
This button is used to give commands to the program

Slider:
Sliders accept numeric input within a specified range by enabling the user to move a sliding bar,
which is called a slider or thumb.
Radio Buttons:

Radio buttons can be used to offer a choice of one, and only one, item from among alternatives.
When you press one button in, the corresponding channel only is selected.
Edit Text:
Edit boxes are designed to read in a piece of typed text. The text inside an Edit box is accessed
via the boxs String property. They can be accessed by using get and set property.
Popup menu:
Popup menus are similar to list boxes in that they allow choosing from among a list of
alternatives, but only one item is shown at a time; the others become visible only when button is
pressed.
List box:
List boxes lets choose from among a scrollable list of alternatives. The list of alternatives is set
by the list boxes string property.
ToggleButton:
Togglebuttonsgenerateanactionandindicatewhethertheyareturnedonoroff.Whenyouclick
atogglebutton,itappearsdepressed,showingthatitison.
Button Group:
This GUI object is used to control other objects or to group the objects inside window.
Axis Property:
This is used to display the plot and results on GUI. 3Axis are used to display shear force,
bending moment and deflected shape.

Miscellaneous Properties of different Buttons:


Text:
GUIs have instructive text that indicates the function of a uicontrol. These can be placed with the
text-style uicontrol.
Frame:
The frame style uicontrol is not an object that is meant to be interacted with. It is a decoration. It
can be used to control and group other objects.
The Tag Property:
It is useful to have some means of finding the handle to an object without explicitly saving it as a
variable. The Tag property uniquely names an object. The object can be found anywhere in code
by looking for the object with that name.

Assembling all the above parameters the final GUI is as follows:


SLOPED TRUSS WINDOW:-

VERTICAL TRUSS:-

By giving number of the Divisions,Division length ,Height,Left Support,Right Support


we can plot the truss
We have to enter the load value and section values by clicking enter,Which opens an
excel sheet where in we can enter the value which is automatically assigned to the truss
members.
Output gives us the result of the input given to the frame.Clear is used to refresh all the
values which are previously assign to the members.Main is used to go back to the first
GUI window.

PRATT TRUSS WINDOW:-

Enter the span length from the left side and the right side,height of the left side
and the right side of the truss and number of the division from the both side from
the center of the truss
Enter the support condition of the left side side of the truss and the right side of
the truss.
Loads and the sections of the truss should be given in the excel sheet
Output gives us the result of the input given to the frame.Clear is used to refresh
all the values which are previously assign to the members.Main is used to go back
to the first GUI window.

2. INTRODUCTION OF TRUSS:The truss is a frame structure which will continue to perform as a geometrically unchangeable
system, even when all of its rigid joints are conventionally replaced by perfect hinges. The
trusses are used for the same purposes as beams and girders, but the spans they cover are much
larger. In trusses all the members are subjected either to direct extension (tension) or
compression. That ensures better utilization of the materials, the stress diagram for each of these
members is constant. The trusses can be space framed structures in which the elements are
situated in several planes. However, the design of the three dimensional trusses can be reduced to
the case of several plane systems. Here we are going to examine two dimensional (plane) trusses
for which all the elements and loads are situated in one plane. The span of a truss is the distance
between its supports. The lower and upper longitudinal members form the upper and lower
chords of the truss. The members connecting both the chords are called the web members. They

are subdivided into verticals and diagonals. The distance between two adjacent joints measured
along the horizontal is usually called a panel (Fig. 1).

The following five criterions may serve as a basis for the classification of trusses:
1) The shape of the upper and lower chords
2) The type of the web
3) The conditions of the supports
4) The purpose of the structure
5) The level of the floor (lane, road)
According to the first criterion, the trusses can be classified into trusses with parallel chords (Fig.
1), polygonal and triangular trusses or trusses with inclined chords (Fig. 2)

The second criterion (type of the web) permits to subdivide the trusses into those with triangular
patterns (Fig. 3a), those with quadrangular patterns (Fig. 3b) formed by vertical and diagonals,
those with the web members form a letter K (Fig. 3c). Finally, trusses formed by superposition of
two or more simple grids (Fig. 3d,e).

The third criterion permits to distinguish between the ordinary end-supported trusses (Fig. 4a),
the cantilever trusses (Fig. 4b), the trusses cantilevering over one or both supports (Fig. 4c), and
finally crescent or arched trusses (Fig. d,e).

According to their purpose the trusses may be classified as roof trusses, bridge trusses, those
used in crane construction. Regarding the level of the road the trusses can be constructed so that
the road is carried by the bottom chord joints (Fig. 5a), or the upper chord joints (Fig. 5b).
Sometimes the road (lane) is carried at some intermediate level (Fig. 5c).

Different types of trusses which we have plotted are


1. Vertical truss
2. Pratt truss
3. Sloped truss

2.1 Vertical truss:

Vertical truss is used in roofs or floors


Designed as top or bottom chord bearing for simple or multiple spans
May also be cantilevered at one or both ends
Vertical roof trusses are one of the more common types of roof trusses
It will probably be a more complicated and expensive construction process
It will need to support a heavier load

2.2 Pratt Truss:

The continued popularity of the Pratt truss is probably due to the fact that the
configuration of the members means that longer diagonal members are only in tension for
gravity load effects.
This allows these members to be used more efficiently, as slenderness effects related
to buckling under compression loads (which are compounded by the length of the
member) will typically not control the design.
Its initial use was mainly to carry trains, replacing the older railway bridges made of
stone or timber.
The biggest advantage of this bridge was its low construction costs; the iron parts
needed could be transported to the building site easily, and the assembly was quick,
requiring only semi-skilled labor.

This type of bridge is typically constructed for the use of pedestrians, cars, trucks,
trains, and pipelines.

Geometry of a Pratt truss bridge

2.3 Sloped truss:

Sloped truss is used for simple roof truss and short spans
Sloped truss uses mainly two angle struts
In sloped truss load bearing is limited
Less skill is required for fabrication

3.ALGORITHM:3.1 Algorithm for sloped and vertical truss:1) Enter the number of divisions (nod)
2) Enter the height of the truss (h)
3) Enter the length of each division (lod)
4) Calculate the number of nodes with the formula
For Sloped truss
(2*nod)+1
For Vertical truss
2*(nod+1)
5) Calculate the X and Y coordinate of each nodes.
6) Calculate the number of members with the formula
For sloped truss
4*nod-1
For vertical truss
5*nod+1
7) Store the nodes connected to the each members and their coordinates
8) Plot each member with the help of member connected nodes coordinates

Sloped truss

Sloped truss

Vertical truss
3.2 Algorithm for Pratt truss:1) Enter the number of divisions (nod)
2) Enter the length of division L1
3) Enter the length of division L2
4) Enter the height of division h1
5) Enter the height of division h2
6) Enter the height of division h3
7) Calculate the number of nodes with the formula
2*(n+1)
n=nod of left side+nod of right side
8) Calculate X and Y coordinates of each nodes
9) Calculate the number of members with the formula
(4*n)+1
10) Store the nodes connected to the each member and their coordinates
11) Plot each member with the help of member connected nodes coordinates
Pratt truss

4.Limitations of Code:1 Actual cross section of members are not plotted in extruded view.
2 Load cannot be assigned directly to the members in extrusion view.
3 At any instant of time only single load condition is visible on the time plot.

5.Conclusion:
1. This project introduced us to the field of computer graphics by plotting 2d graphics in
MATLAB using GUI.
2. It helped us in understanding the constraints involved while writing an algorithm for plotting
these graphics.
3. It also made us understand how UX (user- experience) design of an application is important
from aesthetic perspective for its increased usability and ease of access.

6.References:1. Getting Started With MATLAB: A Quick Introduction for Scientists and
Engineers Oxford University Press, 2009
2. www.wikipedia.org
3. MathWorks-MatLab
4. MATLAB Creating Graphical User Interfaces: The MathWorks, Inc. 2000
5.

MATLAB Product Help: The MathWorks, Inc, 2011

6.

www.youtube.com

You might also like