diff --git a/figs/iff_first_test_bode_plot.pdf b/figs/iff_first_test_bode_plot.pdf new file mode 100644 index 0000000..109770a Binary files /dev/null and b/figs/iff_first_test_bode_plot.pdf differ diff --git a/figs/iff_first_test_bode_plot.png b/figs/iff_first_test_bode_plot.png new file mode 100644 index 0000000..07e6a89 Binary files /dev/null and b/figs/iff_first_test_bode_plot.png differ diff --git a/figs/iff_first_test_coherence.pdf b/figs/iff_first_test_coherence.pdf new file mode 100644 index 0000000..c1e459b Binary files /dev/null and b/figs/iff_first_test_coherence.pdf differ diff --git a/figs/iff_first_test_coherence.png b/figs/iff_first_test_coherence.png new file mode 100644 index 0000000..94f5aa3 Binary files /dev/null and b/figs/iff_first_test_coherence.png differ diff --git a/index.html b/index.html index 8c471da..17c5f2b 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Test Bench APA95ML @@ -27,42 +27,49 @@

Table of Contents

@@ -70,26 +77,26 @@
-
+

setup_picture.png

Figure 1: Picture of the Setup

-
+

setup_zoom.png

Figure 2: Zoom on the APA

-
-

1 Setup

+
+

1 Setup

-
-

1.1 Parameters

+
+

1.1 Parameters

Ts = 1e-4;
@@ -98,8 +105,8 @@
 
-
-

1.2 Filter White Noise

+
+

1.2 Filter White Noise

Glpf = 1/(1 + s/2/pi/500);
@@ -111,13 +118,13 @@ Gz = c2d(Glpf, Ts, 'tustin');
 
-
-

2 Run Experiment and Save Data

+
+

2 Run Experiment and Save Data

-
-

2.1 Load Data

+
+

2.1 Load Data

data = SimulinkRealTime.utils.getFileScopeData('data/apa95ml.dat').data;
@@ -126,8 +133,8 @@ Gz = c2d(Glpf, Ts, 'tustin');
 
-
-

2.2 Save Data

+
+

2.2 Save Data

u = data(:, 1); % Input Voltage [V]
@@ -144,16 +151,16 @@ t = data(:, 3); % Time [s]
 
-
-

3 Huddle Test

+
+

3 Huddle Test

-
-

3.1 Time Domain Data

+
+

3.1 Time Domain Data

-
+

huddle_test_time_domain.png

Figure 3: Measurement of the Mass displacement during Huddle Test

@@ -161,8 +168,8 @@ t = data(:, 3); % Time [s]
-
-

3.2 PSD of Measurement Noise

+
+

3.2 PSD of Measurement Noise

Ts = t(end)/(length(t)-1);
@@ -178,7 +185,7 @@ win = hanning(ceil(1*Fs));
 
-
+

huddle_test_pdf.png

Figure 4: Amplitude Spectral Density of the Displacement during Huddle Test

@@ -187,16 +194,22 @@ win = hanning(ceil(1*Fs));
-
-

4 Transfer Function Estimation using the DAC as the driver

+
+

4 Transfer Function Estimation using the DAC as the driver

+
+

+Results presented in this sections are wrong as the ADC cannot deliver enought current to the piezoelectric actuator. +

+ +
-
-

4.1 Time Domain Data

+
+

4.1 Time Domain Data

-
+

apa95ml_5kg_10V_time_domain.png

Figure 5: Time domain signals during the test

@@ -204,8 +217,8 @@ win = hanning(ceil(1*Fs));
-
-

4.2 Comparison of the PSD with Huddle Test

+
+

4.2 Comparison of the PSD with Huddle Test

Ts = t(end)/(length(t)-1);
@@ -222,7 +235,7 @@ win = hanning(ceil(1*Fs));
 
-
+

apa95ml_5kg_10V_pdf_comp_huddle.png

Figure 6: Comparison of the ASD for the identification test and the huddle test

