Tangle matlab files without comments

This commit is contained in:
Thomas Dehaeze 2025-03-28 16:41:39 +01:00
parent 5a97b43b84
commit 45efef44d6
4 changed files with 1 additions and 268 deletions

View File

@ -10,98 +10,12 @@ addpath('./mat/'); % Path for data
%% Colors for the figures
colors = colororder;
% Location of the Accelerometers
% <<ssec:modal_accelerometers>>
% The location of the accelerometers fixed to the micro-station is essential because it defines where the dynamics is measured.
% A total of 23 accelerometers were fixed to the six key stages of the micro station: the lower and upper granites, the translation stage, the tilt stage, the spindle and the micro hexapod.
% The positions of the accelerometers are visually shown on a CAD model in Figure ref:fig:modal_location_accelerometers and their precise locations with respect to a frame located at the point of interest are summarized in Table ref:tab:modal_position_accelerometers.
% Pictures of the accelerometers fixed to the translation stage and to the micro-hexapod are shown in Figure ref:fig:modal_accelerometer_pictures.
% As all key stages of the micro-station are expected to behave as solid bodies, only 6 acrshort:dof can be considered for each solid body.
% However, it was chosen to use four 3-axis accelerometers (i.e. 12 measured acrshort:dof) for each considered solid body to have some redundancy and to be able to verify the solid body assumption (see Section ref:ssec:modal_solid_body_assumption).
% #+attr_latex: :options [b]{0.63\linewidth}
% #+begin_minipage
% #+name: fig:modal_location_accelerometers
% #+caption: Position of the accelerometers
% #+attr_latex: :width 0.95\linewidth :float nil
% [[file:figs/modal_location_accelerometers.png]]
% #+end_minipage
% \hfill
% #+attr_latex: :options [b]{0.36\linewidth}
% #+begin_minipage
% #+begin_scriptsize
% #+latex: \centering
% #+attr_latex: :environment tabularx :width \linewidth :placement [b] :align Xccc
% #+attr_latex: :booktabs t :float nil :center nil
% | | $x$ | $y$ | $z$ |
% |-------------------+------+------+------|
% | (17) Low. Granite | -730 | -526 | -951 |
% | (18) Low. Granite | -735 | 814 | -951 |
% | (19) Low. Granite | 875 | 799 | -951 |
% | (20) Low. Granite | 865 | -506 | -951 |
% | (13) Up. Granite | -320 | -446 | -786 |
% | (14) Up. Granite | -480 | 534 | -786 |
% | (15) Up. Granite | 450 | 534 | -786 |
% | (16) Up. Granite | 295 | -481 | -786 |
% | (9) Translation | -475 | -414 | -427 |
% | (10) Translation | -465 | 407 | -427 |
% | (11) Translation | 475 | 424 | -427 |
% | (12) Translation | 475 | -419 | -427 |
% | (5) Tilt | -385 | -300 | -417 |
% | (6) Tilt | -420 | 280 | -417 |
% | (7) Tilt | 420 | 280 | -417 |
% | (8) Tilt | 380 | -300 | -417 |
% | (21) Spindle | -155 | -90 | -594 |
% | (22) Spindle | 0 | 180 | -594 |
% | (23) Spindle | 155 | -90 | -594 |
% | (1) Hexapod | -64 | -64 | -270 |
% | (2) Hexapod | -64 | 64 | -270 |
% | (3) Hexapod | 64 | 64 | -270 |
% | (4) Hexapod | 64 | -64 | -270 |
% #+latex: \captionof{table}{\label{tab:modal_position_accelerometers}Positions in mm}
% #+end_scriptsize
% #+end_minipage
% #+name: fig:modal_accelerometer_pictures
% #+caption: Accelerometers fixed on the micro-station stages
% #+attr_latex: :options [htbp]
% #+begin_figure
% #+attr_latex: :caption \subcaption{\label{fig:modal_accelerometers_ty} $T_y$ stage}
% #+attr_latex: :options {0.49\textwidth}
% #+begin_subfigure
% #+attr_latex: :height 6cm
% [[file:figs/modal_accelerometers_ty.jpg]]
% #+end_subfigure
% #+attr_latex: :caption \subcaption{\label{fig:modal_accelerometers_hexapod} Micro-Hexapod}
% #+attr_latex: :options {0.49\textwidth}
% #+begin_subfigure
% #+attr_latex: :height 6cm
% [[file:figs/modal_accelerometers_hexapod.jpg]]
% #+end_subfigure
% #+end_figure
%% Load Accelerometer positions
acc_pos = readtable('mat/acc_pos.txt', 'ReadVariableNames', false);
acc_pos = table2array(acc_pos(:, 1:4));
[~, i] = sort(acc_pos(:, 1));
acc_pos = acc_pos(i, 2:4);
% Force and Response signals
% <<ssec:modal_measured_signals>>
% The force sensor of the instrumented hammer and the accelerometer signals are shown in the time domain in Figure ref:fig:modal_raw_meas.
% Sharp "impacts" can be observed for the force sensor, indicating wide frequency band excitation.
% For the accelerometer, a much more complex signal can be observed, indicating complex dynamics.
% The "normalized" acrfull:asd of the two signals were computed and shown in Figure ref:fig:modal_asd_acc_force.
% Conclusions based on the time domain signals can be clearly observed in the frequency domain (wide frequency content for the force signal and complex dynamics for the accelerometer).
% These data are corresponding to a hammer impact in the vertical direction and to the measured acceleration in the $x$ direction by accelerometer $1$ (fixed to the micro-hexapod).
% Similar results were obtained for all measured frequency response functions.
%% Load raw data
meas1_raw = load('mat/meas_raw_1.mat');
@ -148,31 +62,6 @@ xticks([0:20:200]);
ylim([0, 1])
legend('location', 'northeast', 'FontSize', 8, 'NumColumns', 1);
% #+name: fig:modal_raw_meas_asd
% #+caption: Raw measurement of the accelerometer 1 in the $x$ direction (blue) and of the force sensor at the Hammer tip (red) for an impact in the $z$ direction (\subref{fig:modal_raw_meas}). Computed Amplitude Spectral Densities of the two signals (normalized) (\subref{fig:modal_asd_acc_force})
% #+attr_latex: :options [htbp]
% #+begin_figure
% #+attr_latex: :caption \subcaption{\label{fig:modal_raw_meas}Time domain signals}
% #+attr_latex: :options {0.49\textwidth}
% #+begin_subfigure
% #+attr_latex: :width 0.95\linewidth
% [[file:figs/modal_raw_meas.png]]
% #+end_subfigure
% #+attr_latex: :caption \subcaption{\label{fig:modal_asd_acc_force}Amplitude Spectral Density (normalized)}
% #+attr_latex: :options {0.49\textwidth}
% #+begin_subfigure
% #+attr_latex: :width 0.95\linewidth
% [[file:figs/modal_asd_acc_force.png]]
% #+end_subfigure
% #+end_figure
% The frequency response function from the applied force to the measured acceleration is then computed and shown Figure ref:fig:modal_frf_acc_force.
% The quality of the obtained data can be estimated using the /coherence/ function (Figure ref:fig:modal_coh_acc_force).
% Good coherence is obtained from $20\,\text{Hz}$ to $200\,\text{Hz}$ which corresponds to the frequency range of interest.
%% Compute the transfer function and Coherence
[G1, f] = tfestimate(meas1_raw.Track1, meas1_raw.Track2, win, Noverlap, Nfft, Fs);
[coh1, ~] = mscohere( meas1_raw.Track1, meas1_raw.Track2, win, Noverlap, Nfft, Fs);

