sensor-fusion-test-bench/index.html
2020-08-31 16:13:16 +02:00

252 lines
7.2 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>
<!-- 2020-08-31 lun. 16:09 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Sensor Fusion - Test Bench</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Dehaeze Thomas" />
<link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
<link rel="stylesheet" type="text/css" href="./css/zenburn.css"/>
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
<script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="./js/readtheorg.js"></script>
</head>
<body>
<div id="content">
<h1 class="title">Sensor Fusion - Test Bench</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgaad1791">1. Experimental Setup</a></li>
<li><a href="#org2a43fcc">2. Huddle Test</a>
<ul>
<li><a href="#org20554e9">2.1. Load Data</a></li>
<li><a href="#orgfdfaa65">2.2. Data</a></li>
<li><a href="#org85724d7">2.3. Scale Data</a></li>
<li><a href="#org1bbeff4">2.4. Compare Time Domain Signals</a></li>
<li><a href="#org3fdfc8f">2.5. Compute PSD</a></li>
<li><a href="#org6f491a6">2.6. Dynamical Uncertainty</a></li>
<li><a href="#org91b1273">2.7. Sensor Noise</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-orgaad1791" class="outline-2">
<h2 id="orgaad1791"><span class="section-number-2">1</span> Experimental Setup</h2>
<div class="outline-text-2" id="text-1">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">&#xa0;</th>
<th scope="col" class="org-left">&#xa0;</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">Accelerometer</td>
<td class="org-left">PCB 393B05 - Vertical (<a href="https://www.pcb.com/products?m=393B05">link</a>)</td>
</tr>
<tr>
<td class="org-left">Geophone</td>
<td class="org-left">Mark Product L4C - Vertical</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-org2a43fcc" class="outline-2">
<h2 id="org2a43fcc"><span class="section-number-2">2</span> Huddle Test</h2>
<div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-org20554e9" class="outline-3">
<h3 id="org20554e9"><span class="section-number-3">2.1</span> Load Data</h3>
<div class="outline-text-3" id="text-2-1">
<div class="org-src-container">
<pre class="src src-matlab">load('./mat/huddle_test.mat', 'acc_1', 'acc_2', 'geo_1', 'geo_2', 't');
dt = t(2) - t(1);
</pre>
</div>
</div>
</div>
<div id="outline-container-orgfdfaa65" class="outline-3">
<h3 id="orgfdfaa65"><span class="section-number-3">2.2</span> Data</h3>
<div class="outline-text-3" id="text-2-2">
<div class="org-src-container">
<pre class="src src-matlab">acc_1 = acc_1 - mean(acc_1);
acc_2 = acc_2 - mean(acc_2);
geo_1 = geo_1 - mean(geo_1);
geo_2 = geo_2 - mean(geo_2);
</pre>
</div>
</div>
</div>
<div id="outline-container-org85724d7" class="outline-3">
<h3 id="org85724d7"><span class="section-number-3">2.3</span> Scale Data</h3>
<div class="outline-text-3" id="text-2-3">
<p>
From raw data to estimated velocity.
This takes into account the sensibility of the sensor and possible integration to go from acceleration to velocity.
</p>
<div class="org-src-container">
<pre class="src src-matlab">G0 = 1.02; % [V/(m/s2)]
G_acc = tf(G0);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">T = 276;
xi = 0.5;
w = 2*pi;
G_geo = -T*s^2/(s^2 + 2*xi*w*s + w^2);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">acc_1 = lsim(inv(G_acc), acc_1, t);
acc_2 = lsim(inv(G_acc), acc_2, t);
geo_1 = lsim(inv(G_geo), geo_1, t);
geo_2 = lsim(inv(G_geo), geo_2, t);
</pre>
</div>
</div>
</div>
<div id="outline-container-org1bbeff4" class="outline-3">
<h3 id="org1bbeff4"><span class="section-number-3">2.4</span> Compare Time Domain Signals</h3>
<div class="outline-text-3" id="text-2-4">
<div class="org-src-container">
<pre class="src src-matlab">figure;
hold on;
plot(t, acc_1);
plot(t, acc_2);
plot(t, geo_1);
plot(t, geo_2);
hold off;
</pre>
</div>
</div>
</div>
<div id="outline-container-org3fdfc8f" class="outline-3">
<h3 id="org3fdfc8f"><span class="section-number-3">2.5</span> Compute PSD</h3>
<div class="outline-text-3" id="text-2-5">
<p>
We first define the parameters for the frequency domain analysis.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Fs = 1/dt; % [Hz]
win = hanning(ceil(1*Fs));
</pre>
</div>
<p>
Then we compute the Power Spectral Density using <code>pwelch</code> function.
</p>
<div class="org-src-container">
<pre class="src src-matlab">[p_acc_1, f] = pwelch(acc_1, win, [], [], Fs);
[p_acc_2, ~] = pwelch(acc_2, win, [], [], Fs);
[p_geo_1, ~] = pwelch(geo_1, win, [], [], Fs);
[p_geo_2, ~] = pwelch(geo_2, win, [], [], Fs);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">figure;
hold on;
plot(f, sqrt(p_acc_1));
plot(f, sqrt(p_acc_2));
hold off;
set(gca, 'xscale', 'log');
set(gca, 'yscale', 'log');
xlabel('Frequency [Hz]'); ylabel('ASD Accelerometers $\left[\frac{m/s}{\sqrt{Hz}}\right]$')
xlim([1, 5000]);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">figure;
hold on;
plot(f, sqrt(p_geo_1));
plot(f, sqrt(p_geo_2));
hold off;
set(gca, 'xscale', 'log');
set(gca, 'yscale', 'log');
xlabel('Frequency [Hz]'); ylabel('ASD Geophones $\left[\frac{m/s}{\sqrt{Hz}}\right]$')
xlim([1, 5000]);
</pre>
</div>
</div>
</div>
<div id="outline-container-org6f491a6" class="outline-3">
<h3 id="org6f491a6"><span class="section-number-3">2.6</span> Dynamical Uncertainty</h3>
<div class="outline-text-3" id="text-2-6">
<div class="org-src-container">
<pre class="src src-matlab">[T_acc, ~] = tfestimate(acc_1, acc_2, win, [], [], Fs);
[T_geo, ~] = tfestimate(geo_1, geo_2, win, [], [], Fs);
</pre>
</div>
</div>
</div>
<div id="outline-container-org91b1273" class="outline-3">
<h3 id="org91b1273"><span class="section-number-3">2.7</span> Sensor Noise</h3>
<div class="outline-text-3" id="text-2-7">
<div class="org-src-container">
<pre class="src src-matlab">[coh_acc, ~] = mscohere(acc_1, acc_2, win, [], [], Fs);
[coh_geo, ~] = mscohere(geo_1, geo_2, win, [], [], Fs);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">pN_acc = p_acc_1.*(1 - coh_acc);
pN_geo = p_geo_1.*(1 - coh_geo);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">figure;
hold on;
plot(f, pN_acc, '-', 'DisplayName', 'Accelerometers');
plot(f, pN_geo, '-', 'DisplayName', 'Geophones');
hold off;
set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log');
xlabel('Frequency [Hz]'); ylabel('ASD of the Measurement Noise $\left[\frac{m/s}{\sqrt{Hz}}\right]$');
xlim([1, 5000]);
legend('location', 'northeast');
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2020-08-31 lun. 16:09</p>
</div>
</body>
</html>