@@ -230,8 +243,8 @@ win = hanning(ceil(1*Fs));
-
-

4.3 Compute TF estimate and Coherence

+
+

4.3 Compute TF estimate and Coherence

Ts = t(end)/(length(t)-1);
@@ -248,14 +261,14 @@ Fs = 1/Ts;
 
-
+

apa95ml_5kg_10V_coh.png

Figure 7: Coherence

-
+

apa95ml_5kg_10V_tf.png

Figure 8: Estimation of the transfer function from input voltage to displacement

@@ -263,8 +276,8 @@ Fs = 1/Ts;
-
-

4.4 Comparison with the FEM model

+
+

4.4 Comparison with the FEM model

load('mat/fem_model_5kg.mat', 'Ghm');
@@ -272,7 +285,7 @@ Fs = 1/Ts;
 
-
+

apa95ml_5kg_comp_fem.png

Figure 9: Comparison of the identified transfer function and the one estimated from the FE model

@@ -291,14 +304,35 @@ In the next section, a current amplifier is used.
-
-

5 Transfer Function Estimation using the PI Amplifier

+
+

5 Transfer Function Estimation using the PI Amplifier

-
-

5.1 Comparison of the PSD with Huddle Test

+
+

5.1 Load Data

+
ht = load('./mat/huddle_test.mat', 't', 'u', 'y');
+load('./mat/apa95ml_5kg_Amp_E505.mat', 't', 'u', 'um', 'y');
+
+
+ +
+
u  = 10*(u  - mean(u)); % Input Voltage of Piezo [V]
+um = 10*(um - mean(um)); % Monitor [V]
+y  = y  - mean(y); % Mass displacement [m]
+
+ht.u  = 10*(ht.u  - mean(ht.u));
+ht.y  = ht.y  - mean(ht.y);
+
+
+
+
+ +
+

5.2 Comparison of the PSD with Huddle Test

+
+
Ts = t(end)/(length(t)-1);
 Fs = 1/Ts;
 
@@ -313,7 +347,7 @@ win = hanning(ceil(1*Fs));
 
-
+

apa95ml_5kg_PI_pdf_comp_huddle.png

Figure 10: Comparison of the ASD for the identification test and the huddle test

@@ -321,9 +355,9 @@ win = hanning(ceil(1*Fs));
-
-

5.2 Compute TF estimate and Coherence

-
+
+

5.3 Compute TF estimate and Coherence

+
Ts = t(end)/(length(t)-1);
 Fs = 1/Ts;
@@ -340,14 +374,14 @@ Fs = 1/Ts;
 
-
+

apa95ml_5kg_PI_coh.png

Figure 11: Coherence

-
+

apa95ml_5kg_PI_tf.png

Figure 12: Estimation of the transfer function from input voltage to displacement

@@ -355,16 +389,16 @@ Fs = 1/Ts;
-
-

5.3 Comparison with the FEM model

-
+
+

5.4 Comparison with the FEM model

+
-
load('mat/fem_model_5kg.mat', 'Ghm');
+
load('mat/fem_model_5kg.mat', 'G');
 
-
+

apa95ml_5kg_pi_comp_fem.png

Figure 13: Comparison of the identified transfer function and the one estimated from the FE model

@@ -372,76 +406,207 @@ Fs = 1/Ts;
-
-

6 Transfer function of the PI Amplifier

+ +
+

6 Transfer function from force actuator to force sensor

+

+Two measurements are performed: +

+
    +
  • Speedgoat DAC => Voltage Amplifier (x20) => 1 Piezo Stack => … => 2 Stacks as Force Sensor (parallel) => Speedgoat ADC
  • +
  • Speedgoat DAC => Voltage Amplifier (x20) => 2 Piezo Stacks (parallel) => … => 1 Stack as Force Sensor => Speedgoat ADC
  • +
+ +

+The obtained dynamics from force actuator to force sensor are compare with the FEM model. +

+

+The data are loaded: +

