Rework the presentation of results + analysis

This commit is contained in:
2021-02-18 11:38:56 +01:00
parent 77f2339a9d
commit 29ebdc27e0
19 changed files with 3633 additions and 293 deletions

View File

@@ -1,64 +0,0 @@
%% Remove first second
Ts = t(2)-t(1);
t = t(ceil(1/Ts):end);
d = d(ceil(1/Ts):end);
dp = dp(ceil(1/Ts):end);
F = F(ceil(1/Ts):end);
t = t - t(1);
F = F - F(1);
%% LPf
s = tf('s');
G_lpf = 1/(1+s/2/pi/10);
F = lsim(G_lpf, F, t);
d = lsim(G_lpf, d, t);
dp = lsim(G_lpf, dp, t);
%%
figure;
plot(t, F);
figure;
hold on;
plot(t, d, 'DisplayName', 'Encoder');
plot(t, dp, 'DisplayName', 'Mahr')
hold off;
legend;
%%
t_start = 0.05;
t_end = 0.12;
d = d(t < t_end & t > t_start);
dp = dp(t < t_end & t > t_start);
F = F(t < t_end & t > t_start);
d = d - d(1);
dp = dp - dp(1);
F = F - F(1);
%%
figure;
plot(F, dp);
xlabel('Measured Force [N]');
ylabel('Measured Displacement [m]');
%%
sprintf('Stiffness is %.3f [N/mm]', abs(1e-3*(d\F)))
%%
figure;
hold on;
plot(F, d);
plot(F, F/(d\F));
hold off;
xlabel('Measured Force [N]');
ylabel('Measured Displacement [m]');
%%
figure;
hold on;
plot(dp, d);
hold off;
xlabel('Probe [m]');
ylabel('Encoder [m]');

View File

@@ -0,0 +1,53 @@
%% Clear Workspace and Close figures
clear; close all; clc;
%% Intialize Laplace variable
s = zpk('s');
% Flexible joint Geometry
% The flexible joint used for the Nano-Hexapod is shown in Figure [[fig:flexible_joint_geometry]].
% Its bending stiffness is foreseen to be $k_{R_y}\approx 5\,\frac{Nm}{rad}$ and its stroke $\theta_{y,\text{max}}\approx 25\,mrad$.
% #+name: fig:flexible_joint_geometry
% #+caption: Geometry of the flexible joint
% [[file:figs/flexible_joint_geometry.png]]
% The height between the flexible point (center of the joint) and the point where external forces are applied is $h = 20\,mm$.
% Let's define the parameters on Matlab.
kRx = 5; % Bending Stiffness [Nm/rad]
Rxmax = 25e-3; % Bending Stroke [rad]
h = 20e-3; % Height [m]
% Required external applied force
% The bending $\theta_y$ of the flexible joint due to the force $F_x$ is:
% \begin{equation}
% \theta_y = \frac{M_y}{k_{R_y}} = \frac{F_x h}{k_{R_y}}
% \end{equation}
% Therefore, the applied force to test the full range of the flexible joint is:
% \begin{equation}
% F_{x,\text{max}} = \frac{k_{R_y} \theta_{y,\text{max}}}{h}
% \end{equation}
Fxmax = kRx*Rxmax/h; % Force to induce maximum stroke [N]
% And we obtain:
sprintf('\\begin{equation} F_{x,max} = %.1f\\, [N] \\end{equation}', Fxmax)
% Required actuator stroke and sensors range
% The flexible joint is designed to allow a bending motion of $\pm 25\,mrad$.
% The corresponding stroke at the location of the force sensor is:
% \[ d_{x,\text{max}} = h \tan(R_{x,\text{max}}) \]
dxmax = h*tan(Rxmax);
sprintf('\\begin{equation} d_{max} = %.1f\\, [mm] \\end{equation}', 1e3*dxmax)

67
matlab/error_budget.m Normal file
View File

@@ -0,0 +1,67 @@
%% Clear Workspace and Close figures
clear; close all; clc;
%% Intialize Laplace variable
s = zpk('s');
% Finite Element Model
% From the Finite Element Model, the stiffness and stroke of the flexible joint have been computed and summarized in Tables [[tab:axial_shear_characteristics]] and [[tab:bending_torsion_characteristics]].
%% Stiffness
ka = 94e6; % Axial Stiffness [N/m]
ks = 13e6; % Shear Stiffness [N/m]
kb = 5; % Bending Stiffness [Nm/rad]
kt = 260; % Torsional Stiffness [Nm/rad]
%% Maximum force
Fa = 469; % Axial Force before yield [N]
Fs = 242; % Shear Force before yield [N]
Fb = 0.118; % Bending Force before yield [Nm]
Ft = 1.508; % Torsional Force before yield [Nm]
%% Compute the corresponding stroke
Xa = Fa/ka; % Axial Stroke before yield [m]
Xs = Fs/ks; % Shear Stroke before yield [m]
Xb = Fb/kb; % Bending Stroke before yield [rad]
Xt = Ft/kt; % Torsional Stroke before yield [rad]
% Setup
% The setup is schematically represented in Figure [[fig:test_bench_flex_side_bis]].
% The force is applied on top of the flexible joint with a distance $h$ with the joint's center.
% The displacement of the flexible joint is also measured at the same height.
% The height between the joint's center and the force application point is:
h = 25e-3; % Height [m]
% Estimation error due to force sensor compression
% The measured displacement is not done directly at the joint's location.
% The force sensor compression will then induce an error on the joint's stiffness.
% The force sensor stiffness $k_F$ is estimated to be around:
kF = 50/0.05e-3; % [N/m]
sprintf('k_F = %.1e [N/m]', kF)
% Estimation error due to height estimation error
% Let's consider an error in the estimation of the height from the application of the force to the joint's center:
% \begin{equation}
% h_{\text{est}} = h (1 + \epsilon)
% \end{equation}
% The computed bending stiffness will be:
% \begin{equation}
% k_\text{est} \approx h_{\text{est}}^2 \frac{F_x}{d_x}
% \end{equation}
% And the stiffness estimation error is:
% \begin{equation}
% \frac{k_{\text{est}}}{k_{R_y}} = (1 + \epsilon)^2
% \end{equation}
h_err = 0.2e-3; % Height estimation error [m]

