/************************************************************ * Calculate the acceleration shock spectrum of a speed V(t) * * --------------------------------------------------------- * * SAMPLE RUN: * * Input speed: in file speed.dat * * Output shock spectrum in file shocksp1.txt * * * * C++ Version By J-P Moreau, Paris. * * (www.jpmoreau.fr) * ************************************************************/ #include #include int i,iordre,iordre1,ndata,nspec; FILE *fp_in, *fp_out; REAL df,dzeta,f0,fc,fc1,finf,fmax,fr,fsup,temp,temp1,ts; REAL *ACC, *VIT, *S; void *vmblock; /************************************************************ * This subroutine calculates the acceleration of the sismic * * mass of an elementary oscillator (1 degree of freedom), * * the basis of which is submitted to a given speed, VIT(t). * * The input signal VIT is digitalized with a constant time * * step, TS. The table VIT(I) contains NDATA speed values. * * --------------------------------------------------------- * * INPUTS: * * FREQU........: eigen frequency of oscillator * * VIT..........: input speed signal of basis VIT(t) * * T ...........: time step of signal (constant) * * DZETA........: reduced damping factor * * NDATA........: number of points of signal * * OUTPUT: * * ACC..........: table containing acceleration res- * * ponse of oscillator (NDATA points) * * * * C++ Version By J-P Moreau, Paris. * ************************************************************/ void OSCIL(REAL FREQU,REAL * VIT,REAL * ACC,REAL T,REAL DZETA,int NDATA) { REAL ARG,COSARG,DELTA,EXPA,GOMEGA,OMEGA,OMEGA2,SINARG; REAL Q0,Q1,Q2,QSI,R0,R1,R2,R3,XPN,XPNP1,YPN,YPPN,YPNP1,YPPNP1; int I; OMEGA= (TWO*PI*FREQU); OMEGA2=OMEGA*OMEGA; DELTA= (sqrt(ONE-DZETA*DZETA)); EXPA=(exp(-OMEGA*DZETA*T)); GOMEGA=OMEGA*DELTA; ARG=GOMEGA*T; SINARG=sin(ARG); COSARG=cos(ARG); QSI=DZETA/DELTA; Q0=(COSARG-QSI*SINARG)*EXPA; Q1=OMEGA2*SINARG/GOMEGA*EXPA; Q2=((ONE+(QSI*SINARG-COSARG)*EXPA)/T); R1=SINARG/GOMEGA*EXPA; R0=COSARG*EXPA+DZETA*OMEGA*R1; R2=((ONE-DZETA*OMEGA*T)*R1/T-COSARG*EXPA); R3= (ONE-R1/T); XPNP1=VIT[1]; YPPNP1=ZERO; YPNP1=ZERO; ACC[1]=Q2*XPNP1; for (I=2; I *CMAX) *CMAX=C[I]; if (C[I] < *CMIN) *CMIN=C[I]; } } /*------------------------------------------------------------ " ACCELERATION SHOCK SPECTRUM OF A SPEED " " Inputs: " VIT(I) speed of basis (from deconvolution or else) " DZETA relative damping factor " FMIN begin frequency of spectrum (<>0) " FMAX end frequency of spectrum (<=Nyquist) " N number of points of VIT(I) " T sampling time of speed " NFREQ number of frequencies of spectrum (<=1024) " Output: " S(I) shock spectrum (negative & positive) "------------------------------------------------------------*/ void SPEC(REAL * VIT,REAL DZETA,REAL FMIN,REAL FMAX,int N,REAL T,int NFREQ,REAL * S) { REAL DELTAF,F,YMIN,YMAX; int I; DELTAF=(FMAX-FMIN)/(NFREQ-1); //the algorithm fails if FMIN=0 if (FMIN < DELTAF) FMIN=DELTAF; for (I=1; I