Compare commits

..

No commits in common. "21abe53df051a0aa817f42db6099cc156042c170" and "1910b3bd1e99c0709d982f7c9fb3e34053070e29" have entirely different histories.

11 changed files with 58 additions and 66 deletions

Binary file not shown.

View File

@ -11,7 +11,7 @@ addpath('./src/');
%% Load measurement data for APA number 1
strut_number = 1;
% load(sprintf('mat/frf_data_exc_strut_%i_noise_lf.mat', strut_number), 't', 'Va', 'Vs', 'de');
load(sprintf('mat/iff_strut_%i_noise.mat', strut_number), 't', 'Va', 'Vs', 'de');
load(sprintf('mat/frf_data_exc_strut_%i_noise_hf.mat', strut_number), 't', 'Va', 'Vs', 'de');
% Compute transfer functions:
@ -21,7 +21,7 @@ Fs = 1/Ts;
win = hanning(ceil(1*Fs)); % Hannning Windows
%% DVF
[G_dvf, f] = tfestimate(Vexc, de, win, [], [], 1/Ts);
[G_dvf, f] = tfestimate(Va, de, win, [], [], 1/Ts);
figure;
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');

View File

@ -19,16 +19,15 @@ data = SimulinkRealTime.utils.getFileScopeData('data/data.dat').data;
de = data(:, 1:6); % Measurment displacement (encoder) [m]
Vs = data(:, 7:12); % Measured voltage (force sensor) [V]
u = data(:, 13:18); % DAC Voltage (command) [V]
Vexc = data(:, 19); % Excitation Voltage [V]
Va = data(:, 13); % Excitation Voltage [V]
t = data(:, end); % Time [s]
% And we save this to a =mat= file:
strut_number = 6;
save(sprintf('mat/iff_strut_%i_noise_g_400.mat', strut_number), 't', 'u', 'Vs', 'Vexc', 'de');
% save(sprintf('mat/frf_data_exc_strut_%i_noise_lf.mat', strut_number), 't', 'u', 'Vs', 'de');
% save(sprintf('mat/frf_data_exc_strut_%i_sweep.mat', strut_number), 't', 'u', 'Vs', 'de');
% save(sprintf('mat/iff_strut_%i_noise_hf.mat', strut_number), 't', 'u', 'Vs', 'de');
% save(sprintf('mat/frf_data_exc_strut_%i_add_mass_closed_circuit.mat', strut_number), 't', 'u', 'Vs', 'de');
% save(sprintf('mat/frf_data_exc_strut_%i_noise.mat', strut_number), 't', 'Va', 'Vs', 'de');
% save(sprintf('mat/frf_data_exc_strut_%i_noise_lf.mat', strut_number), 't', 'Va', 'Vs', 'de');
% save(sprintf('mat/frf_data_exc_strut_%i_sweep.mat', strut_number), 't', 'Va', 'Vs', 'de');
save(sprintf('mat/frf_data_exc_strut_%i_noise_hf.mat', strut_number), 't', 'Va', 'Vs', 'de');
% save(sprintf('mat/frf_data_exc_strut_%i_add_mass_closed_circuit.mat', strut_number), 't', 'Va', 'Vs', 'de');

View File