View File

@ -10,57 +10,6 @@ addpath('./mat/'); % Path for data
%% Colors for the figures
colors = colororder;
% #+name: fig:modal_local_to_global_coordinates
% #+caption: Schematic of the measured motions of a solid body
% #+RESULTS:
% [[file:figs/modal_local_to_global_coordinates.png]]
% The motion of the rigid body of figure ref:fig:modal_local_to_global_coordinates can be described by its displacement $\vec{\delta}p = [\delta p_x,\ \delta p_y,\ \delta p_z]$ and (small) rotations $[\delta \Omega_x,\ \delta \Omega_y,\ \delta \Omega_z]$ with respect to the reference frame $\{O\}$.
% The motion $\vec{\delta} p_{i}$ of a point $p_i$ can be computed from $\vec{\delta} p$ and $\bm{\delta \Omega}$ using equation eqref:eq:modal_compute_point_response, with $\bm{\delta\Omega}$ defined in equation eqref:eq:modal_rotation_matrix [[cite:&ewins00_modal chapt. 4.3.2]].
% \begin{equation}\label{eq:modal_compute_point_response}
% \vec{\delta} p_{i} &= \vec{\delta} p + \bm{\delta \Omega} \cdot \vec{p}_{i} \\
% \end{equation}
% \begin{equation}\label{eq:modal_rotation_matrix}
% \bm{\delta\Omega} = \begin{bmatrix}
% 0 & -\delta\Omega_z & \delta\Omega_y \\
% \delta\Omega_z & 0 & -\delta\Omega_x \\
% -\delta\Omega_y & \delta\Omega_x & 0
% \end{bmatrix}
% \end{equation}
% Writing this in matrix form for the four points gives eqref:eq:modal_cart_to_acc.
% \begin{equation}\label{eq:modal_cart_to_acc}
% \left[\begin{array}{c}
% \delta p_{1x} \\ \delta p_{1y} \\ \delta p_{1z} \\\hline \vdots \\\hline \delta p_{4x} \\ \delta p_{4y} \\ \delta p_{4z}
% \end{array}\right] =
% \left[\begin{array}{ccc|ccc}
% 1 & 0 & 0 & 0 & p_{1z} & -p_{1y} \\
% 0 & 1 & 0 & -p_{1z} & 0 & p_{1x} \\
% 0 & 0 & 1 & p_{1y} & -p_{1x} & 0 \\ \hline
% & \vdots & & & \vdots & \\ \hline
% 1 & 0 & 0 & 0 & p_{4z} & -p_{4y} \\
% 0 & 1 & 0 & -p_{4z} & 0 & p_{4x} \\
% 0 & 0 & 1 & p_{4y} & -p_{4x} & 0
% \end{array}\right] \left[\begin{array}{c}
% \delta p_x \\ \delta p_y \\ \delta p_z \\ \hline \delta\Omega_x \\ \delta\Omega_y \\ \delta\Omega_z
% \end{array}\right]
% \end{equation}
% Provided that the four sensors are properly located, the system of equation eqref:eq:modal_cart_to_acc can be solved by matrix inversion[fn:modal_5].
% The motion of the solid body expressed in a chosen frame $\{O\}$ can be determined by inverting equation eqref:eq:modal_cart_to_acc.
% Note that this matrix inversion is equivalent to resolving a mean square problem.
% Therefore, having more accelerometers permits better approximation of the motion of a solid body.
% From the CAD model, the position of the center of mass of each solid body is computed (see Table ref:tab:modal_com_solid_bodies).
% The position of each accelerometer with respect to the center of mass of the corresponding solid body can easily be determined.
%% Load frequency response matrix
load('frf_matrix.mat', 'freqs', 'frf');
@ -88,39 +37,6 @@ save('mat/geometry.mat', 'solids', 'solid_names', 'acc_pos');
%% Extract the CoM of considered solid bodies
model_com = reshape(table2array(readtable('mat/model_solidworks_com.txt', 'ReadVariableNames', false)), [3, 6]);
% #+name: tab:modal_com_solid_bodies
% #+caption: Center of mass of considered solid bodies with respect to the "point of interest"
% #+attr_latex: :environment tabularx :width 0.55\linewidth :align Xccc
% #+attr_latex: :center t :booktabs t
% #+RESULTS:
% | | $X$ | $Y$ | $Z$ |
% |-------------------+-----------------+------------------+--------------------|
% | Bottom Granite | $45\,\text{mm}$ | $144\,\text{mm}$ | $-1251\,\text{mm}$ |
% | Top granite | $52\,\text{mm}$ | $258\,\text{mm}$ | $-778\,\text{mm}$ |
% | Translation stage | $0$ | $14\,\text{mm}$ | $-600\,\text{mm}$ |
% | Tilt Stage | $0$ | $-5\,\text{mm}$ | $-628\,\text{mm}$ |
% | Spindle | $0$ | $0$ | $-580\,\text{mm}$ |
% | Hexapod | $-4\,\text{mm}$ | $6\,\text{mm}$ | $-319\,\text{mm}$ |
% Using eqref:eq:modal_cart_to_acc, the frequency response matrix $\mathbf{H}_\text{CoM}$ eqref:eq:modal_frf_matrix_com expressing the response at the center of mass of each solid body $D_i$ ($i$ from $1$ to $6$ for the $6$ considered solid bodies) can be computed from the initial acrshort:frf matrix $\mathbf{H}$.
% \begin{equation}\label{eq:modal_frf_matrix_com}
% \mathbf{H}_\text{CoM}(\omega_i) = \begin{bmatrix}
% \frac{D_{1,T_x}}{F_x}(\omega_i) & \frac{D_{1,T_x}}{F_y}(\omega_i) & \frac{D_{1,T_x}}{F_z}(\omega_i) \\
% \frac{D_{1,T_y}}{F_x}(\omega_i) & \frac{D_{1,T_y}}{F_y}(\omega_i) & \frac{D_{1,T_y}}{F_z}(\omega_i) \\
% \frac{D_{1,T_z}}{F_x}(\omega_i) & \frac{D_{1,T_z}}{F_y}(\omega_i) & \frac{D_{1,T_z}}{F_z}(\omega_i) \\
% \frac{D_{1,R_x}}{F_x}(\omega_i) & \frac{D_{1,R_x}}{F_y}(\omega_i) & \frac{D_{1,R_x}}{F_z}(\omega_i) \\
% \frac{D_{1,R_y}}{F_x}(\omega_i) & \frac{D_{1,R_y}}{F_y}(\omega_i) & \frac{D_{1,R_y}}{F_z}(\omega_i) \\
% \frac{D_{1,R_z}}{F_x}(\omega_i) & \frac{D_{1,R_z}}{F_y}(\omega_i) & \frac{D_{1,R_z}}{F_z}(\omega_i) \\
% \frac{D_{2,T_x}}{F_x}(\omega_i) & \frac{D_{2,T_x}}{F_y}(\omega_i) & \frac{D_{2,T_x}}{F_z}(\omega_i) \\
% \vdots & \vdots & \vdots \\
% \frac{D_{6,R_z}}{F_x}(\omega_i) & \frac{D_{6,R_z}}{F_y}(\omega_i) & \frac{D_{6,R_z}}{F_z}(\omega_i)
% \end{bmatrix}
% \end{equation}
%% Frequency Response Matrix - Response expressed at the CoM of the solid bodies
frfs_CoM = zeros(length(solid_names)*6, 3, 801);
@ -149,14 +65,6 @@ end
%% Save the computed FRF at the CoM
save('mat/frf_com.mat', 'frfs_CoM');
% Verification of solid body assumption
% <<ssec:modal_solid_body_assumption>>
% From the response of one solid body expressed by its 6 acrshortpl:dof (i.e. from $\mathbf{H}_{\text{CoM}}$), and using equation eqref:eq:modal_cart_to_acc, it is possible to compute the response of the same solid body at any considered location.
% In particular, the responses at the locations of the four accelerometers can be computed and compared with the original measurements $\mathbf{H}$.
% This is what is done here to check whether the solid body assumption is correct in the frequency band of interest.
%% Compute the FRF at the accelerometer location from the CoM reponses
frfs_A = zeros(size(frf));
@ -179,14 +87,6 @@ for exc_dir = 1:3
end
end
% The comparison is made for the 4 accelerometers fixed on the micro-hexapod (Figure ref:fig:modal_comp_acc_solid_body_frf).
% The original frequency response functions and those computed from the CoM responses match well in the frequency range of interest.
% Similar results were obtained for the other solid bodies, indicating that the solid body assumption is valid and that a multi-body model can be used to represent the dynamics of the micro-station.
% This also validates the reduction in the number of degrees of freedom from 69 (23 accelerometers with each 3 acrshort:dof) to 36 (6 solid bodies with 6 acrshort:dof).
%% Comparison of the original accelerometer response and reconstructed response from the solid body response
exc_names = {'$F_x$', '$F_y$', '$F_z$'};
DOFs = {'x', 'y', 'z', '\theta_x', '\theta_y', '\theta_z'};

