colincaprani.com

Structural Engineering, Bridge Research, Programming, and more…

Entries Comments


Visual Basic

The following programs are written in Visual Basic 6. Mostly they are useful for the code snippets, but there are some fully-fledged applications here also. The source codes are given, as are some of the installation programs. Note that the inclusion of the run time files bloats the download. The programs are released under the terms of the GNU General Public License.

FEBeam

This program is the most comprehensive I’ve written in Visual Basic. It is a finite-element analysis package for beams alone. Its benefits are that the second moment of area, as well as the modulus of elasticity can be varied throughout the beam, in steps or curves or even a mixture of the two. All regular forms of loading are allowed for as are fixed displacements and spring supports. An automatic meshing routine, as well as a user-defined mesh density also feature. This combination make it very useful for checking unusual design scenarios not covered by regular analysis software. There are some limitations to it though, for example the output is not comprehensive and neither is the error checking. But it is still a useful program, and a good introduction to programming the finite element method. There are an endless list of possible upgrades to this program, but at the moment I don’t have any intention of doing more work on it.

Note that Section 15 of the GNU GPL, Disclaimer of Warranty, and Section 16, Limitation of Liability, are particularly pertinent to this engineering design program.

Source (305 KB)Installation (5.61 MB)

TrussMaster

This is a fairly functional truss analysis program that features common CAD commands. A user-defined grid can be set up and nodes snapped to grid points and members drawn between nodes. Loads and supports can be defined in the data entry grid, or by generation. Members and nodes can also be created using the node/member generation boxes. Member properties can be generated for any sequence of members, or input via the data entry grid. Note that a pinned support is input as a “1” and a roller support as a “2”. The member and nodal results are output in a grid, whilst the deflected shape is drawn to a user-defined scale, and can also be animated to examine the structural behaviour. There are features required before the program is really useful, such as:

  • member forces to be drawn in window;
  • animation re-scale;
  • better support conditions definitions;
  • better output of results;
  • member selection and editing;
  • move node feature;
  • better drawings of loads and supports.

I’m not sure when I’ll get around to these features (if ever!) so you get it as it is – it’s still very useful though.

Note that Section 15 of the GNU GPL, Disclaimer of Warranty, and Section 16, Limitation of Liability, are particularly pertinent to this engineering design program.

Source (96 KB)Installation (4.33 MB)

TrussGenerator

For some standard trusses, it is laborious to type all joint/member coordinates and loadings into TrussMaster. Therefore this little program generates a TrussMaster file for standard truss configurations. (Actually I lie – it only does the Pratt or “N” configuration for now :)).

Source (19 KB)Installation (2.73 MB)

EC5 Joist

This program is a useful design tool for checking domestic joist designs to Eurocode 5. All usual configurations of span, joist spacing, joist size and material grade are allowed for. Design checks include bending, shear, end-bearing and deflections. The material properties are held on a database file that must reside in the same directory as the exe file. Definitely useful as a fully installed program.

Note that Section 15 of the GNU GPL, Disclaimer of Warranty, and Section 16, Limitation of Liability, are particularly pertinent to this engineering design program.

Source (20 KB)Installation (6.21 MB)

Steel Sections Database

This is a simple program that renders the section properties and an image of a selected steel section from the included database. The sections included are UB, UC, UBP and PFC (though I think the PFC crashes it :)). It’s a basic introduction to how one might include a sections-library into a larger program.

Source and exe (43 KB)

Graph Displacement

This is a small program that graphs the Euler-Bernoulli shape function for a flexural member when the end translations and rotations are given. It then finds the location and value of the maximum displacement along the element. Sort-of useful in its own. It was included into FEBeam to visualize individual element displacements.

Source and exe (43 KB)

Recently Used Files

This program demonstrates the use of a module that manages the recently used files list in the File menu. This version is an update of the previous one that has been downloaded over 36,000 times (here)! This program’s main use is to provide the RUF module for inclusion in your own package. Therefore the installation program really only serves to provide the runtime files if needed.

Source (15 KB)Installation (2.83 MB)

Linear Simultaneous Equations

This program demonstrates two modules written for the solution of matrix equations. The modules are for Gauss Elimination and Cholesky Decomposition. These modules are useful in larger programs, such as finite-element or stiffness method solutions. Both FEBeam and TrussMaster use the Gauss Elimination module as it is found to be more robust than the Cholesky Decomposition module, which (strangely) is the preferred solution method of commercial programs. Not tremendously useful as an installed program.

