**7. Simulation results**

206 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 1

Small search step Big search step

**Figure 9.** Features of the algorithm, depending on the search step value

**Figure 10.** Explanation of the equation (15) parameters

value) is saved. In the procedure a dimension of search area (a range of randomly change of coefficient values) must be determined at each step. In the presented solution a wide area was assumed at the beginning of optimization process for fast quality index reduction and next at the final stage its dimension was reduced to achieve better accuracy. As a result of such *off-line* optimization a set of optimal values of corrector coefficients is found for the analyzed point of operation. If the speed is changed in a wide range, the modifying of the parameter set is needed. This procedure depends on search parameters, may be fast and insensitive to the local minimum of the optimized criterion. The optimization procedure may be performed *off-line* by simulating a transient process. The optimization procedure The model of the PMSM control system was carried out in MATLAB Simulink ® environment. The motor was modeled with ordinary simplifying assumptions such as constant resistance and inductance in stator windings, symmetry of windings, and isotropic properties of motor (3, 4, 5). The motor model was connected with a model of a control system, which includes a vector control system of stator currents, a speed controller and a model of the analyzed observer (Figure 1). Drive model contains also a *d-*axis current control loop because even that current value is considered during sensorless mode operation.

The model of the observer was used as an element of feedback sending detected signals of rotor position and speed. The motor model was calculated with a very small step of integration, which simulates its continuous character. The step value was within the range of 0.0220 s, depending on the simplification level of the inverter model. To reduce simulation time, the inverter may be neglected and calculation step 20 s may be used. Contrary to that, the model of the control system with the observer was calculated with much higher step values (50200 s), simply because it enables a better simulation of how the control system works on a signal processor with a real value of the sampling period. Presented waveforms are achieved for observer's parameter settings prepared for reference speed 5 rad/s.

Selected waveforms of speed, currents and position error are presented below. These images well illustrate the operation of observer compared with sensor mode. These waveforms were obtained as responses to the step change of speed reference, generated in the form of a step sequence starting from zero speed to 10 rad/s and to 5 rad/s at time 0.1 s. Motor load changes from zero to motor's nominal load value at time 0.16 s. In addition, figures 11 and 12 show ±2 % range of reference value. Waveform 11 and 12 prove the well performance of sensorless mode drive at low speed – even at 5 rad/s. That drive still remains robustness on disturbance (rapid reference speed and load change). Enlarged part of figure 11 (Fig. 12) shows clearly the setpoint achieving process. Figures 13 and 14 show waveforms of currents in *q-*axis and *d-*axis respectively obtained for test such as at figure 11. One can notice the *d-*axis current value in sensorless mode isn't close zero at transients – it is determined by temporary ripple in position estimation signal but the ripple quickly fades away. Figure 15 shows waveforms of the calculated position error (observer estimates only sine and cosine of the position). The steady state position error does not depend on motor load (which is seen at time 0.1÷0.2 s of that figure) but the operating point (determined as a motor speed). Presented in figure 16 sine and cosine of the estimated position waveforms proves that observer operates well at longer simulating time. Figures 17 and 18 present drive performance for additional difficulty: disruption of the "measured" phase currents by injection of the random signal. Reliable performance is considered even for such disturbance. Then observer was tested to determine its robust on inaccurate estimation of the motor parameters. Results are shown in figure 19 and table 1. For such system the parameters lower deviation range is about ±10 %. Motor parameters were stationary, only the observer's parameters were changed with factors presented below. Certain robust on inaccuracy parameter estimation is noticed.

**Figure 11.** Waveforms of real and estimated speed involved by step changes of reference 0→10→5 rad/s

at t=0.16 s load changes from 0 to its nominal value

**Figure 11.** Waveforms of real and estimated speed involved by step changes of reference

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2

Time [s]

Speed waveforms of the PMSM ref=0 10 5 rad/s

real speed with sensor real speed without sensor reference speed reference speed +2% reference speed -2%

inaccuracy parameter estimation is noticed.

at t=0.16 s load changes from 0 to its nominal value

0

2

4

6

8

Speed [rad/s]

10

12

14

16

0→10→5 rad/s

sensorless mode drive at low speed – even at 5 rad/s. That drive still remains robustness on disturbance (rapid reference speed and load change). Enlarged part of figure 11 (Fig. 12) shows clearly the setpoint achieving process. Figures 13 and 14 show waveforms of currents in *q-*axis and *d-*axis respectively obtained for test such as at figure 11. One can notice the *d-*axis current value in sensorless mode isn't close zero at transients – it is determined by temporary ripple in position estimation signal but the ripple quickly fades away. Figure 15 shows waveforms of the calculated position error (observer estimates only sine and cosine of the position). The steady state position error does not depend on motor load (which is seen at time 0.1÷0.2 s of that figure) but the operating point (determined as a motor speed). Presented in figure 16 sine and cosine of the estimated position waveforms proves that observer operates well at longer simulating time. Figures 17 and 18 present drive performance for additional difficulty: disruption of the "measured" phase currents by injection of the random signal. Reliable performance is considered even for such disturbance. Then observer was tested to determine its robust on inaccurate estimation of the motor parameters. Results are shown in figure 19 and table 1. For such system the parameters lower deviation range is about ±10 %. Motor parameters were stationary, only the observer's parameters were changed with factors presented below. Certain robust on

**Figure 12.** Waveforms of real and estimated speed involved by step change of reference 0→10 rad/s – enlarged part of fig. 11.

Currents waveforms of the PMSM ref=0 10 5 rad/s

