/***************************************************************** * Calculate the acceleration of the sismic mass of an elementary * * oscillator (1 degree of freedom), the basis of which is submit-* * ted to a given speed, VIT(t). The input signal VIT is digitali-* * zed with a constant time step, TS. The table VIT(I) contains * * NDATA speed values. * * * * C++ Version By J-P Moreau, Paris * * (www.jpmoreau.fr) * * -------------------------------------------------------------- * * SAMPLE RUN: * * * * Read data from file speed.dat * * Write results to file response.txt. * *****************************************************************/ #include #include #include #include #include FILE *fp_in, *fp_out; REAL *ACC, *VIT; int i, NDATA; REAL dzeta, F0, FMAX, T, TBEGIN, temp, temp1, TEND, TS; 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) * * TS...........: 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