62
matlab/probe_stiffness.m Normal file
View File

@@ -0,0 +1,62 @@
%% Clear Workspace and Close figures
clear; close all; clc;
%% Intialize Laplace variable
s = zpk('s');
addpath('./mat/');
% Results :ignore:
% Let's load the measurement results.
load('meas_stiff_probe.mat', 't', 'd', 'dp', 'F')
%% Sampling time [s]
Ts = (t(end) - t(1))/(length(t)-1);
%% Remove first second
t = t(ceil(1/Ts):end);
d = d(ceil(1/Ts):end);
dp = dp(ceil(1/Ts):end);
F = F(ceil(1/Ts):end);
%% Remove Offset
t = t - t(1);
F = F - mean(F(1:ceil(1/Ts)));
% The time domain measured force and displacement are shown in Figure [[fig:mahr_time_domain]].
%% Time Domain plots
figure;
tiledlayout(2, 1, 'TileSpacing', 'None', 'Padding', 'None');
ax1 = nexttile;
plot(t, F);
ylabel('Force [N]'); set(gca, 'XTickLabel',[]);
ax2 = nexttile;
plot(t, d);
xlabel('Time [s]'); ylabel('Displacement [m]');
% #+RESULTS:
% : Stiffness is 0.039 [N/mm]
% This is very close to the 0.04 [N/mm] written in the [[file:doc/tmp3m0cvmue_7888038c-cdc8-48d8-a837-35de02760685.pdf][Millimar 1318 probe datasheet]].
% And compare the linear fit with the raw measurement data (Figure [[fig:mahr_stiffness_f_d_plot]]).
figure;
hold on;
plot(F, d, 'DisplayName', 'Raw data');
plot(F, F/(d\F), 'DisplayName', 'Linear fit');
hold off;
xlabel('Measured Force [N]');
ylabel('Measured Displacement [m]');
legend('location', 'southeast');

86
matlab/probe_vs_encoder.m Normal file
View File

@@ -0,0 +1,86 @@
%% Clear Workspace and Close figures
clear; close all; clc;
%% Intialize Laplace variable
s = zpk('s');
addpath('./mat/');
% Results :ignore:
% Let's load the measurements.
load('meas_probe_against_encoder.mat', 't', 'd', 'dp', 'F')
%% Sampling time [s]
Ts = (t(end) - t(1))/(length(t)-1);
%% Remove first second
t = t(ceil(1/Ts):end);
d = -d(ceil(1/Ts):end);
dp = -dp(ceil(1/Ts):end);
F = F(ceil(1/Ts):end);
% The time domain measured displacement by the probe and by the encoder is shown in Figure [[fig:comp_encoder_probe_time]].
%% Time Domain plots
figure;
hold on;
plot(t, d, 'DisplayName', 'Encoder');
plot(t, dp, 'DisplayName', 'Probe');
hold off;
xlabel('Time [s]'); ylabel('Displacement [m]');
% #+name: fig:comp_encoder_probe_time
% #+caption: Time domain measurement
% #+RESULTS:
% [[file:figs/comp_encoder_probe_time.png]]
% If we zoom, we see that there is some delay between the encoder and the probe (Figure [[fig:comp_encoder_probe_time_zoom]]).
%% Zoom
figure;
hold on;
plot(t, d, 'DisplayName', 'Encoder');
plot(t, dp, 'DisplayName', 'Probe');
hold off;
xlabel('Time [s]'); ylabel('Displacement [m]');
xlim([7.7, 7.9])
% #+RESULTS:
% : The time delay is approximately 15.8 [ms]
% The measured mismatch between the encoder and the probe with and without compensating for the time delay are shown in Figure [[fig:comp_encoder_probe_mismatch]].
figure;
hold on;
plot(t, d-dp, 'DisplayName', 'Raw Mismatch');
plot(t(1:end-finddelay(d, dp)), d(1:end-finddelay(d, dp))-dp(finddelay(d, dp)+1:end), 'DisplayName', 'Removed Delay');
hold off;
xlabel('Time [s]'); ylabel('Measurement Missmatch [m]');
% #+name: fig:comp_encoder_probe_mismatch
% #+caption: Measurement mismatch, with and without delay compensation
% #+RESULTS:
% [[file:figs/comp_encoder_probe_mismatch.png]]
% Finally, the displacement of the probe is shown as a function of the displacement of the encoder and a linear fit is made (Figure [[fig:comp_encoder_probe_linear_fit]]).
figure;
hold on;
plot(1e3*d, 1e3*dp, 'DisplayName', 'Raw data');
plot(1e3*d, 1e3*d*(d\dp), 'DisplayName', sprintf('Linear fit: $\\alpha = %.5f$', (d\dp)));
hold on;
xlabel('Encoder [mm]'); ylabel('Probe [mm]');
legend('location', 'southeast')