View File

@ -10,27 +10,6 @@ addpath('./mat/'); % Path for data
%% Colors for the figures
colors = colororder;
% Number of modes determination
% <<ssec:modal_number_of_modes>>
% The acrshort:mif is applied to the $n\times p$ acrshort:frf matrix where $n$ is a relatively large number of measurement DOFs (here $n=69$) and $p$ is the number of excitation DOFs (here $p=3$).
% The complex modal indication function is defined in equation eqref:eq:modal_cmif where the diagonal matrix $\Sigma$ is obtained from a acrlong:svd of the acrshort:frf matrix as shown in equation eqref:eq:modal_svd.
% \begin{equation} \label{eq:modal_cmif}
% [CMIF(\omega)]_{p\times p} = [\Sigma(\omega)]_{p\times n}^T [\Sigma(\omega)]_{n\times p}
% \end{equation}
% \begin{equation} \label{eq:modal_svd}
% [H(\omega)]_{n\times p} = [U(\omega)]_{n\times n} [\Sigma(\omega)]_{n\times p} [V(\omega)]_{p\times p}^H
% \end{equation}
% The acrshort:mif therefore yields to $p$ values that are also frequency dependent.
% A peak in the acrshort:mif plot indicates the presence of a mode.
% Repeated modes can also be detected when multiple singular values have peaks at the same frequency.
% The obtained acrshort:mif is shown on Figure ref:fig:modal_indication_function.
% A total of 16 modes were found between 0 and $200\,\text{Hz}$.
% The obtained natural frequencies and associated modal damping are summarized in Table ref:tab:modal_obtained_modes_freqs_damps.
%% Load frequency response matrix
load('frf_matrix.mat', 'freqs', 'frf');
@ -56,33 +35,6 @@ xlim([0, 200]);
ylim([1e-6, 2e-2]);
ldg = legend('location', 'southeast', 'FontSize', 8, 'NumColumns', 1);
% Verification of the modal model validity
% <<ssec:modal_model_validity>>
% To check the validity of the modal model, the complete $n \times n$ acrshort:frf matrix $\mathbf{H}_{\text{syn}}$ is first synthesized from the modal parameters.
% Then, the elements of this acrshort:frf matrix $\mathbf{H}_{\text{syn}}$ that were already measured can be compared to the measured acrshort:frf matrix $\mathbf{H}$.
% In order to synthesize the full acrshort:frf matrix, the eigenvectors $\phi_r$ are first organized in matrix from as shown in equation eqref:eq:modal_eigvector_matrix.
% \begin{equation}\label{eq:modal_eigvector_matrix}
% \Phi = \begin{bmatrix}
% & & & & &\\
% \phi_1 & \dots & \phi_N & \phi_1^* & \dots & \phi_N^* \\
% & & & & &
% \end{bmatrix}_{n \times 2m}
% \end{equation}
% The full acrshort:frf matrix $\mathbf{H}_{\text{syn}}$ can be obtained using eqref:eq:modal_synthesized_frf.
% \begin{equation}\label{eq:modal_synthesized_frf}
% [\mathbf{H}_{\text{syn}}(\omega)]_{n\times n} = [\Phi]_{n\times2m} [\mathbf{H}_{\text{mod}}(\omega)]_{2m\times2m} [\Phi]_{2m\times n}^T
% \end{equation}
% With $\mathbf{H}_{\text{mod}}(\omega)$ a diagonal matrix representing the response of the different modes eqref:eq:modal_modal_resp.
% \begin{equation}\label{eq:modal_modal_resp}
% \mathbf{H}_{\text{mod}}(\omega) = \text{diag}\left(\frac{1}{a_1 (j\omega - s_1)},\ \dots,\ \frac{1}{a_m (j\omega - s_m)}, \frac{1}{a_1^* (j\omega - s_1^*)},\ \dots,\ \frac{1}{a_m^* (j\omega - s_m^*)} \right)_{2m\times 2m}
% \end{equation}
%% Load modal parameters
shapes_m = readtable('mat/mode_shapes.txt', 'ReadVariableNames', false); % [Sign / Real / Imag]
freqs_m = table2array(readtable('mat/mode_freqs.txt', 'ReadVariableNames', false)); % in [Hz]
@ -144,14 +96,6 @@ for i = 1:size(Hsyn, 1)
Hsyn(i, :, :) = squeeze(Hsyn(i, :, :)).*(j*2*pi*freqs).^2;
end
% A comparison between original measured frequency response functions and synthesized ones from the modal model is presented in Figure ref:fig:modal_comp_acc_frf_modal.
% Whether the obtained match is good or bad is quite arbitrary.
% However, the modal model seems to be able to represent the coupling between different nodes and different directions, which is quite important from a control perspective.
% This can be seen in Figure ref:fig:modal_comp_acc_frf_modal_3 that shows the frequency response function from the force applied on node 11 (i.e. on the translation stage) in the $y$ direction to the measured acceleration at node $2$ (i.e. at the top of the micro-hexapod) in the $x$ direction.
acc_o = 11; dir_o = 3;
acc_i = 11; dir_i = 3;

View File

@ -22,7 +22,7 @@
#+BIND: org-latex-bib-compiler "biber"
#+PROPERTY: header-args:matlab :session *MATLAB*
#+PROPERTY: header-args:matlab+ :comments org
#+PROPERTY: header-args:matlab+ :comments no
#+PROPERTY: header-args:matlab+ :exports none
#+PROPERTY: header-args:matlab+ :results none
#+PROPERTY: header-args:matlab+ :eval no-export