2019-01-18 17:18:02 +01:00
#+TITLE : Control in a rotating frame
#+HTML_HEAD : <link rel="stylesheet" type="text/css" href="css/htmlize.css"/>
#+HTML_HEAD : <link rel="stylesheet" type="text/css" href="css/readtheorg.css"/>
#+HTML_HEAD : <script src="js/jquery.min.js"></script>
#+HTML_HEAD : <script src="js/bootstrap.min.js"></script>
#+HTML_HEAD : <script type="text/javascript" src="js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD : <script type="text/javascript" src="js/readtheorg.js"></script>
#+LATEX_CLASS : cleanreport
#+LaTeX_CLASS_OPTIONS : [tocnp, secbreak, minted]
#+STARTUP : overview
#+LaTeX_HEADER : \usepackage{svg}
#+LaTeX_HEADER : \newcommand{\authorFirstName}{Thomas}
#+LaTeX_HEADER : \newcommand{\authorLastName}{Dehaeze}
#+LaTeX_HEADER : \newcommand{\authorEmail}{dehaeze.thomas@gmail.com}
#+PROPERTY : header-args:matlab :session *MATLAB*
#+PROPERTY : header-args:matlab+ :comments org
#+PROPERTY : header-args:matlab+ :exports both
#+PROPERTY : header-args:matlab+ :eval no-export
#+PROPERTY : header-args:matlab+ :output-dir Figures
2019-01-21 23:33:23 +01:00
* Introduction
The objective of this note it to highlight some control problems that arises when controlling the position of an object using actuators that are rotating with respect to a fixed reference frame.
2019-01-18 17:18:02 +01:00
2019-01-21 23:33:23 +01:00
In section [[sec:system ]], a simple system composed of a spindle and a translation stage is defined and the equations of motion are written.
The rotation induces some coupling between the actuators and their displacement, and modifies the dynamics of the system.
This is studied using the equations, and some numerical computations are used to compare the use of voice coil and piezoelectric actuators.
2019-01-18 17:18:02 +01:00
2019-01-21 23:33:23 +01:00
Then, in section [[sec:control_strategies ]], two different control approach are compared where:
2019-01-18 17:18:02 +01:00
- the measurement is made in the fixed frame
- the measurement is made in the rotating frame
2019-01-21 23:33:23 +01:00
In section [[sec:simscape ]], the analytical study will be validated using a multi body model of the studied system.
Finally, in section [[sec:control ]], the control strategies are implemented using Simulink and Simscape and compared.
2019-01-24 14:07:14 +01:00
* System Description and Analysis
2019-01-21 23:33:23 +01:00
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle system_numerical_analysis.m
:END:
2019-01-18 17:18:02 +01:00
<<sec:system >>
** System description
The system consists of one 2 degree of freedom translation stage on top of a spindle (figure [[fig:rotating_frame_2dof ]]).
2019-01-21 23:33:23 +01:00
The control inputs are the forces applied by the actuators of the translation stage ($F_u$ and $F_v$).
As the translation stage is rotating around the Z axis due to the spindle, the forces are applied along $u$ and $v$.
2019-01-18 17:18:02 +01:00
2019-01-21 23:33:23 +01:00
The measurement is either the $x-y$ displacement of the object located on top of the translation stage or the $u-v$ displacement of the sample with respect to a fixed reference frame.
2019-01-18 17:18:02 +01:00
#+name : fig:rotating_frame_2dof
#+caption : Schematic of the mecanical system
[[./Figures/rotating_frame_2dof.png ]]
In the following block diagram:
- $G$ is the transfer function from the forces applied in the actuators to the measurement
- $K$ is the controller to design
- $J$ is a Jacobian matrix usually used to change the reference frame
Indices $x$ and $y$ corresponds to signals in the fixed reference frame (along $\vec{i}_x$ and $\vec{i}_y$):
- $D_x$ is the measured position of the sample
- $r_x$ is the reference signal which corresponds to the wanted $D_x$
- $\epsilon_x$ is the position error
Indices $u$ and $v$ corresponds to signals in the rotating reference frame ($\vec{i}_u$ and $\vec{i}_v$):
- $F_u$ and $F_v$ are forces applied by the actuators
- $\epsilon_u$ and $\epsilon_v$ are position error of the sample along $\vec{i}_u$ and $\vec{i}_v$
** Equations
<<sec:equations >>
Based on the figure [[fig:rotating_frame_2dof ]], we can write the equations of motion of the system.
Let's express the kinetic energy $T$ and the potential energy $V$ of the mass $m$:
#+name : eq:energy_inertial_frame
\begin{align}
T & = \frac{1}{2} m \left( \dot{x}^2 + \dot{y}^2 \right) \\
V & = \frac{1}{2} k \left( x^2 + y^2 \right)
\end{align}
The Lagrangian is the kinetic energy minus the potential energy.
#+name : eq:lagrangian_inertial_frame
\begin{equation}
L = T-V = \frac{1}{2} m \left( \dot{x}^2 + \dot{y}^2 \right) - \frac{1}{2} k \left( x^2 + y^2 \right)
\end{equation}
The partial derivatives of the Lagrangian with respect to the variables $(x, y)$ are:
#+name : eq:inertial_frame_deriv
\begin{align*}
\frac{\partial L}{\partial x} & = -kx \\
\frac{\partial L}{\partial y} & = -ky \\
\frac{d}{dt}\frac{\partial L}{\partial \dot{x}} & = m\ddot{x} \\
\frac{d}{dt}\frac{\partial L}{\partial \dot{y}} & = m\ddot{y}
\end{align*}
The external forces applied to the mass are:
\begin{align*}
F_{\text{ext}, x} &= F_u \cos{\theta} - F_v \sin{\theta}\\
F_{\text{ext}, y} &= F_u \sin{\theta} + F_v \cos{\theta}
\end{align*}
By appling the Lagrangian equations, we obtain:
\begin{align}
m\ddot{x} + kx = F_u \cos{\theta} - F_v \sin{\theta}\\
m\ddot{y} + ky = F_u \sin{\theta} + F_v \cos{\theta}
\end{align}
We then change coordinates from $(x, y)$ to $(d_x, d_y, \theta)$.
\begin{align*}
x & = d_u \cos{\theta} - d_v \sin{\theta}\\
y & = d_u \sin{\theta} + d_v \cos{\theta}
\end{align*}
We obtain:
\begin{align*}
\ddot{x} & = \ddot{d_u} \cos{\theta} - 2\dot{d_u}\dot{\theta}\sin{\theta} - d_u\ddot{\theta}\sin{\theta} - d_u\dot{\theta}^2 \cos{\theta}
- \ddot{d_v} \sin{\theta} - 2\dot{d_v}\dot{\theta}\cos{\theta} - d_v\ddot{\theta}\cos{\theta} + d_v\dot{\theta}^2 \sin{\theta} \\
\ddot{y} & = \ddot{d_u} \sin{\theta} + 2\dot{d_u}\dot{\theta}\cos{\theta} + d_u\ddot{\theta}\cos{\theta} - d_u\dot{\theta}^2 \sin{\theta}
+ \ddot{d_v} \cos{\theta} - 2\dot{d_v}\dot{\theta}\sin{\theta} - d_v\ddot{\theta}\sin{\theta} - d_v\dot{\theta}^2 \cos{\theta} \\
\end{align*}
2019-01-18 17:46:54 +01:00
By injecting the previous result into the Lagrangian equation, we obtain:
2019-01-18 17:18:02 +01:00
\begin{align*}
m \ddot{d_u} \cos{\theta} - 2m\dot{d_u}\dot{\theta}\sin{\theta} - m d_u\ddot{\theta}\sin{\theta} - m d_u\dot{\theta}^2 \cos{\theta}
-m \ddot{d_v} \sin{\theta} - 2m\dot{d_v}\dot{\theta}\cos{\theta} - m d_v\ddot{\theta}\cos{\theta} + m d_v\dot{\theta}^2 \sin{\theta}
+ k d_u \cos{\theta} - k d_v \sin{\theta} = F_u \cos{\theta} - F_v \sin{\theta} \\
m \ddot{d_u} \sin{\theta} + 2m\dot{d_u}\dot{\theta}\cos{\theta} + m d_u\ddot{\theta}\cos{\theta} - m d_u\dot{\theta}^2 \sin{\theta}
+ m \ddot{d_v} \cos{\theta} - 2m\dot{d_v}\dot{\theta}\sin{\theta} - m d_v\ddot{\theta}\sin{\theta} - m d_v\dot{\theta}^2 \cos{\theta}
+ k d_u \sin{\theta} + k d_v \cos{\theta} = F_u \sin{\theta} + F_v \cos{\theta}
\end{align*}
Which is equivalent to:
\begin{align*}
m \ddot{d_u} - 2m\dot{d_u}\dot{\theta}\frac{\sin{\theta}}{\cos{\theta}} - m d_u\ddot{\theta}\frac{\sin{\theta}}{\cos{\theta}} - m d_u\dot{\theta}^2
-m \ddot{d_v} \frac{\sin{\theta}}{\cos{\theta}} - 2m\dot{d_v}\dot{\theta} - m d_v\ddot{\theta} + m d_v\dot{\theta}^2 \frac{\sin{\theta}}{\cos{\theta}}
+ k d_u - k d_v \frac{\sin{\theta}}{\cos{\theta}} = F_u - F_v \frac{\sin{\theta}}{\cos{\theta}} \\
m \ddot{d_u} + 2m\dot{d_u}\dot{\theta}\frac{\cos{\theta}}{\sin{\theta}} + m d_u\ddot{\theta}\frac{\cos{\theta}}{\sin{\theta}} - m d_u\dot{\theta}^2
+ m \ddot{d_v} \frac{\cos{\theta}}{\sin{\theta}} - 2m\dot{d_v}\dot{\theta} - m d_v\ddot{\theta} - m d_v\dot{\theta}^2 \frac{\cos{\theta}}{\sin{\theta}}
+ k d_u + k d_v \frac{\cos{\theta}}{\sin{\theta}} = F_u + F_v \frac{\cos{\theta}}{\sin{\theta}}
\end{align*}
We can then subtract and add the previous equations to obtain the following equations:
#+begin_important
2019-01-21 23:33:23 +01:00
#+NAME : eq:du_coupled
\begin{equation}
m \ddot{d_u} + (k - m\dot{\theta}^2) d_u = F_u + 2 m\dot{d_v}\dot{\theta} + m d_v\ddot{\theta}
\end{equation}
#+NAME : eq:dv_coupled
\begin{equation}
m \ddot{d_v} + (k - m\dot{\theta}^2) d_v = F_v - 2 m\dot{d_u}\dot{\theta} - m d_u\ddot{\theta}
\end{equation}
2019-01-18 17:18:02 +01:00
#+end_important
We obtain two differential equations that are coupled through:
- *Euler forces* : $m d_v \ddot{\theta}$
- *Coriolis forces* : $2 m \dot{d_v} \dot{\theta}$
2019-01-21 23:33:23 +01:00
Without the coupling terms, each equation is the equation of a one degree of freedom mass-spring system with mass $m$ and stiffness $k- m\dot{\theta}^2$.
Thus, the term $- m\dot{\theta}^2$ acts like a negative stiffness (due to *centrifugal forces* ).
2019-01-18 17:46:54 +01:00
2019-01-21 23:33:23 +01:00
The forces induced by the rotating reference frame are independent of the stiffness of the actuator.
The resulting effect of those forces should then be higher when using softer actuators.
2019-01-18 17:46:54 +01:00
2019-01-21 23:33:23 +01:00
** Numerical Values for the NASS
2019-01-18 17:46:54 +01:00
#+begin_src matlab :exports none :results silent :noweb yes
<<matlab-init >>
#+end_src
2019-01-18 17:18:02 +01:00
Let's define the parameters for the NASS.
2019-01-21 23:33:23 +01:00
#+begin_src matlab :exports none :results silent
mlight = 35; % Mass for light sample [kg]
mheavy = 85; % Mass for heavy sample [kg]
wlight = 2*pi; % Max rot. speed for light sample [rad/s]
wheavy = 2*pi/60; % Max rot. speed for heavy sample [rad/s]
2019-01-18 17:18:02 +01:00
2019-01-21 23:33:23 +01:00
kvc = 1e3; % Voice Coil Stiffness [N/m]
kpz = 1e8; % Piezo Stiffness [N/m]
2019-01-18 17:18:02 +01:00
2019-01-21 23:33:23 +01:00
wdot = 1; % Maximum rotation acceleration [rad/s2]
2019-01-18 17:18:02 +01:00
2019-01-21 23:33:23 +01:00
d = 0.01; % Maximum excentricity from rotational axis [m]
ddot = 0.2; % Maximum Horizontal speed [m/s]
save('./mat/parameters.mat');
#+end_src
#+begin_src matlab :results table :exports results
labels = {'Light sample mass [kg]', ...
'Heavy sample mass [kg]', ...
'Max rot. speed - light [rpm]', ...
'Max rot. speed - heavy [rpm]', ...
'Voice Coil Stiffness [N/m]', ...
'Piezo Stiffness [N/m]', ...
'Max rot. acceleration [rad/s2]', ...
'Max mass excentricity [m]', ...
'Max Horizontal speed [m/s]'};
data = [mlight, mheavy, 60*wlight/2/pi, 60*wheavy/2/pi, kvc, kpz, wdot, d, ddot];
data2orgtable(data', labels, {}, ' %.1e ')
2019-01-18 17:18:02 +01:00
#+end_src
2019-01-21 23:33:23 +01:00
#+RESULTS :
| Light sample mass [kg] | 3.5e+01 |
| Heavy sample mass [kg] | 8.5e+01 |
| Max rot. speed - light [rpm] | 6.0e+01 |
| Max rot. speed - heavy [rpm] | 1.0e+00 |
| Voice Coil Stiffness [N/m] | 1.0e+03 |
| Piezo Stiffness [N/m] | 1.0e+08 |
| Max rot. acceleration [rad/s2] | 1.0e+00 |
| Max mass excentricity [m] | 1.0e-02 |
| Max Horizontal speed [m/s] | 2.0e-01 |
** Euler and Coriolis forces - Numerical Result
2019-01-18 17:46:54 +01:00
First we will determine the value for Euler and Coriolis forces during regular experiment.
2019-01-21 23:33:23 +01:00
- *Euler forces* : $m d_v \ddot{\theta}$
- *Coriolis forces* : $2 m \dot{d_v} \dot{\theta}$
2019-01-18 17:46:54 +01:00
2019-01-18 17:18:02 +01:00
#+begin_src matlab :exports none :results silent
Felight = mlight*d*wdot;
Feheavy = mheavy*d*wdot;
2019-01-21 23:33:23 +01:00
Fclight = 2*mlight*ddot*wlight;
Fcheavy = 2*mheavy*ddot*wheavy;
2019-01-18 17:18:02 +01:00
#+end_src
2019-01-21 23:33:23 +01:00
The obtained values are displayed in table [[tab:euler_coriolis ]].
2019-01-18 17:18:02 +01:00
#+begin_src matlab :results value table :exports results :post addhdr(*this* )
2019-01-21 23:33:23 +01:00
data = [Fclight, Fcheavy ;
Felight, Feheavy];
data2orgtable(data, {'Coriolis', 'Euler'}, {'Light', 'Heavy'}, ' %.1fN ')
2019-01-18 17:18:02 +01:00
#+end_src
#+NAME : tab:euler_coriolis
#+CAPTION : Euler and Coriolis forces for the NASS
#+RESULTS :
2019-01-21 23:33:23 +01:00
| | Light | Heavy |
|----------+-------+-------|
| Coriolis | 88.0N | 3.6N |
| Euler | 0.4N | 0.8N |
** Negative Spring Effect - Numerical Result
The negative stiffness due to the rotation is equal to $-m{\omega_0}^2$.
2019-01-18 17:18:02 +01:00
#+begin_src matlab :exports none :results silent
2019-01-21 23:33:23 +01:00
Klight = mlight*wlight^2;
Kheavy = mheavy*wheavy^2;
2019-01-18 17:18:02 +01:00
#+end_src
2019-01-18 17:46:54 +01:00
The values for the negative spring effect are displayed in table [[tab:negative_spring ]].
2019-01-21 23:33:23 +01:00
2019-01-18 17:18:02 +01:00
This is definitely negligible when using piezoelectric actuators. It may not be the case when using voice coil actuators.
#+begin_src matlab :results value table :exports results :post addhdr(*this* )
2019-01-21 23:33:23 +01:00
data = [Klight, Kheavy];
data2orgtable(data, {'Neg. Spring'}, {'Light', 'Heavy'}, ' %.1f[N/m] ')
2019-01-18 17:18:02 +01:00
#+end_src
2019-01-18 17:46:54 +01:00
#+NAME : tab:negative_spring
#+CAPTION : Negative Spring effect
2019-01-18 17:18:02 +01:00
#+RESULTS :
2019-01-21 23:33:23 +01:00
| | Light | Heavy |
|-------------+-------------+----------|
| Neg. Spring | 1381.7[N/m] | 0.9[N/m] |
** Limitations due to coupling
To simplify, we consider a constant rotating speed $\dot{\theta} = {\omega_0}$ and thus $\ddot{\theta} = 0$.
From equations [[eq:du_coupled ]] and [[eq:dv_coupled ]], we obtain:
\begin{align*}
(m s^2 + (k - m{\omega_0}^2)) d_u &= F_u + 2 m {\omega_0} s d_v \\
(m s^2 + (k - m{\omega_0}^2)) d_v &= F_v - 2 m {\omega_0} s d_u \\
\end{align*}
From second equation:
\[ d_v = \frac{1}{m s^2 + (k - m{\omega_0}^2)} F_v - \frac{2 m {\omega_0} s}{m s^2 + (k - m{\omega_0}^2)} d_u \]
And we re-inject $d_v$ into the first equation:
\begin{equation*}
(m s^2 + (k - m{\omega_0}^2)) d_u = F_u + \frac{2 m {\omega_0} s}{m s^2 + (k - m{\omega_0}^2)} F_v - \frac{(2 m {\omega_0} s)^2}{m s^2 + (k - m{\omega_0}^2)} d_u
\end{equation*}
\begin{equation*}
\frac{(m s^2 + (k - m{\omega_0}^2))^2 + (2 m {\omega_0} s)^2}{m s^2 + (k - m{\omega_0}^2)} d_u = F_u + \frac{2 m {\omega_0} s}{m s^2 + (k - m{\omega_0}^2)} F_v
\end{equation*}
Finally we obtain $d_u$ function of $F_u$ and $F_v$.
\[ d_u = \frac{m s^2 + (k - m{\omega_0}^2)}{(m s^2 + (k - m{\omega_0}^2))^2 + (2 m {\omega_0} s)^2} F_u + \frac{2 m {\omega_0} s}{(m s^2 + (k - m{\omega_0}^2))^2 + (2 m {\omega_0} s)^2} F_v \]
Similarly we can obtain $d_v$ function of $F_u$ and $F_v$:
\[ d_v = \frac{m s^2 + (k - m{\omega_0}^2)}{(m s^2 + (k - m{\omega_0}^2))^2 + (2 m {\omega_0} s)^2} F_v - \frac{2 m {\omega_0} s}{(m s^2 + (k - m{\omega_0}^2))^2 + (2 m {\omega_0} s)^2} F_u \]
The two previous equations can be written in a matrix form:
#+begin_important
2019-01-24 14:07:14 +01:00
#+NAME : eq:coupledplant
2019-01-21 23:33:23 +01:00
\begin{equation}
\begin{bmatrix} d_u \\ d_v \end{bmatrix} =
\frac{1}{(m s^2 + (k - m{\omega_0}^2))^2 + (2 m {\omega_0} s)^2}
\begin{bmatrix}
ms^2 + (k-m{\omega_0}^2) & 2 m \omega_0 s \\
-2 m \omega_0 s & ms^2 + (k-m{\omega_0}^2) \\
\end{bmatrix}
\begin{bmatrix} F_u \\ F_v \end{bmatrix}
\end{equation}
#+end_important
Then, coupling is negligible if $|-m \omega^2 + (k - m{\omega_0}^2)| \gg |2 m {\omega_0} \omega|$.
*** Numerical Analysis
We plot on the same graph $\frac{|-m \omega^2 + (k - m {\omega_0}^2)|}{|2 m \omega_0 \omega|}$ for the voice coil and the piezo:
- with the light sample (figure [[fig:coupling_light ]]).
- with the heavy sample (figure [[fig:coupling_heavy ]]).
2019-01-24 14:07:14 +01:00
#+begin_src matlab :exports none :results silent
2019-01-21 23:44:33 +01:00
f = logspace(-1, 3, 1000);
2019-01-21 23:33:23 +01:00
figure;
hold on;
plot(f, abs(-mlight*(2*pi*f).^2 + kvc - mlight * wlight^2)./abs(2*mlight*wlight*2*pi*f), 'DisplayName', 'Voice Coil')
plot(f, abs(-mlight*(2*pi*f).^2 + kpz - mlight * wlight^2)./abs(2*mlight*wlight*2*pi*f), 'DisplayName', 'Piezo')
plot(f, ones(1, length(f)), 'k--', 'HandleVisibility', 'off')
2019-01-21 23:44:33 +01:00
hold off;
xlim([f(1), f(end)]);
2019-01-21 23:33:23 +01:00
set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log');
xlabel('Frequency [Hz]');
legend('Location', 'northeast');
#+end_src
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/coupling_light.png" :var figsize="normal-normal"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+NAME : fig:coupling_light
#+CAPTION : Relative Coupling for light mass and high rotation speed
#+RESULTS :
[[file:Figures/coupling_light.png ]]
2019-01-24 14:07:14 +01:00
#+begin_src matlab :exports none :results silent
2019-01-21 23:33:23 +01:00
figure;
hold on;
plot(f, abs(-mheavy*(2*pi*f).^2 + kvc - mheavy * wheavy^2)./abs(2*mheavy*wheavy*2*pi*f), 'DisplayName', 'Voice Coil')
plot(f, abs(-mheavy*(2*pi*f).^2 + kpz - mheavy * wheavy^2)./abs(2*mheavy*wheavy*2*pi*f), 'DisplayName', 'Piezo')
plot(f, ones(1, length(f)), 'k--', 'HandleVisibility', 'off')
2019-01-21 23:44:33 +01:00
hold off;
xlim([f(1), f(end)]);
2019-01-21 23:33:23 +01:00
set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log');
xlabel('Frequency [Hz]');
legend('Location', 'northeast');
#+end_src
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/coupling_heavy.png" :var figsize="normal-normal"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+NAME : fig:coupling_heavy
#+CAPTION : Relative Coupling for heavy mass and low rotation speed
#+RESULTS :
[[file:Figures/coupling_heavy.png ]]
#+begin_important
Coupling is higher for actuators with small stiffness.
#+end_important
** Limitations due to negative stiffness effect
If $\max{\dot{\theta}} \ll \sqrt{\frac{k}{m}}$, then the negative spring effect is negligible and $k - m\dot{\theta}^2 \approx k$.
Let's estimate what is the maximum rotation speed for which the negative stiffness effect is still negligible ($\omega_\text{max} = 0.1 \sqrt{\frac{k}{m}}$). Results are shown table [[tab:negative_stiffness ]].
#+begin_src matlab :results table :exports results :post addhdr(*this* )
data = 0.1*60*(1/2/pi)* [sqrt(kvc/mlight), sqrt(kpz/mlight);
sqrt(kvc/mheavy), sqrt(kpz/mheavy)];
data2orgtable(data, {'Light', 'Heavy'}, {'Voice Coil', 'Piezo'}, ' %.0f[rpm] ')
#+end_src
#+NAME : tab:negative_stiffness
#+CAPTION : Maximum rotation speed at which negative stiffness is negligible ($0.1\sqrt{\frac{k}{m}}$)
#+RESULTS :
| | Voice Coil | Piezo |
|-------+------------+-----------|
| Light | 5[rpm] | 1614[rpm] |
| Heavy | 3[rpm] | 1036[rpm] |
The negative spring effect is proportional to the rotational speed $\omega$.
The system dynamics will be much more affected when using soft actuator.
#+begin_important
Negative stiffness effect has very important effect when using soft actuators.
#+end_important
The system can even goes unstable when $m \omega^2 > k$, that is when the centrifugal forces are higher than the forces due to stiffness.
From this analysis, we can determine the lowest practical stiffness that is possible to use: $k_\text{min} = 10 m \omega^2$ (table [[tab:min_k ]])
#+begin_src matlab :results table :exports results :post addhdr(*this* )
data = 10*[mlight*2*pi, mheavy*2*pi/60]
data2orgtable(data, {'k min [N/m]'}, {'Light', 'Heavy'}, ' %.0f ')
#+end_src
#+NAME : tab:min_k
#+CAPTION : Minimum possible stiffness
#+RESULTS :
| | Light | Heavy |
|-------------+-------+-------|
| k min [N/m] | 2199 | 89 |
2019-01-18 17:18:02 +01:00
2019-01-24 14:07:14 +01:00
** Effect of rotation speed on the plant
As shown in equation [[eq:coupledplant ]], the plant changes with the rotation speed $\omega_0$.
Then, we compute the bode plot of the direct term and coupling term for multiple rotating speed.
Then we compare the result between voice coil and piezoelectric actuators.
*** Voice coil actuator
#+begin_src matlab :exports none :results silent
m = mlight;
k = kvc;
#+end_src
#+begin_src matlab :exports none :results silent
ws = [0, 1, 10, 60]*2*pi/60; % [rmp]
Gs = {zeros(1, length(ws))};
Gcs = {zeros(1, length(ws))};
for i = 1:length(ws)
w = ws(i);
Gs(i) = {(m*s^2 + (k-m*w^2))/((m*s^2 + (k - m*w^2))^2 + (2*m*w*s)^2)};
Gcs(i) = {(2*m*w*s)/((m*s^2 + (k - m*w^2))^2 + (2*m*w*s)^2)};
end
#+end_src
#+begin_src matlab :exports none :results silent
freqs = logspace(-2, 1, 1000);
figure;
ax1 = subaxis(2,1,1);
hold on;
for i = 1:length(ws)
plot(freqs, abs(squeeze(freqresp(Gs{i}, freqs, 'Hz'))), 'DisplayName', sprintf('w = %.0f [rpm]', ws(i)*60/2/pi));
end
hold off;
xlim([freqs(1), freqs(end)]);
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
set(gca, 'XTickLabel',[]);
ylabel('Magnitude [m/N]');
legend('Location', 'southwest');
ax2 = subaxis(2,1,2);
hold on;
for i = 1:length(ws)
plot(freqs, 180/pi*angle(squeeze(freqresp(Gs{i}, freqs, 'Hz'))));
end
hold off;
yticks(-180:90:180);
ylim([-180 180]);
xlim([freqs(1), freqs(end)]);
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
linkaxes([ax1,ax2],'x');
#+end_src
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/G_ws_vc.png" :var figsize="wide-tall"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+NAME : fig:G_ws_vc
#+CAPTION : Bode plot of the direct transfer function term (from $F_u$ to $D_u$) for multiple rotation speed - Voice coil
#+RESULTS :
[[file:Figures/G_ws_vc.png ]]
#+begin_src matlab :exports none :results silent
freqs = logspace(-2, 1, 1000);
figure;
ax1 = subaxis(2,1,1);
hold on;
for i = 1:length(ws)
plot(freqs, abs(squeeze(freqresp(Gcs{i}, freqs, 'Hz'))), 'DisplayName', sprintf('w = %.0f [rpm]', ws(i)*60/2/pi));
end
hold off;
xlim([freqs(1), freqs(end)]);
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
set(gca, 'XTickLabel',[]);
ylabel('Magnitude [m/N]');
legend('Location', 'southwest');
ax2 = subaxis(2,1,2);
hold on;
for i = 1:length(ws)
plot(freqs, 180/pi*angle(squeeze(freqresp(Gcs{i}, freqs, 'Hz'))));
end
hold off;
yticks(-180:90:180);
ylim([-180 180]);
xlim([freqs(1), freqs(end)]);
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
linkaxes([ax1,ax2],'x');
#+end_src
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/Gc_ws_vc.png" :var figsize="wide-tall"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+NAME : fig:Gc_ws_vc
#+CAPTION : Bode plot of the coupling transfer function term (from $F_u$ to $D_v$) for multiple rotation speed - Voice coil
#+RESULTS :
[[file:Figures/Gc_ws_vc.png ]]
*** Piezoelectric actuator
#+begin_src matlab :exports none :results silent
m = mlight;
k = kpz;
#+end_src
#+begin_src matlab :exports none :results silent
ws = [0, 1, 10, 60]*2*pi/60; % [rmp]
Gs = {zeros(1, length(ws))};
Gcs = {zeros(1, length(ws))};
for i = 1:length(ws)
w = ws(i);
Gs(i) = {(m*s^2 + (k-m*w^2))/((m*s^2 + (k - m*w^2))^2 + (2*m*w*s)^2)};
Gcs(i) = {(2*m*w*s)/((m*s^2 + (k - m*w^2))^2 + (2*m*w*s)^2)};
end
#+end_src
#+begin_src matlab :exports none :results silent
freqs = logspace(2, 3, 1000);
figure;
ax1 = subaxis(2,1,1);
hold on;
for i = 1:length(ws)
plot(freqs, abs(squeeze(freqresp(Gs{i}, freqs, 'Hz'))), 'DisplayName', sprintf('w = %.0f [rpm]', ws(i)*60/2/pi));
end
hold off;
xlim([freqs(1), freqs(end)]);
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
set(gca, 'XTickLabel',[]);
ylabel('Magnitude [m/N]');
legend('Location', 'southwest');
ax2 = subaxis(2,1,2);
hold on;
for i = 1:length(ws)
plot(freqs, 180/pi*angle(squeeze(freqresp(Gs{i}, freqs, 'Hz'))));
end
hold off;
yticks(-180:90:180);
ylim([-180 180]);
xlim([freqs(1), freqs(end)]);
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
linkaxes([ax1,ax2],'x');
#+end_src
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/G_ws_pz.png" :var figsize="wide-tall"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+NAME : fig:G_ws_pz
#+CAPTION : Bode plot of the direct transfer function term (from $F_u$ to $D_u$) for multiple rotation speed - Piezoelectric actuator
#+RESULTS :
[[file:Figures/G_ws_pz.png ]]
#+begin_src matlab :exports none :results silent
figure;
ax1 = subaxis(2,1,1);
hold on;
for i = 1:length(ws)
plot(freqs, abs(squeeze(freqresp(Gcs{i}, freqs, 'Hz'))), 'DisplayName', sprintf('w = %.0f [rpm]', ws(i)*60/2/pi));
end
hold off;
xlim([freqs(1), freqs(end)]);
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
set(gca, 'XTickLabel',[]);
ylabel('Magnitude [m/N]');
legend('Location', 'southwest');
ax2 = subaxis(2,1,2);
hold on;
for i = 1:length(ws)
plot(freqs, 180/pi*angle(squeeze(freqresp(Gcs{i}, freqs, 'Hz'))));
end
hold off;
yticks(-180:90:180);
ylim([-180 180]);
xlim([freqs(1), freqs(end)]);
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
linkaxes([ax1,ax2],'x');
#+end_src
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/Gc_ws_pz.png" :var figsize="wide-tall"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+NAME : fig:Gc_ws_pz
#+CAPTION : Bode plot of the coupling transfer function term (from $F_u$ to $D_v$) for multiple rotation speed - Piezoelectric actuator
#+RESULTS :
[[file:Figures/Gc_ws_pz.png ]]
*** Analysis
When the rotation speed is null, the coupling terms are equal to zero and the diagonal terms corresponds to one degree of freedom mass spring system.
When the rotation speed in not null, the resonance frequency is duplicated into two pairs of complex conjugate poles.
As the rotation speed increases, one of the two resonant frequency goes to lower frequencies as the other one goes to higher frequencies.
The poles of the coupling terms are the same as the poles of the diagonal terms. The magnitude of the coupling terms are increasing with the rotation speed.
As shown in the previous figures, the system with voice coil is much more sensitive to rotation speed.
*** Campbell diagram
The poles of the system are computed for multiple values of the rotation frequency.
#+begin_src matlab :results silent :exports code
m = mlight;
k = kvc;
c = 0.1*sqrt(k*m);
ws = linspace(0, 10, 100); % [rad/s]
polesvc = zeros(2, length(ws));
for i = 1:length(ws)
polei = pole(1/((m*s^2 + c*s + (k - m*ws(i)^2))^2 + (2*m*ws(i)*s)^2));
polesvc(:, i) = sort(polei(imag(polei) > 0));
end
#+end_src
#+begin_src matlab :results silent :exports code
m = mlight;
k = kpz;
c = 0.1*sqrt(k*m);
ws = linspace(0, 1000, 100); % [rad/s]
polespz = zeros(2, length(ws));
for i = 1:length(ws)
polei = pole(1/((m*s^2 + c*s + (k - m*ws(i)^2))^2 + (2*m*ws(i)*s)^2));
polespz(:, i) = sort(polei(imag(polei) > 0));
end
#+end_src
We then plot the real and imaginary part of the poles as a function of the rotation frequency (figures [[fig:poles_w_vc ]] and [[fig:poles_w_pz ]]).
When the real part of one pole becomes positive, the system goes unstable.
For the voice coil (figure [[fig:poles_w_vc ]]), the system is unstable when the rotation speed is above 5 rad/s. The real and imaginary part of the poles of the system with piezoelectric actuators are changing much less (figure [[fig:poles_w_pz ]]).
#+begin_src matlab :results silent :exports none
figure;
% Amplitude
ax1 = subplot(1,2,1);
hold on;
plot(ws, real(polesvc(1, :)))
set(gca,'ColorOrderIndex',1)
plot(ws, real(polesvc(2, :)))
plot(ws, zeros(size(ws)), 'k--')
hold off;
xlabel('Rotation Frequency [rad/s]');
ylabel('Pole Real Part');
ax2 = subplot(1,2,2);
hold on;
plot(ws, imag(polesvc(1, :)))
set(gca,'ColorOrderIndex',1)
plot(ws, -imag(polesvc(1, :)))
set(gca,'ColorOrderIndex',1)
plot(ws, imag(polesvc(2, :)))
set(gca,'ColorOrderIndex',1)
plot(ws, -imag(polesvc(2, :)))
hold off;
xlabel('Rotation Frequency [rad/s]');
ylabel('Pole Imaginary Part');
#+end_src
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/poles_w_vc.png" :var figsize="wide-tall"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+NAME : fig:poles_w_vc
#+CAPTION : Real and Imaginary part of the poles of the system as a function of the rotation speed - Voice Coil and light sample
#+RESULTS :
[[file:Figures/poles_w_vc.png ]]
#+begin_src matlab :results silent :exports none
figure;
% Amplitude
ax1 = subplot(1,2,1);
hold on;
plot(ws, real(polespz(1, :)))
set(gca,'ColorOrderIndex',1)
plot(ws, real(polespz(2, :)))
plot(ws, zeros(size(ws)), 'k--')
hold off;
xlabel('Rotation Frequency [rad/s]');
ylabel('Pole Real Part');
ax2 = subplot(1,2,2);
hold on;
plot(ws, imag(polespz(1, :)))
set(gca,'ColorOrderIndex',1)
plot(ws, -imag(polespz(1, :)))
set(gca,'ColorOrderIndex',1)
plot(ws, imag(polespz(2, :)))
set(gca,'ColorOrderIndex',1)
plot(ws, -imag(polespz(2, :)))
hold off;
xlabel('Rotation Frequency [rad/s]');
ylabel('Pole Imaginary Part');
#+end_src
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/poles_w_pz.png" :var figsize="wide-tall"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+NAME : fig:poles_w_pz
#+CAPTION : Real and Imaginary part of the poles of the system as a function of the rotation speed - Voice Coil and light sample
#+RESULTS :
[[file:Figures/poles_w_pz.png ]]
2019-01-18 17:18:02 +01:00
* Control Strategies
<<sec:control_strategies >>
** Measurement in the fixed reference frame
First, let's consider a measurement in the fixed referenced frame.
The transfer function from actuator $[F_u, F_v]$ to sensor $[D_x, D_y]$ is then $G(\theta)$.
Then the measurement is subtracted to the reference signal $[r_x, r_y]$ to obtain the position error in the fixed reference frame $[\epsilon_x, \epsilon_y]$.
The position error $[\epsilon_x, \epsilon_y]$ is then express in the rotating frame corresponding to the actuators $[\epsilon_u, \epsilon_v]$.
Finally, the control low $K$ links the position errors $[\epsilon_u, \epsilon_v]$ to the actuator forces $[F_u, F_v]$.
The block diagram is shown on figure [[fig:control_measure_fixed_2dof ]].
#+name : fig:control_measure_fixed_2dof
#+caption : Control with a measure from fixed frame
[[./Figures/control_measure_fixed_2dof.png ]]
The loop gain is then $L = G(\theta) K J(\theta)$.
2019-01-18 17:46:54 +01:00
One question we wish to answer is: is $G(\theta) J(\theta) = G(\theta_0) J(\theta_0)$?
2019-01-18 17:18:02 +01:00
** Measurement in the rotating frame
2019-01-18 17:46:54 +01:00
Let's consider that the measurement is made in the rotating reference frame.
2019-01-18 17:18:02 +01:00
The corresponding block diagram is shown figure [[fig:control_measure_rotating_2dof ]]
#+name : fig:control_measure_rotating_2dof
#+caption : Control with a measure from rotating frame
[[./Figures/control_measure_rotating_2dof.png ]]
The loop gain is $L = G K$.
2019-01-21 23:33:23 +01:00
* Multi Body Model - Simscape
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle simscape_analysis.m
:END:
<<sec:simscape >>
2019-01-18 17:46:54 +01:00
2019-01-24 14:07:14 +01:00
** Initialize
2019-01-18 17:46:54 +01:00
#+begin_src matlab :exports none :results silent :noweb yes
<<matlab-init >>
2019-01-21 23:33:23 +01:00
load('./mat/parameters.mat');
2019-01-18 17:46:54 +01:00
#+end_src
2019-01-21 23:33:23 +01:00
#+begin_src matlab :exports none :results silent
open rotating_frame.slx
#+end_src
2019-01-18 17:18:02 +01:00
2019-01-23 15:21:17 +01:00
** Parameter for the Simscape simulations
2019-01-24 14:07:14 +01:00
First we define the parameters that must be defined in order to run the Simscape simulation.
2019-01-23 15:21:17 +01:00
#+begin_src matlab :exports code :results silent
w = 2*pi; % Rotation speed [rad/s]
theta_e = 0; % Static measurement error on the angle theta [rad]
m = 5; % mass of the sample [kg]
mTuv = 30;% Mass of the moving part of the Tuv stage [kg]
kTuv = 1e8; % Stiffness of the Tuv stage [N/m]
cTuv = 0; % Damping of the Tuv stage [N/(m/s)]
#+end_src
2019-01-24 14:07:14 +01:00
Then, we defined parameters that will be used in the following analysis.
2019-01-23 15:21:17 +01:00
#+begin_src matlab :exports code :results silent
mlight = 5; % Mass for light sample [kg]
mheavy = 55; % Mass for heavy sample [kg]
wlight = 2*pi; % Max rot. speed for light sample [rad/s]
wheavy = 2*pi/60; % Max rot. speed for heavy sample [rad/s]
kvc = 1e3; % Voice Coil Stiffness [N/m]
kpz = 1e8; % Piezo Stiffness [N/m]
d = 0.01; % Maximum excentricity from rotational axis [m]
2019-01-24 14:07:14 +01:00
freqs = logspace(-2, 3, 1000); % Frequency vector for analysis [Hz]
2019-01-23 15:21:17 +01:00
#+end_src
2019-01-21 23:33:23 +01:00
** Identification in the rotating referenced frame
2019-01-24 14:07:14 +01:00
We initialize the inputs and outputs of the system to identify:
- Inputs: $f_u$ and $f_v$
- Outputs: $d_u$ and $d_v$
2019-01-23 15:21:17 +01:00
2019-01-21 23:33:23 +01:00
#+begin_src matlab :exports code :results silent
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
2019-01-18 17:18:02 +01:00
2019-01-21 23:33:23 +01:00
%% Name of the Simulink File
mdl = 'rotating_frame';
%% Input/Output definition
io(1) = linio([mdl, '/fu'], 1, 'input');
io(2) = linio([mdl, '/fv'], 1, 'input');
io(3) = linio([mdl, '/du'], 1, 'output');
io(4) = linio([mdl, '/dv'], 1, 'output');
#+end_src
We start we identify the transfer functions at high speed with the light sample.
#+begin_src matlab :exports code :results silent
2019-01-23 15:21:17 +01:00
w = wlight; % Rotation speed [rad/s]
m = mlight; % mass of the sample [kg]
2019-01-21 23:33:23 +01:00
2019-01-23 15:21:17 +01:00
kTuv = kpz;
2019-01-21 23:33:23 +01:00
Gpz_light = linearize(mdl, io, 0.1);
Gpz_light.InputName = {'Fu', 'Fv'};
Gpz_light.OutputName = {'Du', 'Dv'};
2019-01-23 15:21:17 +01:00
kTuv = kvc;
Gvc_light = linearize(mdl, io, 0.1);
2019-01-21 23:33:23 +01:00
Gvc_light.InputName = {'Fu', 'Fv'};
Gvc_light.OutputName = {'Du', 'Dv'};
#+end_src
2019-01-23 15:21:17 +01:00
Then we identify the system with an heavy mass and low speed.
#+begin_src matlab :exports code :results silent
w = wheavy; % Rotation speed [rad/s]
m = mheavy; % mass of the sample [kg]
kTuv = kpz;
Gpz_heavy = linearize(mdl, io, 0.1);
Gpz_heavy.InputName = {'Fu', 'Fv'};
Gpz_heavy.OutputName = {'Du', 'Dv'};
kTuv = kvc;
Gvc_heavy = linearize(mdl, io, 0.1);
Gvc_heavy.InputName = {'Fu', 'Fv'};
Gvc_heavy.OutputName = {'Du', 'Dv'};
#+end_src
2019-01-24 14:07:14 +01:00
** Coupling ratio between $f_{uv}$ and $d_{uv}$
From the previous identification, we plot the coupling ratio in both case (figure [[fig:coupling_ration_light_heavy ]]).
2019-01-23 15:21:17 +01:00
We obtain the same result than the analytical case (figures [[fig:coupling_light ]] and [[fig:coupling_heavy ]]).
#+begin_src matlab :results silent :exports none
figure;
hold on;
plot(freqs, abs(squeeze(freqresp(Gvc_light('Du', 'Fu'), freqs, 'Hz')))./abs(squeeze(freqresp(Gvc_light('Dv', 'Fu'), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(Gpz_light('Du', 'Fu'), freqs, 'Hz')))./abs(squeeze(freqresp(Gpz_light('Dv', 'Fu'), freqs, 'Hz'))));
set(gca,'ColorOrderIndex',1);
plot(freqs, abs(squeeze(freqresp(Gvc_heavy('Du', 'Fu'), freqs, 'Hz')))./abs(squeeze(freqresp(Gvc_heavy('Dv', 'Fu'), freqs, 'Hz'))), '--');
plot(freqs, abs(squeeze(freqresp(Gpz_heavy('Du', 'Fu'), freqs, 'Hz')))./abs(squeeze(freqresp(Gpz_heavy('Dv', 'Fu'), freqs, 'Hz'))), '--');
hold off;
xlim([freqs(1), freqs(end)]);
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Coupling ratio');
legend({'light - VC', 'light - PZ', 'heavy - VC', 'heavy - PZ'})
#+end_src
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/coupling_ration_light_heavy.png" :var figsize="wide-tall"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+NAME : fig:coupling_ration_light_heavy
#+RESULTS :
[[file:Figures/coupling_ration_light_heavy.png ]]
2019-01-24 14:07:14 +01:00
** Plant Control
The goal is the study control problems due to the coupling that appears because of the rotation.
#+begin_src matlab :exports none :results silent
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
%% Name of the Simulink File
mdl = 'rotating_frame';
%% Input/Output definition
io(1) = linio([mdl, '/fu'], 1, 'input');
io(2) = linio([mdl, '/fv'], 1, 'input');
io(3) = linio([mdl, '/du'], 1, 'output');
io(4) = linio([mdl, '/dv'], 1, 'output');
#+end_src
First, we identify the system when the rotation speed is null and then when the rotation speed is equal to 60rpm.
The actuators are voice coil with some damping.
#+begin_src matlab :exports none :results silent
w = 0; % Rotation speed [rad/s]
m = mlight; % mass of the sample [kg]
kTuv = kvc;
% cTuv = 0.1*sqrt(kTuv*m);
cTuv = 0;
G = linearize(mdl, io, 0.1);
G.InputName = {'Fu', 'Fv'};
G.OutputName = {'Du', 'Dv'};
#+end_src
#+begin_src matlab :exports none :results silent
w = 0.1; % Rotation speed [rad/s]
m = mlight; % mass of the sample [kg]
kTuv = kvc;
% cTuv = 0.1*sqrt(kTuv*m);
cTuv = 0;
Gt = linearize(mdl, io, 0.1);
Gt.InputName = {'Fu', 'Fv'};
Gt.OutputName = {'Du', 'Dv'};
#+end_src
#+begin_src matlab :exports none :results silent
figure;
bode(G, 'r-', Gt, 'b--')
legend({'G - w = 0', 'G - w = 60rpm'}, 'Location', 'southwest');
#+end_src
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/coupling_ration_light_heavy.png" :var figsize="wide-tall"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+begin_src matlab :exports none :results silent
figure;
% Amplitude
ax1 = subaxis(2,1,1);
hold on;
plot(freqs, abs(squeeze(freqresp(Gvc_light('du', 'fu'), freqs, 'Hz'))), '-');
set(gca,'xscale','log'); set(gca,'yscale','log');
ylabel('Amplitude [m/N]');
set(gca, 'XTickLabel',[]);
hold off;
% Phase
ax2 = subaxis(2,1,2);
hold on;
plot(freqs, 180/pi*unwrap(angle(squeeze(freqresp(Gvc_light('du', 'fu'), freqs, 'Hz')))), '-');
set(gca,'xscale','log');
yticks(-180:180:180);
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
hold off;
linkaxes([ax1,ax2],'x');
#+end_src
#+begin_src matlab :exports none :results silent
figure;
% Amplitude
ax1 = subaxis(2,1,1);
hold on;
plot(freqs, abs(squeeze(freqresp(-Gvc_light('dv', 'fv'), freqs, 'Hz'))), '-');
set(gca,'xscale','log'); set(gca,'yscale','log');
ylabel('Amplitude [m/N]');
set(gca, 'XTickLabel',[]);
hold off;
% Phase
ax2 = subaxis(2,1,2);
hold on;
plot(freqs, 180/pi*unwrap(angle(squeeze(freqresp(-Gvc_light('dv', 'fv'), freqs, 'Hz')))), '-');
set(gca,'xscale','log');
yticks(-180:180:180);
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
hold off;
linkaxes([ax1,ax2],'x');
#+end_src
2019-01-23 15:21:17 +01:00
2019-01-21 23:33:23 +01:00
#+begin_src matlab :exports none :results silent
figure;
bode(Gpz_light, Gvc_light);
#+end_src
2019-01-21 23:44:33 +01:00
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/coupling_simscape_light.png" :var figsize="wide-tall"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+RESULTS :
[[file:Figures/coupling_simscape_light.png ]]
2019-01-21 23:33:23 +01:00
And then with the heavy sample.
#+begin_src matlab :exports code :results silent
rot_speed = wheavy;
angle_e = 0;
m = mheavy;
k = kpz;
c = 1e3;
Gpz_heavy = linearize(mdl, io, 0.1);
k = kvc;
c = 1e3;
Gvc_heavy = linearize(mdl, io, 0.1);
Gpz_heavy.InputName = {'Fu', 'Fv'};
Gpz_heavy.OutputName = {'Du', 'Dv'};
Gvc_heavy.InputName = {'Fu', 'Fv'};
Gvc_heavy.OutputName = {'Du', 'Dv'};
#+end_src
#+begin_src matlab :exports none :results silent
figure;
bode(Gpz_heavy, Gvc_heavy);
#+end_src
2019-01-21 23:44:33 +01:00
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/coupling_simscape_heavy.png" :var figsize="wide-tall"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+RESULTS :
[[file:Figures/coupling_simscape_heavy.png ]]
2019-01-21 23:33:23 +01:00
Plot the ratio between the main transfer function and the coupling term:
#+begin_src matlab :results silent :exports none
freqs = logspace(-2, 3, 1000);
figure;
hold on;
2019-01-21 23:44:33 +01:00
plot(freqs, abs(squeeze(freqresp(Gvc_light('Du', 'Fu'), freqs, 'Hz')))./abs(squeeze(freqresp(Gvc_light('Dv', 'Fu'), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(Gpz_light('Du', 'Fu'), freqs, 'Hz')))./abs(squeeze(freqresp(Gpz_light('Dv', 'Fu'), freqs, 'Hz'))));
2019-01-21 23:33:23 +01:00
hold off;
2019-01-21 23:44:33 +01:00
xlim([freqs(1), freqs(end)]);
2019-01-21 23:33:23 +01:00
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Coupling ratio');
legend({'Voice Coil', 'Piezoelectric'})
#+end_src
2019-01-21 23:44:33 +01:00
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/coupling_ration_simscape_light.png" :var figsize="wide-tall"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+RESULTS :
[[file:Figures/coupling_ration_simscape_light.png ]]
2019-01-21 23:33:23 +01:00
#+begin_src matlab :results silent :exports none
freqs = logspace(-2, 3, 1000);
figure;
hold on;
2019-01-21 23:44:33 +01:00
plot(freqs, abs(squeeze(freqresp(Gvc_heavy('Du', 'Fu'), freqs, 'Hz')))./abs(squeeze(freqresp(Gvc_heavy('Dv', 'Fu'), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(Gpz_heavy('Du', 'Fu'), freqs, 'Hz')))./abs(squeeze(freqresp(Gpz_heavy('Dv', 'Fu'), freqs, 'Hz'))));
2019-01-21 23:33:23 +01:00
hold off;
2019-01-21 23:44:33 +01:00
xlim([freqs(1), freqs(end)]);
2019-01-21 23:33:23 +01:00
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Coupling ratio');
legend({'Voice Coil', 'Piezoelectric'})
#+end_src
2019-01-21 23:44:33 +01:00
#+HEADER : :tangle no :exports results :results file :noweb yes
#+HEADER : :var filepath="Figures/coupling_ration_simscape_heavy.png" :var figsize="wide-tall"
#+begin_src matlab
<<plt-matlab >>
#+end_src
#+RESULTS :
[[file:Figures/coupling_ration_simscape_heavy.png ]]
2019-01-21 23:33:23 +01:00
*** Low rotation speed and High rotation speed
#+begin_src matlab :exports code :results silent
rot_speed = 2*pi/60; angle_e = 0;
G_low = linearize(mdl, io, 0.1);
2019-01-18 17:18:02 +01:00
2019-01-21 23:33:23 +01:00
rot_speed = 2*pi; angle_e = 0;
G_high = linearize(mdl, io, 0.1);
2019-01-18 17:46:54 +01:00
2019-01-21 23:33:23 +01:00
G_low.InputName = {'Fu', 'Fv'};
G_low.OutputName = {'Du', 'Dv'};
G_high.InputName = {'Fu', 'Fv'};
G_high.OutputName = {'Du', 'Dv'};
#+end_src
2019-01-18 17:46:54 +01:00
2019-01-21 23:33:23 +01:00
#+begin_src matlab :results silent
figure;
bode(G_low, G_high);
#+end_src
2019-01-18 17:46:54 +01:00
2019-01-21 23:33:23 +01:00
** Identification in the fixed frame
Let's define some options as well as the inputs and outputs for linearization.
#+begin_src matlab :exports code :results silent
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
2019-01-18 17:18:02 +01:00
2019-01-21 23:33:23 +01:00
%% Name of the Simulink File
mdl = 'rotating_frame';
2019-01-18 17:18:02 +01:00
2019-01-21 23:33:23 +01:00
%% Input/Output definition
io(1) = linio([mdl, '/fx'], 1, 'input');
io(2) = linio([mdl, '/fy'], 1, 'input');
io(3) = linio([mdl, '/dx'], 1, 'output');
io(4) = linio([mdl, '/dy'], 1, 'output');
#+end_src
We then define the error estimation of the error and the rotational speed.
#+begin_src matlab :exports code :results silent
%% Run the linearization
angle_e = 0;
rot_speed = 0;
#+end_src
Finally, we run the linearization.
#+begin_src matlab :exports code :results silent
G = linearize(mdl, io, 0);
%% Input/Output names
G.InputName = {'Fx', 'Fy'};
G.OutputName = {'Dx', 'Dy'};
#+end_src
#+begin_src matlab :exports code :results silent
%% Run the linearization
angle_e = 0;
rot_speed = 2*pi;
Gr = linearize(mdl, io, 0);
%% Input/Output names
Gr.InputName = {'Fx', 'Fy'};
Gr.OutputName = {'Dx', 'Dy'};
2019-01-18 17:18:02 +01:00
#+end_src
2019-01-21 23:33:23 +01:00
#+begin_src matlab :exports code :results silent
%% Run the linearization
angle_e = 1*2*pi/180;
rot_speed = 2*pi;
Ge = linearize(mdl, io, 0);
%% Input/Output names
Ge.InputName = {'Fx', 'Fy'};
Ge.OutputName = {'Dx', 'Dy'};
#+end_src
#+begin_src matlab :exports code :results silent
figure;
bode(G);
% exportFig('G_x_y', 'wide-tall');
figure;
bode(Ge);
% exportFig('G_x_y_e', 'normal-normal');
#+end_src
** Identification from actuator forces to displacement in the fixed frame
#+begin_src matlab :exports code :results silent
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
%% Name of the Simulink File
mdl = 'rotating_frame';
%% Input/Output definition
io(1) = linio([mdl, '/fu'], 1, 'input');
io(2) = linio([mdl, '/fv'], 1, 'input');
io(3) = linio([mdl, '/dx'], 1, 'output');
io(4) = linio([mdl, '/dy'], 1, 'output');
#+end_src
#+begin_src matlab :exports code :results silent
rot_speed = 2*pi;
angle_e = 0;
G = linearize(mdl, io, 0.0);
G.InputName = {'Fu', 'Fv'};
G.OutputName = {'Dx', 'Dy'};
#+end_src
#+begin_src matlab :exports code :results silent
rot_speed = 2*pi;
angle_e = 0;
G1 = linearize(mdl, io, 0.4);
G1.InputName = {'Fu', 'Fv'};
G1.OutputName = {'Dx', 'Dy'};
#+end_src
#+begin_src matlab :exports code :results silent
rot_speed = 2*pi;
angle_e = 0;
G2 = linearize(mdl, io, 0.8);
G2.InputName = {'Fu', 'Fv'};
G2.OutputName = {'Dx', 'Dy'};
#+end_src
#+begin_src matlab :exports code :results silent
figure;
bode(G, G1, G2);
exportFig('G_u_v_to_x_y', 'wide-tall');
#+end_src
** Effect of the rotating Speed
<<sec:effect_rot_speed >>
#+begin_src matlab :exports none :results silent :noweb yes
<<matlab-init >>
#+end_src
*** TODO Use realistic parameters for the mass of the sample and stiffness of the X-Y stage
*** TODO Check if the plant is changing a lot when we are not turning to when we are turning at the maximum speed (60rpm)
** Effect of the X-Y stage stiffness
<<sec:effect_stiffness >>
*** TODO At full speed, check how the coupling changes with the stiffness of the actuators
* Control Implementation
<<sec:control >>
** Measurement in the fixed reference frame