Spreadsheet Hell

“I, too, am in spreadsheet hell”

Why am I linking to yet another data analysis guy whinging about Excel?

Mostly because I liked what he said on his Home sheet:

“I’m a number cruncher, SAS programmer, Linux user, and an Excel fanboy. There, I said it – and I won’t take it back. For all its flaws (and there are a few), Excel is still my pick for the best analysis tool/spreadsheet development platform out there. Hopefully I’ll be able to communicate some of my reasons for believing that here. I also will be chatting a little about free software from time to time.”

But also because there is plenty worth reading in his first few posts.

Posted in Computing - general, Excel | 1 Comment

Frame Analysis with Excel 1 – Single beam

Download Beam1.zip

This is the first of a series of posts in which I will develop a structural frame analysis program operating within Excel.  The first few stages will be mostly spreadsheet based, with later stages using VBA routines to analyse data generated in the spreadsheet, and ultimately linking to external dll programs to do the heavy number crunching involved in the solution of complex frames.

This post will look at the analysis of a single 2D beam element subject to any combination of transverse and and axial loading, with any three of the six end freedoms restrained.  This will introduce the use of the stiffness method, setting up of a beam stiffness matrix and a matrix of end actions, and solution of these matrices using the Excel matrix functions.

Future posts will:

  • Modify the beam analysis to deal with beams inclined to the global loading axes.
  • Combine and solve the stiffness matrices for a number of straight continuous beams.
  • Form and solve the stiffness matrix for a simple 2D frame.
  • Convert the spreadsheet solution to a VBA routine suitable for solving large and complex 2D problems.
  • Add provision for members with end moment or translational releases.
  • Convert to 3D frames.
  • Add provision for plotting of frame geometry, including applied loads, and plotting of analysis results.
  • Convert the VBA analysis routines to a Fortran DLL, for improved performance.

As always, all the files presented here will be available for download, and all my code will be open source.  In addition to Internet resources, which will be referenced where applicable, the main sources of background information are:

The essence of the “stiffness” method of frame analysis is to set up a series of equations:

Kw = f

where K is a square matrix representing the “stiffness” of the frame, that is the deflection of the frame when subject to unit load; w is a column matrix representing the deflections of each node of the frame; and is a column matrix representing the loads applied to the nodes of the frame.

If K and f can be generated for any specified frame subject to a known set of loads, the deflections of each node can be found using the relationship:

w =K-1 f

In this post the “frame” will consist of a single horizontal beam, and the matrices will be formed and solved on the spreadsheet, with the aid of a User Defined Function (UDF) to generate the applied nodal loads from the specified distributed and point loads and moments, that may be applied to any part of the beam.

The required input is shown in the screen shot below:

  • Beam length
  • Beam cross sectional area
  • Beam second moment of area
  • Beam Young’s Modulus
  • Applied loads: distributed transverse loads, point transverse or longitudinal loads, and point moments
  • Restrained end freedoms, three of vertical or horizontal deflection or rotation at either end
Beam properties and applied loads

Beam properties and applied loads

The nodal actions required for the analysis are the “fixed end” moments and reactions due to the applied loading, that is the end moments and reactions forces that would be generated by the applied loads if the ends of the beam were fully fixed against rotation and translation.  These are calculated by the UDF “FEMACT()”, which has as inputs the beam length, and the thre tables: distributed loads, point loads, and moments.  This UDF will be described in greater detail in a later post.  The output of the UDF is shown in the screen shot below:

beam2

The formation of the beam stiffness matrix, and the matrix coefficients for the example beam are shown in the screen shot below.  The beam stiffness matrix coefficients are derived from the standard beam slope deflection equations, combined with the application of Hooke’s law for axial loads.  Further details of the derivation are given in many structural analysis textbooks.

beam3

For the purposes of finding the magnitude of the unrestrained freedoms the beam stiffness matrix is reduced to 3×3 by extracting only the rows and columns related to the unrestrained freedoms, as shown in the screen shot below.  This matrix is then inverted, using the Excel Minverse function, then multiplied by the applied loads at the unrestrained nodes, using the Mmult function.  The result is a column of 3 cells giving the translations or rotations at the unrestrained nodes.  The final stage is to multiply the full original stiffness matrix by the full deflection column matrix to derive the nett force at each node.  The reactions at each node are then found by deducting the applied loads (i.e. the “fixed end” actions”).  It can be seen from the example output that the reactions at the unrestrained nodes are zero, and the reactions at the fixed nodes are equal and opposite to the applied loads, as would be expected.

Inverted stiffness matrix and analysis results

Inverted stiffness matrix and analysis results

Posted in Excel, Finite Element Analysis, Frame Analysis, Newton, UDFs, Uncategorized | Tagged , , , | 14 Comments

Apple Numbers 09

A review of the new Apple spreadsheet, with an emphasis on engineering applications, from the “Engineering for the Real World” blog.

I don’t think I’ll be changing any time soon, but for Mac users familiar with Apple Script it looks like it would be well worth a look.

Posted in Computing - general | Leave a comment

Lotus Day

As well as being Australia Day, January 26th is also the anniversary of the first release of Lotus 123 (for my younger readers, “Lotus” is what we used to call spreadsheets, before they became “Excel”). Lotus 123 is now 26, and still going.

This news was brought to you via John Walkenbach’s Blog which includes a screenshot, which appears to be Release 3, but other than the 3 on the end of the file extension, and the worksheet letter on the front of the cell address, looks identical to the original release.  It may not be pretty, but the functionality made the bigest change to the way engineering calculations are made and presented since the introduction of the scientific calculator (The Hewlett Packard HP-45 was released 10 years earlier, if I remember correctly).

Evidence that 123 is still not totally defunct:  The IBM Lotus Forum

Another blogger with fond memories of the spreadsheet before Excel

Posted in Computing - general | Leave a comment

Repeating a set of data

The Microsoft Excel Blog has a discussion on ways of repeating a set of data, for instance making three copies of every row of a range of data.  I have written a simple UDF to do this job, and also extract specified rows or columns, or rows or columns at a specified spacing. 

Download IndexA.zip

Note that this is an array function, and must be entered with the usual array function procedure:

  • Enter the function in the top left cell.
  • Select the range to be covered by the function.
  • Press F2
  • Press Ctrl-Shift-Enter

For example:

 

indexa1

 

indexa2

 

 

indexa3

 

indexa4

 

Posted in Arrays, Excel, UDFs, VBA | 1 Comment