Frame4; now with added Alglib

Edit 29 Nov 2012: I have now added an xls version to the download zip file.  This also has a much smaller example model, which will solve quickly using the VBA solver, so will be more useable for anyone having problems with the Alglib solver.

The compiled matrix functions featured in recent posts (Compiled Matrix Functions for Excel; Using Regasm.exe), have now been incorporated into the Frame4 spreadsheet (Download here), and also Frame4Buckle (Download here).  Both spreadsheets include full open-source code, and the Frame4 download also includes the necessary interface files (ALMatrixLib.tlb and ALMatrixLib.dll), and the AlgLib dll file (Alglibnet2.dll).  Step by step installation instructions are given below; see the previous posts for some shortcuts, and details of how to compile the program yourself (not necessary, unless you want to modify the code, or just follow the process).

Installation:

  • Copy the files: ALMatrixLib.dll, ALMatrixLib.tlb, and alglibnet2.dll to your C:\Windows\System32\ folder.
  • Copy the spreadsheet files to any convenient directory.
  • Click on “Start” (bottom left)-Computer and find the latest Microsoft.NET\Framework folder.  On my machine this is at C:\Windows\Microsoft.NET\Framework\v4.0.30319
  • Right click on the final folder name (at the top of the window) and select “copy address as text”
  • Click on “Start” and enter cmd in the search box
  • Right click on the cmd icon under Programs(1) and select Run as Administrator
  • It is necesary to move to the folder containing the Regasm.exe file. In the command line window enter:  CD space , right click and paste the folder path name.
  • Ensure that you are in the correct folder then enter:
    regasm /codebase C:\Windows\System32\ALMatrixLib.dll /tlb
    (with path amended as required) or copy this line and right click at the command prompt to paste it.
  • Check that there is no error message.  If there is, check the spelling of the command and that you opened the cmd window “as administrator”.
  • If there is no error, close the command prompt window.
  • Open any of the three downloaded spreadsheets and check if the Alglib functions are working.  If not:
  • Press Alt-F11 to open the Visual Basic editor window.
  • Select Tools-References-Browse, go to \Windows\System32 and select ALMatrixLib.tlb.
  • Return to the spreadsheet, which should now work correctly.
  • This process should only be necessary once.
  • Any problems, let me know.

The new code gives a respectable improvement in performance; how much? – see below:

Speed increase with compiled solver; 2500x

To use the compiled code ensure that the necessary files are installed then simply click the “Use Alglib Sparse Solver” check-box as shown below.  Note that if the Alglib routines are not properly installed the solver will automatically revert to the VBA routine, and the check box will automatically de-select.

Frame4 Output sheet with Alglib Sparse Solver checkbox

The screenshots below show the frame included with the download spreadsheet, and an example of bending moment diagrams plotted for selected beams.

Example analysis deflected shape plot

Bending moment diagrams for selected beams

This entry was posted in AlgLib, Beam Bending, Excel, Finite Element Analysis, Frame Analysis, Link to dll, Newton, UDFs, VBA and tagged , , , , , . Bookmark the permalink.

