From b2d631767930f677345393d5ce8bbeb93f26686b Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Thu, 12 Sep 2019 15:50:31 +0200 Subject: [PATCH] Error when saving the signals --- index.html | 210 ++++++++++++++++++++++++++++++++++++--------- index.org | 243 ++++++++++++++++++++++++++++++++++++++--------------- run_test.m | 6 +- 3 files changed, 348 insertions(+), 111 deletions(-) diff --git a/index.html b/index.html index 0965d0f..f4f4f5c 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Cercalo Test Bench @@ -276,27 +276,39 @@ for the JavaScript code in this tag.

Table of Contents

+
+

1 Introduction

+
-
-

1 Identification

-
+
+

2 Identification

+

- +

@@ -306,9 +318,9 @@ All the files (data and Matlab scripts) are accessible -

1.1 Excitation Data

-
+
+

2.1 Excitation Data

+
fs = 1e4;
 Ts = 1/fs;
@@ -344,9 +356,80 @@ Discrete-time zero/pole/gain model.
 
-
-

1.2 Input / Output data

-
+
+

2.2 Huddle Test

+
+

+We load the data taken during the Huddle Test. +

+
+
load('mat/data_huddle_test.mat', 't', 'xh', 'xv', 'cuh', 'cuv');
+
+
+ +

+The variables are: +

+
+
\(x_h\)
Normalized position of the beam in the horizontal direction as measured by the 4 quadrant diode
+
\(x_v\)
Normalized position of the beam in the vertical direction as measured by the 4 quadrant diode
+
\(cu_h\)
Voltage across the inductance used for the horizontal positioning of the Cercalo
+
\(vu_v\)
Voltage across the inductance used for the vertical positioning of the Cercalo
+
+ +
+
xh(t<1) = [];
+xv(t<1) = [];
+cuh(t<1) = [];
+cuv(t<1) = [];
+t(t<1) = [];
+t = t - t(1);
+
+
+ +
+
[psd_xh, f] = pwelch(xh, hanning(ceil(1*fs)), [], [], fs);
+[psd_xv, ~] = pwelch(xv, hanning(ceil(1*fs)), [], [], fs);
+
+
+ +
+
figure;
+hold on;
+plot(f, sqrt(psd_xh), 'DisplayName', '$\Gamma_{x_h}$');
+plot(f, sqrt(psd_xv), 'DisplayName', '$\Gamma_{x_v}$');
+hold off;
+set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log');
+xlabel('Frequency [Hz]'); ylabel('ASD $\left[\frac{V}{\sqrt{Hz}}\right]$')
+legend('Location', 'southwest');
+xlim([1, 1000]);
+
+
+ +
+
[psd_cuh, f] = pwelch(cuh, hanning(ceil(1*fs)), [], [], fs);
+[psd_cuv, ~] = pwelch(cuv, hanning(ceil(1*fs)), [], [], fs);
+
+
+ +
+
figure;
+hold on;
+plot(f, sqrt(psd_cuh), 'DisplayName', '$\Gamma_{cu_h}$');
+plot(f, sqrt(psd_cuv), 'DisplayName', '$\Gamma_{cu_v}$');
+hold off;
+set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log');
+xlabel('Frequency [Hz]'); ylabel('ASD $\left[\frac{V}{\sqrt{Hz}}\right]$')
+legend('Location', 'southwest');
+xlim([1, 1000]);
+
+
+
+
+ +
+

2.3 Input / Output data

+

The identification data is loaded

@@ -388,7 +471,7 @@ uy.yy = uy.yy-mean +

identification_ux.png

Figure 1: Identification signals when exciting the \(x\) axis (png, pdf)

@@ -396,7 +479,7 @@ uy.yy = uy.yy-mean +

identification_uy.png

Figure 2: Identification signals when exciting the \(y\) axis (png, pdf)

@@ -404,9 +487,9 @@ uy.yy = uy.yy-mean -

1.3 Estimation of the Frequency Response Function Matrix

-
+
+

