Control of PMSM Based on Switched Systems and Field-Oriented Control Strategy

: Starting from the problem of studying the parametric robustness in the case of the control of a permanent magnet-synchronous motor (PMSM), although robust control systems correspond entirely to this problem, due to the complexity of the algorithms of the robust type, in this article the use of switched systems theory is proposed as a study option, given the fact that these types of systems are suitable both for the study of systems with variable structure and for systems with signiﬁcant parametric variation under conditions of lower complexity of the control algorithms. The study begins by linearizing a PMSM model at a static operating point and continues with a systematic presentation of the basic elements and concepts concerning the stability of switched systems by applying these concepts to the control system of a PMSM based on the ﬁeld-oriented control (FOC) strategy, which usually changes the value of its parameters during operation (stator resistance R s , stator inductances L d and L q , but also combined inertia of PMSM rotor and load J ). The numerical simulations performed in Simulink validate the fact that, for parametric variations of the PMSM structure, the PMSM control switched systems preserve qualitative performance in terms of its control. A series of Matlab programs are presented based on the YALMIP toolbox to obtain P i matrices, by solving Lyapunov–Metzler type inequalities, and using dwell time to demonstrate stability, as well as the qualitative study of the performance of PMSM control switched systems by presenting in phase plane and state space analysis of the evolution of state vectors: ω PMSM rotor speed, i q current, and i d current.


Introduction
Simultaneously with the development of interest in PMSM, due to undeniable construction and performance advantages, PMSM control systems and their applications have been developed in areas such as robotics, CNC machines, computer peripherals, and aerospace engineering. These require both high performance of the control system and parametric robustness in the sense of performance preservation in case of significant variation of PMSM parameters [1][2][3][4].
Common control strategies for PMSM include FOC and direct torque control (DTC) [5][6][7][8]. If the DTC strategy provides acceptable performance but with a relatively simple control system, the FOC strategy provides both superior control performance and a control structure that can be implemented in low-and medium-cost embedded systems.
Different types of control systems can provide high performance, but variable costs of implementation in embedded systems have been developed and implemented in a particular manner depending on the applications and requirements of the PMSM control system. Thus, one can mention adaptive [9,10], predictive [11,12], and sliding mode control (SMC) [13,14], as well as neuro-fuzzy [15,16] and computational intelligence-based control systems [17,18].

•
PMSM model linearization at a static operating point; • Basic elements and concept summary of switched-systems stability; • Application of FOC control strategy and control switched systems for the control of a PMSM under significant variation of parameters that usually change value during operation (stator resistance R s , stator inductances L d and L q , but also combined inertia of PMSM rotor and load J); • Matlab/Simulink program implementation for calculation of the control system characteristic matrices under parametric variations, calculation of the positive definite matrices P i from Lyapunov-Metzler inequalities to demonstrate system stability; • Matlab program implementation for calculation of the dwell time; • Numerical simulations development for the PMSM control switched systems using a switching signal with frequency lower than the one corresponding to the dwell time; • Qualitative study of the PMSM control system performance by presenting in phase plane and state space the evolution of state vectors: ω PMSM rotor speed, i q current, and i d current.
The rest of the paper is organized as follows. The PMSM mathematical model and the FOC-type strategy are presented in Section 2, and the basic concepts of the switched systems are presented in Section 3. The numerical simulations realized in Matlab/Simulink programming and numerical computing environment for the PMSM control switched systems are presented in Section 4, while the final section presents conclusions and perspectives on future approaches.