Source (17 KB)Installation (2.61 MB)

Stochastic Beam Design

This program uses the Monte Carlo method to calculate the probability of failure of a simply-supported beam in which all variables are stochastic. Each variable can have one of the five different probability distributions which are allowed for. Possibly interesting as an installed program to investigate safety levels in a potential design.

Source (23 KB)Installation (3.7 MB)

Operations Time

This program finds the time required by different operators (+, -, x, /) on your particular machine.

Source and exe (43 KB)

Comments

Comment from salah
Time: 28 August, 2008, 11:32

very happy to find this site and thanks for the team who run this site

Comment from apparao
Time: 7 November, 2008, 15:24

very interesting and useful programs presented

Comment from eng.zarzour
Time: 24 January, 2009, 18:36

thanks for every thing it’s a great site and i will tell all my friends about it

Comment from ugo
Time: 2 February, 2009, 15:51

great work!

Comment from ordiah evans vans
Time: 12 May, 2009, 11:38

This is programs source codes are the best free engineering source codes I have seen. God bless you real good for giving this out. I am a civil /structural engineer and I lecturer in a university in Nigeria. I will appreciate having more of this free codes and books in visual basic/visual basic.net.Thank you sir.

Comment from Jason
Time: 3 September, 2009, 17:25

Thank you for this great share. I used to be a visual basic programmer (vb5 and vb6, i know it’s old lol) and i can see the quality in your programs. Thank you so much for this great share. Jason

Comment from Sanjay Desai
Time: 2 November, 2009, 20:44

Just stumbled upon this great site while looking for programming material on Beam design. Thank you for sharing the VB Source Codes. Greatly appreciated.

Comment from Ayman Atmeh
Time: 2 April, 2010, 17:16

Thank You Very much for this program but i want ask you how can we find a moment on specific distance in your Code you put moments only on Nodes

Comment from isaac muriithi
Time: 17 July, 2010, 08:21

I am very pleased with the program. Its quite a lot of efforts.

Comment from Gelbert R. Silot
Time: 8 September, 2010, 09:50

Thanks for this program. I’ve been longing for this free great stuff.

Comment from shrikant
Time: 7 October, 2010, 20:19

sir,
do you have any program on structural analysis…

Comment from mehdi
Time: 14 October, 2010, 06:47

tanks for your excellent app’s
they are so usefull for me.

Comment from mghozi2002
Time: 12 December, 2010, 15:54

great works!! thanks for share the code which very usefull for my study.
it will be so complete if i can get the code for 3D truss, sir (please).
god bless us all.

Comment from Ahmad Mansour
Time: 22 December, 2010, 11:51

Great works, i am very happy that i found such website, appreciations

Comment from reza
Time: 26 April, 2011, 13:44

this is really nice.
i’m really happy to find you.
thank you alot.

Comment from Rob
Time: 11 July, 2011, 17:55

Great resource for bridge engineers, Thanks.

I recently launched a bridge assessment program, a free version is available at bridgeassessment.co.uk

Comment from Colin
Time: 11 July, 2011, 21:44

Rob,
Looks really slick – well done, and the best of luck with success for it. Did you write it in C#?
Colin

Comment from Rob
Time: 12 July, 2011, 11:39

Hi Colin thanks very much, Yea it’s written in C#, it’s a great language and combined with windows presentation foundation (WPF) you can get some great UI’s and sharp looking reports using the XPS document format.

Kind Regards
Rob

Comment from Mak UD’s
Time: 6 August, 2011, 10:07

Dude u r awesome !! 😀

Comment from Sohail
Time: 16 September, 2011, 18:38

Hey there ! its really nice work i have also created some civil engg related softwares e.g. Trruss Analysis and beam solution for indeterminate beams. hit me on email

Comment from Tim Eckert
Time: 19 September, 2011, 01:39

On the joist program- can anyone tell me the major equation differences from the Eurocode to the International Building Code or BOCA building Code? It seems like a useful program that i can use. I could take the force effects and then design independently.

Comment from Osman Şahinoğlu
Time: 22 September, 2011, 15:39

Visual Basic ile yazılmış programlarınızı takip ediyorum.

Comment from OSUNDE TOYIN ANTHONY
Time: 8 October, 2011, 16:51

i am studying production engineering in the university of Benin,Benin city NIGERIA.THANKS FOR THE WONDERFUL JOB AND ALLOWING PEOPLE TO HAVE ACCESS TO YOUR WORK.PLEASE,KEEP UP THE GOOD WORK.

