diff --git a/content/zettels/position_jitter_due_to_asynchronous_acquisition.md b/content/zettels/position_jitter_due_to_asynchronous_acquisition.md new file mode 100644 index 0000000..ba6edec --- /dev/null +++ b/content/zettels/position_jitter_due_to_asynchronous_acquisition.md @@ -0,0 +1,149 @@ ++++ +title = "Position Jitter due to Asynchronous Acquisition" +author = ["Dehaeze Thomas"] +draft = false ++++ + +Tags +: + + +## Observed issue {#observed-issue} + +Sometime the controller is not compatible with the encoder protocol. +In that case a PEPU can be used in between the encoder and the controller to convert the encoder value to something readable by the controller. +This is illustrated in Figure . + + + +{{< figure src="/ox-hugo/position_jitter_issue.png" caption="Figure 1: Measurement Setup: an encoder working with BISS protocol is read by a PEPU (every \\(T\_{s,\text{pepu}}\\) seconds) and the controller reads the stored encoder value in the PEPU every \\(T\_{s,\text{ctrl}}\\) seconds" >}} + +When scanning the device (i.e. changing rapidly the read value on the encoder), some "jumps" on the encoder value read by the controller can be seen. +This effect is due to some "jitter" between the PEPU acquisition rate and the controller rate as will be explained bellow. + + +## Visual display of jitter issue {#visual-display-of-jitter-issue} + +Let's make a simulation to understand what is going on. +Let's choose the following parameters: + +- \\(T\_{s,\text{pepu}} = 60\\,\mu s\\): the acquisition rate of the encoder on the PEPU (very typical for a 32bit absolute encoder) +- \\(v = 1\\,mm/s\\): the scan velocity +- \\(T\_{s,\text{ctrl}} = 100\\,\mu s\\) the "sampling rate" of the controller + +The encoder position as well as the stored value on the PEPU and the position used in the controller are shown in Figure , left. +The errors associated with the "jitter" is shown in Figure , right. + +```matlab +%% Simulation parameters +v = 1e-3; % Scanning velocity [m/s or rad/s] +Ts_pepu = 60e-6; % Sampling time of PEPU [s] i.e. time to get a new encoder value +Ts_ctrl = 1e-4; % Sampling time of controller [s] + +t_sim = 10*Ts_ctrl; % Total simulation time [s] +t = 0:1e-6:t_sim; % Time vector used for simulation [s] +x = v*t; % Suppose linear position [m, rad] + +%% Compute position stored in PEPU as every time step +x_pepu = Ts_pepu*floor(t/Ts_pepu)*v; + +%% Compute position get on the controller at each control period +t_ctrl = 0:Ts_ctrl:t_sim; % Time vector [s] +x_ctrl = zeros(size(t_ctrl)); % Position stored on the controller [m] +x_error = zeros(size(t_ctrl)); % Position error due to "jitter" [m] +for i = 1:length(t_ctrl) + [~, i_t] = min(abs(t - t_ctrl(i))); % Find the stored encoder value in the PEPU at the time of the controller period + x_ctrl(i) = x_pepu(i_t); + x_error(i) = x_pepu(i_t) - x(i_t); +end +``` + + + +{{< figure src="/ox-hugo/jitter_error_example.png" caption="Figure 2: Measurement error due to Jitter. 1mm/s velocity scan, Ts_pepu is 60us and Ts_ctrl is 100us" >}} + + +## Expected error induced by "jitter" {#expected-error-induced-by-jitter} + +Th "position jitter" depends on: + +- \\(T\_{s,\text{pepu}}\\): the "sampling time" of the encoder on the PEPU +- \\(v\\): the scan velocity in [unit/s] + +The obtain "jitter" can be as large as (expressed in the same units as \\(v\\)): + +\begin{equation} +dx = v \cdot T\_{s,\text{pepu}} +\end{equation} + +Let's make a numerical example: + +```matlab +%% Simulation parameters +v = 1e-3; % Scanning velocity [m/s or rad/s] +Ts_pepu = 60e-6; % Sampling time of PEPU [s] i.e. time to get a new encoder value +``` + +```text +dx = 60 [nm] with v = 1.0 [mm/s] and Ts_pepu = 60 [us] +``` + + +## Is there an optimal PEPU acquisition rate? {#is-there-an-optimal-pepu-acquisition-rate} + +Changing the readout time of the PEPU (its clock for instance) changes the jitter amplitude as well as its "pattern": + +```matlab +%% Longer simulation than before to better see the pattern +t_sim = 50*Ts_ctrl; % Total simulation time [s] +t = 0:1e-6:t_sim; % Time vector used for simulation [s] +x = v*t; % Suppose linear position [m, rad] +t_ctrl = 0:Ts_ctrl:t_sim; % Time vector [s] + +%% Large Ts_pepu to try to match with controller sampling time +Ts_pepu = 95e-6; % Sampling time of PEPU [s] i.e. time to get a new encoder value +x_pepu = Ts_pepu*floor(t/Ts_pepu)*v; +x_error_1 = zeros(size(t_ctrl)); % Position error due to "jitter" [m] +for i = 1:length(t_ctrl) + [~, i_t] = min(abs(t - t_ctrl(i))); % Find the stored encoder value in the PEPU at the time of the controller period + x_error_1(i) = x_pepu(i_t) - x(i_t); +end + +%% Small Ts_pepu as possible to reduce jitter amplitude +Ts_pepu = 30e-6; % Sampling time of PEPU [s] i.e. time to get a new encoder value +x_pepu = Ts_pepu*floor(t/Ts_pepu)*v; +x_error_2 = zeros(size(t_ctrl)); % Position error due to "jitter" [m] +for i = 1:length(t_ctrl) + [~, i_t] = min(abs(t - t_ctrl(i))); % Find the stored encoder value in the PEPU at the time of the controller period + x_error_2(i) = x_pepu(i_t) - x(i_t); +end + +%% Small Ts_pepu as possible to reduce jitter amplitude +Ts_pepu = 10e-6; % Sampling time of PEPU [s] i.e. time to get a new encoder value +x_pepu = Ts_pepu*floor(t/Ts_pepu)*v; +x_error_3 = zeros(size(t_ctrl)); % Position error due to "jitter" [m] +for i = 1:length(t_ctrl) + [~, i_t] = min(abs(t - t_ctrl(i))); % Find the stored encoder value in the PEPU at the time of the controller period + x_error_3(i) = x_pepu(i_t) - x(i_t); +end +``` + + + +{{< figure src="/ox-hugo/jitter_errors_effect_Ts_pepu.png" caption="Figure 3: Measurement errors due to Jitter. Effect of the refresh rate on the PEPU, different \"patterns\" can appear. Velocity scan is 1mm/s" >}} + +
+ +For high velocity / high precision scans, it is important to reduce the timing jitter of the measured position (i.e. "position jitter"). + +Ideally, this is the control system (i.e. where the feedback controller is implemented) that triggers the readout of all the sensors. + +Having a intermediate electronic device (here the PEPU) that triggers the readout of the encoders not in sync with the controller can affect quite negatively the quality of the motion. + +
+ + +## Bibliography {#bibliography} + +
+
diff --git a/static/ox-hugo/jitter_error_example.png b/static/ox-hugo/jitter_error_example.png new file mode 100644 index 0000000..9dddebd Binary files /dev/null and b/static/ox-hugo/jitter_error_example.png differ diff --git a/static/ox-hugo/jitter_errors_effect_Ts_pepu.png b/static/ox-hugo/jitter_errors_effect_Ts_pepu.png new file mode 100644 index 0000000..b193e40 Binary files /dev/null and b/static/ox-hugo/jitter_errors_effect_Ts_pepu.png differ diff --git a/static/ox-hugo/position_jitter_issue.png b/static/ox-hugo/position_jitter_issue.png new file mode 100644 index 0000000..fb32491 Binary files /dev/null and b/static/ox-hugo/position_jitter_issue.png differ