@ -16,17 +16,13 @@ Trec_dur = 100; % Recording Duration [s]
Tsim = 2*Trec_start + Trec_dur; % Simulation Time [s]
%% Security
u_min = -1;
u_max = 6;
%% Shaped Noise
V_noise = generateShapedNoise('Ts', 1/Fs, ...
'V_mean', 0, ...
't_start', Trec_start, ...
'exc_duration', Trec_dur, ...
'smooth_ends', true, ...
'V_exc', 0.05/(1 + s/2/pi/10));
'V_mean', 3.25, ...
't_start', Trec_start, ...
'exc_duration', Trec_dur, ...
'smooth_ends', true, ...
'V_exc', 0.05/(1 + s/2/pi/10));
%% Sweep Sine
gc = 0.1;
@ -37,72 +33,76 @@ wn = 2*pi*92.7;
G_sweep = 0.2*(s^2 + 2*gc*xi*wn*s + wn^2)/(s^2 + 2*xi*wn*s + wn^2);
V_sweep = generateSweepExc('Ts', Ts, ...
'f_start', 10, ...
'f_end', 400, ...
'V_mean', 0, ...
't_start', Trec_start, ...
'exc_duration', Trec_dur, ...
'sweep_type', 'log', ...
'V_exc', G_sweep*1/(1 + s/2/pi/500));
'f_start', 10, ...
'f_end', 400, ...
'V_mean', 3.25, ...
't_start', Trec_start, ...
'exc_duration', Trec_dur, ...
'sweep_type', 'log', ...
'V_exc', G_sweep*1/(1 + s/2/pi/500));
V_sweep_lf = generateSweepExc('Ts', Ts, ...
'f_start', 0.1, ...
'f_end', 10, ...
'V_mean', 0, ...
't_start', Trec_start, ...
'exc_duration', Trec_dur, ...
'sweep_type', 'log', ...
'V_exc', 0.2);
'f_start', 0.1, ...
'f_end', 10, ...
'V_mean', 3.25, ...
't_start', Trec_start, ...
'exc_duration', Trec_dur, ...
'sweep_type', 'log', ...
'V_exc', 0.2);
%% High Frequency Shaped Noise
[b,a] = cheby1(10, 2, 2*pi*[240 2e3], 'bandpass', 's');
wL = 0.005*tf(b, a);
V_noise_hf = generateShapedNoise('Ts', 1/Fs, ...
'V_mean', 0, ...
't_start', Trec_start, ...
'exc_duration', Trec_dur, ...
'smooth_ends', true, ...
'V_exc', wL);
'V_mean', 3.25, ...
't_start', Trec_start, ...
'exc_duration', Trec_dur, ...
'smooth_ends', true, ...
'V_exc', wL);
%% Low Frequency Shaped Noise
[b,a] = cheby1(10, 2, 2*pi*[10 260], 'bandpass', 's');
wL = 0.005*tf(b, a);
V_noise_lf = generateShapedNoise('Ts', 1/Fs, ...
'V_mean', 0, ...
't_start', Trec_start, ...
'exc_duration', Trec_dur, ...
'smooth_ends', true, ...
'V_exc', wL);
'V_mean', 3.25, ...
't_start', Trec_start, ...
'exc_duration', Trec_dur, ...
'smooth_ends', true, ...
'V_exc', wL);
%% Sinus excitation with increasing amplitude
V_sin = generateSinIncreasingAmpl('Ts', 1/Fs, ...
'V_mean', 0, ...
'sin_ampls', [0.1, 0.2, 0.4, 1, 2, 4], ...
'sin_period', 1, ...
'sin_num', 5, ...
't_start', Trec_start, ...
'smooth_ends', true);
'V_mean', 3.25, ...
'sin_ampls', [0.1, 0.2, 0.4, 1, 2, 4], ...
'sin_period', 1, ...
'sin_num', 5, ...
't_start', Trec_start, ...
'smooth_ends', true);
%% Zero Excitation
Trec_start = 10; % Start time for Recording [s]
Trec_dur = 10; % Recording Duration [s]
Tsim = 2*Trec_start + Trec_dur; % Simulation Time [s]
%% Offset Voltage for all APA
V_zero = generateShapedNoise('Ts', 1/Fs, ...
'V_mean', 3.25, ...
't_start', Trec_start, ...
'exc_duration', Trec_dur, ...
'smooth_ends', true, ...
'V_exc', tf(0));
'V_mean', 1.25, ...
't_start', Trec_start, ...
'exc_duration', Trec_dur, ...
'smooth_ends', true, ...
'V_exc', tf(0));
%% Select the excitation signal and offset voltage
V_exc = timeseries(V_noise(2,:), V_noise(1,:));
V_off = timeseries(V_zero(2,:), V_zero(1,:));
%% Select the excitation signal
V_exc = timeseries(V_zero(2,:), V_zero(1,:));
%% Plot
figure;
tiledlayout(1, 2, 'TileSpacing', 'Normal', 'Padding', 'None');
ax1 = nexttile;
plot(V_exc.Time, squeeze(V_exc.Data+V_off.Data));
plot(V_exc.Time, squeeze(V_exc.Data));
xlabel('Time [s]'); ylabel('Amplitude [V]');
ax2 = nexttile;

Binary file not shown.

View File

@ -9,11 +9,4 @@ Kiff_g1 = (1/(s + 2*pi*40))*... % Low pass filter (provides integral action abov
Kiff = c2d(Kiff_g1, Ts, 'tustin');
%%
save('./frf_data.mat', 'Fs', ...
'Ts', ...
'Tsim', ...
'Trec_start', ...
'Trec_dur', ...
'V_exc', ...
'V_off', ...
'Kiff');
save('./frf_data.mat', 'Fs', 'Ts', 'Tsim', 'Trec_start', 'Trec_dur', 'V_exc', 'Kiff');