dcm-feedback-control/dcm-feedback-control.html
2022-06-02 18:24:25 +02:00

1765 lines
99 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2022-06-02 Thu 18:23 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>ESRF Double Crystal Monochromator - Feedback Controller</title>
<meta name="author" content="Dehaeze Thomas" />
<meta name="generator" content="Org Mode" />
<link rel="stylesheet" type="text/css" href="https://research.tdehaeze.xyz/css/style.css"/>
<script type="text/javascript" src="https://research.tdehaeze.xyz/js/script.js"></script>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="../index.html"> UP </a>
|
<a accesskey="H" href="../index.html"> HOME </a>
</div><div id="content" class="content">
<h1 class="title">ESRF Double Crystal Monochromator - Feedback Controller</h1>
<div id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
<li><a href="#org1620898">1. Estimation of Sensitivity Function</a>
<ul>
<li><a href="#org0ff4d2f">1.1. Load Data</a></li>
<li><a href="#org5cb4293">1.2. Controller</a></li>
<li><a href="#org8589479">1.3. Test</a></li>
</ul>
</li>
<li><a href="#org51751d5">2. System Identification</a>
<ul>
<li><a href="#org73578a9">2.1. Identification ID24</a></li>
<li><a href="#orgc743cad">2.2. Identification</a></li>
<li><a href="#org673d6ae">2.3. Identification - New</a></li>
<li><a href="#orge907c10">2.4. Identification - White noise</a></li>
<li><a href="#org0186b06">2.5. Test</a></li>
<li><a href="#orgbc3952e">2.6. New controller - Higher bandwidth</a></li>
<li><a href="#orge532a7b">2.7. Added gain</a></li>
</ul>
</li>
<li><a href="#org3ccf16c">3. Noise Budgeting</a>
<ul>
<li><a href="#org493fefa">3.1. No Displacement</a></li>
<li><a href="#org4970c4f">3.2. Scans</a></li>
<li><a href="#org4b209d0">3.3. Noise budgeting - No rotation</a></li>
<li><a href="#org396c4bf">3.4. Noise budgeting - Bragg rotation</a></li>
</ul>
</li>
<li><a href="#org9f3bb05">4. Test Mode C</a>
<ul>
<li><a href="#org093ca2f">4.1. Mode B and Mode C</a></li>
</ul>
</li>
<li><a href="#orgbc6f5ab">5. Export numerator and denominator</a>
<ul>
<li><a href="#org2106b0d">5.1. Export</a></li>
<li><a href="#org3833e47">5.2. Verify</a></li>
</ul>
</li>
</ul>
</div>
</div>
<hr>
<p>This report is also available as a <a href="./dcm-feedback-control.pdf">pdf</a>.</p>
<hr>
<div id="outline-container-org1620898" class="outline-2">
<h2 id="org1620898"><span class="section-number-2">1.</span> Estimation of Sensitivity Function</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-org0ff4d2f" class="outline-3">
<h3 id="org0ff4d2f"><span class="section-number-3">1.1.</span> Load Data</h3>
<div class="outline-text-3" id="text-1-1">
<p>
Two scans are performed:
</p>
<ul class="org-ul">
<li><code>1.1</code> in mode B</li>
<li><code>3.1</code> in mode C</li>
</ul>
<p>
The difference between the two is that mode C adds the feedback controller.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Load Data of the new LUT method</span>
Ts = 0.1;
ol_drx = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'xanes_0003.h5'</span>,<span class="org-string">'/1.1/measurement/xtal_111_drx_filter'</span>)); <span class="org-comment-delimiter">% </span><span class="org-comment">Rx [rad]</span>
cl_drx = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'xanes_0003.h5'</span>,<span class="org-string">'/3.1/measurement/xtal_111_drx_filter'</span>)); <span class="org-comment-delimiter">% </span><span class="org-comment">Rx [rad]</span>
ol_dry = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'xanes_0003.h5'</span>,<span class="org-string">'/1.1/measurement/xtal_111_dry_filter'</span>)); <span class="org-comment-delimiter">% </span><span class="org-comment">Ry [rad]</span>
cl_dry = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'xanes_0003.h5'</span>,<span class="org-string">'/3.1/measurement/xtal_111_dry_filter'</span>)); <span class="org-comment-delimiter">% </span><span class="org-comment">Ry [rad]</span>
t = linspace(Ts, Ts<span class="org-builtin">*</span>length(ol_drx), length(ol_drx));
</pre>
</div>
<p>
By comparison the frequency content of the crystal orientation errors between mode B and mode C, it is possible to estimate the Sensitivity transfer function (Figure <a href="#org2936cb6">1</a>).
</p>
<div class="org-src-container">
<pre class="src src-matlab">win = hanning(ceil(1<span class="org-builtin">/</span>Ts));
[pxx_ol_drx, f] = pwelch(ol_drx, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_cl_drx, <span class="org-builtin">~</span>] = pwelch(cl_drx, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_ol_dry, <span class="org-builtin">~</span>] = pwelch(ol_dry, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_cl_dry, <span class="org-builtin">~</span>] = pwelch(cl_dry, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
<div id="org2936cb6" class="figure">
<p><img src="figs/sensitivity_function_drx_est.png" alt="sensitivity_function_drx_est.png" />
</p>
<p><span class="figure-number">Figure 1: </span>Estimation of the sensitivity transfer function magnitude</p>
</div>
</div>
</div>
<div id="outline-container-org5cb4293" class="outline-3">
<h3 id="org5cb4293"><span class="section-number-3">1.2.</span> Controller</h3>
<div class="outline-text-3" id="text-1-2">
<div class="org-src-container">
<pre class="src src-matlab">load(<span class="org-string">'X_tal_cage_PID.mat'</span>, <span class="org-string">'K'</span>);
</pre>
</div>
<div id="org511889d" class="figure">
<p><img src="figs/bode_plot_cur_controller.png" alt="bode_plot_cur_controller.png" />
</p>
<p><span class="figure-number">Figure 2: </span>Bode Plot of the Controller</p>
</div>
</div>
</div>
<div id="outline-container-org8589479" class="outline-3">
<h3 id="org8589479"><span class="section-number-3">1.3.</span> Test</h3>
<div class="outline-text-3" id="text-1-3">
<div class="org-src-container">
<pre class="src src-matlab">Ts = 5e<span class="org-builtin">-</span>3;
cl_drx = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'xanes_0003.h5'</span>,<span class="org-string">'/16.1/measurement/xtal_111_drx_filter'</span>)); <span class="org-comment-delimiter">% </span><span class="org-comment">Rx [rad]</span>
ol_drx = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'xanes_0003.h5'</span>,<span class="org-string">'/18.1/measurement/xtal_111_drx_filter'</span>)); <span class="org-comment-delimiter">% </span><span class="org-comment">Rx [rad]</span>
t = linspace(Ts, Ts<span class="org-builtin">*</span>length(ol_drx), length(ol_drx));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(t, ol_drx)
<span class="org-builtin">plot</span>(t, cl_drx)
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">win = hanning(ceil(10<span class="org-builtin">/</span>Ts));
[pxx_ol_drx, f] = pwelch(ol_drx, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_cl_drx, <span class="org-builtin">~</span>] = pwelch(cl_drx, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org51751d5" class="outline-2">
<h2 id="org51751d5"><span class="section-number-2">2.</span> System Identification</h2>
<div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-org73578a9" class="outline-3">
<h3 id="org73578a9"><span class="section-number-3">2.1.</span> Identification ID24</h3>
<div class="outline-text-3" id="text-2-1">
<div class="org-src-container">
<pre class="src src-matlab">load(<span class="org-string">'test_id_id24_3.mat'</span>)
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">t = 1e<span class="org-builtin">-</span>4<span class="org-builtin">*</span>ones(size(fjpur, 1), 1);
ur.dz = fjpur(<span class="org-builtin">:</span>,1) <span class="org-builtin">-</span> mean(fjpur(<span class="org-builtin">:</span>,1));
ur.dry = fjpur(<span class="org-builtin">:</span>,2) <span class="org-builtin">-</span> mean(fjpur(<span class="org-builtin">:</span>,2));
ur.drx = fjpur(<span class="org-builtin">:</span>,3) <span class="org-builtin">-</span> mean(fjpur(<span class="org-builtin">:</span>,3));
ur.u = fjpur(<span class="org-builtin">:</span>,7) <span class="org-builtin">-</span> mean(fjpur(<span class="org-builtin">:</span>,7));
uh.dz = fjpuh(<span class="org-builtin">:</span>,1) <span class="org-builtin">-</span> mean(fjpuh(<span class="org-builtin">:</span>,1));
uh.dry = fjpuh(<span class="org-builtin">:</span>,2) <span class="org-builtin">-</span> mean(fjpuh(<span class="org-builtin">:</span>,2));
uh.drx = fjpuh(<span class="org-builtin">:</span>,3) <span class="org-builtin">-</span> mean(fjpuh(<span class="org-builtin">:</span>,3));
uh.u = fjpuh(<span class="org-builtin">:</span>,8) <span class="org-builtin">-</span> mean(fjpuh(<span class="org-builtin">:</span>,8));
d.dz = fjpd(<span class="org-builtin">:</span>,1) <span class="org-builtin">-</span> mean(fjpd(<span class="org-builtin">:</span>,1));
d.dry = fjpd(<span class="org-builtin">:</span>,2) <span class="org-builtin">-</span> mean(fjpd(<span class="org-builtin">:</span>,2));
d.drx = fjpd(<span class="org-builtin">:</span>,3) <span class="org-builtin">-</span> mean(fjpd(<span class="org-builtin">:</span>,3));
d.u = fjpd(<span class="org-builtin">:</span>,9) <span class="org-builtin">-</span> mean(fjpd(<span class="org-builtin">:</span>,9));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">J_a_311 = [1, 0.14, <span class="org-builtin">-</span>0.0675
1, 0.14, 0.1525
1, <span class="org-builtin">-</span>0.14, 0.0425];
J_a_111 = [1, 0.14, <span class="org-builtin">-</span>0.1525
1, 0.14, 0.0675
1, <span class="org-builtin">-</span>0.14, <span class="org-builtin">-</span>0.0425];
ur.y = [J_a_311 <span class="org-builtin">*</span> [<span class="org-builtin">-</span>ur.dz, ur.dry,<span class="org-builtin">-</span>ur.drx]<span class="org-builtin">'</span>]<span class="org-builtin">'</span>;
uh.y = [J_a_311 <span class="org-builtin">*</span> [<span class="org-builtin">-</span>uh.dz, uh.dry,<span class="org-builtin">-</span>uh.drx]<span class="org-builtin">'</span>]<span class="org-builtin">'</span>;
d.y = [J_a_311 <span class="org-builtin">*</span> [<span class="org-builtin">-</span>d.dz, d.dry, <span class="org-builtin">-</span>d.drx]<span class="org-builtin">'</span>]<span class="org-builtin">'</span>;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Sampling Time and Frequency</span>
Ts = 1e<span class="org-builtin">-</span>4; <span class="org-comment-delimiter">% </span><span class="org-comment">[s]</span>
Fs = 1<span class="org-builtin">/</span>Ts; <span class="org-comment-delimiter">% </span><span class="org-comment">[Hz]</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Hannning Windows</span>
win = hanning(ceil(1<span class="org-builtin">*</span>Fs));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% And we get the frequency vector</span>
[G_ur, f] = tfestimate(ur.u, ur.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[G_uh, <span class="org-builtin">~</span>] = tfestimate(uh.u, uh.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[G_d, <span class="org-builtin">~</span>] = tfestimate(d.u, d.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">[coh_ur, <span class="org-builtin">~</span>] = mscohere(ur.u, ur.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[coh_uh, <span class="org-builtin">~</span>] = mscohere(uh.u, uh.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[coh_d, <span class="org-builtin">~</span>] = mscohere(d.u, d.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc743cad" class="outline-3">
<h3 id="orgc743cad"><span class="section-number-3">2.2.</span> Identification</h3>
<div class="outline-text-3" id="text-2-2">
<div class="org-src-container">
<pre class="src src-matlab">ur = load(<span class="org-string">'FJPUR_step.mat'</span>);
uh = load(<span class="org-string">'FJPUH_step.mat'</span>);
d = load(<span class="org-string">'FJPD_step.mat'</span>);
</pre>
</div>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-right" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-right">1</td>
<td class="org-left">dz311</td>
</tr>
<tr>
<td class="org-right">2</td>
<td class="org-left">dry311</td>
</tr>
<tr>
<td class="org-right">3</td>
<td class="org-left">drx311</td>
</tr>
<tr>
<td class="org-right">4</td>
<td class="org-left">dz111</td>
</tr>
<tr>
<td class="org-right">5</td>
<td class="org-left">dry111</td>
</tr>
<tr>
<td class="org-right">6</td>
<td class="org-left">drx111</td>
</tr>
<tr>
<td class="org-right">7</td>
<td class="org-left">fjpur</td>
</tr>
<tr>
<td class="org-right">8</td>
<td class="org-left">fjpuh</td>
</tr>
<tr>
<td class="org-right">9</td>
<td class="org-left">fjpd</td>
</tr>
<tr>
<td class="org-right">10</td>
<td class="org-left">bragg</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-matlab">ur.time = ur.time <span class="org-builtin">-</span> ur.time(1);
ur.allValues(<span class="org-builtin">:</span>, 1) = ur.allValues(<span class="org-builtin">:</span>, 1) <span class="org-builtin">-</span> mean(ur.allValues(ur.time<span class="org-builtin">&lt;</span>1, 1));
ur.allValues(<span class="org-builtin">:</span>, 2) = ur.allValues(<span class="org-builtin">:</span>, 2) <span class="org-builtin">-</span> mean(ur.allValues(ur.time<span class="org-builtin">&lt;</span>1, 2));
ur.allValues(<span class="org-builtin">:</span>, 3) = ur.allValues(<span class="org-builtin">:</span>, 3) <span class="org-builtin">-</span> mean(ur.allValues(ur.time<span class="org-builtin">&lt;</span>1, 3));
t_filt = ur.time <span class="org-builtin">&gt;</span> 48 <span class="org-builtin">&amp;</span> ur.time <span class="org-builtin">&lt;</span> 60;
ur.u = ur.allValues(t_filt, 7);
ur.y_111 = [<span class="org-builtin">-</span>ur.allValues(t_filt, 1), ur.allValues(t_filt, 2), ur.allValues(t_filt, 3)];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">uh.time = uh.time <span class="org-builtin">-</span> uh.time(1);
uh.allValues(<span class="org-builtin">:</span>, 1) = uh.allValues(<span class="org-builtin">:</span>, 1) <span class="org-builtin">-</span> mean(uh.allValues(uh.time<span class="org-builtin">&lt;</span>1, 1));
uh.allValues(<span class="org-builtin">:</span>, 2) = uh.allValues(<span class="org-builtin">:</span>, 2) <span class="org-builtin">-</span> mean(uh.allValues(uh.time<span class="org-builtin">&lt;</span>1, 2));
uh.allValues(<span class="org-builtin">:</span>, 3) = uh.allValues(<span class="org-builtin">:</span>, 3) <span class="org-builtin">-</span> mean(uh.allValues(uh.time<span class="org-builtin">&lt;</span>1, 3));
uh.u = uh.allValues(t_filt, 8);
uh.y_111 = [<span class="org-builtin">-</span>uh.allValues(t_filt, 1), uh.allValues(t_filt, 2), uh.allValues(t_filt, 3)];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">d.time = d.time <span class="org-builtin">-</span> d.time(1);
d.allValues(<span class="org-builtin">:</span>, 1) = d.allValues(<span class="org-builtin">:</span>, 1) <span class="org-builtin">-</span> mean(d.allValues(d.time<span class="org-builtin">&lt;</span>1, 1));
d.allValues(<span class="org-builtin">:</span>, 2) = d.allValues(<span class="org-builtin">:</span>, 2) <span class="org-builtin">-</span> mean(d.allValues(d.time<span class="org-builtin">&lt;</span>1, 2));
d.allValues(<span class="org-builtin">:</span>, 3) = d.allValues(<span class="org-builtin">:</span>, 3) <span class="org-builtin">-</span> mean(d.allValues(d.time<span class="org-builtin">&lt;</span>1, 3));
d.u = d.allValues(t_filt, 9);
d.y_111 = [<span class="org-builtin">-</span>d.allValues(t_filt, 1), d.allValues(t_filt, 2), d.allValues(t_filt, 3)];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">J_a_111 = [1, 0.14, <span class="org-builtin">-</span>0.0675
1, 0.14, 0.1525
1, <span class="org-builtin">-</span>0.14, 0.0425];
J_a_311 = [1, 0.14, <span class="org-builtin">-</span>0.1525
1, 0.14, 0.0675
1, <span class="org-builtin">-</span>0.14, <span class="org-builtin">-</span>0.0425];
ur.y = [J_a_311 <span class="org-builtin">*</span> ur.y_111<span class="org-builtin">'</span>]<span class="org-builtin">'</span>;
uh.y = [J_a_311 <span class="org-builtin">*</span> uh.y_111<span class="org-builtin">'</span>]<span class="org-builtin">'</span>;
d.y = [J_a_311 <span class="org-builtin">*</span> d.y_111<span class="org-builtin">'</span>]<span class="org-builtin">'</span>;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Sampling Time and Frequency</span>
Ts = 1e<span class="org-builtin">-</span>4; <span class="org-comment-delimiter">% </span><span class="org-comment">[s]</span>
Fs = 1<span class="org-builtin">/</span>Ts; <span class="org-comment-delimiter">% </span><span class="org-comment">[Hz]</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Hannning Windows</span>
win = hanning(ceil(5<span class="org-builtin">*</span>Fs));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% And we get the frequency vector</span>
[G_ur, f] = tfestimate(ur.u, ur.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[G_uh, <span class="org-builtin">~</span>] = tfestimate(uh.u, uh.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[G_d, <span class="org-builtin">~</span>] = tfestimate(d.u, d.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">[coh_ur, <span class="org-builtin">~</span>] = mscohere(ur.u, ur.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[coh_uh, <span class="org-builtin">~</span>] = mscohere(uh.u, uh.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[coh_d, <span class="org-builtin">~</span>] = mscohere(d.u, d.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
<div id="org5c94b33" class="figure">
<p><img src="figs/coherence_id_dcm_dyn.png" alt="coherence_id_dcm_dyn.png" />
</p>
<p><span class="figure-number">Figure 3: </span>Coherence</p>
</div>
<div id="org301c9e5" class="figure">
<p><img src="figs/bode_plot_dcm_dynamics.png" alt="bode_plot_dcm_dynamics.png" />
</p>
<p><span class="figure-number">Figure 4: </span>Bode Plot of the DCM dynamics in the frame of the fast jack.</p>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Previously used controller</span>
load(<span class="org-string">'X_tal_cage_PID.mat'</span>, <span class="org-string">'K'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Controller design</span>
s = tf(<span class="org-string">'s'</span>);
<span class="org-comment-delimiter">% </span><span class="org-comment">Lead</span>
a = 4; <span class="org-comment-delimiter">% </span><span class="org-comment">Amount of phase lead / width of the phase lead / high frequency gain</span>
wc = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>20; <span class="org-comment-delimiter">% </span><span class="org-comment">Frequency with the maximum phase lead [rad/s]</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Low Pass Filter</span>
w0 = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>100; <span class="org-comment-delimiter">% </span><span class="org-comment">Cut-off frequency [rad/s]</span>
xi = 0.4; <span class="org-comment-delimiter">% </span><span class="org-comment">Damping Ratio</span>
Kb = eye(3)<span class="org-builtin">*</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>20)<span class="org-builtin">^</span>2<span class="org-builtin">/</span>(s<span class="org-builtin">^</span>2) <span class="org-builtin">*</span>1<span class="org-builtin">/</span>(sqrt(a))<span class="org-builtin">*</span> (1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(wc<span class="org-builtin">/</span>sqrt(a)))<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(wc<span class="org-builtin">*</span>sqrt(a))) <span class="org-builtin">*</span> 1<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>xi<span class="org-builtin">/</span>w0<span class="org-builtin">*</span>s <span class="org-builtin">+</span> s<span class="org-builtin">^</span>2<span class="org-builtin">/</span>w0<span class="org-builtin">^</span>2);;
</pre>
</div>
<div id="orgaec2623" class="figure">
<p><img src="figs/loop_gain_dcm_contr_simple.png" alt="loop_gain_dcm_contr_simple.png" />
</p>
<p><span class="figure-number">Figure 5: </span>Loop gain</p>
</div>
<div id="org3a5fc68" class="figure">
<p><img src="figs/loop_gain_diag_old_new_contr.png" alt="loop_gain_diag_old_new_contr.png" />
</p>
<p><span class="figure-number">Figure 6: </span>Loop gain</p>
</div>
<p>
Compare Sensitivity functions
</p>
<div id="org5cb9988" class="figure">
<p><img src="figs/sensitivity_comp.png" alt="sensitivity_comp.png" />
</p>
<p><span class="figure-number">Figure 7: </span>Comparison of sensitivity functions</p>
</div>
<div class="org-src-container">
<pre class="src src-matlab">L = zeros(3, 3, length(f));
Lb = zeros(3, 3, length(f));
<span class="org-keyword">for</span> <span class="org-variable-name">i_f</span> = <span class="org-constant">1:length(f)</span>
L(<span class="org-builtin">:</span>,<span class="org-builtin">:</span>,i_f) = [G_ur(i_f,<span class="org-builtin">:</span>); G_uh(i_f,<span class="org-builtin">:</span>); G_d(i_f,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>freqresp(K , f(i_f), <span class="org-string">'Hz'</span>);
Lb(<span class="org-builtin">:</span>,<span class="org-builtin">:</span>,i_f) = [G_ur(i_f,<span class="org-builtin">:</span>); G_uh(i_f,<span class="org-builtin">:</span>); G_d(i_f,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>freqresp(Kb, f(i_f), <span class="org-string">'Hz'</span>);
<span class="org-keyword">end</span>
</pre>
</div>
<div id="org263ead8" class="figure">
<p><img src="figs/loci_loop_gain_comp_controllers.png" alt="loci_loop_gain_comp_controllers.png" />
</p>
<p><span class="figure-number">Figure 8: </span>Root Locus</p>
</div>
</div>
</div>
<div id="outline-container-org673d6ae" class="outline-3">
<h3 id="org673d6ae"><span class="section-number-3">2.3.</span> Identification - New</h3>
<div class="outline-text-3" id="text-2-3">
<div class="org-src-container">
<pre class="src src-matlab">ur = load(<span class="org-string">'FJPUR_step_new.mat'</span>);
uh = load(<span class="org-string">'FJPUH_step_new.mat'</span>);
d = load(<span class="org-string">'FJPD_step_new.mat'</span>);
</pre>
</div>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-right" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-right">1</td>
<td class="org-left">dz311</td>
</tr>
<tr>
<td class="org-right">2</td>
<td class="org-left">dry311</td>
</tr>
<tr>
<td class="org-right">3</td>
<td class="org-left">drx311</td>
</tr>
<tr>
<td class="org-right">4</td>
<td class="org-left">dz111</td>
</tr>
<tr>
<td class="org-right">5</td>
<td class="org-left">dry111</td>
</tr>
<tr>
<td class="org-right">6</td>
<td class="org-left">drx111</td>
</tr>
<tr>
<td class="org-right">7</td>
<td class="org-left">fjpur</td>
</tr>
<tr>
<td class="org-right">8</td>
<td class="org-left">fjpuh</td>
</tr>
<tr>
<td class="org-right">9</td>
<td class="org-left">fjpd</td>
</tr>
<tr>
<td class="org-right">10</td>
<td class="org-left">bragg</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-matlab">ur.time = ur.time <span class="org-builtin">-</span> ur.time(1);
ur.allValues(<span class="org-builtin">:</span>, 1) = ur.allValues(<span class="org-builtin">:</span>, 1) <span class="org-builtin">-</span> mean(ur.allValues(ur.time<span class="org-builtin">&lt;</span>0.1, 1));
ur.allValues(<span class="org-builtin">:</span>, 2) = ur.allValues(<span class="org-builtin">:</span>, 2) <span class="org-builtin">-</span> mean(ur.allValues(ur.time<span class="org-builtin">&lt;</span>0.1, 2));
ur.allValues(<span class="org-builtin">:</span>, 3) = ur.allValues(<span class="org-builtin">:</span>, 3) <span class="org-builtin">-</span> mean(ur.allValues(ur.time<span class="org-builtin">&lt;</span>0.1, 3));
t_filt = ur.time <span class="org-builtin">&lt;</span> 5;
ur.u = ur.allValues(t_filt, 7);
ur.y_111 = [<span class="org-builtin">-</span>ur.allValues(t_filt, 1), ur.allValues(t_filt, 2), ur.allValues(t_filt, 3)];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">uh.time = uh.time <span class="org-builtin">-</span> uh.time(1);
uh.allValues(<span class="org-builtin">:</span>, 1) = uh.allValues(<span class="org-builtin">:</span>, 1) <span class="org-builtin">-</span> mean(uh.allValues(uh.time<span class="org-builtin">&lt;</span>0.1, 1));
uh.allValues(<span class="org-builtin">:</span>, 2) = uh.allValues(<span class="org-builtin">:</span>, 2) <span class="org-builtin">-</span> mean(uh.allValues(uh.time<span class="org-builtin">&lt;</span>0.1, 2));
uh.allValues(<span class="org-builtin">:</span>, 3) = uh.allValues(<span class="org-builtin">:</span>, 3) <span class="org-builtin">-</span> mean(uh.allValues(uh.time<span class="org-builtin">&lt;</span>0.1, 3));
uh.u = uh.allValues(t_filt, 8);
uh.y_111 = [<span class="org-builtin">-</span>uh.allValues(t_filt, 1), uh.allValues(t_filt, 2), uh.allValues(t_filt, 3)];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">d.time = d.time <span class="org-builtin">-</span> d.time(1);
d.allValues(<span class="org-builtin">:</span>, 1) = d.allValues(<span class="org-builtin">:</span>, 1) <span class="org-builtin">-</span> mean(d.allValues(d.time<span class="org-builtin">&lt;</span>0.1, 1));
d.allValues(<span class="org-builtin">:</span>, 2) = d.allValues(<span class="org-builtin">:</span>, 2) <span class="org-builtin">-</span> mean(d.allValues(d.time<span class="org-builtin">&lt;</span>0.1, 2));
d.allValues(<span class="org-builtin">:</span>, 3) = d.allValues(<span class="org-builtin">:</span>, 3) <span class="org-builtin">-</span> mean(d.allValues(d.time<span class="org-builtin">&lt;</span>0.1, 3));
d.u = d.allValues(t_filt, 9);
d.y_111 = [<span class="org-builtin">-</span>d.allValues(t_filt, 1), d.allValues(t_filt, 2), d.allValues(t_filt, 3)];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">J_a_111 = [1, 0.14, <span class="org-builtin">-</span>0.0675
1, 0.14, 0.1525
1, <span class="org-builtin">-</span>0.14, 0.0425];
J_a_311 = [1, 0.14, <span class="org-builtin">-</span>0.1525
1, 0.14, 0.0675
1, <span class="org-builtin">-</span>0.14, <span class="org-builtin">-</span>0.0425];
ur.y = [J_a_311 <span class="org-builtin">*</span> ur.y_111<span class="org-builtin">'</span>]<span class="org-builtin">'</span>;
uh.y = [J_a_311 <span class="org-builtin">*</span> uh.y_111<span class="org-builtin">'</span>]<span class="org-builtin">'</span>;
d.y = [J_a_311 <span class="org-builtin">*</span> d.y_111<span class="org-builtin">'</span>]<span class="org-builtin">'</span>;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Sampling Time and Frequency</span>
Ts = 1e<span class="org-builtin">-</span>4; <span class="org-comment-delimiter">% </span><span class="org-comment">[s]</span>
Fs = 1<span class="org-builtin">/</span>Ts; <span class="org-comment-delimiter">% </span><span class="org-comment">[Hz]</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Hannning Windows</span>
win = hanning(ceil(5<span class="org-builtin">*</span>Fs));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% And we get the frequency vector</span>
[G_ur, f] = tfestimate(ur.u, ur.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[G_uh, <span class="org-builtin">~</span>] = tfestimate(uh.u, uh.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[G_d, <span class="org-builtin">~</span>] = tfestimate(d.u, d.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">[coh_ur, <span class="org-builtin">~</span>] = mscohere(ur.u, ur.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[coh_uh, <span class="org-builtin">~</span>] = mscohere(uh.u, uh.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[coh_d, <span class="org-builtin">~</span>] = mscohere(d.u, d.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Previously used controller</span>
load(<span class="org-string">'X_tal_cage_PID.mat'</span>, <span class="org-string">'K'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Controller design</span>
s = tf(<span class="org-string">'s'</span>);
<span class="org-comment-delimiter">% </span><span class="org-comment">Lead</span>
a = 4; <span class="org-comment-delimiter">% </span><span class="org-comment">Amount of phase lead / width of the phase lead / high frequency gain</span>
wc = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>20; <span class="org-comment-delimiter">% </span><span class="org-comment">Frequency with the maximum phase lead [rad/s]</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Low Pass Filter</span>
w0 = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>100; <span class="org-comment-delimiter">% </span><span class="org-comment">Cut-off frequency [rad/s]</span>
xi = 0.4; <span class="org-comment-delimiter">% </span><span class="org-comment">Damping Ratio</span>
Kb = eye(3)<span class="org-builtin">*</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>20)<span class="org-builtin">^</span>2<span class="org-builtin">/</span>(s<span class="org-builtin">^</span>2) <span class="org-builtin">*</span>1<span class="org-builtin">/</span>(sqrt(a))<span class="org-builtin">*</span> (1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(wc<span class="org-builtin">/</span>sqrt(a)))<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(wc<span class="org-builtin">*</span>sqrt(a))) <span class="org-builtin">*</span> 1<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>xi<span class="org-builtin">/</span>w0<span class="org-builtin">*</span>s <span class="org-builtin">+</span> s<span class="org-builtin">^</span>2<span class="org-builtin">/</span>w0<span class="org-builtin">^</span>2);;
</pre>
</div>
<p>
Compare Sensitivity functions
</p>
<div id="org2369077" class="figure">
<p><img src="figs/sensitivity_comp.png" alt="sensitivity_comp.png" />
</p>
<p><span class="figure-number">Figure 9: </span>Comparison of sensitivity functions</p>
</div>
<div class="org-src-container">
<pre class="src src-matlab">L = zeros(3, 3, length(f));
Lb = zeros(3, 3, length(f));
<span class="org-keyword">for</span> <span class="org-variable-name">i_f</span> = <span class="org-constant">1:length(f)</span>
L(<span class="org-builtin">:</span>,<span class="org-builtin">:</span>,i_f) = [G_ur(i_f,<span class="org-builtin">:</span>); G_uh(i_f,<span class="org-builtin">:</span>); G_d(i_f,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>freqresp(K , f(i_f), <span class="org-string">'Hz'</span>);
Lb(<span class="org-builtin">:</span>,<span class="org-builtin">:</span>,i_f) = [G_ur(i_f,<span class="org-builtin">:</span>); G_uh(i_f,<span class="org-builtin">:</span>); G_d(i_f,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>freqresp(Kb, f(i_f), <span class="org-string">'Hz'</span>);
<span class="org-keyword">end</span>
</pre>
</div>
<div id="orgc3a88ca" class="figure">
<p><img src="figs/loci_loop_gain_comp_controllers.png" alt="loci_loop_gain_comp_controllers.png" />
</p>
<p><span class="figure-number">Figure 10: </span>Root Locus</p>
</div>
</div>
</div>
<div id="outline-container-orge907c10" class="outline-3">
<h3 id="orge907c10"><span class="section-number-3">2.4.</span> Identification - White noise</h3>
<div class="outline-text-3" id="text-2-4">
<div class="org-src-container">
<pre class="src src-matlab">ur = load(<span class="org-string">'fjpur_white_noise.mat'</span>);
uh = load(<span class="org-string">'fjpuh_white_noise.mat'</span>);
d = load(<span class="org-string">'fjpd_white_noise.mat'</span>);
</pre>
</div>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-right" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-right">1</td>
<td class="org-left">dz111</td>
</tr>
<tr>
<td class="org-right">2</td>
<td class="org-left">dry111</td>
</tr>
<tr>
<td class="org-right">3</td>
<td class="org-left">drx111</td>
</tr>
<tr>
<td class="org-right">4</td>
<td class="org-left">fjpur</td>
</tr>
<tr>
<td class="org-right">5</td>
<td class="org-left">fjpuh</td>
</tr>
<tr>
<td class="org-right">6</td>
<td class="org-left">fjpd</td>
</tr>
<tr>
<td class="org-right">7</td>
<td class="org-left">bragg</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-matlab">ur.time = ur.time <span class="org-builtin">-</span> ur.time(1);
ur.drx = ur.drx <span class="org-builtin">-</span> mean(ur.drx);
ur.dry = ur.dry <span class="org-builtin">-</span> mean(ur.dry);
ur.dz = ur.dz <span class="org-builtin">-</span> mean(ur.dz);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">uh.time = uh.time <span class="org-builtin">-</span> uh.time(1);
uh.drx = uh.drx <span class="org-builtin">-</span> mean(uh.drx);
uh.dry = uh.dry <span class="org-builtin">-</span> mean(uh.dry);
uh.dz = uh.dz <span class="org-builtin">-</span> mean(uh.dz);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">d.time = d.time <span class="org-builtin">-</span> d.time(1);
d.drx = d.drx <span class="org-builtin">-</span> mean(d.drx);
d.dry = d.dry <span class="org-builtin">-</span> mean(d.dry);
d.dz = d.dz <span class="org-builtin">-</span> mean(d.dz);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">J_a_111 = [1, 0.14, <span class="org-builtin">-</span>0.0675
1, 0.14, 0.1525
1, <span class="org-builtin">-</span>0.14, 0.0425];
ur.y = [J_a_111 <span class="org-builtin">*</span> [<span class="org-builtin">-</span>ur.dz, ur.dry, ur.drx]<span class="org-builtin">'</span>]<span class="org-builtin">'</span>;
uh.y = [J_a_111 <span class="org-builtin">*</span> [<span class="org-builtin">-</span>uh.dz, uh.dry, uh.drx]<span class="org-builtin">'</span>]<span class="org-builtin">'</span>;
d.y = [J_a_111 <span class="org-builtin">*</span> [<span class="org-builtin">-</span>d.dz, d.dry, d.drx]<span class="org-builtin">'</span>]<span class="org-builtin">'</span>;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Sampling Time and Frequency</span>
Ts = 1e<span class="org-builtin">-</span>4; <span class="org-comment-delimiter">% </span><span class="org-comment">[s]</span>
Fs = 1<span class="org-builtin">/</span>Ts; <span class="org-comment-delimiter">% </span><span class="org-comment">[Hz]</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Hannning Windows</span>
win = hanning(ceil(0.5<span class="org-builtin">*</span>Fs));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% And we get the frequency vector</span>
[G_ur, f] = tfestimate(ur.fjpur, ur.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[G_uh, <span class="org-builtin">~</span>] = tfestimate(uh.fjpuh, uh.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[G_d, <span class="org-builtin">~</span>] = tfestimate(d.fjpd, d.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">[coh_ur, <span class="org-builtin">~</span>] = mscohere(ur.fjpur, ur.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[coh_uh, <span class="org-builtin">~</span>] = mscohere(uh.fjpuh, uh.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
[coh_d, <span class="org-builtin">~</span>] = mscohere(d.fjpd, d.y, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
<div id="orgf3b9650" class="figure">
<p><img src="figs/coherence_ident_noise.png" alt="coherence_ident_noise.png" />
</p>
<p><span class="figure-number">Figure 11: </span>description</p>
</div>
<div id="org164ac89" class="figure">
<p><img src="figs/bode_plot_ident_noise.png" alt="bode_plot_ident_noise.png" />
</p>
<p><span class="figure-number">Figure 12: </span>Bode Plot of the DCM dynamics in the frame of the fast jack.</p>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Previously used controller</span>
load(<span class="org-string">'X_tal_cage_PID.mat'</span>, <span class="org-string">'K'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Controller design</span>
s = tf(<span class="org-string">'s'</span>);
<span class="org-comment-delimiter">% </span><span class="org-comment">Lead</span>
a = 8; <span class="org-comment-delimiter">% </span><span class="org-comment">Amount of phase lead / width of the phase lead / high frequency gain</span>
wc = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>20; <span class="org-comment-delimiter">% </span><span class="org-comment">Frequency with the maximum phase lead [rad/s]</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Low Pass Filter</span>
w0 = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>80; <span class="org-comment-delimiter">% </span><span class="org-comment">Cut-off frequency [rad/s]</span>
xi = 0.4; <span class="org-comment-delimiter">% </span><span class="org-comment">Damping Ratio</span>
Kb = eye(3)<span class="org-builtin">*</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>20)<span class="org-builtin">^</span>2<span class="org-builtin">/</span>(s<span class="org-builtin">^</span>2) <span class="org-builtin">*</span>1<span class="org-builtin">/</span>(sqrt(a))<span class="org-builtin">*</span> (1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(wc<span class="org-builtin">/</span>sqrt(a)))<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(wc<span class="org-builtin">*</span>sqrt(a))) <span class="org-builtin">*</span> 1<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>xi<span class="org-builtin">/</span>w0<span class="org-builtin">*</span>s <span class="org-builtin">+</span> s<span class="org-builtin">^</span>2<span class="org-builtin">/</span>w0<span class="org-builtin">^</span>2);;
</pre>
</div>
<div id="orgc24fb93" class="figure">
<p><img src="figs/loop_gain_dcm_contr_simple.png" alt="loop_gain_dcm_contr_simple.png" />
</p>
<p><span class="figure-number">Figure 13: </span>Loop gain</p>
</div>
<div id="org20893e8" class="figure">
<p><img src="figs/loop_gain_diag_old_new_contr.png" alt="loop_gain_diag_old_new_contr.png" />
</p>
<p><span class="figure-number">Figure 14: </span>Loop gain</p>
</div>
<p>
Compare Sensitivity functions
</p>
<div id="orge7079a4" class="figure">
<p><img src="figs/sensitivity_comp.png" alt="sensitivity_comp.png" />
</p>
<p><span class="figure-number">Figure 15: </span>Comparison of sensitivity functions</p>
</div>
<div class="org-src-container">
<pre class="src src-matlab">L = zeros(3, 3, length(f));
Lb = zeros(3, 3, length(f));
<span class="org-keyword">for</span> <span class="org-variable-name">i_f</span> = <span class="org-constant">1:length(f)</span>
L(<span class="org-builtin">:</span>,<span class="org-builtin">:</span>,i_f) = [G_ur(i_f,<span class="org-builtin">:</span>); G_uh(i_f,<span class="org-builtin">:</span>); G_d(i_f,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>freqresp(K , f(i_f), <span class="org-string">'Hz'</span>);
Lb(<span class="org-builtin">:</span>,<span class="org-builtin">:</span>,i_f) = [G_ur(i_f,<span class="org-builtin">:</span>); G_uh(i_f,<span class="org-builtin">:</span>); G_d(i_f,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>freqresp(Kb, f(i_f), <span class="org-string">'Hz'</span>);
<span class="org-keyword">end</span>
</pre>
</div>
<div id="org03e5090" class="figure">
<p><img src="figs/loci_loop_gain_comp_controllers.png" alt="loci_loop_gain_comp_controllers.png" />
</p>
<p><span class="figure-number">Figure 16: </span>Root Locus</p>
</div>
</div>
</div>
<div id="outline-container-org0186b06" class="outline-3">
<h3 id="org0186b06"><span class="section-number-3">2.5.</span> Test</h3>
<div class="outline-text-3" id="text-2-5">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Notch</span>
gm = 0.015;
xi = 0.1;
wn = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>208;
K_notch = (s<span class="org-builtin">^</span>2 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>gm<span class="org-builtin">*</span>xi<span class="org-builtin">*</span>wn<span class="org-builtin">*</span>s <span class="org-builtin">+</span> wn<span class="org-builtin">^</span>2)<span class="org-builtin">/</span>(s<span class="org-builtin">^</span>2 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>xi<span class="org-builtin">*</span>wn<span class="org-builtin">*</span>s <span class="org-builtin">+</span> wn<span class="org-builtin">^</span>2);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Double integrator</span>
w0 = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>40;
K_int = (w0<span class="org-builtin">^</span>2)<span class="org-builtin">/</span>(s<span class="org-builtin">^</span>2);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Lead</span>
a = 3; <span class="org-comment-delimiter">% </span><span class="org-comment">Amount of phase lead / width of the phase lead / high frequency gain</span>
K_lead = 1<span class="org-builtin">/</span>(sqrt(a))<span class="org-builtin">*</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(w0<span class="org-builtin">/</span>sqrt(a)))<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(w0<span class="org-builtin">*</span>sqrt(a)));
K_lead = K_lead<span class="org-builtin">*</span>K_lead;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Low Pass Filter</span>
w0 = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>120; <span class="org-comment-delimiter">% </span><span class="org-comment">Cut-off frequency [rad/s]</span>
xi = 0.3; <span class="org-comment-delimiter">% </span><span class="org-comment">Damping Ratio</span>
K_lpf = 1<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>xi<span class="org-builtin">/</span>w0<span class="org-builtin">*</span>s <span class="org-builtin">+</span> s<span class="org-builtin">^</span>2<span class="org-builtin">/</span>w0<span class="org-builtin">^</span>2);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Diagonal controller</span>
Kb = 0.8<span class="org-builtin">*</span>eye(3)<span class="org-builtin">*</span>K_notch<span class="org-builtin">*</span>K_int<span class="org-builtin">*</span>K_lead<span class="org-builtin">*</span>K_lpf;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgbc3952e" class="outline-3">
<h3 id="orgbc3952e"><span class="section-number-3">2.6.</span> New controller - Higher bandwidth</h3>
<div class="outline-text-3" id="text-2-6">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Previously used controller</span>
load(<span class="org-string">'X_tal_cage_PID.mat'</span>, <span class="org-string">'K'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Current Controller design</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Lead</span>
a = 8; <span class="org-comment-delimiter">% </span><span class="org-comment">Amount of phase lead / width of the phase lead / high frequency gain</span>
wc = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>20; <span class="org-comment-delimiter">% </span><span class="org-comment">Frequency with the maximum phase lead [rad/s]</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Low Pass Filter</span>
w0 = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>80; <span class="org-comment-delimiter">% </span><span class="org-comment">Cut-off frequency [rad/s]</span>
xi = 0.4; <span class="org-comment-delimiter">% </span><span class="org-comment">Damping Ratio</span>
Kb_old = eye(3)<span class="org-builtin">*</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>20)<span class="org-builtin">^</span>2<span class="org-builtin">/</span>(s<span class="org-builtin">^</span>2) <span class="org-builtin">*</span>1<span class="org-builtin">/</span>(sqrt(a))<span class="org-builtin">*</span> (1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(wc<span class="org-builtin">/</span>sqrt(a)))<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(wc<span class="org-builtin">*</span>sqrt(a))) <span class="org-builtin">*</span> 1<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>xi<span class="org-builtin">/</span>w0<span class="org-builtin">*</span>s <span class="org-builtin">+</span> s<span class="org-builtin">^</span>2<span class="org-builtin">/</span>w0<span class="org-builtin">^</span>2);;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Notch</span>
gm = 0.015;
xi = 0.2;
wn = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>208;
K_notch = (s<span class="org-builtin">^</span>2 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>gm<span class="org-builtin">*</span>xi<span class="org-builtin">*</span>wn<span class="org-builtin">*</span>s <span class="org-builtin">+</span> wn<span class="org-builtin">^</span>2)<span class="org-builtin">/</span>(s<span class="org-builtin">^</span>2 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>xi<span class="org-builtin">*</span>wn<span class="org-builtin">*</span>s <span class="org-builtin">+</span> wn<span class="org-builtin">^</span>2);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Double integrator</span>
w0 = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>40;
K_int = (w0<span class="org-builtin">^</span>2)<span class="org-builtin">/</span>(s<span class="org-builtin">^</span>2);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Lead</span>
a = 3; <span class="org-comment-delimiter">% </span><span class="org-comment">Amount of phase lead / width of the phase lead / high frequency gain</span>
w0 = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>40;
K_lead = 1<span class="org-builtin">/</span>(sqrt(a))<span class="org-builtin">*</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(w0<span class="org-builtin">/</span>sqrt(a)))<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(w0<span class="org-builtin">*</span>sqrt(a)));
K_lead = K_lead<span class="org-builtin">*</span>K_lead;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Low Pass Filter</span>
w0 = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>120; <span class="org-comment-delimiter">% </span><span class="org-comment">Cut-off frequency [rad/s]</span>
xi = 0.3; <span class="org-comment-delimiter">% </span><span class="org-comment">Damping Ratio</span>
K_lpf = 1<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>xi<span class="org-builtin">/</span>w0<span class="org-builtin">*</span>s <span class="org-builtin">+</span> s<span class="org-builtin">^</span>2<span class="org-builtin">/</span>w0<span class="org-builtin">^</span>2);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Diagonal controller</span>
Kb = 0.9<span class="org-builtin">*</span>eye(3)<span class="org-builtin">*</span>K_notch<span class="org-builtin">*</span>K_int<span class="org-builtin">*</span>K_lead<span class="org-builtin">*</span>K_lpf;
</pre>
</div>
<div id="org9b503a7" class="figure">
<p><img src="figs/loop_gain_compare.png" alt="loop_gain_compare.png" />
</p>
<p><span class="figure-number">Figure 17: </span>description</p>
</div>
<div class="org-src-container">
<pre class="src src-matlab">L = zeros(3, 3, length(f));
Lb = zeros(3, 3, length(f));
Lb_new = zeros(3, 3, length(f));
<span class="org-keyword">for</span> <span class="org-variable-name">i_f</span> = <span class="org-constant">1:length(f)</span>
L(<span class="org-builtin">:</span>,<span class="org-builtin">:</span>,i_f) = [G_ur(i_f,<span class="org-builtin">:</span>); G_uh(i_f,<span class="org-builtin">:</span>); G_d(i_f,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>freqresp(K , f(i_f), <span class="org-string">'Hz'</span>);
Lb(<span class="org-builtin">:</span>,<span class="org-builtin">:</span>,i_f) = [G_ur(i_f,<span class="org-builtin">:</span>); G_uh(i_f,<span class="org-builtin">:</span>); G_d(i_f,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>freqresp(Kb_old, f(i_f), <span class="org-string">'Hz'</span>);
Lb_new(<span class="org-builtin">:</span>,<span class="org-builtin">:</span>,i_f) = [G_ur(i_f,<span class="org-builtin">:</span>); G_uh(i_f,<span class="org-builtin">:</span>); G_d(i_f,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>freqresp(Kb, f(i_f), <span class="org-string">'Hz'</span>);
<span class="org-keyword">end</span>
</pre>
</div>
<div id="org8f7b23d" class="figure">
<p><img src="figs/nyquist_compare.png" alt="nyquist_compare.png" />
</p>
<p><span class="figure-number">Figure 18: </span>Nyquist Plot</p>
</div>
<div id="org36bde27" class="figure">
<p><img src="figs/sensitivity_function_compare.png" alt="sensitivity_function_compare.png" />
</p>
<p><span class="figure-number">Figure 19: </span>description</p>
</div>
</div>
</div>
<div id="outline-container-orge532a7b" class="outline-3">
<h3 id="orge532a7b"><span class="section-number-3">2.7.</span> Added gain</h3>
<div class="outline-text-3" id="text-2-7">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Notch</span>
gm = 0.015;
xi = 0.2;
wn = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>208;
K_notch = (s<span class="org-builtin">^</span>2 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>gm<span class="org-builtin">*</span>xi<span class="org-builtin">*</span>wn<span class="org-builtin">*</span>s <span class="org-builtin">+</span> wn<span class="org-builtin">^</span>2)<span class="org-builtin">/</span>(s<span class="org-builtin">^</span>2 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>xi<span class="org-builtin">*</span>wn<span class="org-builtin">*</span>s <span class="org-builtin">+</span> wn<span class="org-builtin">^</span>2);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Double integrator</span>
w0 = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>40;
K_int = (w0<span class="org-builtin">^</span>2)<span class="org-builtin">/</span>(s<span class="org-builtin">^</span>2);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Lead</span>
a = 3; <span class="org-comment-delimiter">% </span><span class="org-comment">Amount of phase lead / width of the phase lead / high frequency gain</span>
w0 = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>40;
K_lead = 1<span class="org-builtin">/</span>(sqrt(a))<span class="org-builtin">*</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(w0<span class="org-builtin">/</span>sqrt(a)))<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>(w0<span class="org-builtin">*</span>sqrt(a)));
K_lead = K_lead<span class="org-builtin">*</span>K_lead;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Low Pass Filter</span>
w0 = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>120; <span class="org-comment-delimiter">% </span><span class="org-comment">Cut-off frequency [rad/s]</span>
xi = 0.3; <span class="org-comment-delimiter">% </span><span class="org-comment">Damping Ratio</span>
K_lpf = 1<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>xi<span class="org-builtin">/</span>w0<span class="org-builtin">*</span>s <span class="org-builtin">+</span> s<span class="org-builtin">^</span>2<span class="org-builtin">/</span>w0<span class="org-builtin">^</span>2);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">gm = 10;
xi = 0.02;
wn = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>15;
H = (s<span class="org-builtin">^</span>2 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>gm<span class="org-builtin">*</span>xi<span class="org-builtin">*</span>wn<span class="org-builtin">*</span>s <span class="org-builtin">+</span> wn<span class="org-builtin">^</span>2)<span class="org-builtin">/</span>(s<span class="org-builtin">^</span>2 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>xi<span class="org-builtin">*</span>wn<span class="org-builtin">*</span>s <span class="org-builtin">+</span> wn<span class="org-builtin">^</span>2);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Diagonal controller</span>
Kb_gain = 0.9<span class="org-builtin">*</span>eye(3)<span class="org-builtin">*</span>H<span class="org-builtin">*</span>K_notch<span class="org-builtin">*</span>K_int<span class="org-builtin">*</span>K_lead<span class="org-builtin">*</span>K_lpf;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">Lb_gain = zeros(3, 3, length(f));
<span class="org-keyword">for</span> <span class="org-variable-name">i_f</span> = <span class="org-constant">1:length(f)</span>
Lb_gain(<span class="org-builtin">:</span>,<span class="org-builtin">:</span>,i_f) = [G_ur(i_f,<span class="org-builtin">:</span>); G_uh(i_f,<span class="org-builtin">:</span>); G_d(i_f,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>freqresp(Kb_gain, f(i_f), <span class="org-string">'Hz'</span>);
<span class="org-keyword">end</span>
</pre>
</div>
<div id="org8434d01" class="figure">
<p><img src="figs/loop_gain_compare_added_gain.png" alt="loop_gain_compare_added_gain.png" />
</p>
<p><span class="figure-number">Figure 20: </span>description</p>
</div>
<div id="orga8c5169" class="figure">
<p><img src="figs/sensitivity_new_gain_compare.png" alt="sensitivity_new_gain_compare.png" />
</p>
<p><span class="figure-number">Figure 21: </span>description</p>
</div>
<div id="org76c08c6" class="figure">
<p><img src="figs/nyquist_after_gain_frequency.png" alt="nyquist_after_gain_frequency.png" />
</p>
<p><span class="figure-number">Figure 22: </span>nyquist plot</p>
</div>
</div>
</div>
</div>
<div id="outline-container-org3ccf16c" class="outline-2">
<h2 id="org3ccf16c"><span class="section-number-2">3.</span> Noise Budgeting</h2>
<div class="outline-text-2" id="text-3">
</div>
<div id="outline-container-org493fefa" class="outline-3">
<h3 id="org493fefa"><span class="section-number-3">3.1.</span> No Displacement</h3>
<div class="outline-text-3" id="text-3-1">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-right" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-right">1</td>
<td class="org-left">dz311</td>
</tr>
<tr>
<td class="org-right">2</td>
<td class="org-left">dry311</td>
</tr>
<tr>
<td class="org-right">3</td>
<td class="org-left">drx311</td>
</tr>
<tr>
<td class="org-right">4</td>
<td class="org-left">dz111</td>
</tr>
<tr>
<td class="org-right">5</td>
<td class="org-left">dry111</td>
</tr>
<tr>
<td class="org-right">6</td>
<td class="org-left">drx111</td>
</tr>
<tr>
<td class="org-right">7</td>
<td class="org-left">fjpur</td>
</tr>
<tr>
<td class="org-right">8</td>
<td class="org-left">fjpuh</td>
</tr>
<tr>
<td class="org-right">9</td>
<td class="org-left">fjpd</td>
</tr>
<tr>
<td class="org-right">10</td>
<td class="org-left">bragg</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-matlab">data_10_deg = load(<span class="org-string">'no_mov_10.mat'</span>);
data_70_deg = load(<span class="org-string">'no_mov_70.mat'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">data_10_deg = extractDatData(<span class="org-string">'no_mov_10.mat'</span>, <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
{<span class="org-string">"dz311"</span>, <span class="org-string">"dry311"</span>, <span class="org-string">"drx311"</span>, <span class="org-string">"dz"</span>, <span class="org-string">"dry"</span>, <span class="org-string">"drx"</span>, <span class="org-string">"fjpur"</span>, <span class="org-string">"fjpuh"</span>, <span class="org-string">"fjpd"</span>, <span class="org-string">"bragg"</span>}, <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
[1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8, <span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180]);
data_10_deg = processMeasData(data_10_deg);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">Ts = 1e<span class="org-builtin">-</span>4;
t = Ts<span class="org-builtin">*</span>[1<span class="org-builtin">:</span>length(data_10_deg.bragg)];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">data_10_deg.dz = data_10_deg.allValues(<span class="org-builtin">:</span>,4) <span class="org-builtin">-</span> mean(data_10_deg.allValues(<span class="org-builtin">:</span>,4));
data_10_deg.dry = data_10_deg.allValues(<span class="org-builtin">:</span>,5) <span class="org-builtin">-</span> mean(data_10_deg.allValues(<span class="org-builtin">:</span>,5));
data_10_deg.drx = data_10_deg.allValues(<span class="org-builtin">:</span>,6) <span class="org-builtin">-</span> mean(data_10_deg.allValues(<span class="org-builtin">:</span>,6));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Compute motion error in the frame of the fast jack</span>
J_a_111 = [1, 0.14, <span class="org-builtin">-</span>0.1525
1, 0.14, 0.0675
1, <span class="org-builtin">-</span>0.14, 0.0425];
de_111 = [data_10_deg.dz<span class="org-builtin">'</span>; data_10_deg.dry<span class="org-builtin">'</span>; data_10_deg.drx<span class="org-builtin">'</span>];
de_fj = J_a_111<span class="org-builtin">*</span>de_111;
data_10_deg.fj_ur = de_fj(1,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>;
data_10_deg.fj_uh = de_fj(2,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>;
data_10_deg.fj_d = de_fj(3,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>;
de_111 = [data_70_deg.dz<span class="org-builtin">'</span>; data_70_deg.dry<span class="org-builtin">'</span>; data_70_deg.drx<span class="org-builtin">'</span>];
de_fj = J_a_111<span class="org-builtin">*</span>de_111;
data_70_deg.fj_ur = de_fj(1,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>;
data_70_deg.fj_uh = de_fj(2,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>;
data_70_deg.fj_d = de_fj(3,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">win = hanning(ceil(1<span class="org-builtin">/</span>Ts));
[pxx_10_ur, f] = pwelch(data_10_deg.fj_ur, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_70_ur, <span class="org-builtin">~</span>] = pwelch(data_70_deg.fj_ur, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_10_uh, <span class="org-builtin">~</span>] = pwelch(data_10_deg.fj_uh, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_70_uh, <span class="org-builtin">~</span>] = pwelch(data_70_deg.fj_uh, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_10_d, <span class="org-builtin">~</span>] = pwelch(data_10_deg.fj_d, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_70_d, <span class="org-builtin">~</span>] = pwelch(data_70_deg.fj_d, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">CPS_10_ur = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_10_ur)));
CPS_10_uh = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_10_uh)));
CPS_10_d = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_10_d)));
CPS_70_ur = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_70_ur)));
CPS_70_uh = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_70_uh)));
CPS_70_d = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_70_d)));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(f, sqrt(CPS_10_ur), <span class="org-string">'-'</span> , <span class="org-string">'color'</span>, colors(1, <span class="org-builtin">:</span>), <span class="org-string">'DisplayName'</span>, <span class="org-string">'10 deg - $u_r$'</span>)
<span class="org-builtin">plot</span>(f, sqrt(CPS_70_ur), <span class="org-string">'--'</span>, <span class="org-string">'color'</span>, colors(1, <span class="org-builtin">:</span>), <span class="org-string">'DisplayName'</span>, <span class="org-string">'70 deg - $u_r$'</span>)
<span class="org-builtin">plot</span>(f, sqrt(CPS_10_uh), <span class="org-string">'-'</span> , <span class="org-string">'color'</span>, colors(2, <span class="org-builtin">:</span>), <span class="org-string">'DisplayName'</span>, <span class="org-string">'10 deg - $u_h$'</span>)
<span class="org-builtin">plot</span>(f, sqrt(CPS_70_uh), <span class="org-string">'--'</span>, <span class="org-string">'color'</span>, colors(2, <span class="org-builtin">:</span>), <span class="org-string">'DisplayName'</span>, <span class="org-string">'70 deg - $u_h$'</span>)
<span class="org-builtin">plot</span>(f, sqrt(CPS_10_d), <span class="org-string">'-'</span> , <span class="org-string">'color'</span>, colors(3, <span class="org-builtin">:</span>), <span class="org-string">'DisplayName'</span>, <span class="org-string">'10 deg - $d$'</span>)
<span class="org-builtin">plot</span>(f, sqrt(CPS_70_d), <span class="org-string">'--'</span>, <span class="org-string">'color'</span>, colors(3, <span class="org-builtin">:</span>), <span class="org-string">'DisplayName'</span>, <span class="org-string">'70 deg - $d$'</span>)
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">off;</span>
<span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'XScale'</span>, <span class="org-string">'log'</span>); <span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'YScale'</span>, <span class="org-string">'log'</span>);
<span class="org-builtin">xlabel</span>(<span class="org-string">'Frequency [Hz]'</span>); <span class="org-builtin">ylabel</span>(<span class="org-string">'ASD [$\frac{nrad}{\sqrt{Hz}}$]'</span>);
<span class="org-builtin">legend</span>(<span class="org-string">'location'</span>, <span class="org-string">'northwest'</span>);
<span class="org-builtin">xlim</span>([1, 1e3]);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(f, sqrt(pxx_10_ur))
<span class="org-builtin">plot</span>(f, sqrt(pxx_70_ur))
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">off;</span>
<span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'XScale'</span>, <span class="org-string">'log'</span>); <span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'YScale'</span>, <span class="org-string">'log'</span>);
<span class="org-builtin">xlabel</span>(<span class="org-string">'Frequency [Hz]'</span>); <span class="org-builtin">ylabel</span>(<span class="org-string">'ASD [$\frac{nrad}{\sqrt{Hz}}$]'</span>);
<span class="org-builtin">legend</span>(<span class="org-string">'location'</span>, <span class="org-string">'northwest'</span>);
<span class="org-builtin">xlim</span>([1, 1e3]);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">data_70_deg.dz = data_70_deg.allValues(<span class="org-builtin">:</span>,4) <span class="org-builtin">-</span> mean(data_70_deg.allValues(<span class="org-builtin">:</span>,4));
data_70_deg.dry = data_70_deg.allValues(<span class="org-builtin">:</span>,5) <span class="org-builtin">-</span> mean(data_70_deg.allValues(<span class="org-builtin">:</span>,5));
data_70_deg.drx = data_70_deg.allValues(<span class="org-builtin">:</span>,6) <span class="org-builtin">-</span> mean(data_70_deg.allValues(<span class="org-builtin">:</span>,6));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">win = hanning(ceil(1<span class="org-builtin">/</span>Ts));
[pxx_10_drx, f] = pwelch(data_10_deg.drx, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_70_drx, <span class="org-builtin">~</span>] = pwelch(data_70_deg.drx, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_10_dry, <span class="org-builtin">~</span>] = pwelch(data_10_deg.dry, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_70_dry, <span class="org-builtin">~</span>] = pwelch(data_70_deg.dry, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_10_dz, <span class="org-builtin">~</span>] = pwelch(data_10_deg.dz, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_70_dz, <span class="org-builtin">~</span>] = pwelch(data_70_deg.dz, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(f, sqrt(pxx_10_drx))
<span class="org-builtin">plot</span>(f, sqrt(pxx_70_drx))
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">off;</span>
<span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'XScale'</span>, <span class="org-string">'log'</span>); <span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'YScale'</span>, <span class="org-string">'log'</span>);
<span class="org-builtin">xlabel</span>(<span class="org-string">'Frequency [Hz]'</span>); <span class="org-builtin">ylabel</span>(<span class="org-string">'ASD [$\frac{nrad}{\sqrt{Hz}}$]'</span>);
<span class="org-builtin">legend</span>(<span class="org-string">'location'</span>, <span class="org-string">'northwest'</span>);
<span class="org-builtin">xlim</span>([1, 1e3]);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(f, sqrt(pxx_10_dry))
<span class="org-builtin">plot</span>(f, sqrt(pxx_70_dry))
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">off;</span>
<span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'XScale'</span>, <span class="org-string">'log'</span>); <span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'YScale'</span>, <span class="org-string">'log'</span>);
<span class="org-builtin">xlabel</span>(<span class="org-string">'Frequency [Hz]'</span>); <span class="org-builtin">ylabel</span>(<span class="org-string">'ASD [$\frac{nrad}{\sqrt{Hz}}$]'</span>);
<span class="org-builtin">legend</span>(<span class="org-string">'location'</span>, <span class="org-string">'northwest'</span>);
<span class="org-builtin">xlim</span>([1, 1e3]);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(f, sqrt(pxx_10_dz))
<span class="org-builtin">plot</span>(f, sqrt(pxx_70_dz))
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">off;</span>
<span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'XScale'</span>, <span class="org-string">'log'</span>); <span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'YScale'</span>, <span class="org-string">'log'</span>);
<span class="org-builtin">xlabel</span>(<span class="org-string">'Frequency [Hz]'</span>); <span class="org-builtin">ylabel</span>(<span class="org-string">'ASD [$\frac{nm}{\sqrt{Hz}}$]'</span>);
<span class="org-builtin">legend</span>(<span class="org-string">'location'</span>, <span class="org-string">'northwest'</span>);
<span class="org-builtin">xlim</span>([1, 1e3]);
</pre>
</div>
</div>
</div>
<div id="outline-container-org4970c4f" class="outline-3">
<h3 id="org4970c4f"><span class="section-number-3">3.2.</span> Scans</h3>
<div class="outline-text-3" id="text-3-2">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-right" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-right">1</td>
<td class="org-left">dz311</td>
</tr>
<tr>
<td class="org-right">2</td>
<td class="org-left">dry311</td>
</tr>
<tr>
<td class="org-right">3</td>
<td class="org-left">drx311</td>
</tr>
<tr>
<td class="org-right">4</td>
<td class="org-left">dz111</td>
</tr>
<tr>
<td class="org-right">5</td>
<td class="org-left">dry111</td>
</tr>
<tr>
<td class="org-right">6</td>
<td class="org-left">drx111</td>
</tr>
<tr>
<td class="org-right">7</td>
<td class="org-left">fjpur</td>
</tr>
<tr>
<td class="org-right">8</td>
<td class="org-left">fjpuh</td>
</tr>
<tr>
<td class="org-right">9</td>
<td class="org-left">fjpd</td>
</tr>
<tr>
<td class="org-right">10</td>
<td class="org-left">bragg</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Load Data</span>
data_10_70_deg = extractDatData(<span class="org-string">'thtraj_10_70.mat'</span>, <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
{<span class="org-string">"dz311"</span>, <span class="org-string">"dry311"</span>, <span class="org-string">"drx311"</span>, <span class="org-string">"dz"</span>, <span class="org-string">"dry"</span>, <span class="org-string">"drx"</span>, <span class="org-string">"fjur"</span>, <span class="org-string">"fjuh"</span>, <span class="org-string">"fjd"</span>, <span class="org-string">"bragg"</span>}, <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
[1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8, <span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180]);
Ts = 1e<span class="org-builtin">-</span>4;
t = Ts<span class="org-builtin">*</span>[1<span class="org-builtin">:</span>length(data_10_70_deg.bragg)];
<span class="org-matlab-cellbreak">%% Actuator Jacobian</span>
J_a_111 = [1, 0.14, <span class="org-builtin">-</span>0.0675
1, 0.14, 0.1525
1, <span class="org-builtin">-</span>0.14, 0.0425];
data_10_70_deg.ddz = 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(data_10_70_deg.bragg)) <span class="org-builtin">-</span> data_10_70_deg.dz;
<span class="org-matlab-cellbreak">%% Computation of the position of the FJ as measured by the interferometers</span>
error = J_a_111 <span class="org-builtin">*</span> [data_10_70_deg.ddz, data_10_70_deg.dry, data_10_70_deg.drx]<span class="org-builtin">'</span>;
data_10_70_deg.fjur_e = error(1,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
data_10_70_deg.fjuh_e = error(2,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
data_10_70_deg.fjd_e = error(3,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Load Data</span>
data_70_10_deg = extractDatData(<span class="org-string">'thtraj_70_10.mat'</span>, <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
{<span class="org-string">"dz311"</span>, <span class="org-string">"dry311"</span>, <span class="org-string">"drx311"</span>, <span class="org-string">"dz"</span>, <span class="org-string">"dry"</span>, <span class="org-string">"drx"</span>, <span class="org-string">"fjur"</span>, <span class="org-string">"fjuh"</span>, <span class="org-string">"fjd"</span>, <span class="org-string">"bragg"</span>}, <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
[1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8, <span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180]);
<span class="org-matlab-cellbreak">%% Actuator Jacobian</span>
J_a_111 = [1, 0.14, <span class="org-builtin">-</span>0.0675
1, 0.14, 0.1525
1, <span class="org-builtin">-</span>0.14, 0.0425];
data_70_10_deg.ddz = 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(data_70_10_deg.bragg)) <span class="org-builtin">-</span> data_70_10_deg.dz;
<span class="org-matlab-cellbreak">%% Computation of the position of the FJ as measured by the interferometers</span>
error = J_a_111 <span class="org-builtin">*</span> [data_70_10_deg.ddz, data_70_10_deg.dry, data_70_10_deg.drx]<span class="org-builtin">'</span>;
data_70_10_deg.fjur_e = error(1,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
data_70_10_deg.fjuh_e = error(2,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
data_70_10_deg.fjd_e = error(3,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">win = hanning(ceil(1<span class="org-builtin">/</span>Ts));
[pxx_10_70_ur, f] = pwelch(data_10_70_deg.fjur_e(t<span class="org-builtin">&lt;</span>100), win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_70_10_ur, <span class="org-builtin">~</span>] = pwelch(data_70_10_deg.fjur_e(t<span class="org-builtin">&lt;</span>100), win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_10_70_uh, <span class="org-builtin">~</span>] = pwelch(data_10_70_deg.fjuh_e(t<span class="org-builtin">&lt;</span>100), win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_70_10_uh, <span class="org-builtin">~</span>] = pwelch(data_70_10_deg.fjuh_e(t<span class="org-builtin">&lt;</span>100), win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_10_70_d, <span class="org-builtin">~</span>] = pwelch(data_10_70_deg.fjd_e(t<span class="org-builtin">&lt;</span>100), win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_70_10_d, <span class="org-builtin">~</span>] = pwelch(data_70_10_deg.fjd_e(t<span class="org-builtin">&lt;</span>100), win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">CPS_10_70_ur = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_10_70_ur)));
CPS_10_70_uh = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_10_70_uh)));
CPS_10_70_d = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_10_70_d)));
CPS_70_10_ur = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_70_10_ur)));
CPS_70_10_uh = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_70_10_uh)));
CPS_70_10_d = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_70_10_d)));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(f, 1e9<span class="org-builtin">*</span>sqrt(CPS_10_70_ur))
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">off;</span>
<span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'XScale'</span>, <span class="org-string">'log'</span>); <span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'YScale'</span>, <span class="org-string">'log'</span>);
<span class="org-builtin">xlabel</span>(<span class="org-string">'Frequency [Hz]'</span>); <span class="org-builtin">ylabel</span>(<span class="org-string">'ASD [$\frac{nrad}{\sqrt{Hz}}$]'</span>);
<span class="org-builtin">legend</span>(<span class="org-string">'location'</span>, <span class="org-string">'northwest'</span>);
<span class="org-builtin">xlim</span>([1, 1e3]);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(f, sqrt(pxx_10_70_ur))
<span class="org-builtin">plot</span>(f, sqrt(pxx_70_10_ur))
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">off;</span>
<span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'XScale'</span>, <span class="org-string">'log'</span>); <span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'YScale'</span>, <span class="org-string">'log'</span>);
<span class="org-builtin">xlabel</span>(<span class="org-string">'Frequency [Hz]'</span>); <span class="org-builtin">ylabel</span>(<span class="org-string">'ASD [$\frac{nrad}{\sqrt{Hz}}$]'</span>);
<span class="org-builtin">legend</span>(<span class="org-string">'location'</span>, <span class="org-string">'northwest'</span>);
<span class="org-builtin">xlim</span>([1, 1e3]);
</pre>
</div>
</div>
</div>
<div id="outline-container-org4b209d0" class="outline-3">
<h3 id="org4b209d0"><span class="section-number-3">3.3.</span> Noise budgeting - No rotation</h3>
<div class="outline-text-3" id="text-3-3">
<p>
First, we look at the position errors when the bragg axis is not moving
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Load Measurement Data</span>
ol_data = load(<span class="org-string">'FJPUR_step.mat'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Pre-processing</span>
ol_time = ol_data.time <span class="org-builtin">-</span> ol_data.time(1);
ol_drx = ol_data.allValues(ol_time <span class="org-builtin">&lt;</span> 45, 6);
ol_dry = ol_data.allValues(ol_time <span class="org-builtin">&lt;</span> 45, 5);
ol_dz = ol_data.allValues(ol_time <span class="org-builtin">&lt;</span> 45, 4);
ol_drx = ol_drx <span class="org-builtin">-</span> mean(ol_drx);
ol_dry = ol_dry <span class="org-builtin">-</span> mean(ol_dry);
ol_dz = ol_dz <span class="org-builtin">-</span> mean(ol_dz);
ol_time = ol_time(ol_time <span class="org-builtin">&lt;</span> 45);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>;
<span class="org-builtin">plot</span>(ol_time, ol_drx)
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Parameters for Spectral Analysis</span>
Ts = 1e<span class="org-builtin">-</span>4;
win = hanning(ceil(1<span class="org-builtin">/</span>Ts));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Computation of the PSD</span>
[pxx_ol_drx, f] = pwelch(ol_drx, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_ol_dry, <span class="org-builtin">~</span>] = pwelch(ol_dry, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_ol_dz, <span class="org-builtin">~</span>] = pwelch(ol_dz, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
<div id="org1af1104" class="figure">
<p><img src="figs/noise_budget_no_mov_asd.png" alt="noise_budget_no_mov_asd.png" />
</p>
<p><span class="figure-number">Figure 23: </span>Amplitude Spectral Density</p>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Cumulative Spectral Density</span>
CPS_drx = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_ol_drx)));
CPS_dry = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_ol_dry)));
CPS_dz = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(pxx_ol_dz)));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Cumulative Spectral Density</span>
CPS_drx = cumtrapz(f, pxx_ol_drx);
CPS_dry = cumtrapz(f, pxx_ol_dry);
CPS_dz = cumtrapz(f, pxx_ol_dz);
</pre>
</div>
<div id="orgebbafd2" class="figure">
<p><img src="figs/noise_budget_no_mov_cas.png" alt="noise_budget_no_mov_cas.png" />
</p>
<p><span class="figure-number">Figure 24: </span>Cumulative Amplitude Spectrum</p>
</div>
</div>
</div>
<div id="outline-container-org396c4bf" class="outline-3">
<h3 id="org396c4bf"><span class="section-number-3">3.4.</span> Noise budgeting - Bragg rotation</h3>
</div>
</div>
<div id="outline-container-org9f3bb05" class="outline-2">
<h2 id="org9f3bb05"><span class="section-number-2">4.</span> Test Mode C</h2>
<div class="outline-text-2" id="text-4">
</div>
<div id="outline-container-org093ca2f" class="outline-3">
<h3 id="org093ca2f"><span class="section-number-3">4.1.</span> Mode B and Mode C</h3>
<div class="outline-text-3" id="text-4-1">
<div class="org-src-container">
<pre class="src src-matlab">data_B = extractDatData(sprintf(<span class="org-string">"/home/thomas/mnt/data_id21/22Jan/blc13491/id21/test_regul_220119/%s"</span>,<span class="org-string">"lut_const_fj_vel_19012022_1450.dat"</span>), <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
{<span class="org-string">"bragg"</span>, <span class="org-string">"dz"</span>, <span class="org-string">"dry"</span>, <span class="org-string">"drx"</span>, <span class="org-string">"fjur"</span>, <span class="org-string">"fjuh"</span>, <span class="org-string">"fjd"</span>}, <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
[<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8]);
data_B = processMeasData(data_B);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">data_C = extractDatData(sprintf(<span class="org-string">"/home/thomas/mnt/data_id21/22Jan/blc13491/id21/test_regul_220119/%s"</span>,<span class="org-string">"lut_const_fj_vel_19012022_1454.dat"</span>), <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
{<span class="org-string">"bragg"</span>, <span class="org-string">"dz"</span>, <span class="org-string">"dry"</span>, <span class="org-string">"drx"</span>, <span class="org-string">"fjur"</span>, <span class="org-string">"fjuh"</span>, <span class="org-string">"fjd"</span>}, <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
[<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8]);
data_C = processMeasData(data_C);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(180<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>data_B.bragg, 1e9<span class="org-builtin">*</span>data_B.drx)
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">off;</span>
<span class="org-builtin">xlabel</span>(<span class="org-string">'Bragg Angle [deg]'</span>); <span class="org-builtin">ylabel</span>(<span class="org-string">'DRX [nrad]'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(180<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>data_B.bragg, 1e9<span class="org-builtin">*</span>data_B.fjur_e_filt)
<span class="org-builtin">plot</span>(180<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>data_C.bragg, 1e9<span class="org-builtin">*</span>data_C.fjur_e_filt)
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">off;</span>
<span class="org-builtin">xlabel</span>(<span class="org-string">'Bragg Angle [deg]'</span>); <span class="org-builtin">ylabel</span>(<span class="org-string">'FJUR Error [nm]'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(180<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>data_B.bragg, 1e9<span class="org-builtin">*</span>data_B.fjur_e)
<span class="org-builtin">plot</span>(180<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>data_C.bragg, 1e9<span class="org-builtin">*</span>data_C.fjur_e)
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">off;</span>
<span class="org-builtin">xlabel</span>(<span class="org-string">'Bragg Angle [deg]'</span>); <span class="org-builtin">ylabel</span>(<span class="org-string">'FJUR Error [nm]'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% FIR Filter</span>
Fs = 1e4; <span class="org-comment-delimiter">% </span><span class="org-comment">Sampling Frequency [Hz]</span>
fir_order = 5000; <span class="org-comment-delimiter">% </span><span class="org-comment">Filter's order</span>
delay = fir_order<span class="org-builtin">/</span>2; <span class="org-comment-delimiter">% </span><span class="org-comment">Delay induced by the filter</span>
B_fir = firls(5000, <span class="org-comment-delimiter">.</span><span class="org-comment">.. % Filter's order</span>
[0 5<span class="org-builtin">/</span>(Fs<span class="org-builtin">/</span>2) 10<span class="org-builtin">/</span>(Fs<span class="org-builtin">/</span>2) 1], <span class="org-comment-delimiter">.</span><span class="org-comment">.. % Frequencies [Hz]</span>
[1 1 0 0]); <span class="org-comment-delimiter">% </span><span class="org-comment">Wanted Magnitudes</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Filtering all measured Fast Jack Position using the FIR filter</span>
data_B.drx_filter = filter(B_fir, 1, data_B.drx);
data_B.drx_filter(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>delay) = data_B.drx_filter(delay<span class="org-builtin">+</span>1<span class="org-builtin">:</span>end);
data_C.drx_filter = filter(B_fir, 1, data_C.drx);
data_C.drx_filter(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>delay) = data_C.drx_filter(delay<span class="org-builtin">+</span>1<span class="org-builtin">:</span>end);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(180<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>data_B.bragg, 1e9<span class="org-builtin">*</span>data_B.drx_filter)
<span class="org-builtin">plot</span>(180<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>data_C.bragg, 1e9<span class="org-builtin">*</span>data_C.drx_filter)
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">off;</span>
<span class="org-builtin">xlabel</span>(<span class="org-string">'Bragg Angle [deg]'</span>); <span class="org-builtin">ylabel</span>(<span class="org-string">'DRX [nrad]'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">Ts = 1e<span class="org-builtin">-</span>4;
win = hanning(ceil(1<span class="org-builtin">/</span>Ts));
[pxx_B_drx, f] = pwelch(data_B.drx, win, [], [], 1<span class="org-builtin">/</span>Ts);
[pxx_C_drx, <span class="org-builtin">~</span>] = pwelch(data_C.drx, win, [], [], 1<span class="org-builtin">/</span>Ts);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgbc6f5ab" class="outline-2">
<h2 id="orgbc6f5ab"><span class="section-number-2">5.</span> Export numerator and denominator</h2>
<div class="outline-text-2" id="text-5">
</div>
<div id="outline-container-org2106b0d" class="outline-3">
<h3 id="org2106b0d"><span class="section-number-3">5.1.</span> Export</h3>
<div class="outline-text-3" id="text-5-1">
<div class="org-src-container">
<pre class="src src-matlab">K_order = 10;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">load(<span class="org-string">'X_tal_cage_PID.mat'</span>, <span class="org-string">'K'</span>);
K_order = order(K(1,1));
Kz = c2d(K(1,1)<span class="org-builtin">*</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>2<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>2e3)<span class="org-builtin">^</span>(9<span class="org-builtin">-</span>K_order)<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>2<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>2e3)<span class="org-builtin">^</span>(9<span class="org-builtin">-</span>K_order), 1e<span class="org-builtin">-</span>4);
[num, den] = tfdata(Kz, <span class="org-string">'v'</span>);
formatSpec = <span class="org-string">'%.18e %.18e %.18e %.18e %.18e %.18e %.18e %.18e %.18e %.18e\n'</span>;
fileID = fopen(<span class="org-string">'X_tal_cage_PID.dat'</span>, <span class="org-string">'w'</span>);
fprintf(fileID, formatSpec, [num; den]<span class="org-builtin">'</span>);
fclose(fileID);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">load(<span class="org-string">'X_tal_cage_PID_20Hz.mat'</span>, <span class="org-string">'K'</span>);
K_order = order(K(1,1));
Kz = c2d(K(1,1)<span class="org-builtin">*</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>2<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>2e3)<span class="org-builtin">^</span>(9<span class="org-builtin">-</span>K_order)<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>2<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>2e3)<span class="org-builtin">^</span>(9<span class="org-builtin">-</span>K_order), 1e<span class="org-builtin">-</span>4);
[num, den] = tfdata(Kz, <span class="org-string">'v'</span>);
formatSpec = <span class="org-string">'%.18e %.18e %.18e %.18e %.18e %.18e %.18e %.18e %.18e %.18e\n'</span>;
fileID = fopen(<span class="org-string">'X_tal_cage_PID_20Hz.dat'</span>, <span class="org-string">'w'</span>);
fprintf(fileID, formatSpec, [num; den]<span class="org-builtin">'</span>);
fclose(fileID);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">load(<span class="org-string">'X_tal_cage_PID_40Hz.mat'</span>, <span class="org-string">'K'</span>);
K_order = order(K(1,1));
Kz = c2d(K(1,1)<span class="org-builtin">*</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>2<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>2e3)<span class="org-builtin">^</span>(9<span class="org-builtin">-</span>K_order)<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>2<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>2e3)<span class="org-builtin">^</span>(9<span class="org-builtin">-</span>K_order), 1e<span class="org-builtin">-</span>4);
[num, den] = tfdata(Kz, <span class="org-string">'v'</span>);
formatSpec = <span class="org-string">'%.18e %.18e %.18e %.18e %.18e %.18e %.18e %.18e %.18e %.18e\n'</span>;
fileID = fopen(<span class="org-string">'X_tal_cage_PID_40Hz.dat'</span>, <span class="org-string">'w'</span>);
fprintf(fileID, formatSpec, [num; den]<span class="org-builtin">'</span>);
fclose(fileID);
</pre>
</div>
</div>
</div>
<div id="outline-container-org3833e47" class="outline-3">
<h3 id="org3833e47"><span class="section-number-3">5.2.</span> Verify</h3>
<div class="outline-text-3" id="text-5-2">
<div class="org-src-container">
<pre class="src src-matlab">K_data = importdata(<span class="org-string">'X_tal_cage_PID_20Hz.dat'</span>);
K = tf(K_data(1,<span class="org-builtin">:</span>), K_data(2,<span class="org-builtin">:</span>), 1e<span class="org-builtin">-</span>4)
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2022-06-02 Thu 18:23</p>
</div>
</body>
</html>