2.4 Estimation of the Frequency Response Function Matrix

+

We compute an estimate of the transfer functions.

@@ -419,7 +502,7 @@ We compute an estimate of the transfer functions.
-
+

frequency_response_matrix.png

Figure 3: Frequency Response Matrix (png, pdf)

@@ -427,9 +510,9 @@ We compute an estimate of the transfer functions.
-
-

1.4 Coherence

-
+
+

2.5 Coherence

+
[coh_ux_yx, f] = mscohere(ux.ux, ux.yx, hanning(ceil(1*fs)), [], [], fs);
 [coh_ux_yy, ~] = mscohere(ux.ux, ux.yy, hanning(ceil(1*fs)), [], [], fs);
@@ -439,7 +522,7 @@ We compute an estimate of the transfer functions.
 
-
+

identification_coherence.png

Figure 4: Coherence (png, pdf)

@@ -448,9 +531,9 @@ We compute an estimate of the transfer functions.
-
-

1.5 Extraction of a transfer function matrix

-
+
+

2.6 Extraction of a transfer function matrix

+

First we define the initial guess for the resonance frequencies and the weights associated.

@@ -503,7 +586,7 @@ Ignore data above some frequency.
-
+

weights.png

Figure 5: Weights amplitude (png, pdf)

@@ -555,7 +638,7 @@ An we run the vectfit3 algorithm.
-
+

identification_matrix_fit.png

Figure 6: Transfer Function Extraction of the FRF matrix (png, pdf)