**Figure 13.** Waveforms of *q-*axis current in sensor and sensorless mode; step changes of reference speed 0→10→5 rad/s as shown in fig. 11. At t=0.16 s load changes from 0 to its nominal value

**Figure 14.** Waveforms of *d-*axis current in sensor and sensorless mode; step changes of reference speed 0→10→5 rad/s as shown in fig. 11. At t=0.16 s load changes from 0 to its nominal value

Sensorless mode position error ref=0 10 5 rad/s

**Figure 15.** Waveform of position estimation error involved by step changes of reference speed 0→10→5 rad/s as shown in fig. 11

at t=0.16 s load changes from 0 to its nominal value

Currents waveforms of the PMSM ref=0 10 5 rad/s

d axis current with sensor d axis current without sensor

position estimation error

**Figure 14.** Waveforms of *d-*axis current in sensor and sensorless mode; step changes of reference speed

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2

Time [s]

Sensorless mode position error ref=0 10 5 rad/s

0→10→5 rad/s as shown in fig. 11. At t=0.16 s load changes from 0 to its nominal value

**Figure 15.** Waveform of position estimation error involved by step changes of reference speed

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2

Time [s]

0→10→5 rad/s as shown in fig. 11





0

Position error []

0.5

1

1.5

2




0

Current [A]

2

4

6

at t=0.16 s load changes from 0 to its nominal value

**Figure 16.** Waveforms of sine and cosine of the estimated and real position at reference speed 5 rad/ at steady state

Phase currents waveforms of the PMSM ref=5 rad/s with noise at phase currents

**Figure 17.** Waveforms of phase currents in sensorless mode for reference speed 5 rad/s with "measuring" noise at phase currents

**Figure 18.** Waveforms of sine and cosine of the estimated and real position at reference speed 5 rad/s at steady state with "measuring" noise at phase currents as shown in fig. 17


**Table 1.** Position error according to motor parameter inaccuracy

The final test was prepared to determine the robustness to the incorrect estimate of the initial position. The question was how big may be position difference between estimated and the real one, to prevent the motor startup. Tests have shown, that the possible range of the initial position error, for which the engine will start correctly, it is 80 degrees of arc (Fig. 24). Figures 20-23 show the sine and cosine waveforms of the estimated and the real shaft position. Corresponding to sine and cosine waveforms from figures 20-23, figure 24 shows the "measured" speed waveforms. The robustness on initial position error estimation is proven.

**Figure 19.** Position error [ ° ] according to motor parameter inaccuracy

**Figure 18.** Waveforms of sine and cosine of the estimated and real position at reference speed 5 rad/s at

3 3.2 3.4 3.6 3.8 4 4.2 4.4 4.6 4.8

Time [s]

Sine and cosine of the shaft position ref=5 rad/s with noise at phase currents

unloaded 5 rad/s

unloaded 10 rad/s

sin( real) cos( real) sin( est.) cos( est.)

*In observer* Position error [°]

5 rad/s

1 1 0.08 0.08 0.5 1.2 1 0.1 0.1 0.5 0.9 1 0.06 0.08 0.5 1 0.91 -0.2 0.05 0.5 1.1 0.91 -0.2 0.06 0.5

The final test was prepared to determine the robustness to the incorrect estimate of the initial position. The question was how big may be position difference between estimated and the real one, to prevent the motor startup. Tests have shown, that the possible range of the initial position error, for which the engine will start correctly, it is 80 degrees of arc (Fig. 24). Figures 20-23 show the sine and cosine waveforms of the estimated and the real shaft position. Corresponding to sine and cosine waveforms from figures 20-23, figure 24 shows the "measured" speed waveforms. The robustness on initial position error estimation is

steady state with "measuring" noise at phase currents as shown in fig. 17



0

[-]

0.2 0.4 0.6 0.8 1

R factor L factor loaded

**Table 1.** Position error according to motor parameter inaccuracy

proven.

**Figure 20.** Waveforms of sine and cosine of the estimated and real position at reference speed 10 rad/s during startup – shaft initial position equal the estimated one

**Figure 21.** Waveforms of sine and cosine of the estimated and real position at reference speed 10 rad/s during startup – shaft initial position different than estimated one: 30 °

**Figure 22.** Waveforms of sine and cosine of the estimated and real position at reference speed 10 rad/s during startup – shaft initial position different than estimated one: 60 °

sine and cosine of the shaft position ref=10 rad/s - initial position 30 [deg]

sin( real) cos( real) sin( est.) cos( est.)

sin( real) cos( real) sin( est.) cos( est.)

**Figure 21.** Waveforms of sine and cosine of the estimated and real position at reference speed 10 rad/s

0 0.005 0.01 0.015 0.02 0.025 0.03

Time [s]

sine and cosine of the shaft position ref=10 rad/s - initial position 60 [deg]

**Figure 22.** Waveforms of sine and cosine of the estimated and real position at reference speed 10 rad/s

0 0.005 0.01 0.015 0.02 0.025 0.03

Time [s]

during startup – shaft initial position different than estimated one: 30 °




0

0.2

[-]

0.4

0.6

0.8

1


0

0.2

[-]

0.4

0.6

0.8

1

during startup – shaft initial position different than estimated one: 60 °

**Figure 23.** Waveforms of sine and cosine of the estimated and real position at reference speed 10 rad/s during startup – shaft initial position different than estimated one: 80 °

**Figure 24.** Robustness to the incorrect estimate of initial position during startup – speed waveforms for 0→±80 ° position variance