Comment from J.Mc
Time: 20 January, 2012, 13:18

You guys are legends. Some great stuff here

Comment from Abhijeet Oundhakar
Time: 1 June, 2012, 11:35

Dear Dr Caprani, thanks for sharing the source code to your excellent programs. I downloaded the source for trussmaster, but there does not seem to be any project file. Could you guide me to set up the project for compilation?

Comment from Wilfred Mathias
Time: 9 June, 2012, 11:21

Pls guys i try to write a vb6 program to calculate a simultanous equation with three variable pls can someone hlp me out

Comment from klark
Time: 3 August, 2012, 09:01

Based on the GUI of the program, I think ETABS were programmed using Visual Basic.
Anyone who agree with me?

Comment from Williams
Time: 15 November, 2012, 05:18

Thanks for this great sacrifice. Can help with any step by step manual on VB6.0 as am new to it. I will kindly request source codes for solving upto 10 by 10 matrixes. thanks

Comment from Risa
Time: 30 September, 2015, 14:50

Thank you so much! 🙂

Comment from Redem Legaspi
Time: 18 January, 2016, 18:56

Dr. Caprani, thank you so much for the very excellent FEBeam program. I have already written

versions of this program to run both in Microsoft Excel and SMath Studio platforms. Both are

functional and had been put to use for almost 3 years now.

However, I found a slight problem on the program; a programming bug. The program returns incorrect

results with TRAPEZOIDAL LOADING for both shear and moment diagrams. Of, course, this has also

affected the results for the REACTIONS. I’ve already made several attempts to correct the results

by modifying the program but with no success.

Below is the subroutine where the error is generated:

‘———————–

Sub Apply_TDL()
Dim i As Long
Dim q As Long
Dim tDisanp As Long
Dim tDisbnp As Long
Dim Inc As Double
Dim L2R As Boolean
Dim L_Ele As Double
Dim wL As Double
Dim wR As Double ‘Leftload and rightload of element
Dim w1 As Double
Dim w2 As Double ‘Small large load values
Dim Mmax As Double
Dim Mmin As Double ‘Big m little m
Dim Rmax As Double
Dim Rmin As Double ‘Big R little R

For i = 1 To tLn
For q = 1 To mod_nNp
If Abs(mod_X(q) – tDisa(i)) <= mod_PREC Then
tDisanp = q
End If
If Abs(mod_X(q) – tDisb(i)) <= mod_PREC Then
tDisbnp = q
If tDisanp < tDisbnp And Not tDisanp = 0 Then q = mod_nNp
End If
Next

If tLoadw1(i) <= tLoadw2(i) Then 'decides slope of tdl
L2R = True 'left rising to right
Else
L2R = False 'r 2 l
End If

Inc = (tLoadw2(i) – tLoadw1(i)) / Abs(tDisbnp – tDisanp)

For q = tDisanp To tDisbnp – 1
L_Ele = mod_L(q) 'Length of Element

wL = tLoadw1(i) + Inc * (mod_X(q) – tDisa(i))
wR = wL + Inc * L_Ele

If L2R Then 'Allocates w1 & w2
w2 = wR
w1 = wL
Else
w1 = wR
w2 = wL
End If

Mmin = (3 * w1 + 2 * w2) * L_Ele ^ 2 / 60 'absolute values
Mmax = (2 * w1 + 3 * w2) * L_Ele ^ 2 / 60 'for the applied
Rmin = (19 * w1 + 9 * w2) * L_Ele / 60 'nodal actions
Rmax = (11 * w1 + 21 * w2) * L_Ele / 60 'to be "signed"

If L2R Then
Call f_AppTof(Rmin, Mmin, Rmax, Mmax, q)
Else
Call f_AppTof(Rmax, Mmax, Rmin, Mmin, q)
End If
Next
Next
End Sub

'———————–

Comment from Redem Legaspi
Time: 12 February, 2016, 12:59

Just to add to my previous comments (see above), the ERROR on trapezoidal loading can be easily detected by applying the same trapezoidal load — two times.
..
1st time: Apply the SAME trapezoidal load with INCREASING intensity
2nd time: Apply the SAME trapezoidal load with DECREASING intensity
..
Then observe the resulting max SHEAR and max MOMENT on both conditions…
The results, regardless of the intensity orientations, should be the SAME and EQUAL.

Comment from Jijeesh
Time: 22 August, 2017, 18:26

thank you
I am also working on basic fea program for arbitrary shapes

Write a comment