PMSM Mathematical Model and FOC-Type Strategy
The FOC-PMSM control strategy shown as a block diagram in Figure 1 emphasizes the two cascade control loops; inner loop for current control and outer loop for the PMSM rotor speed control.
where ud, uq and id, iq denote the stator voltages and stator currents of the PMSM, respectively, these relations being valid in the d-q reference frame. We have denoted the stator inductances and resistances of the PMSM in the d-q reference frame as Ld, Lq and Rd, Rq. We also denoted the stator resistance of the PMSM as Rs, the PMSM rotor speed as ω, the flux linkage as λ0, the number of pair poles as np, the PMSM rotor moment inertia combined with load moment inertia as J, the load torque as TL, and finally the viscous friction coefficient as B. For Ld = Lq system (1) can be written under the usual form given by the system (2).
The following equilibrium relation can be written around this operating point: The mathematical model of the PMSM is a nonlinear one, and is presented by the relations in the system (1) [5][6][7][8].
where u d , u q and i d , i q denote the stator voltages and stator currents of the PMSM, respectively, these relations being valid in the d-q reference frame. We have denoted the stator inductances and resistances of the PMSM in the d-q reference frame as L d , L q and R d , R q . We also denoted the stator resistance of the PMSM as R s , the PMSM rotor speed as ω, the flux linkage as λ 0 , the number of pair poles as n p , the PMSM rotor moment inertia combined with load moment inertia as J, the load torque as T L , and finally the viscous friction coefficient as B.
For L d = L q system (1) can be written under the usual form given by the system (2).
The linearization of the PMSM nonlinear model are achieved around an operating point (x * , u * ), where the states and commands are given in (3): The following equilibrium relation can be written around this operating point: Automation 2022, 3 649 A linear system described in (5) can also be associated with the system (3): .
As a typical example of the static operating point, we can choose a state vector of the PMSM control system defined in the relation (7).

Switched Systems-A General Description
Hybrid systems can generally be defined as systems in which continuous and discrete actions and states dynamically interact with each other. Of these systems, those that are continuous, but influenced by discrete events and have the effect of continuously changing the described dynamics, define the switched-type systems. To be define them more accurately, the differential system [22][23][24] .
x(t) = f (x(t)) (8) can be considered, where f : R n → R n is a Lipschitz function. System (8) can be rewritten in the following form, which characterizes a switched system: .
where there are N smooth vector fields, f i , i . . . N, and there is also a switching signal piecewise constant σ : For example, the equations defining the temperature pattern in a heated room can be written as [22][23][24]: .
if the action heater is on (10) where θ represents the room temperature and λ and β are two quantities which characterize the heating process. Based on these, system (10) can be written as a switched system: For the linear case, the switched systems can be written as .
A necessary condition for the stability of the switching system where the switching random function σ(t) = i, ∀t is that all matrices A i , i = 1, . . . , N are Hurwitz.
If σ(t) is a switching signal defined for example as in the following expression: where 2T is the period of the system, and Φ(t, τ) is the transition matrix of the system (12) considered periodic in this example, the monodromy matrix is defined as According to [23] the system is asymptotically stable if the monodromy matrix has subunit eigenvalues modulus.
For the general form of the linear case, one can consider the switched systems .
where the notations are the usual ones, and A i , i = 1, . . . , N, are Hurwitz matrices.
There is the matter of finding the minimum of γ > 0 for which sup w∈L 2 (0,∞) and γ fulfills the condition where: γ i is the H ∞ norm associated with the system (A i , B i , C i , D i ) defined in relation (16). In this respect the following theorem is presented [24][25][26]: Theorem 1. Given the system (15) and assuming that there is a positive definite matrix P so that the following relation is satisfied, then the global asymptotic stability of the switched systems (15) is ensured for the switching signal σ and in addition the following inequality is fulfilled: Proof of Theorem 1. From Schur's lemma and from (18), the inequality γ 2 I − D T i D i > 0 and the relation (20) are obtained.
Based on these, relation (21) ensures the global asymptotic stability in the case of random switching for any input w square-integrable. This is equivalent to choosing a Lyapunov function V(x) = x T Px whose derivative Based on notation (22), the next relation is obtained: (23) and from this, by integrating . V, the relation (24) is obtained, which represents the conclusion of the proof of the theorem.
The following are two examples that ensure a better understanding of what has been presented so far and of how the presentation continues.

