Data Analysis Experimental Methods in Marine Hydrodynamics Lecture in week 36 Objectives of this lecture: • Give you an overview of the most important methods of data analysis in use in experimental marine hydrodynamics • Give some examples of how to do data analysis using Matlab Covers Chapter 10 in the lecture notes 1 Contents • Typical types of tests: – – – – • • • • 1. 2. 3. 4. Static tests Decay tests Regular wave tests Irregular wave tests Filtering Spectral Analysis Statistical Analysis Special analyses: – Slamming – Ventilation and air injection to waterjets – Sea sickness incidence 2 Static tests • Tests expected to give a constant measured value – Example: Ship resistance, propulsion and open water tests • Only the mean value is of interest • Take care to avoid transient effects at start-up • Notice that even for tests of stationary phenomena like ship resistance in calm water, there will be oscillations in the signal – To create a reliable average at least ten oscillations should be included in the time window 140 2 RTm 1.98 Speed 130 Model Resistance R 110 1.92 100 1.9 1.88 90 1.86 80 1.84 70 1.82 60 3 1.8 10 Transient part 15 20 Stationary part 25 Tim e [s e conds ] 30 35 40 Carriage speed [m/s] 1.94 Tm [N] 1.96 120 Decay Tests • • • Model is oscillated and then released, and response is measured Provides information about natural period and linear and quadratic damping terms Very useful for lightly damped systems – Well suited: Natural period and damping in roll – Difficult, but possible: pitch – Close to impossible: heave 4 Logaritmic decrement: ln( xi ) xi1 Analysis of decay tests The damping ratio: p p pcr 2 M 0 For low damping ratios (<0.2): 2 The logarithmic decrement: ln( 5 xi ) xi 1 Equivalent damping: 2C pEQ 2 M 0 0 Alternative analysis of decay tests - fitting of equivalent theoretical system 7 6 5 http://www.ivt.ntnu.no/imt/courses/tmr7/resources/decay.pdf 4 3 Response 2 1 0 -1 -2 -3 -4 -5 6 -6 40 50 60 Time [s] 70 80 Filtering • Low-pass filtering with hardware filter in experiment – To remove Nyquist-phenomena (down-folding) – Filter-frequency: lower than half the sampling frequency • Additional filtering may be applied in analysis. Purposes: – Remove noise: • High-frequent noise: Low-pass filter • Noise at particular frequencies: Notch-filter, Low-pass – Remove low-frequent and constant values • High-pass or band-pass 7 Amplitude Filters Ideal characteristic Real characteristic Low pass filter High pass filter Band pass filter Frequency 8 "Notch" filter Real-time filters influences the phase of the signal! • An actual filter alters both the magnitude and the phase of the signal, but not its frequency Filtered signals to be compared with respect to phase should be filtered with the same filter (type and setting) From ”Measurement and Data Analysis for Engineering and Science” by P.F. Dunn 9 Understanding filtering Asymmetric filtering (used in real-time) phase lag 2.5 2 Averaging window 1.5 1 0.5 0 -0.5 0 10 20 30 40 50 60 70 80 90 100 -1 -1.5 -2 -2.5 Symmetric filtering (can only be used after the test) no phase lag Averaging window 2.5 2 1.5 1 0.5 0 -0.5 0 10 20 30 40 50 60 70 -1 -1.5 -2 -2.5 12 Now! 80 90 100 Data acquisition without filtering • It is OK to do data acquisition without filtering as long as there is virtually no signal above half the sampling frequency – so the noise is not folded down into the frequency range of interest • Requires high sampling frequency – (>100 Hz, depending on noise sources) • Requires knowledge of noise in unfiltered signal – Spectral analysis, use of oscilloscope • Unfiltered data acquisition eliminates the filter as error source, and eliminates the problem of phase shift due to filtering – Drawbacks: • Must have good control of high-frequency noise • High sampling frequency means large data files 13 Data acquisition with filtering • The phase shift is only a problem if channels with filtering is compared to channels without filtering, or with different filtering • Phase-shift problems frequently occur when digital and analog sensors are combined (since digital sensors can’t be filtered using the conventional analog hardware filters) • Phase-shift problems might also occur when one is sampling different sensors with different frequency (since filter frequency is usually selected dependant on sampling frequency) 14 Filtering as part of the analysis • Filters are applied to the digital signals – No special hardware is required – One can play around with different filter settings to obtain the optimum result • Symmetric1 filters might be applied – No phase shift problems • Note that even if symmetric filters are used so phase shift is avoided, there might still be attenuation of the signal at other frequencies than the filter frequency 1What 15 we call symmetric filters are called ‘Anti-Causal Zero-phase Filter’ in Matlab Filtering in Matlab From Matlab help – signal processing toolbox: • Many options! • Signal Processing Toolbox contains a large number of relevant time-series analysis tools, including filters • The tstool time series analysis tool also offers filtering • Use Matlab help! 16 Aims of analysis of regular wave tests • Response amplitude • Response amplitude operator (divide by wave amplitude) • Phase angle (between wave at reference location and response) • Response frequencies – In non-linear systems you often get response at other frequencies than the excitation (wave) frequency • Take care to leave out transient response at the start of the time series! 17 Analysis methods of regular wave tests • ”Visual” analysis of time series – – – – • Needs nice, noise-free signals (can be obtained by filtering) Work-intensive Not very accurate, especially phase Gives good understanding and overview of the results Fourier series analysis – Gives amplitude and phase of the response at the specified (or measured) wave frequency (and higher harmonics of the wave frequency) • Least-squares fit to measured signal of a sum of harmonic components with different phase and frequency – Novel technique – Suitable for time-series of relatively short durations (few oscillations) • Spectral analysis – Gives information about frequency distribution of response – Not suitable method to get response amplitudes • 18 Estimate the amplitude from the standard deviation: amp 2 st.dev Example of accuracy of estimating amplitude from st.dev. in regular waves 3.5 3 2.5 2 1.5 1 0.5 0 8002 19 8004 8006 8000 8002 sqrt(2)*stdev(Waveheight 1) sqrt(2)*stdev(Acc1_FP) RAO Acc1_FP sqrt(2)*stdev 8005 8001 8002 8003 Fourier analysis Waveheight 1 Fourier analysis Acc1_FP1 RAO Acc1_FP Fourier 8006 20 21 Regular Wave 8002, H=1.3 m, T=6 s (spec) 22 Fourier Analysis • A periodic signal can be fully described by an infinite sum of harmonic components: 2 t 4 t f (t ) a0 a1 cos a cos Fourier series: 2 T T 2 t 4 t b1 sin b sin 2 T T 2 kt 2 kt f (t ) a0 ak cos b sin k T T k 1 In compact notation: T 1 a0 f (t )dt T 0 2 2 kt ak f (t ) cos dt T 0 T T With coefficients defined as: 23 2 2 kt bk f (t ) sin dt T 0 T T Fourier analysis of regular waves • The primary period T of the signal is determined: – Automatically from the frequency of maximum energy of the signal – Manually (for instance specified as input wave period) – Automatically from the frequency of maximum energy of a reference signal (for instance a wave probe) 2 kt 2 kt f (t ) a0 ak cos b sin k T T k 1 Output from MARINTEK in-house time-series analysis system: • Mean value, amplitude and phase of the primary period and higher harmonics are determined by Fourier analysis 24 About Fourier series models in Matlab • To fit a Fourier Series to a time series: 1. 2. 3. 4. 25 Create a new time series containing just the relevant window Open the Curve Fitting Toolbox (>> cftool) Choose Fourier from the model type list. Use Fit Options to control the fit. Choosing window Full time series of vertical acceleration Create new arrays for time and acceleration with just the needed data: 4 Range of stable response 3 2 >> Time_tr=Time(9302:12890); >> Acc1_FP_tr=Acc1_FP(9302:12890); X: 1.289e+04 Y: 2.389 1 0 -1 3 -2 2 -3 -4 1 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 0 -1 -2 26 -3 0 500 1000 1500 2000 2500 3000 3500 4000 Invoke the curve fitting tool >>cftool 27 Fourier Integral • When T in the Fourier Series the Fourier Integral is obtained In compact notation: f (t ) A( ) cos t B( ) sin t d 0 A( ) With coefficients defined as: B( ) 1 1 f (t ) cos t dt f (t ) sin t dt Note that T means that the signal no longer needs to be periodic! 28 The Fourier series is applicable only to periodic signals, while the general Fourier Integral (Fourier Analysis) is applicable also to non-periodic signals Fourier integral in compact, complex form A more compact form of the Fourier integral: With the Fourier transform of f(t): 29 1 f (t ) 2 ˆf ( ) 1 2 fˆ ( )eit d f (t )e it dt Discrete Fourier Transform (DFT) • Typically, the values of f(t) are sampled at equally spaced points (constant sampling interval) • The DFT of a signal f with n components will be: 1 fˆn N N 1 fe k 0 i(2 n k N ) k • DFT requires O(N2) operations in the computer 30 Fast Fourier Transform FFT • FFT is a computer algorithm for calculation of the complex Fourier integrals (in discrete form) • Conventional Discrete Fourier Transform (DFT) can also be implemented in a computer – DFT requires n2 multiplications – FFT requires n·log(n) multiplications – FFT is more accurate (due to fewer multiplications) • FFT is a core function of all digital data analysis 31 Matlab: use functions Y=fft(x) and y=ifft(X) to compute the Fourier and inverse Fourier transforms using the FFT algorithm. See fft and/or Fourier transform in Matlab help for (a lot) more info Irregular wave tests • Direct representation of the full scale sea condition • Typically wanted results: – Response spectra – Response spectrum parameters: • Spectral moments • Standard deviation • Peak period – Response amplitude operator (RAO) – Statistical results: • Max and min values, • Information about statistical distribution • Extreme value statistics (extrapolation using the statistical distribution) • Weibull plots etc. 32 Properties of stochastic processes • Stationary: - Statistical properties constant with time • Homogeneous: - Statistical properties constant in space • Ergodic: - Time can be replaced by space as primary variable without changing the statistical properties • The wave environment is commonly assumed to be a stationary, ergodic process • This assumption greatly simplifies the analysis, and is a necessity for all established analysis methods • 33 It is not exactly true in the towing tank – wave amplitude tends to decrease with distance from the wave maker, due to viscous damping The stochastic wave process in the laboratory • • The wave maker produces a stationary wave output Viscous damping means that the wave amplitude will decrease with distance from the wave maker – Might be of some significance, but only for long towing tanks and small waves • Dissipation increases with distance from wave maker – means that part of the energy at one frequency will dissipate to nearby frequencies – Regular waves are no longer completely regular • Wave reflections (from models and tank walls) introduces nonstationary and non-homogeneous effects – Important to have a minimum of wave reflections 34 Autocorrelation function Limit 1 T Rxx ( ) x(t ) x(t )dt T T 0 is the standard deviation and m is the average value 35 Figures from Newland (1984) Cross-correlation function Limit 1 T Rxy ( ) x(t ) y (t )dt T T 0 Cross-correlation function for two sine waves with y(t) lagging x(t) by an angle 36 Figures from Newland (1984) Spectral Analysis • A stationary random process is not periodic – We cannot use Fourier analysis directly to obtain information about frequency distribution • The frequency distribution of a stationary random process is determined by Fourier analysis of the autocorrelation function: S xx ( ) R xx ( )e ( i ) d where 37 Limit 1 T Rxx ( ) x(t ) x(t )dt T T 0 Cross Spectral Analysis • The cross spectrum is found by Fourier analysis of the cross-correlation function: S xy ( ) Rxy ( )e( i ) d • The linear complex transfer function is the ratio between spectrum and cross-spectrum: S xy ( ) H ( ) S xx ( ) 38 The Response Amplitude Operator RAO: H ( ) 2 39 S yy ( ) S xx ( ) Meaning of spectral moments • The n’th moments of the spectrum is defined as: mn n S ( )d 0 • Standard deviation of response: m0 • Significant value of response: • Average period of response: • Average zero crossing period : 40 x1 3 4 m0 m0 T1 m1 m0 T2 m2 Output from MARINTEK batch-oriented Time Series analysis system (timsas) 41 42 Statistical distributions • The probability distribution function, P(x), is the probability that a general value of the process x(t) is less than or equal to the value of x P ( x ) P ( x (t ) x) dP ( x) p( x) dx • The probability density function: • The probability that a<x(t)<b is given by the probability density function such that: b P ( a x(t ) b) p ( x) dx 43 a Probability distributions used in the study of wave generated responses • The distribution of the process itself, e.g. the distribution of the wave elevation x(t) and the measured response y(t) Gaussian distribution • The distribution of amplitudes; e.g. distribution of the wave amplitudes xA and measured response amplitudes, yA in the tests. Rayleigh distribution 44 Rayleigh distribution of amplitudes • Follows from the assumption that the elevation itself is Gaussian 1 x 2 X • The cumulative distribution: P( x) 1 exp 2 X • Here is the mean or expected value of x(t) defined as: X E x xp( x)dx • is the variance of x(t), defined as: 2 X2 E x X E x 2 X 2 45 Rayleigh distribution • For a measured time series with N samples the mean value and the variance are calculated as: 1 X N N x i 1 i N 1 ( xi X ) X2 N 1 i 1 46 Non-linear response • The response y(t) follows a Rayleigh distribution only if it is a linear function of the wave elevation x(t) • To describe non-linear response it is common to use the more general Weibull distribution: 1 x A X G P ( x A ) 1 exp G – G=2 gives the Rayleigh distribution – G=1 gives the Exponential distribution 47 Weibull plots P(xA)-axis plotted as ln ln1 P(x A ) Horisontal axis: response amplitude yA 48 Horisontal axis: response amplitude yA Significant values • Significant maxima: – the mean of the highest one-third of the crest-to-zero values of xA, • Significant minima: – the mean of the highest one-third of the trough-to-zero values of xA, • Significant double amplitude: – mean of the highest one-third of the maximum to minimum values of xA 49 Maximum/Minimum Values • Maximum Value: – Measured maximum value in the record • Minimum Value: – Measured minimum value in the record • Largest double amplitude: – Largest measured crest to trough value in the record 50 Skewness • The Skewness is defined as the third central moment of the m process: 1 E ( x X )3 33 X • The skewness provide an indication of the degree of asymmetry in the probability distribution about the mean value. • For a Gaussian distribution the skewness will therefore be zero • Skewness is nonzero for a Rayleigh distribution. 51 Kurtosis • The Kurtosis is defined as: 2 E ( x X )4 3 m4 X 4 3 • The Kurtosis is zero for a Gaussian process 52 Example of statistical analysis results 53 Examples of special analyses: • Slamming • Ventilation and air injection to waterjets • Sea sickness incidence 54 Slamming analysis • Definition of slamming threshold value(s) – Typically 50 kPa, but depends heavily on context • Counting (automatically) the number of slams above different threshold levels • Detailed analysis of the time series of each slam reveals properties of the slam, the transducer and the model dynamic response 55 56 Air suction to waterjets Propulsion test, Seastate 5 (Hs=2.4 m) Torque, Starboard jet [Nm] 12 10 Limit for air suction 8 6 4 2 0 57 5.115 10.230 15.345 Time [seconds] 20.460 Analysis of air suction to waterjets • Number of occurrences, given in groups as percentage of nominal torque value. 58 GUIDE RAIL CABIN NBDL ROLL AXIS TILT TABLE + PITCH AXIS MOVING Sea sickness incidence A-FRAME HEAVE GUIDE RAIL • Estimation of sea sickness incidence is based on: – Measurement of motions and accelerations of the model/ship – Measurement of motion sickness incidence MSI (percentage of people vomiting) to vertical accelerations of different frequency, amplitude and duration • Empirical relations of motion sickness incidence (MSI) as function of frequency, RMS amplitude, and duration available in ISO standard ISO 2631 1-4 59 60 Summary • How to analyze decay tests • The difference between analog real-time and digital filtering in analysis – the phase-shift of analog filtering can be avoided when filtering in the analysis • Short summary of the essentials of Fourier analysis – Fourier series to analyze periodic signals (regular waves) – Discretized Fourier integral to analyze an irregular wave response • Information about specialized analyses: – Slamming – Air suction to waterjets – Sea sickness 61 Some tips on data analysis in Matlab • Import time series into Matlab – Mat-files can be opened directly – Binary files from Catman can be imported using catman_read.m – It is also possible to read Excel-files and various ASCII file formats – see Matlab help • tstool is a graphical user interface for working with time series – The same methods can be applied from the command line – Code can be generated by tstool to automate the process – Suitable for generating time series plots, filtering, statistics, plotting of spectra etc. • Curvefitting tools, including Fourier Series fitting, is collected in the cftool GUI • Use Matlab help 62