This section describes some of the work obtained as part of Samar Alhaj Hassan PhD work, in collaboration with Romain Delpoux, Lubin Kerhuel, Vincent Léchappé and Xavier Brun. These results have been published in **(Alhaj2024_Electrimacs)**. The work presents a methodology for a faster development of observers. On board real-time high frequency measurements are logged and used as inputs to validate an open-loop observer in an offline simulation. It allows embedded implementation constraints to be taken into account as early as possible in the development process. The proposed method facilitates and speeds up the design procedure compared to on-board validation, which often involves trial and error gain tuning.

Replicating the exact behavior of the on-chip observer in an offline-simulation presents several advantages:

- accelerating the open-loop verification: a fixed-step simulation is faster than RCP and on-board test
- reducing on-chip gain tuning, since the data used is closer to the embedded behavior,
- having a unified benchmark for offline comparison between open-loop observers,
- taking into account implementation constraints for observer open-loop validation, with no hardware.

This method is limited to open-loop observer validation: the estimation use in the control clearly impacts the observer’s logged inputs.

The proposed methodology in this page follows RCP solution developed in this website. Based on the control strategy developed in the section FOC - Control, the objective is to use the data from this control strategy for the design of observers. The overall strategy is illustrated below :

The differences with the classical approach are highlighted in green. Classically, observer design process usually consists of simulation (as reported in **(Klein2013)**), followed by on-board tests in open-loop, where estimated variables are compared with the measured ones and then in closed-loop where estimated variables are used in the control instead of the measured ones. Thanks to the realization of real-time high frequency data logging, the observer synthesis can be first tuned offline on real data, before being tested on-board.

While high-frequency data logging was limited to the use of expensive RCP systems like dSpace, here the use of a USB 2.0 Hi-Speed to UART cable based on FTDI’s FT232H USB to UART interface device allows high speed transmission. The cable used provides a fast, simple way to connect devices with 3.3 volt digital interfaces to USB. Given that the control algorithm’s sampling frequency is at \(20\)kHz, it has been possible to obtain a data log with \(6\) variables using a baud rate of \(6\times10^6\) \(baud\). On the remote computer, the data are collected thanks to a lightweight serial terminal, RealTerm has been used here.

Using Clarke and Park’s transformations the PMSM mathematical model in the d-q frame however it requires absolute position measurement to be obtained. To provide mechanical sensor less control an estimation of the position is computed rather than measurement.

In order to observer the speed and angle, the PMSM model is expressed in the \(\alpha\beta\) frame using Clarke transformation, leading to the continuous current dynamic is expressed as: \[ \left\{ \begin{array}{lcl} \frac{di_{\alpha\beta}}{dt} &=& -\frac{R}{L} i_{\alpha\beta}+\frac{1}{L} v_{\alpha\beta}-\frac{1}{L} e_{\alpha\beta}\\ e_{\alpha\beta} &=& \phi_f p \Omega \left[\begin{matrix} -\sin(p\theta)\\ \cos(p\theta)\end{matrix}\right] \end{array} \right. \] From these equations, the unknown EMF variable \(e_{\alpha\beta}\) can be observed using state space observer and thus reconstruct the motor position or velocity. It is also possible to compute an estimated Park transforamtion given by \[ \hat{P}=\dfrac{1}{\sqrt{{\hat e_\alpha}^2+{\hat e_\beta}^2}}\begin{bmatrix} {\hat e_\beta} & -{\hat e_\alpha}\\ {\hat e_\alpha} & {\hat e_\beta}\\ \end{bmatrix} \] with \(\hat e_{\alpha\beta}\) the EMF estimatimation. This allows the projection of variables in the estimated Park frame that we call \(\hat d-\hat q\), such as \(\hat{x}_{dq}=\hat{P}x_{\alpha\beta}\).

To evaluate the efficiency of the different observer available in the literature, on board real-time high frequency measurements are logged using the industrial benchmark from the literature **(Glumineau2015)**:

This trajectory has the advantage of being able to test the observer on start-up, at low and high speeds and under load. Based on the control strategy developed in the section FOC - Control, it has been possible to obtain a data log with \(6\) variables at \(20\)kHz on the low cost setup as depicted on the figure below:

The data set is available on-line on GitHub and the Matlab/Simulink, MCU_dataLogger_simulation.slx is provided:

It allows the off-line tunning and validation of the observer under study.

An example for the real time implementation can be downloaded and tested by following the instruction on GitHub

**(Alhaj2024_Electrimacs)** S. Alhaj Hassan, R. Delpoux, L. Kerhuel, V. Léchappé & Xavier Brun (2024) “Offline real-time high frequency data logging based methodology for PMSM observer design”, Proceedings of ELECTRIMACS 2024 – Castello de la Plana, Spain, 27-30 May 2024.

**(Glumineau2015)** Alain Glumineau and Jes ́us De Le ́on Morales. Sensorless AC Electric Motor Control: Robust Advanced Design Techniques and Applications. Advances in Industrial Control. Cham: Springer International Publishing, 2015.

**(Klein2013)** R. Klein et al. “Electrochemical Model Based Observer Design for a Lithium-Ion Battery”. In: IEEE Transactions on Control Systems Technology 21.2 (Mars 2013).