Example 1
Let us consider a switching system described by the following subsystems defined by the matrices: Using the Matlab environment, the eigenvalues are calculated as follows: eig(A 1 ) = {−3, −1} and eig(A 2 ) = {−2, −5}. The result is that A 1 and A 2 are Hurwitz matrices. By applying the relation (21), we obtain the next system: Using the Matlab environment and YALMIP toolbox, the matrix P containing the solution to the system (28) is obtained as: Since eig(P) = {0.1708, 0.2969}, matrix P is positive definite and ensures the global asymptotic stability of the switched systems defined by (27).

Example 2
Let us consider a switching system described by the following subsystems defined by the matrices: Using the Matlab environment, the eigenvalues are calculated as eig(A 1 ) = eig(A 2 ) = {−1.0000 + 1.0000i, −1.0000 − 1.0000i} from which it results that A 1 and A 2 are Hurwitz matrices.
Following the above method, it is demonstrated that there is no matrix P > 0 which verifies the system (28). Thus, the above theorem cannot be applied and it cannot be stated that the switched system described by (30) is stable even if the two subsystems are stable. This proves once again that local stability does not imply global stability, and the conditions imposed by a system such as (28) are too restrictive. In contrast, Theorem 2, below, has more restrictive conditions but ensures the stability of the switched systems [24].
First, the term dwell time is described by the following definition [25][26][27]: then T is called dwell time of the switched systems.

Theorem 2.
Assume that for T > 0 there is a set of positive definite matrices{P 1 , . . . , P N } of corresponding dimensions, so as to fulfill the inequalities: Under these conditions, the time switching control law where t k and t k+1 are successive switching moments so that t k+1 − t k ≥ T, ∀k ∈ N ensures the global asymptotic stability of the switched system.

Proof of Theorem 2.
A draft of the demonstration consists in the fact that by choosing a Lyapunov function and calculating its derivative, the next relation is obtained: From this, α > 0 and β > 0 so that By exploiting the relation (33) the next form can be obtained: This results in µ ∈ (0, 1) so that From relations (36) and (38) the global asymptotic stability of the switched system is obtained. It can be pointed out that inequalities (32) and (33) are known as Lyapunov-Metzler inequalities.
A number of ways of estimating the dwell time of the switched systems are presented in [26,27], where we propose an estimate used in practical examples. An upper limit for the minimum dwell time T* is given by Evidently, by using the above theorems, the stability of a switched system can be demonstrated if the switching signal does not switch more often than the dwell time. In terms of establishing a control law of a switched system, similarly to the way the above Lyapunov functions have been chosen, corresponding control laws can be obtained for the closed loop system.

