Mission Synthesis test labs results does not match my code from Matlab. Using test labs to verify the formulation and my code.
Show older comments
Hi All!
I am using test labs mission synthesis to verify the formulation and my code for fatigue damage spectruma analysis. I am having issues with replicating the final result even though I provide the same inputs. I am trying to find the fatigue damage spectrum of an SDOF model with a natural frequency range of 5 Hz to 100 Hz in 1 Hz increments. The SDOF model and calculation properties are A = 1 Pa; K = 1 Pa/m; Damping ratio = 5%; b = 5; Extrema probability density function = Rayliegh; T = 3600 seconds.
My input is NOT a time series but an acceleration PSD. [G^2/HZ]. It is loglog interpolated between the breakpoints. Here are the breakpoints:
Freq = [5 22 47 100] (Hz)
PSD = [0.0492 0.182 0.0565 0.1218] (g^2/hz)
from mission synthesis, the max damage on my FDS is 0.000296 or 2.9e-4 at 6 hz.
from matlab, the max damage on my FDS is 0.000793147 or 7.9315e-4 at 6hz. FDS variable is D_Total
my matlab code follows the formulation from equation 7 of this article from tom irvine
I have tried the correction factors from that article and none seem to match as well.
here is my code for reference:
clear;
clc;
close all;
%% Step 1: Vibration Profile
% [g^2/Hz]
freq = [5 22 47 100 ];
PSD = [0.0492 0.182 0.0565 0.1218 ];
% Interpolate between points by 1 Hz
f_interp = freq(1):1:freq(end);
PSD_interp = 10.^interp1(log10(freq),log10(PSD),log10(f_interp),'linear');
freq = f_interp;
PSD = PSD_interp;
% Convert from g^2/Hz to (m/s^2)^2/Hz
PSD = PSD.*9.81.^2;
%% Step 2: Input SDOF Model parameters*
% Damping ratio and corresponding Quality factor
dp = 0.05; Q = 1/(2*dp);
% SDOF Natural Frequency(s) [Hz]
f_n = 5:1:100;
% Pre-allocate Arrays
fn_size = size(f_n);
D_total_array = zeros(fn_size);
x_rms_Array = zeros(fn_size);
x_rms_Array_app2 = zeros(fn_size);
for j = 1:fn_size(1,2)
%% Step 3: Acceleration PSD to Displacement PSD
% Transfer function [s^2]
r = freq./f_n(j);
TF = 1 ./((2*pi*f_n(j)).^2 .*sqrt((1-r.^2).^2 + (2*dp*r).^2) );
% Convert to Displacement PSD [(m^2/Hz)]
DPSD = (abs(TF).^2).*PSD;
%% Step 4: Spectral Moments, Displacement RMS, Total peaks and Peak Rate
%% Step 4a: Calculate moments
% Define moments of DPSD
m0 = trapz(freq,DPSD); %[m^2]
m1 = trapz(freq,freq.*DPSD); %[Hz*m^2]
m2 = trapz(freq,freq.^2.*DPSD); %[Hz^2*m^2]
m3 = trapz(freq,freq.^3.*DPSD); %[Hz^3*m^2]
m4 = trapz(freq,freq.^4.*DPSD); %[Hz^4*m^2]
%% Step 4b: Input duration of test in seconds*
% Duration [seconds]
T = 3600; %[s]
%% Step 4c: Use moments and input duration to determine Displacement RMS, Total peaks and Peak Rate
% Define displacement RMS [m]
x_rms = sqrt(m0);
% Define rate of zero amplitude crossings [Hz] or [cycles/sec]
vo = sqrt(m2/m0);
% Define peak rate [Hz] or [cycles/sec]
vp = sqrt(m4/m2);
% Define Total Peaks [cycles]
N_peaks = vp*T;
% Define Total number of zero crossings[cycles]
N_zc = vo*T;
% Define irregularity factor [ul]
alpha_2 = m2./sqrt(m0.*m4);
%% Step 5: Apply Hookes Law
%% Step 5a: Input Material Constant*
% Define Material Constant, K [Pa/m] or [(N/m^2)/m]
K = 1;
%% Step 5b: Stress equation
% Hooke's law equation [Pa] or [N/m^2]
sigma_S = K.*x_rms;
%% Step 6: Apply S-N curve Equation to find cycles to Failure
%% Step 6a: Input Wohler terms A and b
% Wohler term A [Pa] or [N/m^2]
A_woh = 1;
% Wohler term b [ul]
b_woh = 5;
%% Step 6b: Solve Wohler equation
% Number of cycles to failure equation
%Nf = A_woh.*sigma_S.^(-b_woh);
D_total = (N_zc ./ A_woh).*((sqrt(2.).*sigma_S).^b_woh) .*gamma(b_woh./2 + 1);
D_total_array(j) = D_total;
if f_n(j) == 6
fprintf('fn=%g\n',f_n(j))
fprintf('vo=%g\n',vo)
fprintf('vp=%g\n',vp)
fprintf('alpha=%g\n',alpha_2)
end
end
figure(1)
semilogx(f_n,D_total_array,'LineWidth',2)
ax = gca;
ax.XScale = 'log'; % Optional, matches your screenshot
ax.YScale = 'linear';
yticks(0:1e-4:11e-4)
ytickformat('%.2E')
ylim([1e-30 11e-4])
grid on
xlabel('Natural Frequency (Hz)')
ylabel('Damage')
hold on
Answers (1)
1 Hz integration grid is much too coarse for a 5% damped SDOF, especially at a natural frequency of 6 Hz.
%% Step 1: Define the input acceleration PSD
freq_bp = [5, 22, 47, 100];
PSD_bp_g = [0.0492, 0.182, 0.0565, 0.1218];
% Standard gravitational acceleration [m/s^2]
g0 = 9.80665;
%% Step 2: Create a fine frequency grid for numerical integration
% This is the integration frequency spacing, not the FDS output spacing.
df = 0.001;
freq = freq_bp(1):df:freq_bp(end);
% Log-log interpolation of the acceleration PSD
PSD_g = 10.^interp1(log10(freq_bp), log10(PSD_bp_g), log10(freq), 'linear');
% Convert from g^2/Hz to (m/s^2)^2/Hz
PSD_accel = PSD_g .* g0^2;
%% Step 3: Define the SDOF model and fatigue properties
% Damping ratio
zeta = 0.05;
% Natural frequencies where the FDS will be calculated
f_n = 5:1:100;
% Test duration [seconds]
T = 3600;
% Stress-to-displacement coefficient [Pa/m]
K = 1;
% Wohler curve parameters
A_woh = 1;
b_woh = 5;
%% Step 4: Pre-allocate result arrays
D_Total = zeros(size(f_n));
x_rms_Array = zeros(size(f_n));
nu0_Array = zeros(size(f_n));
nup_Array = zeros(size(f_n));
alpha2_Array = zeros(size(f_n));
%% Step 5: Calculate fatigue damage at each natural frequency
for j = 1:numel(f_n)
fn = f_n(j);
% Frequency ratio
r = freq ./ fn;
% Squared magnitude of the transfer function from
% base acceleration to relative displacement
H2 = 1 ./ ((2*pi*fn)^4 .* ((1 - r.^2).^2 + (2*zeta*r).^2));
% Relative displacement response PSD [m^2/Hz]
DPSD = H2 .* PSD_accel;
%% Calculate spectral moments using frequency in Hz
m0 = trapz(freq, DPSD);
m1 = trapz(freq, freq .* DPSD);
m2 = trapz(freq, freq.^2 .* DPSD);
m3 = trapz(freq, freq.^3 .* DPSD);
m4 = trapz(freq, freq.^4 .* DPSD);
% Relative displacement RMS [m]
x_rms = sqrt(m0);
% Mean positive zero-crossing rate [cycles/second]
nu0 = sqrt(m2 ./ m0);
% Mean peak rate [peaks/second]
nup = sqrt(m4 ./ m2);
% Irregularity factor
alpha2 = m2 ./ sqrt(m0 .* m4);
%% Convert displacement RMS to stress RMS
sigma_rms = K .* x_rms;
%% Calculate narrowband Rayleigh fatigue damage
D_NB = (nu0 .* T ./ A_woh) .* (sqrt(2) .* sigma_rms).^b_woh .* gamma(1 + b_woh ./ 2);
%% Store results
D_Total(j) = D_NB;
x_rms_Array(j) = x_rms;
nu0_Array(j) = nu0;
nup_Array(j) = nup;
alpha2_Array(j) = alpha2;
end
%% Step 6: Report the maximum damage
[D_max, index_max] = max(D_Total);
fprintf('Maximum narrowband damage = %.10e\n', D_max);
fprintf('Natural frequency at maximum damage = %.1f Hz\n', f_n(index_max));
%% Step 7: Report detailed results at 6 Hz
index_6Hz = find(f_n == 6, 1);
fprintf('\nResults at fn = 6 Hz\n');
fprintf('Displacement RMS = %.10e m\n', x_rms_Array(index_6Hz));
fprintf('Zero-crossing rate = %.10f Hz\n', nu0_Array(index_6Hz));
fprintf('Peak rate = %.10f Hz\n', nup_Array(index_6Hz));
fprintf('Irregularity factor = %.10f\n', alpha2_Array(index_6Hz));
fprintf('Narrowband damage = %.10e\n', D_Total(index_6Hz));
%% Step 8: Plot the fatigue damage spectrum
figure;
semilogx(f_n, D_Total, 'LineWidth', 2);
grid on;
xlabel('Natural Frequency [Hz]');
ylabel('Damage');
title('Narrowband Fatigue Damage Spectrum');
ax = gca;
ax.XScale = 'log';
ax.YScale = 'linear';
xlim([min(f_n), max(f_n)]);
Categories
Find more on Spectral Estimation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!