+
+
a_ss = load('mat/apa95ml_5kg_1a_2s.mat', 't', 'u', 'y', 'v');
+aa_s = load('mat/apa95ml_5kg_2a_1s.mat', 't', 'u', 'y', 'v');
+load('mat/G_force_sensor_5kg.mat', 'G');
+
-
-

6.1 Compute TF estimate and Coherence

+

+Let’s use the amplifier gain to obtain the true voltage applied to the actuator stack(s) +

+ +

+The parameters of the piezoelectric stacks are defined below: +

+
+
d33 = 3e-10; % Strain constant [m/V]
+n = 80; % Number of layers per stack
+eT = 1.6e-8; % Permittivity under constant stress [F/m]
+sD = 2e-11; % Elastic compliance under constant electric displacement [m2/N]
+ka = 235e6; % Stack stiffness [N/m]
+
+
+ +

+From the FEM, we construct the transfer function from DAC voltage to ADC voltage. +

+
+
Gfem_aa_s = exp(-s/1e4)*20*(2*d33*n*ka)*(G(3,1)+G(3,2))*d33/(eT*sD*n);
+Gfem_a_ss = exp(-s/1e4)*20*(  d33*n*ka)*(G(3,1)+G(2,1))*d33/(eT*sD*n);
+
+
+

+The transfer function from input voltage to output voltage are computed and shown in Figure 14. +

+
+
Ts = a_ss.t(end)/(length(a_ss.t)-1);
+Fs = 1/Ts;
+
+win = hann(ceil(10/Ts));
+
+[tf_a_ss,  f] = tfestimate(a_ss.u, a_ss.v, win, [], [], 1/Ts);
+[coh_a_ss, ~] = mscohere(  a_ss.u, a_ss.v, win, [], [], 1/Ts);
+
+[tf_aa_s,  f] = tfestimate(aa_s.u, aa_s.v, win, [], [], 1/Ts);
+[coh_aa_s, ~] = mscohere(  aa_s.u, aa_s.v, win, [], [], 1/Ts);
+
+
+ + +
+

bode_plot_force_sensor_voltage_comp_fem.png +

+

Figure 14: Comparison of the identified dynamics from voltage output to voltage input and the FEM

+
+
+ +
+

6.1 System Identification

-
Ts = t(end)/(length(t)-1);
-Fs = 1/Ts;
+
w_z = 2*pi*111; % Zeros frequency [rad/s]
+w_p = 2*pi*255; % Pole frequency [rad/s]
+xi_z = 0.05;
+xi_p = 0.015;
+G_inf = 2;
+
+Gi = G_inf*(s^2 - 2*xi_z*w_z*s + w_z^2)/(s^2 + 2*xi_p*w_p*s + w_p^2);
 
-

-The coherence and the transfer function are estimate from the voltage input of the PI amplifier to its voltage inputs. -

-

-The coherence is very good as expected (Figure 14). +

+

iff_plant_identification_apa95ml.png

+

Figure 15: Identification of the IFF plant

+
+
+
-

-The transfer function show a low pass filter behavior with a lot of phase drop (Figure 15). + +

+

6.2 Integral Force Feedback

+
+ +
+

root_locus_iff_apa95ml_identification.png

+

Figure 16: Root Locus for IFF

+
+
+
+
+ +
+

7 IFF Tests

+
+
+
+

7.1 Load Data

+
+
+
iff_g10 = load('./mat/apa95ml_iff_g10_res.mat', 'u', 't', 'y', 'v');
+iff_g100 = load('./mat/apa95ml_iff_g100_res.mat', 'u', 't', 'y', 'v');
+iff_of = load('./mat/apa95ml_iff_off_res.mat', 'u', 't', 'y', 'v');
+
+
-
win = hann(ceil(10/Ts));
+
Ts = 1e-4;
+win = hann(ceil(10/Ts));
 
