FreeSRS
Info
Download













On 29.12.2009 I released the new version 1.0 of FreeSRS,which calculates the shock response spectrum (SRS) of an acceleration signal. The code is practically unchanged, I only adapted some lines in the Python code to the current Python standard, e.g. by using numpy. The algorithm used is from David O. Smallwood, see An improved recursive formula for calculating shock reponse spectra. Shock and Vibration Bulletin, No. 51, May 1981. For more background information please have a look on http://en.wikipedia.org/wiki/Shock_response_spectrum.

The code was developed on a windows machine and compiled using Python(x,y) 2.6.2 and f2py for all Python related programs. There is also a pure C++ version which I compiled using Eclipse (and mingw32). I intended to use the Fortran version together with Python, i.e. as the "fast" library. The program is very fast, time-critical parts are written in Fortran 77, which is linked to Python by f2py.

After you downloaded and unzipped the files you should have a folder freesrs containg the sub-folders

  • doc
  • src

The folder src contains sub-folders f77 and cpp.

  • Folder f77

    contains Python version and f77 library (in .pyd files)

    There are 2 modules (or libraries):

  • 'SmallwoodFilter' is auto-generated with f2py (version:2).

    Functions:

    ypp = smallwoodfilter(model,fraction,xi,omega_n,ts,t,xpp,n)

    ypp = smallwoodfilterabsaccelmodelexact(xi,omega_n,ts,t,xpp,n)

    ypp = smallwoodfilterreldisplmodelexact(xi,omega_n,ts,t,xpp,n)

    yppm = recursiveequ(b0,b1,b2,a1s,a2s,xppm,xppm1,xppm2,yppm1,yppm2)

    b0,b1,b2,a1s,a2s = absaccelmodel(xi,omega_n,ts,t)

    b0,b1,b2,a1s,a2s = reldisplmodel(xi,omega_n,ts,t)

    ypp = smallwoodfilterapp(b0,b1,b2,a1s,a2s,xpp,n)

    b0,b1,b2,a1s,a2s = absaccelmodelapprox(xi,omega_n,ts)

    b0,b1,b2,a1s,a2s = reldisplmodelapprox(xi,omega_n,ts)

  • 'GenShockTimeHistories' is auto-generated with f2py (version:2).

    Functions:

    t,a = gensquaredsinusshock(f_shock,fs,ampli,n)

    t,a = genrectangularshock(t_shock,fs,ampli,n)

    t = gentimevector(ts,n)

    noofconstlogfreq1 = noofconstlogfreq1(nfo,f1,f2)

    noofconstlogfreq2 = noofconstlogfreq2(nfo,f1,f2)

    f = compfreqconstlog(nfo,nf,f1,f2)

  • Folder cpp

    It contains the Eclipse project and the .exe files (debug and release version) compiled for windows. You may use the acc.inp file (half-sinus transient) for testing.

In general the f77 / Python version is intended for general use. There, all spectra in the time and the frequency domain are accessible to the user via the Python environment, e.g. when running ipython. This allows easy analysis of all kinds of SRS, i.e. positive, negative or primary and residual SRS. For generating the plots I used matplotlib (which is included in Python(x,y)).

The code should also run under Linux or any other OS but has to be compiled before! In folder f77 SmallwoodFilter.bat contains the f2py commands to generate the .pyd libraries (windows). Please, let me know when you compile the code for another OS that I can provide it to the community.

There might be bugs! Please report bugs to dynamicsmec.

Examples:

SRS of sinus shock:
SRS of simus shock
SRS of rectangular shock:
SRS of rectangular shock



Copyright © 2004-2009 by dynamec