Numerical Simulations for PMSM Control Switched Systems
For the PMSM control in the classical structure (Figure 1), the so-called FOC control strategy, with the outer speed control loop supplying the references for the inner i d and i q current control loops, Figure 2 shows the implementation in Matlab/Simulink, noting that the current reference i dref is set to 0 for the maximization of the electromagnetic torque T e . )) ( ( From relations (36) and (38) the global asymptotic stability of the switched system is obtained. It can be pointed out that inequalities (32) and (33) are known as Lyapunov-Metzler inequalities.
A number of ways of estimating the dwell time of the switched systems are presented in [26,27], where we propose an estimate used in practical examples. An upper limit for the minimum dwell time T* is given by T* Evidently, by using the above theorems, the stability of a switched system can be demonstrated if the switching signal does not switch more often than the dwell time. In terms of establishing a control law of a switched system, similarly to the way the above Lyapunov functions have been chosen, corresponding control laws can be obtained for the closed loop system.

Numerical Simulations for PMSM Control Switched Systems
For the PMSM control in the classical structure ( Figure 1), the so-called FOC control strategy, with the outer speed control loop supplying the references for the inner id and iq current control loops, Figure 2 shows the implementation in Matlab/Simulink, noting that the current reference idref is set to 0 for the maximization of the electromagnetic torque Te.
Usually, the controllers of the two inner current control loops and the controller of the outer PMSM rotor speed control loop are of PI type. Below the numerical simulations are presented for the control system of a PMSM, with nominal parameters as given in Table 1. Usually, the controllers of the two inner current control loops and the controller of the outer PMSM rotor speed control loop are of PI type.
Below the numerical simulations are presented for the control system of a PMSM, with nominal parameters as given in Table 1. Figure 3 shows the evolution of the parameters of interest (rotor speed noted with ω, electromagnetic and load torques noted with T e and T L , stator currents noted with i a , i b , i c , and d-q frame currents noted with i d and i q ) of the PMSM control system based on the classic FOC control structure with PI-type controllers, following the numerical simulations by applying two-step signals for the speed reference ω ref = [800, 1200] rpm and a load torque T L of 0.5 Nm. It can be noted that the PMSM control system demonstrates good performance.  Figure 3 shows the evolution of the parameters of interest (rotor speed noted with ω, electromagnetic and load torques noted with Te and TL, stator currents noted with ia, ib, ic, and d-q frame currents noted with id and iq) of the PMSM control system based on the classic FOC control structure with PI-type controllers, following the numerical simulations by applying two-step signals for the speed reference ωref = [800, 1200] rpm and a load torque TL of 0.5 Nm. It can be noted that the PMSM control system demonstrates good performance.           In the case of the PMSM control, it can be noted that a number of its parameters may vary. These include stator resistance R s , stator inductances L d and L q , but also combined inertia of PMSM rotor and load J.
Thus, using the notions described in Section 3 for switched systems, it is possible to achieve a qualitative study on the behavior of the PMSM control system in case of parametric variation.
Thus, Figure 9 shows the general block diagram for PMSM control system based on FOC-type strategy and switched systems.
The parametric structure of the PMSM is considered to change over time, and the time points at which these changes occur are correlated with an external signal called the switching signal.
Thus, Figures 10 and 11 show the Matlab/Simulink implementation for PMSM control system based on FOC-type strategy for PMSM variable structure with switching signal type 1.  In the case of the PMSM control, it can be noted that a number of its parameters may vary. These include stator resistance Rs, stator inductances Ld and Lq, but also combined inertia of PMSM rotor and load J.
Thus, using the notions described in Section 3 for switched systems, it is possible to achieve a qualitative study on the behavior of the PMSM control system in case of parametric variation.
Thus, Figure 9 shows the general block diagram for PMSM control system based on FOC-type strategy and switched systems.
The parametric structure of the PMSM is considered to change over time, and the time points at which these changes occur are correlated with an external signal called the switching signal.
Thus, Figures 10 and 11 show the Matlab/Simulink implementation for PMSM control system based on FOC-type strategy for PMSM variable structure with switching signal type 1.  In the case of the PMSM control, it can be noted that a number of its parameters may vary. These include stator resistance Rs, stator inductances Ld and Lq, but also combined inertia of PMSM rotor and load J.
Thus, using the notions described in Section 3 for switched systems, it is possible to achieve a qualitative study on the behavior of the PMSM control system in case of parametric variation.
Thus, Figure 9 shows the general block diagram for PMSM control system based on FOC-type strategy and switched systems.
The parametric structure of the PMSM is considered to change over time, and the time points at which these changes occur are correlated with an external signal called the switching signal.
Thus, Figures 10 and 11 show the Matlab/Simulink implementation for PMSM control system based on FOC-type strategy for PMSM variable structure with switching signal type 1.         . Switching signal type 1. Figure 11. Switching signal type 1.
It is considered that the variation of the PMSM parameters corresponds to that shown in Table 2. For the verification of Lyapunov-Metzler inequalities, Figure 12 shows the diagram of a program implemented in Matlab using the YALMIP toolbox. For the verification of Lyapunov-Metzler inequalities, Figure 12 shows the diagram of a program implemented in Matlab using the YALMIP toolbox. Using the Matlab environment and YALMIP toolbox, the matrices P1 and P2 containing the solution to the system are obtained as follows: Using the Matlab environment and YALMIP toolbox, the matrices P 1 and P 2 containing the solution to the system are obtained as follows: The Matlab program shown in Figure 13 is used to calculate the dwell time. A dwell time T = 1.1 ms is obtained.
This is used to demonstrate that in terms of the PMSM control switched systems, system stability is ensured if switching between systems is performed at time intervals at least equal to the dwell time of 1.1 ms.
Using Matlab/Simulink, numerical simulations are presented in Figure 14 The Matlab program shown in Figure 13 is used to calculate the dwell time. A dwell time T = 1.1 ms is obtained. This is used to demonstrate that in terms of the PMSM control switched systems, system stability is ensured if switching between systems is performed at time intervals at least equal to the dwell time of 1.1 ms.  Furthermore, Figures 15-17 show the evolution of the states of the PMSM control switched systems (ω, iq, id) in the form of the phase plane for their corresponding combinations. In addition, for two successive PMSM reference speed steps, Figures 18 and 19 show the evolution in the state plane for the PMSM control switched systems. It can be noted that the steady-state conditions are achieved after a relatively fast transient regime and damped oscillations. Furthermore, Figures 15-17 show the evolution of the states of the PMSM control switched systems (ω, i q , i d ) in the form of the phase plane for their corresponding combinations. In addition, for two successive PMSM reference speed steps, Figures 18 and 19 show the evolution in the state plane for the PMSM control switched systems. It can be noted that the steady-state conditions are achieved after a relatively fast transient regime and damped oscillations. Figure 14. Time evolution parameters for PMSM control system based on FOC-type strategy for PMSM variable structure with switching signal type 1, ωref = [800, 1200] rpm, and TL = 0.5 Nm.
Furthermore, Figures 15-17 show the evolution of the states of the PMSM control switched systems (ω, iq, id) in the form of the phase plane for their corresponding combinations. In addition, for two successive PMSM reference speed steps, Figures 18 and 19 show the evolution in the state plane for the PMSM control switched systems. It can be noted that the steady-state conditions are achieved after a relatively fast transient regime and damped oscillations.         Next, it is considered that the variation of the PMSM parameters corresponds to that shown in Table 3.  Figure 20 presents the Simulink implementation for control switched systems of PMSM based on FOC-type strategy for variable structure with switching signal type 2. The Stateflow Matlab implementation detail for PMSM variable structure used for parameter selection from debug, analysis and time evolution subsystem from Figure 20 is presented in Figure 21.
The evolution of the switching signal type 2 is presented in Figure 22. Next, it is considered that the variation of the PMSM parameters corresponds to that shown in Table 3.  Figure 20 presents the Simulink implementation for control switched systems of PMSM based on FOC-type strategy for variable structure with switching signal type 2. The Stateflow Matlab implementation detail for PMSM variable structure used for parameter selection from debug, analysis and time evolution subsystem from Figure 20 is presented in Figure 21.   For the verification of Lyapunov-Metzler inequalities, Figure 23 shows the diagram of a program implemented in Matlab using the YALMIP toolbox. The evolution of the switching signal type 2 is presented in Figure 22.  For the verification of Lyapunov-Metzler inequalities, Figure 23 shows the diagram of a program implemented in Matlab using the YALMIP toolbox.  For the verification of Lyapunov-Metzler inequalities, Figure 23 shows the diagram of a program implemented in Matlab using the YALMIP toolbox. Using the Matlab environment and YALMIP toolbox, the matrices P1, P2, P3, and P4 containing the solution to the system are obtained as follows: Using the Matlab environment and YALMIP toolbox, the matrices P 1 , P 2 , P 3 , and P 4 containing the solution to the system are obtained as follows: Moreover, for this variable structure with switching signal 2, the Matlab program shown in Figure 24 is also used to calculate the dwell time. Moreover, for this variable structure with switching signal 2, the Matlab prog shown in Figure 24 is also used to calculate the dwell time.
The dwell time T = 1.1 ms. This have been used to demonstrate that, in terms o PMSM control switched systems (variable structure type 2), system stability is ensur switching between systems is performed at time intervals at least equal to the dwell of 1.1 ms.  The dwell time T = 1.1 ms. This have been used to demonstrate that, in terms of the PMSM control switched systems (variable structure type 2), system stability is ensured if switching between systems is performed at time intervals at least equal to the dwell time of 1.1 ms.
The time evolution for PMSM control system based on FOC-type strategy for PMSM variable structure with switching signal type 2, ω ref = [800, 1200] rpm, and T L = 0.5 Nm is presented in Figure 25.
Automation 2022, 3, FOR PEER REVIEW 22 The time evolution for PMSM control system based on FOC-type strategy for PMSM variable structure with switching signal type 2, ωref = [800, 1200] rpm, and TL = 0.5 Nm is presented in Figure 25.   It can be noted that the steady-state conditions are achieved after a relatively fast transient regime and damped oscillations.
Moreover, as in the case of variable structure and switching signal type 1, compared to the evolution of the states for the PMSM control system where the parameters remain constant (case presented at the beginning of Section 4), slight additional oscillations are noted due to the switching between the various parametric structures of the PMSM, preserving stability and overall performance without affecting the qualitative picture of the evolution of the system given by the state space.
In synthesis in this section, three examples are considered: the model of a PMSM controlled with FOC, the model of a PMSM in which the parametric variations contribute to the definition of two PMSM models, and the model of a PMSM in which the parametric variations contribute to the definition of four PMSM models. After calculating the dwell time and checking the Lyapunov-Metzler inequalities, the conclusion of PMSM stability can be drawn using switched systems theory. On the other hand, just to confirm the results obtained using the FOC strategy, the state space portraits are presented for the qualitative analysis of the system's behavior, confirming the stability and parametric robustness of the system. For two successive reference speed steps of PMSM ωref = [800, 1200] rpm, Figures 32  and 33 show the evolution in the state plane for the PMSM control switched systems with variable structure and switching signal type 2.
It can be noted that the steady-state conditions are achieved after a relatively fast transient regime and damped oscillations.                  Moreover, as in the case of variable structure and switching signal type 1, compared to the evolution of the states for the PMSM control system where the parameters remain constant (case presented at the beginning of Section 4), slight additional oscillations are noted due to the switching between the various parametric structures of the PMSM, preserving stability and overall performance without affecting the qualitative picture of the evolution of the system given by the state space. According to Example 2 in Section 3, it is proven once again that local stability does not imply global stability, in the sense that although each subsystem is stable, the evolution of the entire switched systems can be unstable. This means that although using the classic methods of stability analysis mentioned above, each subsystem is stable, but the mode of transition between these systems is not taken into consideration, thus implying that the switched systems could be unstable. This discrepancy in the analysis of the stability of the switched systems is resolved by specific means, namely by introducing the notion of dwell time and solving the Lyapunov-Metzler type inequalities.
It can be concluded that, by using the switched systems theory in the presented example of PMSM control, the FOC control strategy is a control strategy that ensures parametric robustness, in the sense that in case of significant variations of the parameters in the PMSM structure, the overall performance of the control system is preserved both qualitatively and quantitatively.

Conclusions
Usually, the parameters of a PMSM vary over time, and the study of the parametric robustness of the PMSM control systems becomes an important step in the chain of control system design. Using switched-systems theory, elements have been presented regarding the demonstration of the stability of switched systems by solving Lyapunov-Metzler inequalities, where the switching signal frequency is lower than the switching frequency given by the dwell time. An algorithm for calculating the dwell time has also been defined and presented. Numerical simulations performed in Simulink validate the fact that, for parametric variations of the PMSM structure, the PMSM control switched systems preserve the qualitative performance in terms of its control. A series of Matlab programs based on the YALMIP toolbox for obtaining Pi matrices and dwell time are presented to demonstrate the stability and performance of the PMSM control switched systems. In this paper, the stability demonstration was achieved using elements of the switched systems theory, while the PMSM control structure was a predefined FOC structure. In future papers, we will propose the implementation of control laws whose synthesis is derived from specific elements of the switched-systems theory. Moreover, one of our directions of research will involve the study of approximate controllability of fractional integrodifferential equations using resolvent operators [35].