-[tf_est, f] = tfestimate(u, um, win, [], [], 1/Ts);
-[co_est, ~] = mscohere(  u, um, win, [], [], 1/Ts);
+[tf_iff_g10, f] = tfestimate(iff_g10.u, iff_g10.y, win, [], [], 1/Ts);
+[co_iff_g10, ~] = mscohere(iff_g10.u, iff_g10.y, win, [], [], 1/Ts);
+
+[tf_iff_g100, f] = tfestimate(iff_g100.u, iff_g100.y, win, [], [], 1/Ts);
+[co_iff_g100, ~] = mscohere(iff_g100.u, iff_g100.y, win, [], [], 1/Ts);
+
+[tf_iff_of, ~] = tfestimate(iff_of.u, iff_of.y, win, [], [], 1/Ts);
+[co_iff_of, ~] = mscohere(iff_of.u, iff_of.y, win, [], [], 1/Ts);
 
- -
-

PI_E505_coh.png -

-

Figure 14: Coherence

-
- - -
-

PI_E505_tf.png -

-

Figure 15: Estimation of the transfer function from input voltage to displacement

-
- -

-The delay can be estimated as follow (in ms): -

-
finddelay(u, um)*(1000*Ts)
+
figure;
+
+hold on;
+plot(f, co_iff_of, '-', 'DisplayName', 'g=0')
+plot(f, co_iff_g10, '-', 'DisplayName', 'g=10')
+plot(f, co_iff_g100, '-', 'DisplayName', 'g=100')
+set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
+ylabel('Coherence'); xlabel('Frequency [Hz]');
+hold off;
+legend();
+xlim([60, 600])
 
-
-0.4
-
- -

-This most probably corresponds to a FIR filter. +

+

iff_first_test_coherence.png

+

Figure 17: Coherence

+
+ + +
+
figure;
+ax1 = subplot(2, 1, 1);
+hold on;
+plot(f, abs(tf_iff_of), '-', 'DisplayName', 'g=0')
+plot(f, abs(tf_iff_g10), '-', 'DisplayName', 'g=10')
+plot(f, abs(tf_iff_g100), '-', 'DisplayName', 'g=100')
+set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
+ylabel('Amplitude'); xlabel('Frequency [Hz]');
+hold off;
+legend();
+
+ax2 = subplot(2, 1, 2);
+hold on;
+plot(f, 180/pi*angle(-tf_iff_of), '-')
+plot(f, 180/pi*angle(-tf_iff_g10), '-')
+plot(f, 180/pi*angle(-tf_iff_g100), '-')
+set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
+ylabel('Phase'); xlabel('Frequency [Hz]');
+hold off;
+
+linkaxes([ax1,ax2], 'x');
+xlim([60, 600]);
+
+
+ + +
+

iff_first_test_bode_plot.png +

+

Figure 18: Bode plot for different values of IFF gain

+

Author: Dehaeze Thomas

-

Created: 2020-07-24 ven. 15:48

+

Created: 2020-08-20 jeu. 23:08