@@ -583,16 +666,65 @@ G = [G_ux_yx, G_uy_yx;
-
-

2 Plant Analysis

+
+

3 Sensor Noise

-
-

3 Control

+
+

4 Plant Analysis

+
+
+
+

4.1 Rotation Matrix

+
+
+
G0 = freqresp(G, 0);
+
+
+
+
+
+
+

5 Control Objective

+
+

+The maximum expected stroke is \(y_\text{max} = 3mm \approx 5e^{-2} rad\) at \(1Hz\). +The maximum wanted error is \(e_\text{max} = 10 \mu rad\). +

+ +

+Thus, we require the sensitivity function at \(\omega_0 = 1\text{ Hz}\): +

+\begin{align*} + |S(j\omega_0)| &< \left| \frac{e_\text{max}}{y_\text{max}} \right| \\ + &< 2 \cdot 10^{-4} +\end{align*} + +

+In terms of loop gain, this is equivalent to: +\[ |L(j\omega_0)| > 5 \cdot 10^{3} \] +

+
+
+ +
+

6 Plant Scaling

+
+
    +
  • measured noise
  • +
  • expected perturbations
  • +
  • maximum input usage
  • +
  • maximum wanted error
  • +
+
+
+ +
+

7 Control Design

Author: Dehaeze Thomas

-

Created: 2019-09-11 mer. 09:10

+

Created: 2019-09-12 jeu. 15:20

Validate

diff --git a/index.org b/index.org index a7015b4..061654d 100644 --- a/index.org +++ b/index.org @@ -24,8 +24,7 @@ #+PROPERTY: header-args:matlab+ :mkdirp yes :END: -Notes: -145 994 8 +* Introduction * Identification :PROPERTIES: @@ -89,11 +88,93 @@ Sample time: 0.0001 seconds Discrete-time zero/pole/gain model. #+end_example +** Huddle Test +We load the data taken during the Huddle Test. +#+begin_src matlab + load('mat/data_huddle_test.mat', 't', 'xh', 'xv', 'cuh', 'cuv'); +#+end_src + +The variables are: +- $x_h$ :: Normalized position of the beam in the horizontal direction as measured by the 4 quadrant diode +- $x_v$ :: Normalized position of the beam in the vertical direction as measured by the 4 quadrant diode +- $cu_h$ :: Voltage across the inductance used for the horizontal positioning of the Cercalo +- $vu_v$ :: Voltage across the inductance used for the vertical positioning of the Cercalo + +We remove the first second of data where everything is settling down. +#+begin_src matlab + xh(t<1) = []; + xv(t<1) = []; + cuh(t<1) = []; + cuv(t<1) = []; + t(t<1) = []; + t = t - t(1); +#+end_src + +#+begin_src matlab :exports none + figure; + hold on; + plot(t, xh, 'DisplayName', '$x_h$'); + plot(t, xv, 'DisplayName', '$x_v$'); + hold off; + xlabel('Time [s]'); + ylabel('Amplitude [V]'); + xlim([t(1), t(end)]); + legend(); +#+end_src + +We compute the Power Spectral Density of the horizontal and vertical positions of the beam as measured by the 4 quadrant diode. +#+begin_src matlab + [psd_xh, f] = pwelch(xh, hanning(ceil(1*fs)), [], [], fs); + [psd_xv, ~] = pwelch(xv, hanning(ceil(1*fs)), [], [], fs); +#+end_src + +#+begin_src matlab :results none + figure; + hold on; + plot(f, sqrt(psd_xh), 'DisplayName', '$\Gamma_{x_h}$'); + plot(f, sqrt(psd_xv), 'DisplayName', '$\Gamma_{x_v}$'); + hold off; + set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log'); + xlabel('Frequency [Hz]'); ylabel('ASD $\left[\frac{V}{\sqrt{Hz}}\right]$') + legend('Location', 'southwest'); + xlim([1, 1000]); +#+end_src + +#+begin_src matlab :exports none + figure; + hold on; + plot(t, cuh, 'DisplayName', '$cu_h$'); + plot(t, cuv, 'DisplayName', '$cu_v$'); + hold off; + xlabel('Time [s]'); + ylabel('Amplitude [V]'); + xlim([t(1), t(end)]); + legend(); +#+end_src + +We compute the Power Spectral Density of the voltage across the inductance used for horizontal and vertical positioning of the Cercalo. +#+begin_src matlab + [psd_cuh, f] = pwelch(cuh, hanning(ceil(1*fs)), [], [], fs); + [psd_cuv, ~] = pwelch(cuv, hanning(ceil(1*fs)), [], [], fs); +#+end_src + +#+begin_src matlab :results none + figure; + hold on; + plot(f, sqrt(psd_cuh), 'DisplayName', '$\Gamma_{cu_h}$'); + plot(f, sqrt(psd_cuv), 'DisplayName', '$\Gamma_{cu_v}$'); + hold off; + set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log'); + xlabel('Frequency [Hz]'); ylabel('ASD $\left[\frac{V}{\sqrt{Hz}}\right]$') + legend('Location', 'southwest'); + xlim([1, 1000]); +#+end_src + ** Input / Output data The identification data is loaded #+begin_src matlab - ux = load('mat/data_ux.mat', 't', 'ux', 'yx', 'yy'); - uy = load('mat/data_uy.mat', 't', 'uy', 'yx', 'yy'); + uh = load('mat/data_uh.mat', 't', 'xh', 'xv', 'uh', 'cuh', 'cuv'); + uv = load('mat/data_uv.mat', 't', 'xh', 'xv', 'uv', 'cuh', 'cuv'); #+end_src We remove the first seconds where the Cercalo is turned on. @@ -102,102 +183,102 @@ We remove the first seconds where the Cercalo is turned on. i0y = 10*fs; - ux.t = ux.t( i0x:end) - ux.t(i0x); - ux.ux = ux.ux(i0x:end); - ux.yx = ux.yx(i0x:end); - ux.yy = ux.yy(i0x:end); + uh.t = uh.t( i0x:end) - uh.t(i0x); + uh.uh = uh.uh(i0x:end); + uh.xh = uh.xh(i0x:end); + uh.xv = uh.xv(i0x:end); - uy.t = uy.t( i0y:end) - uy.t(i0x); - uy.uy = uy.uy(i0y:end); - uy.yx = uy.yx(i0y:end); - uy.yy = uy.yy(i0y:end); + uv.t = uv.t( i0y:end) - uv.t(i0x); + uv.uv = uv.uv(i0y:end); + uv.xh = uv.xh(i0y:end); + uv.xv = uv.xv(i0y:end); #+end_src #+begin_src matlab - ux.ux = ux.ux-mean(ux.ux); - ux.yx = ux.yx-mean(ux.yx); - ux.yy = ux.yy-mean(ux.yy); + uh.uh = uh.uh-mean(uh.uh); + uh.xh = uh.xh-mean(uh.xh); + uh.xv = uh.xv-mean(uh.xv); - uy.ux = uy.ux-mean(uy.ux); - uy.yx = uy.yx-mean(uy.yx); - uy.yy = uy.yy-mean(uy.yy); + uv.uv = uv.uv-mean(uv.uv); + uv.xh = uv.xh-mean(uv.xh); + uv.xv = uv.xv-mean(uv.xv); #+end_src #+begin_src matlab :exports none figure; ax1 = subplot(1, 2, 1); - plot(ux.t, ux.ux); + plot(uh.t, uh.uh); xlabel('Time [s]'); ylabel('Amplitude [V]'); legend({'$u_x$'}); ax2 = subplot(1, 2, 2); hold on; - plot(ux.t, ux.yx, 'DisplayName', '$y_x$'); - plot(ux.t, ux.yy, 'DisplayName', '$y_y$'); + plot(uh.t, uh.xh, 'DisplayName', '$y_x$'); + plot(uh.t, uh.xv, 'DisplayName', '$y_y$'); hold off; xlabel('Time [s]'); ylabel('Amplitude [V]'); legend() linkaxes([ax1,ax2],'x'); - xlim([ux.t(1), ux.t(end)]) + xlim([uh.t(1), uh.t(end)]) #+end_src #+HEADER: :tangle no :exports results :results none :noweb yes -#+begin_src matlab :var filepath="figs/identification_ux.pdf" :var figsize="full-normal" :post pdf2svg(file=*this*, ext="png") +#+begin_src matlab :var filepath="figs/identification_uh.pdf" :var figsize="full-normal" :post pdf2svg(file=*this*, ext="png") <> #+end_src -#+NAME: fig:identification_ux -#+CAPTION: Identification signals when exciting the $x$ axis ([[./figs/identification_ux.png][png]], [[./figs/identification_ux.pdf][pdf]]) -[[file:figs/identification_ux.png]] +#+NAME: fig:identification_uh +#+CAPTION: Identification signals when exciting the $x$ axis ([[./figs/identification_uh.png][png]], [[./figs/identification_uh.pdf][pdf]]) +[[file:figs/identification_uh.png]] #+begin_src matlab :exports none figure; ax1 = subplot(1, 2, 1); - plot(uy.t, uy.uy); + plot(uv.t, uv.uv); xlabel('Time [s]'); ylabel('Amplitude [V]'); legend({'$u_y$'}); ax2 = subplot(1, 2, 2); hold on; - plot(uy.t, uy.yy, 'DisplayName', '$y_y$'); - plot(uy.t, uy.yx, 'DisplayName', '$y_x$'); + plot(uv.t, uv.xh, 'DisplayName', '$y_x$'); + plot(uv.t, uv.xv, 'DisplayName', '$y_y$'); hold off; xlabel('Time [s]'); ylabel('Amplitude [V]'); legend() linkaxes([ax1,ax2],'x'); - xlim([uy.t(1), uy.t(end)]) + xlim([uv.t(1), uv.t(end)]) #+end_src #+HEADER: :tangle no :exports results :results none :noweb yes -#+begin_src matlab :var filepath="figs/identification_uy.pdf" :var figsize="full-normal" :post pdf2svg(file=*this*, ext="png") +#+begin_src matlab :var filepath="figs/identification_uv.pdf" :var figsize="full-normal" :post pdf2svg(file=*this*, ext="png") <> #+end_src -#+NAME: fig:identification_uy -#+CAPTION: Identification signals when exciting the $y$ axis ([[./figs/identification_uy.png][png]], [[./figs/identification_uy.pdf][pdf]]) -[[file:figs/identification_uy.png]] +#+NAME: fig:identification_uv +#+CAPTION: Identification signals when exciting the $y$ axis ([[./figs/identification_uv.png][png]], [[./figs/identification_uv.pdf][pdf]]) +[[file:figs/identification_uv.png]] ** Estimation of the Frequency Response Function Matrix We compute an estimate of the transfer functions. #+begin_src matlab - [tf_ux_yx, f] = tfestimate(ux.ux, ux.yx, hanning(ceil(1*fs)), [], [], fs); - [tf_ux_yy, ~] = tfestimate(ux.ux, ux.yy, hanning(ceil(1*fs)), [], [], fs); - [tf_uy_yx, ~] = tfestimate(uy.uy, uy.yx, hanning(ceil(1*fs)), [], [], fs); - [tf_uy_yy, ~] = tfestimate(uy.uy, uy.yy, hanning(ceil(1*fs)), [], [], fs); + [tf_uh_xh, f] = tfestimate(uh.uh, uh.xh, hanning(ceil(1*fs)), [], [], fs); + [tf_uh_xv, ~] = tfestimate(uh.uh, uh.xv, hanning(ceil(1*fs)), [], [], fs); + [tf_uv_xh, ~] = tfestimate(uv.uv, uv.xh, hanning(ceil(1*fs)), [], [], fs); + [tf_uv_xv, ~] = tfestimate(uv.uv, uv.xv, hanning(ceil(1*fs)), [], [], fs); #+end_src #+begin_src matlab :exports none figure; ax11 = subplot(2, 2, 1); hold on; - plot(f, abs(tf_ux_yx)) + plot(f, abs(tf_uh_xh)) title('Frequency Response Function $\frac{y_x}{u_x}$') set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log'); ylabel('Amplitude') @@ -205,14 +286,14 @@ We compute an estimate of the transfer functions. ax12 = subplot(2, 2, 2); hold on; - plot(f, abs(tf_uy_yx)) + plot(f, abs(tf_uv_xh)) title('Frequency Response Function $\frac{y_x}{u_y}$') set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log'); hold off; ax21 = subplot(2, 2, 3); hold on; - plot(f, abs(tf_ux_yy)) + plot(f, abs(tf_uh_xv)) title('Frequency Response Function $\frac{y_y}{u_x}$') set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log'); ylabel('Amplitude') @@ -221,7 +302,7 @@ We compute an estimate of the transfer functions. ax22 = subplot(2, 2, 4); hold on; - plot(f, abs(tf_uy_yy)) + plot(f, abs(tf_uv_xv)) title('Frequency Response Function $\frac{y_y}{u_y}$') set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log'); xlabel('Frequency [Hz]') @@ -244,17 +325,17 @@ We compute an estimate of the transfer functions. ** Coherence #+begin_src matlab - [coh_ux_yx, f] = mscohere(ux.ux, ux.yx, hanning(ceil(1*fs)), [], [], fs); - [coh_ux_yy, ~] = mscohere(ux.ux, ux.yy, hanning(ceil(1*fs)), [], [], fs); - [coh_uy_yx, ~] = mscohere(uy.uy, uy.yx, hanning(ceil(1*fs)), [], [], fs); - [coh_uy_yy, ~] = mscohere(uy.uy, uy.yy, hanning(ceil(1*fs)), [], [], fs); + [coh_uh_xh, f] = mscohere(uh.uh, uh.xh, hanning(ceil(1*fs)), [], [], fs); + [coh_uh_xv, ~] = mscohere(uh.uh, uh.xv, hanning(ceil(1*fs)), [], [], fs); + [coh_uv_xh, ~] = mscohere(uv.uv, uv.xh, hanning(ceil(1*fs)), [], [], fs); + [coh_uv_xv, ~] = mscohere(uv.uv, uv.xv, hanning(ceil(1*fs)), [], [], fs); #+end_src #+begin_src matlab :exports none figure; ax11 = subplot(2, 2, 1); hold on; - plot(f, coh_ux_yx) + plot(f, coh_uh_xh) set(gca, 'Xscale', 'log'); title('Coherence $\frac{y_x}{u_x}$') ylabel('Coherence') @@ -262,14 +343,14 @@ We compute an estimate of the transfer functions. ax12 = subplot(2, 2, 2); hold on; - plot(f, coh_uy_yx) + plot(f, coh_uv_xh) set(gca, 'Xscale', 'log'); title('Coherence $\frac{y_x}{u_y}$') hold off; ax21 = subplot(2, 2, 3); hold on; - plot(f, coh_ux_yy) + plot(f, coh_uh_xv) set(gca, 'Xscale', 'log'); title('Coherence $\frac{y_y}{u_x}$') ylabel('Coherence') @@ -278,7 +359,7 @@ We compute an estimate of the transfer functions. ax22 = subplot(2, 2, 4); hold on; - plot(f, coh_uy_yy) + plot(f, coh_uv_xv) set(gca, 'Xscale', 'log'); title('Coherence $\frac{y_y}{u_y}$') xlabel('Frequency [Hz]') @@ -381,16 +462,16 @@ We define the number of iteration. An we run the =vectfit3= algorithm. #+begin_src matlab for iter = 1:Niter - [SER_ux_yx, poles, ~, fit_ux_yx] = vectfit3(tf_ux_yx.', 1i*2*pi*f, poles, weight, opts); + [SER_uh_xh, poles, ~, fit_uh_xh] = vectfit3(tf_uh_xh.', 1i*2*pi*f, poles, weight, opts); end for iter = 1:Niter - [SER_uy_yx, poles, ~, fit_uy_yx] = vectfit3(tf_uy_yx.', 1i*2*pi*f, poles, weight, opts); + [SER_uv_xh, poles, ~, fit_uv_xh] = vectfit3(tf_uv_xh.', 1i*2*pi*f, poles, weight, opts); end for iter = 1:Niter - [SER_ux_yy, poles, ~, fit_ux_yy] = vectfit3(tf_ux_yy.', 1i*2*pi*f, poles, weight, opts); + [SER_uh_xv, poles, ~, fit_uh_xv] = vectfit3(tf_uh_xv.', 1i*2*pi*f, poles, weight, opts); end for iter = 1:Niter - [SER_uy_yy, poles, ~, fit_uy_yy] = vectfit3(tf_uy_yy.', 1i*2*pi*f, poles, weight, opts); + [SER_uv_xv, poles, ~, fit_uv_xv] = vectfit3(tf_uv_xv.', 1i*2*pi*f, poles, weight, opts); end #+end_src @@ -398,8 +479,8 @@ An we run the =vectfit3= algorithm. figure; ax11 = subplot(2, 2, 1); hold on; - plot(f, abs(tf_ux_yx)) - plot(f, abs(fit_ux_yx)) + plot(f, abs(tf_uh_xh)) + plot(f, abs(fit_uh_xh)) title('Frequency Response Function $\frac{y_x}{u_x}$') set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log'); ylabel('Amplitude') @@ -407,16 +488,16 @@ An we run the =vectfit3= algorithm. ax12 = subplot(2, 2, 2); hold on; - plot(f, abs(tf_uy_yx)) - plot(f, abs(fit_uy_yx)) + plot(f, abs(tf_uv_xh)) + plot(f, abs(fit_uv_xh)) title('Frequency Response Function $\frac{y_x}{u_y}$') set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log'); hold off; ax21 = subplot(2, 2, 3); hold on; - plot(f, abs(tf_ux_yy)) - plot(f, abs(fit_ux_yy)) + plot(f, abs(tf_uh_xv)) + plot(f, abs(fit_uh_xv)) title('Frequency Response Function $\frac{y_y}{u_x}$') set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log'); ylabel('Amplitude') @@ -425,8 +506,8 @@ An we run the =vectfit3= algorithm. ax22 = subplot(2, 2, 4); hold on; - plot(f, abs(tf_uy_yy)) - plot(f, abs(fit_uy_yy)) + plot(f, abs(tf_uv_xv)) + plot(f, abs(fit_uv_xv)) title('Frequency Response Function $\frac{y_y}{u_y}$') set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log'); xlabel('Frequency [Hz]') @@ -449,18 +530,42 @@ An we run the =vectfit3= algorithm. And finally, we create the identified state space model: #+begin_src matlab - G_ux_yx = minreal(ss(full(SER_ux_yx.A),SER_ux_yx.B,SER_ux_yx.C,SER_ux_yx.D)); - G_uy_yx = minreal(ss(full(SER_uy_yx.A),SER_uy_yx.B,SER_uy_yx.C,SER_uy_yx.D)); - G_ux_yy = minreal(ss(full(SER_ux_yy.A),SER_ux_yy.B,SER_ux_yy.C,SER_ux_yy.D)); - G_uy_yy = minreal(ss(full(SER_uy_yy.A),SER_uy_yy.B,SER_uy_yy.C,SER_uy_yy.D)); + G_uh_xh = minreal(ss(full(SER_uh_xh.A),SER_uh_xh.B,SER_uh_xh.C,SER_uh_xh.D)); + G_uv_xh = minreal(ss(full(SER_uv_xh.A),SER_uv_xh.B,SER_uv_xh.C,SER_uv_xh.D)); + G_uh_xv = minreal(ss(full(SER_uh_xv.A),SER_uh_xv.B,SER_uh_xv.C,SER_uh_xv.D)); + G_uv_xv = minreal(ss(full(SER_uv_xv.A),SER_uv_xv.B,SER_uv_xv.C,SER_uv_xv.D)); - G = [G_ux_yx, G_uy_yx; - G_ux_yy, G_uy_yy]; + G = [G_uh_xh, G_uv_xh; + G_uh_xv, G_uv_xv]; #+end_src #+begin_src matlab save('mat/plant.mat', 'G'); #+end_src +* Sensor Noise * Plant Analysis -* Control +** Rotation Matrix +#+begin_src matlab + G0 = freqresp(G, 0); +#+end_src +* Control Objective +The maximum expected stroke is $y_\text{max} = 3mm \approx 5e^{-2} rad$ at $1Hz$. +The maximum wanted error is $e_\text{max} = 10 \mu rad$. + +Thus, we require the sensitivity function at $\omega_0 = 1\text{ Hz}$: +\begin{align*} + |S(j\omega_0)| &< \left| \frac{e_\text{max}}{y_\text{max}} \right| \\ + &< 2 \cdot 10^{-4} +\end{align*} + +In terms of loop gain, this is equivalent to: +\[ |L(j\omega_0)| > 5 \cdot 10^{3} \] + +* Plant Scaling +- measured noise +- expected perturbations +- maximum input usage +- maximum wanted error + +* Control Design diff --git a/run_test.m b/run_test.m index 4cfecaa..503e74e 100644 --- a/run_test.m +++ b/run_test.m @@ -5,7 +5,7 @@ tg = slrt; % if tg.Status == "stopped" % %% Load the application % tg.load('test_cercalo'); -% +% % %% Run the application % tg.start; % pause(10); @@ -26,8 +26,8 @@ uh = data(:, 1); % Voltage sent to cercalo in horizontal direction uv = data(:, 2); % [...] in vertical direction xh = data(:, 3); % Measured horizontal position of the beam by the 4QD xv = data(:, 4); % [...] vertical position -cuh = data(:, 3); % Voltage of the cercalo's inductors used for horizontal -cuv = data(:, 4); % [...] vertical +cuh = data(:, 5); % Voltage of the cercalo's inductors used for horizontal +cuv = data(:, 6); % [...] vertical save('mat/data_uv.mat', 't', 'uh', 'uv', 'xh', 'xv', 'cuh', 'cuv');