24 Responses to Frame4; now with added Alglib

  1. George says:

    It looks like an Amazing job!
    However, I do not understand how can I install the Alglib routines.
    Are there any easy to use instructions of how to make it work?
    Thank you

    Like

    • dougaj4 says:

      George – it’s all in the two posts linked at the top, but I’ll add a complete step by step approach to make it easier to follow.

      Also I’ve just been doing some experimentation on my machine (which has 64 bit Windows 7) to check out what happens if the dll files are installed in different folders, and found some very strange behaviour (such as the files being visible in “Computer” but invisible to Visual Studio). My advice for now is don’t mess with the SysWOW64 folder (if you have one) unless you know what you are doing. I’m going to recompile the ALMatrixLib files on a 32 bit Windows, which I hope should help avoid difficulties with installation.

      Like

  2. I must say Frame4 really rocks…
    Your installation instructions are quite clear, but when I try to copy the ALMatrixLib.dll, ALMatrixLib.tlb, and alglibnet2.dll to my “System32” folder it doesn’t allows me to do this. Can I paste it in some other directory?
    I am running on windows 7 32-bit version.

    Like

    • dougaj4 says:

      Ankit – If you try to copy files to the System32 folder you should get a warning that this requires to be done “as administrator”, but if you accept that, it should work. Alternatively you can use a file manager like Total Commander, which makes the process easier (in my opinion).

      But to answer your question, I think you should be able to copy the files anywhere, as long as you give the correct full path when you go through the registration process.

      Like

  3. Ankit M. says:

    May be, then my account doesn’t have admin privileges. I will get these files copied from the system admin. Thanks for your quick reply.

    Like

  4. Julien G. says:

    Hello,
    Is there any way to use Frame4 with Excel 2003 ? Actually, I want to use a support displacement but I can’t find any release which allows this function.

    Like

    • dougaj4 says:

      Julien – I have added an xls version to the download zip file. I haven’t tested it in XL 2003, so please let me know if there are any problems.

      For support displacements, I will add this feature some time in the future, but for now probably the easiest way is to put some dummy members at the location where you want the displacement, and use the Excel Solver to adjust the stiffness to give the required displacement. Another way would be to find the displacement under unit load at each support, then find the displacement under full loading and calculate applied loads that will give the desired displacement. I’ll post some examples when I have time.

      Like

  5. Tom says:

    Hi Doug

    Thanks for the comprehensive update. I got an error when using Regasm, but the library was listed in Excel. Frame4 ran but gave a type mismatch error in Linbeam() X1 = DLoads(j, 1) where
    DLoads(j, 1) = “X”. I didn’t change any of the loads, constraints etc to do a trial run. Any ideas?

    Thanks
    Tom

    Like

    • dougaj4 says:

      Tom – I’ve adjusted the loads input in the latest version (just uploaded today) and I forgot to check the Linbeam routine. I’ll post a corrected version as soon as I can.

      Like

    • dougaj4 says:

      The latest update is now available for download, and it also fixes a few other problems. I will post a detailed description of the update in the next few days.

      Regarding registration of the dlls, the program will run even if it doesn’t find the dll and tlb files, but it will unselect the “Use Alglib Solver” box, so if the box remains selected after a run it used the Alglib solver, but if it is unchecked it used the VBA solver.

      It makes very little difference for a small model, but for a medium to large model it makes a huge difference.

      Like

  6. Tom says:

    Works like a charm, except for Alglib. Thanks

    Like

    • dougaj4 says:

      Thanks for the feedback Tom.

      Like

      • Tom says:

        Hi Doug, with the .dll and .tlb files placed the system32, I kept getting a file not found error – even with nessessary permissions in cmd. With the .dll and .tlb files placed in the Microsoft.NET\Framework\v4.0.30319 folder, I ran regasm and the registration worked fine, now Alglib solver is enabled during solving.

        Like

  7. Pingback: Frame4 Version 3.04 | Newton Excel Bach, not (just) an Excel Blog

  8. Pingback: 3DFrame – 3D Frame analysis for Excel | Newton Excel Bach, not (just) an Excel Blog

  9. Pingback: New Release Alglib Library | Newton Excel Bach, not (just) an Excel Blog

  10. Pingback: 3DFrame Ver 1.03 and Frame4 Ver 3.07 | Newton Excel Bach, not (just) an Excel Blog

  11. Ahmet says:

    While trying to install the files according to the procedure given above, it gives RegAsm error RA0000. Can anyone explain how to overcome it.

    Like

  12. soco says:

    dear sir dougaj4
    I’ve kind of lost in code and hit the wall , it’s hard to me to keep each step you ‘ve made, can u you please put explanation in the code for each step , like define the parameter and the function
    function area(A as double, B as double)as double
    area=A*B
    end function
    area is a Fun to claculate the area of rectangle
    A is the length
    B is the width

    Like

    • dougaj4 says:

      I’m afraid I don’t have time to go back and document every detail in the code. The later versions are really intended to be working applications, rather than for educational purposes anyway.
      If you want to work through the code in detail probably the best way is to look at each frame analysis related post in sequence, and I have posted a list of them today.
      If you have any specific questions please feel free to ask, but please do give as much detail as possible.

      Like

  13. Pingback: Frame Analysis with Excel | Newton Excel Bach, not (just) an Excel Blog

  14. Pingback: Using Frame4Buckle with the Alglib solver | Newton Excel Bach, not (just) an Excel Blog

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.