diff --git a/index.org b/index.org index 1f9d00c..9486ad1 100644 --- a/index.org +++ b/index.org @@ -166,6 +166,11 @@ :header-args:matlab+: :comments org :mkdirp yes :END: +** Introduction :ignore: +#+begin_important +Results presented in this sections are wrong as the ADC cannot deliver enought current to the piezoelectric actuator. +#+end_important + ** Matlab Init :noexport:ignore: #+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) <> @@ -353,18 +358,18 @@ In the next section, a current amplifier is used. <> #+end_src -** Load Data :noexport: +** Load Data #+begin_src matlab ht = load('./mat/huddle_test.mat', 't', 'u', 'y'); load('./mat/apa95ml_5kg_Amp_E505.mat', 't', 'u', 'um', 'y'); #+end_src #+begin_src matlab - u = u - mean(u); - um = um - mean(um); - y = y - mean(y); + u = 10*(u - mean(u)); % Input Voltage of Piezo [V] + um = 10*(um - mean(um)); % Monitor [V] + y = y - mean(y); % Mass displacement [m] - ht.u = ht.u - mean(ht.u); + ht.u = 10*(ht.u - mean(ht.u)); ht.y = ht.y - mean(ht.y); #+end_src @@ -443,7 +448,7 @@ In the next section, a current amplifier is used. plot(f, abs(tf_est), 'DisplayName', 'Input Voltage') plot(f, abs(tf_um), 'DisplayName', 'Monitor Voltage') set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log'); - ylabel('Amplitude'); xlabel('Frequency [Hz]'); + ylabel('Amplitude [m/V]'); xlabel('Frequency [Hz]'); hold off; legend('location', 'southwest') @@ -472,7 +477,7 @@ In the next section, a current amplifier is used. ** Comparison with the FEM model #+begin_src matlab - load('mat/fem_model_5kg.mat', 'Ghm'); + load('mat/fem_model_5kg.mat', 'G'); #+end_src #+begin_src matlab :exports none @@ -480,17 +485,17 @@ In the next section, a current amplifier is used. figure; ax1 = subplot(2, 1, 1); hold on; - plot(f, 1/10*170/1400*abs(tf_um), 'DisplayName', 'Identification') - plot(freqs, abs(squeeze(freqresp(Ghm, freqs, 'Hz'))), 'DisplayName', 'FEM') + plot(f, abs(tf_um), 'DisplayName', 'Identification') + plot(freqs, abs(squeeze(freqresp(G, freqs, 'Hz'))), 'DisplayName', 'FEM') set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log'); - ylabel('Amplitude'); xlabel('Frequency [Hz]'); + ylabel('Amplitude [m/V]'); xlabel('Frequency [Hz]'); legend('location', 'northeast') hold off; ax2 = subplot(2, 1, 2); hold on; plot(f, 180/pi*unwrap(angle(tf_um))) - plot(freqs, 180/pi*unwrap(angle(squeeze(freqresp(Ghm, freqs, 'Hz'))))) + plot(freqs, 180/pi*unwrap(angle(squeeze(freqresp(G, freqs, 'Hz'))))) set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin'); ylabel('Phase'); xlabel('Frequency [Hz]'); hold off; @@ -509,7 +514,192 @@ In the next section, a current amplifier is used. #+caption: Comparison of the identified transfer function and the one estimated from the FE model #+RESULTS: [[file:figs/apa95ml_5kg_pi_comp_fem.png]] -* Transfer function of the PI Amplifier + +* Transfer function from force actuator to force sensor +** Introduction :ignore: +Two measurements are performed: +- Speedgoat DAC => Voltage Amplifier (x20) => 1 Piezo Stack => ... => 2 Stacks as Force Sensor (parallel) => Speedgoat ADC +- Speedgoat DAC => Voltage Amplifier (x20) => 2 Piezo Stacks (parallel) => ... => 1 Stack as Force Sensor => Speedgoat ADC + +The obtained dynamics from force actuator to force sensor are compare with the FEM model. + +** Matlab Init :noexport:ignore: +#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) + <> +#+end_src + +#+begin_src matlab :exports none :results silent :noweb yes + <> +#+end_src + +** Load Data :ignore: +The data are loaded: +#+begin_src matlab + a_ss = load('mat/apa95ml_5kg_1a_2s.mat', 't', 'u', 'y', 'v'); + aa_s = load('mat/apa95ml_5kg_2a_1s.mat', 't', 'u', 'y', 'v'); + load('mat/G_force_sensor_5kg.mat', 'G'); +#+end_src + +** Adjust gain :ignore: +Let's use the amplifier gain to obtain the true voltage applied to the actuator stack(s) + +The parameters of the piezoelectric stacks are defined below: +#+begin_src matlab + d33 = 3e-10; % Strain constant [m/V] + n = 80; % Number of layers per stack + eT = 1.6e-8; % Permittivity under constant stress [F/m] + sD = 2e-11; % Elastic compliance under constant electric displacement [m2/N] + ka = 235e6; % Stack stiffness [N/m] +#+end_src + +From the FEM, we construct the transfer function from DAC voltage to ADC voltage. +#+begin_src matlab + Gfem_aa_s = exp(-s/1e4)*20*(2*d33*n*ka)*(G(3,1)+G(3,2))*d33/(eT*sD*n); + Gfem_a_ss = exp(-s/1e4)*20*( d33*n*ka)*(G(3,1)+G(2,1))*d33/(eT*sD*n); +#+end_src + +** Compute TF estimate and Coherence :ignore: +The transfer function from input voltage to output voltage are computed and shown in Figure [[fig:bode_plot_force_sensor_voltage_comp_fem]]. +#+begin_src matlab + Ts = a_ss.t(end)/(length(a_ss.t)-1); + Fs = 1/Ts; + + win = hann(ceil(10/Ts)); + + [tf_a_ss, f] = tfestimate(a_ss.u, a_ss.v, win, [], [], 1/Ts); + [coh_a_ss, ~] = mscohere( a_ss.u, a_ss.v, win, [], [], 1/Ts); + + [tf_aa_s, f] = tfestimate(aa_s.u, aa_s.v, win, [], [], 1/Ts); + [coh_aa_s, ~] = mscohere( aa_s.u, aa_s.v, win, [], [], 1/Ts); +#+end_src + +#+begin_src matlab :exports none + freqs = logspace(1, 4, 1000); + + figure; + ax1 = subplot(2, 1, 1); + hold on; + set(gca,'ColorOrderIndex',1) + plot(f, abs(tf_aa_s), '-') + set(gca,'ColorOrderIndex',1) + plot(freqs, abs(squeeze(freqresp(Gfem_aa_s, freqs, 'Hz'))), '--') + set(gca,'ColorOrderIndex',2) + plot(f, abs(tf_a_ss), '-') + set(gca,'ColorOrderIndex',2) + plot(freqs, abs(squeeze(freqresp(Gfem_a_ss, freqs, 'Hz'))), '--') + set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log'); + ylabel('Amplitude'); xlabel('Frequency [Hz]'); + hold off; + ylim([1e-2, 1e2]); + + ax2 = subplot(2, 1, 2); + hold on; + set(gca,'ColorOrderIndex',1) + plot(f, 180/pi*angle(tf_aa_s), '-', 'DisplayName', '2 Act - 1 Sen') + set(gca,'ColorOrderIndex',1) + plot(freqs, 180/pi*angle(squeeze(freqresp(Gfem_aa_s, freqs, 'Hz'))), '--', 'DisplayName', '2 Act - 1 Sen, - FEM') + set(gca,'ColorOrderIndex',2) + plot(f, 180/pi*angle(tf_a_ss), '-', 'DisplayName', '1 Act - 2 Sen') + set(gca,'ColorOrderIndex',2) + plot(freqs, 180/pi*angle(squeeze(freqresp(Gfem_a_ss, freqs, 'Hz'))), '--', 'DisplayName', '1 Act - 2 Sen, - FEM') + set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin'); + ylabel('Phase'); xlabel('Frequency [Hz]'); + hold off; + ylim([-180, 180]); + yticks(-180:90:180); + legend('location', 'northeast') + + linkaxes([ax1,ax2], 'x'); + xlim([10, 5e3]); +#+end_src + +#+begin_src matlab :tangle no :exports results :results file replace + exportFig('figs/bode_plot_force_sensor_voltage_comp_fem.pdf', 'width', 'full', 'height', 'full'); +#+end_src + +#+name: fig:bode_plot_force_sensor_voltage_comp_fem +#+caption: Comparison of the identified dynamics from voltage output to voltage input and the FEM +#+RESULTS: +[[file:figs/bode_plot_force_sensor_voltage_comp_fem.png]] + +** System Identification +#+begin_src matlab + w_z = 2*pi*111; % Zeros frequency [rad/s] + w_p = 2*pi*255; % Pole frequency [rad/s] + xi_z = 0.05; + xi_p = 0.015; + G_inf = 2; + + Gi = G_inf*(s^2 - 2*xi_z*w_z*s + w_z^2)/(s^2 + 2*xi_p*w_p*s + w_p^2); +#+end_src + +#+begin_src matlab :exports none + freqs = logspace(1, 4, 1000); + + figure; + ax1 = subplot(2, 1, 1); + hold on; + plot(f, abs(tf_aa_s), '-') + plot(freqs, abs(squeeze(freqresp(Gi, freqs, 'Hz'))), '--') + set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log'); + ylabel('Amplitude'); xlabel('Frequency [Hz]'); + hold off; + ylim([1e-2, 1e2]); + + ax2 = subplot(2, 1, 2); + hold on; + plot(f, 180/pi*angle(tf_aa_s), '-', 'DisplayName', '2 Act - 1 Sen') + plot(freqs, 180/pi*angle(squeeze(freqresp(Gi, freqs, 'Hz'))), '--', 'DisplayName', '2 Act - 1 Sen, - FEM') + set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin'); + ylabel('Phase'); xlabel('Frequency [Hz]'); + hold off; + ylim([-180, 180]); + yticks(-180:90:180); + legend('location', 'northeast') + + linkaxes([ax1,ax2], 'x'); + xlim([10, 5e3]); +#+end_src + +#+begin_src matlab :tangle no :exports results :results file replace + exportFig('figs/iff_plant_identification_apa95ml.pdf', 'width', 'full', 'height', 'full'); +#+end_src + +#+name: fig:iff_plant_identification_apa95ml +#+caption: Identification of the IFF plant +#+RESULTS: +[[file:figs/iff_plant_identification_apa95ml.png]] + + +** Integral Force Feedback +#+begin_src matlab :exports none + gains = logspace(0, 5, 1000); + + figure; + hold on; + plot(real(pole(Gi)), imag(pole(Gi)), 'kx'); + plot(real(tzero(Gi)), imag(tzero(Gi)), 'ko'); + for i = 1:length(gains) + cl_poles = pole(feedback(Gi, (gains(i)/s))); + plot(real(cl_poles), imag(cl_poles), 'k.'); + end + ylim([0, 1800]); + xlim([-1600,200]); + xlabel('Real Part') + ylabel('Imaginary Part') + axis square +#+end_src + +#+begin_src matlab :tangle no :exports results :results file replace + exportFig('figs/root_locus_iff_apa95ml_identification.pdf', 'width', 'wide', 'height', 'tall'); +#+end_src + +#+name: fig:root_locus_iff_apa95ml_identification +#+caption: Root Locus for IFF +#+RESULTS: +[[file:figs/root_locus_iff_apa95ml_identification.png]] + +* IFF Tests ** Matlab Init :noexport:ignore: #+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) <> @@ -519,87 +709,81 @@ In the next section, a current amplifier is used. <> #+end_src -** Load Data :noexport: +** Load Data #+begin_src matlab - load('./mat/apa95ml_5kg_Amp_E505.mat', 't', 'u', 'um'); + iff_g10 = load('./mat/apa95ml_iff_g10_res.mat', 'u', 't', 'y', 'v'); + iff_g100 = load('./mat/apa95ml_iff_g100_res.mat', 'u', 't', 'y', 'v'); + iff_of = load('./mat/apa95ml_iff_off_res.mat', 'u', 't', 'y', 'v'); #+end_src -** Compute TF estimate and Coherence -#+begin_src matlab - Ts = t(end)/(length(t)-1); - Fs = 1/Ts; -#+end_src - -The coherence and the transfer function are estimate from the voltage input of the PI amplifier to its voltage inputs. - -The coherence is very good as expected (Figure [[fig:PI_E505_coh]]). - -The transfer function show a low pass filter behavior with a lot of phase drop (Figure [[fig:PI_E505_tf]]). - #+begin_src matlab + Ts = 1e-4; win = hann(ceil(10/Ts)); - [tf_est, f] = tfestimate(u, um, win, [], [], 1/Ts); - [co_est, ~] = mscohere( u, um, win, [], [], 1/Ts); + [tf_iff_g10, f] = tfestimate(iff_g10.u, iff_g10.y, win, [], [], 1/Ts); + [co_iff_g10, ~] = mscohere(iff_g10.u, iff_g10.y, win, [], [], 1/Ts); + + [tf_iff_g100, f] = tfestimate(iff_g100.u, iff_g100.y, win, [], [], 1/Ts); + [co_iff_g100, ~] = mscohere(iff_g100.u, iff_g100.y, win, [], [], 1/Ts); + + [tf_iff_of, ~] = tfestimate(iff_of.u, iff_of.y, win, [], [], 1/Ts); + [co_iff_of, ~] = mscohere(iff_of.u, iff_of.y, win, [], [], 1/Ts); #+end_src -#+begin_src matlab :exports none +#+begin_src matlab figure; hold on; - plot(f, co_est, 'k-') + plot(f, co_iff_of, '-', 'DisplayName', 'g=0') + plot(f, co_iff_g10, '-', 'DisplayName', 'g=10') + plot(f, co_iff_g100, '-', 'DisplayName', 'g=100') set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin'); ylabel('Coherence'); xlabel('Frequency [Hz]'); hold off; - xlim([10, 5e3]); + legend(); + xlim([60, 600]) #+end_src #+begin_src matlab :tangle no :exports results :results file replace - exportFig('figs/PI_E505_coh.pdf', 'width', 'wide', 'height', 'normal'); + exportFig('figs/iff_first_test_coherence.pdf', 'width', 'wide', 'height', 'normal'); #+end_src -#+name: fig:PI_E505_coh +#+name: fig:iff_first_test_coherence #+caption: Coherence #+RESULTS: -[[file:figs/PI_E505_coh.png]] +[[file:figs/iff_first_test_coherence.png]] -#+begin_src matlab :exports none + +#+begin_src matlab figure; ax1 = subplot(2, 1, 1); hold on; - plot(f, abs(tf_est), 'k-') + plot(f, abs(tf_iff_of), '-', 'DisplayName', 'g=0') + plot(f, abs(tf_iff_g10), '-', 'DisplayName', 'g=10') + plot(f, abs(tf_iff_g100), '-', 'DisplayName', 'g=100') set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log'); ylabel('Amplitude'); xlabel('Frequency [Hz]'); hold off; + legend(); ax2 = subplot(2, 1, 2); hold on; - plot(f, 180/pi*angle(tf_est), 'k-') - set(gca, 'Xscale', 'lin'); set(gca, 'Yscale', 'lin'); + plot(f, 180/pi*angle(-tf_iff_of), '-') + plot(f, 180/pi*angle(-tf_iff_g10), '-') + plot(f, 180/pi*angle(-tf_iff_g100), '-') + set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin'); ylabel('Phase'); xlabel('Frequency [Hz]'); hold off; - ylim([-180, 180]); - yticks(-180:90:180); linkaxes([ax1,ax2], 'x'); - xlim([10, 5e3]); + xlim([60, 600]); #+end_src #+begin_src matlab :tangle no :exports results :results file replace - exportFig('figs/PI_E505_tf.pdf', 'width', 'full', 'height', 'full'); + exportFig('figs/iff_first_test_bode_plot.pdf', 'width', 'full', 'height', 'full'); #+end_src -#+name: fig:PI_E505_tf -#+caption: Estimation of the transfer function from input voltage to displacement +#+name: fig:iff_first_test_bode_plot +#+caption: Bode plot for different values of IFF gain #+RESULTS: -[[file:figs/PI_E505_tf.png]] - -The delay can be estimated as follow (in ms): -#+begin_src matlab :results replace value - finddelay(u, um)*(1000*Ts) -#+end_src - -#+RESULTS: -: 0.4 - -This most probably corresponds to a FIR filter. +[[file:figs/iff_first_test_bode_plot.png]]