Scientific Bulletin of the Electrical Engineering Faculty Year 13 No. () ISSN 1843-6188 SHOCK RESPONSE SPECTRUM ANALYSER USING MATLAB SCRIPTS C. DUMITRACHE 1, N. OLARIU 1, E. LAKATOS 1, G. MANTESCU, L. OLTEANU, M. BADEA 1 VALAHIA University Targoviste, Faculty of Electrical Engineering, 18, Unirii Boulevard, 13008 Targoviste, Romania, VALAHIA University Targoviste, Energy Environment Research Department, 18, Unirii Boulevard, 13008 Targoviste, Romania E-mail: cristiandumitrache@gmail.com Abstract. We present in this article a complete arrangement, hardware and software, that enables analysis of shocks encountered in real operating conditions as well as those generated by simulation systems. The actual part of the analysis is based on Matlab scripts. After a theoretical introduction on the subject we make a detailed description of each script, its place and function in shock analysis methodology. The concept Shock Response Spectrum has been kept for historical reason, although a better term would be Maximum Response Spectrum. Our work has been accomplished through the use of digital signal acquisition systems and computerized data processing equipment. The analysis of data is therefore primarily a digital signal - processing task that use the ramp invariant method. Keywords: Shock response spectrum, Digital signal processing, Ramp invariant method. 1. INTRODUCTION The term Shock response spectrum was first introduced in 193 by M. A. Biot at California Institute of Technology, under the name Earthquake spectrum. Biot's apparatus consisted of a set of torsion pulum which simulated mechanical systems with one degree of freedom [3]. He defined the SRS (Shock Response Spectrum) as the maximum response motion from a set of single DOF oscillators covering the frequency range. After the World War, first in USA and later in Europe, the concept was used to standardize mechanical shock tests [4], [5]. In parallel, methods have evolved for obtaining this spectrum, analogue first (analogical computer and active filters) and then, numerical, with the computer (Duhamel or Laplace evaluation of convolution integral or digital filtering). After 1965, digital filtering to permit the changeover of transfer function H(s) to H(z) used either the trapezoidal method (Tustin) either the impulse invariant method. After 1980, is almost exclusively recommed the step invariance method presented by D. O. Smallwood in [].. MATHEMATICAL ASPECTS We briefly present the mathematical aspects related to the shock spectrum in [], [4], [5] and [6]. That way, the scripts, presented in the chapter that follows, will be clearer. In Figure 1 we present a single DOF mechanical system (without the influence of gravity). Figure 1. Single Degree of Freedom (DOF) System In Figure 1: mass=m; viscous damping coefficient=c; stiffness=k; absolute displacement of the mass=x; base input displacement=y. Q is the quality factor. Response acceleration: Base acceleration: d ( x ( t )) = a ( ) m t dt d dt ( yt ( )) = a ( ) 0 t c m = ξϖ n 1 Q ξ = ω = n k m Differential equation describing the system is:.. c. k c. k x+ x+ x = y+ y (1) m m m m If the mechanical system is without initially accumulated energy, the transfer function, connecting the response acceleration with base acceleration is: A () s ξϖ s+ ω H() s = = A s s s m n n 0 () + ξϖn + ωn (1 ) 10
ISSN 1843-6188 Scientific Bulletin of the Electrical Engineering Faculty Year 13 No. () For s = jω, we can plot the Bode diagram (Figure ). Where: ωn A = Q (9) 1 B = ω n 1 (10) 4 Q The next step is to find the difference equation that connects the output acceleration x ( kt ) with the input acceleration y(kt). We use Z -1 transform and the recursive formula is: x = b y + b y + b y a x a x (11) k 0 k 1 k 1 k 1 k 1 k Figure. Bode Plot for H(jω) We wish to obtain a pulse transfer function using the step invariant method []. The key is to consider that sampling the response of the continuous system with a ramp invariant method would provide the same result as a discrete sequence, applied at the entry to digital system, described by H (z). Finally: ( ) H s T z = ( ) ( z 1 ) 1 Z L H z s t= nt Here T=1/fs - sampling period. () The result is given in [1] and [] and the calculation is made by Irvine in [6]. Here is the result: b + b z + b z H(z) = (3) 1 + + 0 1 1 a1 z a z We obtain the Bode plot for pulse transfer function H (z) (digital filter), using Matlab command dbode. It is represented in Figure 3. This should be compared with Figure, corresponding to continuous case. The frequency response of the ramp invariant discrete time filter is related to the frequency response of the analog filter as described in [7]. ω sin n π + j ω T n π + H( e ) = H j ω j + T ω + n π (1) The first term in the sum leads to aliasing and the second is a systematic one (sinc distortion). His value is 8 db at the Nyquist frequency. In our paper the maximum analysis frequency is one tenth of the sampling frequency. That leads to errors less than 5%. With the coefficients for the digital filter: sin( b) b0 = 1 exp( A) B (4) sin( B) b1 = exp( A) cos( B) B (5) sin( B) b = exp( A) exp( A) (6) B Figure 3. Bode plot for H(z=e jωt ) a = exp( A) cos( ) (7) 1 B ( A) a = exp (8) 11
Scientific Bulletin of the Electrical Engineering Faculty Year 13 No. () ISSN 1843-6188 3. EXPERIMENTAL ARRANGEMENTS The experimental arrangement is represented in Figure 4. Figure 4. Experimental arrangement The first two levels are devices: the B&K piezotransducer has a resonance frequency higher than 40 khz. The charge amplifier has a flat frequency characteristic from 1Hz to 10 khz. The third level is a common sound card (Realtek) or a PC Daq Card (sampling frequency 44100 Hz). A more elaborate solution can be a digital event recorder. This arrangement is enough for shock due to transport or pyroshocks in the far region. Further we use Matlab [8]: Data Acquisition Toolbox and Signal Processing Toolbox. - Data Real Time (DRT.m): This script opens the channel for communication with the sound card and plots the real shock in time. The values are saved in DRT.mat. Here is this script: %DataRealTime (DRT.m) %In datareal is the real shock in time %The value are saved in DRT.mat and ploted = analoginput('winsound',0); chan = addchannel(,1); duration = 1; SampleRate = 44100;% due to Sound Card set(,'samplerate',samplerate); set(,'samplespertrigger',duration*samplerate); set(,'triggertype','manual'); start(); trigger(); K=100; %Scale factor for 1V=100g. datareal =getdata(); datareal=k*datareal t=1/44100:1/44100:1 %1sec. plot(t,datareal)%without t we can plot in sample title('real data versus time') xlabel('time in sec.') ylabel('aceleration in g.') save DRT.mat - Data Real Frequency (DRF.m): This is a function [9] with input parameter fs=44100-sampling frequency; Fmin - low frequency in Hz; fmax - maximum frequency in Hz; fno - number of frequency; Q - quality factor-10; This function plots the maximal shock spectrum and save this data in DRF.mat Function [datarealfreq,f] = DRF(fs,fmin,fmax,fno,Q) %SRS Max raspuns la soc cu inv. la rampa %DataRealFrequency % [datarealfreq,f] = DRF(fs,fmin,fmax,fno,Q) % y maxim este calculat % f este vectorul frecventelor masurat in Hz % fs este frecventa de esantionare in Hz-Adica=44100 %Hz (sound card) % fmin este frecventa minima in Hz % fmax este frecventa maxima in Hz % fno este numarul de frecvente % Q este facorul de calitate. Aici este 10 % In datareal data for real shock from DRT.mat load DRT.mat plot (t,datareal) %just for control pause datarealfreq = zeros(fno,1); % De aici f = zeros(fno,1); % k1 = log(fmax/fmin)/(fno-1); k = pi/q/fs; k3 = *pi/fs*sqrt(1-1/(4*q*q)); % for n = 1:fno; f0 = fmin*exp(k1*(n-1)); A = k*f0; B= k3*f0; a = [1, -*cos(b)*exp(-a), exp(-*a)]; b=[1-exp(-a)*sin(b)/b,*exp(-a)*(sin(b)/bcos(b)),exp(-*a)-exp(-a)*sin(b)/b]; % si pana aici z = filter(b,a,datareal); datarealfreq(n,1) = max(abs((z))); f(n,1) = f0; loglog(f,datarealfreq) grid title('shock Spectrum for Real Situation in log-log axes') xlabel('frequncy in Hz') ylabel('acceleration in g') save DRF.mat - Data Simulation Time (DST.m). This is a function with input arguments: AMP - amplitude in g of 1/sinus used currently for simulation and τ (in ms.) is the duration of 1/ sinus. All the values are plotted versus time and saved in DST.mat 1
ISSN 1843-6188 Scientific Bulletin of the Electrical Engineering Faculty Year 13 No. () Here is the script: Function DST = DST(AMP,tau) %DataSimulation in time % AMP is amplitude in g. % tau is 1/ sinus duration % Function DST.m to plot 1/ sinus for simulation %DataSimulationTime t=1/44100:1/44100:0*tau; k=max(size(t)); for i=1:k if((t(i)>=0)&(t(i)<=tau)) datasim(i)=amp*sin(*pi*t(i)/(*tau)); else datasim(i)=0; plot(t,datasim) title('1/sinus for simulation') xlabel('time in sec.') ylabel('acceleration in g.') save DST.mat - Data Simulation Frequency (DSF.m): This function is similar to DRF.m- with the same input arguments as DRF.m This function plot the maximal shock spectrum for 1/ sinus and save this data in DSF.mat. Here is this function: Function [datasimfreq,f] = DSF(fs,fmin,fmax,fno,Q) [datasimfreq,f] = DSF(x,fs,fmin,fmax,fno,Q,A,T) % datasimfreq maximal is calculated % f este vectorul frecventelor in Hz % datasim -input vector from DST.mat % fs este frecventa de esantionare Hz % fmin este frecventa limita de jos Hz % fmax este frecventa limita de sus Hz % fno este numarul de frecvente % Q este factorul de calitate =10 % In datasim data for half-sinus load DST.mat datasimfreq = zeros(fno,1); f = zeros(fno,1); % Inserati de aici % 11 comenzi de mai sus adica din DRF % si pana aici datasimfreq(n,1) = max(abs((z))); f(n,1) = f0; loglog(f,datasimfreq) grid title('shock Spectrum for 1/sinus A=100g, tau=11ms.') xlabel('frequency in Hz ') ylabel('acceleration in g.') save DSF.mat - Comparison (COMP.m). This is a script that use all the four.mat files and the result is a plot of both maximal shock spectrum for the real shock and for the simulation shock. Here is this script: %COMP load DST.mat load DSF.mat load DRT.mat load DRF.mat loglog(f,datarealfreq,'om',f,datasimfreq,'*r') grid title('shock Spectrum: magenta-real and red -simulation') xlabel('frequency in HZ') ylabel('acceleration in g.') % FM is the Merit Function from last squares method ind=1:1:max(size(f)); for ind=1:max(size(f)) FM(ind)=sum((datarealfreq(ind)-datasimfreq(ind)).^); FM=sqrt(sum(FM(ind)))/max(size(f)) AMPLITUDE_in_g=AMP HALF_SINUS_TIME_in_s= τ *1000 FM function, calculated similarly to the method of least squares, gives a mathematical picture of the degree of overlap of the two spectra. But it is the duty of the engineer, who knows the exact situation, to search and assess how small can be the minimum. 4. REZULTS The real shock, produced by the fall of transducer from a height of 10 cm on a wood surface, is represented in Figure 5. Here we used B&K 4367 transducer, B&K 66 charge amplifier and PC Realtek sound card and DRT.m In Figure 6 is represented the maximal Shock Spectrum for this experimental real shock (see DRF.m) In Figure 7 is represented a simulation shock -1/ sinus, with 150 g. amplitude and duration 10 ms (see DST.m). Figure 5. Real shock (see DRT.m) 13
Scientific Bulletin of the Electrical Engineering Faculty Year 13 No. () ISSN 1843-6188 Figure 6. Maximal Shock Spectrum for real shock (see DRF.m) Figure 9. The Maximal Shock Spectrum real and simulation (see COMP.m) Here FM is 5.3. Probably a better coefficient could be achieved. This is beyond the intention of our article. Farther, a good engineer must have a decision: to use for shock test real data, processed like this article (or something similar) or direct to use a norm. 5. CONCLUSIONS Figure 7. Simulation Shock in time (150g, 10 ms) (see DST.m) The Maximal Shock Spectrum (for this 1/ sinus) is represented in Figure 8 (see DSF.m) We presented in this article a complete (cheap) arrangement, experimental and software, that enables analysis of shocks encountered in real conditions as well as those generated by simulation systems. The actual part of the analysis is based on Matlab scripts and Digital Signal Processing. The analysis method is ramp invariant method and maximal shock spectrum. Finally, a real shock can be equalled with a simulation shock of form 1/ sinus with amplitude and duration predetermined. 6. REFERENCES Figure 8. Maximal Shock Spectrum for 1/ sinus -150 g, 10 ms. (see DSF.m) The last test is to compare the Spectrum via COMP.m The result is presented in Figure 9. [1] *** ISO/WD 18431-4, Mechanical vibration and shock Signal processing Part 4, Shock response spectrum analysis. [] Smallwood, David, An Improved Recursive Formula for Calculating Shock Response Spectra, 51st Shockand Vibration Bulletin, 1980. [3] M. Biot, A Mechanical Analyzer for the Prediction of Earthquake Stresses, Bulletin of the Seismological Society of America, Volume 31, Number, April 1941. [4] G. A. Piersol, T. Paez, Harris Shock and Vibration Handbook, Sixth Edition, Mc Graw Hill, 010. [5] A. Lenk, J. Rehnitz, Schwingungsprutechnik, Auflage, Veb Verlag Technik Berlin, 1976. [6] T. Irvine, Derivation of the Filter Coefficients for the Ramp Invariant Method as Applied to Base 14
ISSN 1843-6188 Scientific Bulletin of the Electrical Engineering Faculty Year 13 No. () Excitation of a Single-degree-of Freedom System, Vibration data, February, 01. [7] D. Schlichtharle, Digital Filters, Second Edition, Springer-Verlag, 011. [8] www.mathworks.com/products/matlab/ [9] K. Ahlin, Comparison of Test Specifications and Measured Field Data, Sound and Vibration, September 008. 15