You are on page 1of 54

VYSOK UEN TECHNICK V BRN

BRNO UNIVERSITY OF TECHNOLOGY

FAKULTA ELEKTROTECHNIKY A KOMUNIKANCH TECHNOLOGI STAV AUTOMATIZACE A MIC TECHNIKY


FACULTY OF ELECTRICAL ENGINEERING AND COMMUNICATION DEPARTMENT OF CONTROL AND INSTRUMENTATION

SIMULACE POHONU SE SYNCHRONNM MOTOREM S OVENM NA RELNM SYSTMU


SIMULATION OF A DRIVE WITH SYNCHRONOUS MACHINE AND ITS EVALUATION USING A REAL SYSTEM

DIPLOMOV PRCE
MASTERS THESIS

AUTOR PRCE
AUTHOR

Bc. JOSEF TKADLEC doc. Ing. PAVEL VCLAVEK, Ph.D.

VEDOUC PRCE
SUPERVISOR BRNO 2013

VYSOK UEN TECHNICK V BRN Fakulta elektrotechniky a komunikanch technologi stav automatizace a mic techniky

Diplomov prce
magistersk navazujc studijn obor Kybernetika, automatizace a men Student: Ronk: NZEV TMATU: Bc. Josef Tkadlec 2 ID: 115295 Akademick rok: 2012/2013

Simulace pohonu se synchronnm motorem s ovenm na relnm systmu


POKYNY PRO VYPRACOVN: Vytvote model pro realistickou simulaci "PMSM FOC - speed control with sensor" s pouitm average modelu mnie. Popite klov parametry motoru a mnie a jejich zskn. Ovte vytvoenou simulaci na relnm systmu PMSM mnie se zt. Vyhodnote aspekty a parametry, kter ovlivuj pesnost simulace vzhledem k relnmu systmu. Zamte se zejmna na vlastnosti jednotlivch numerickch metod a kroku vpotu na kvalitu simulanch vsledk a vpoetn nronost. DOPORUEN LITERATURA: [1] Caha, Z.; ern, M. : Elektrick pohony, Praha, SNTL 1990. dal dle pokyn vedoucho a konzultanta Termn zadn: 11.2.2013 Termn odevzdn: 20.5.2013

Vedouc prce: doc. Ing. Pavel Vclavek, Ph.D. Konzultanti diplomov prce: Ing. Radim Viinka

doc. Ing. Vclav Jirsk, CSc. Pedseda oborov rady

UPOZORNN:
Autor diplomov prce nesm pi vytven diplomov prce poruit autorsk prva tetch osob, zejmna nesm zasahovat nedovolenm zpsobem do cizch autorskch prv osobnostnch a mus si bt pln vdom nsledk poruen ustanoven 11 a nsledujcch autorskho zkona . 121/2000 Sb., vetn monch trestnprvnch dsledk vyplvajcch z ustanoven sti druh, hlavy VI. dl 4 Trestnho zkonku .40/2009 Sb.

Abstrakt
Prce se zabv modelovnm PMSM, jeho parametry a jejich zskvnm. Dle je v prci popsn model mnie berouc v potaz dead-time efekt. Tyto modely jsou implementovny spolen s dalmi bloky v prosted Matlab/Simulink a dohromady tvo knihovnu pro vektorov zen motor FSL_MC_TOOL. Soust prce je tak men a identifikace parametr skutenho PMSM. Dle byly vytvoeny pklady simulac, v nich je pouit motor s tmito parametry a vyhodnocena pesnost simulace. Tmto jsou simulace oveny na relnm systmu.

Klov slova
PMSM, tfzov mni, FOC, Matlab/Simulink, identifikace

Abstract
The thesis deals with modeling of PMSM, its parameters and their measurement. In addition there is described a model of inverter taking into account a dead-time effect. These models are implemented with other blocks in Matlab/Simulink and together form library for FOC called FSL_MC_TOOL. Another part of the thesis is dedicated to parameters of a real PMSM measurement and identification. These parameters are used in example simulations in order to check the simulations and evaluate simulation accuracy.

Keywords
PMSM, 3-phase inverter, FOC, Matlab/Simulink, identification

Bibliographic reference:
TKADLEC, J. Simulace pohonu se synchronnm motorem s ovenm na relnm systmu. Brno: Vysok uen technick v Brn, Fakulta elektrotechniky a komunikanch technologi, 2013. 54s. Vedouc diplomov prce byl doc. Ing. Pavel Vclavek, Ph.D.

Prohlen
Prohlauji, e svou diplomovou prci na tma Simulace pohonu se synchronnm motorem s ovenm na relnm systmu jsem vypracoval samostatn pod vedenm vedoucho diplomov prce a s pouitm odborn literatury a dalch informanch zdroj, kter jsou vechny citovny v prci a uvedeny v seznamu literatury na konci prce. Jako autor uveden diplomov prce dle prohlauji, e v souvislosti s vytvoenm tto diplomov prce jsem neporuil autorsk prva tetch osob, zejmna jsem nezashl nedovolenm zpsobem do cizch autorskch prv osobnostnch a jsem si pln vdom nsledk poruen ustanoven 11 a nsledujcch autorskho zkona . 121/2000 Sb., vetn monch trestnprvnch dsledk vyplvajcch z ustanoven sti druh, hlavy VI. dl 4 Trestnho zkonku . 40/2009 Sb.

V Brn dne: 20. kvtna 2013

podpis autora

Podkovn

Dkuji vedoucmu diplomov prce doc. Ing. Pavlu Vclavkovi, Ph.D za innou metodickou, pedagogickou a odbornou pomoc a dal cenn rady pi zpracovn m diplomov prce. Chci tak podkovat firm Freescale Polovodie esk Republika, s.r.o. za poskytnut vybaven a monost men v jejich laboraroi. Dle chci podkovat konzultantm z Freescale Polovodie esk Republika, s.r.o. Ing. Radimu Viinkovi, Ph.D. za konzultace a Ing. Viktoru Bobekovi, Ph.D. za pomoc s menm a dal cenn rady.

V Brn dne: 20. kvtna 2013

podpis autora

Contents
1 2 Introduction ........................................................................................................................ 13 Field Oriented Control (FOC) ............................................................................................ 14 2.1 Coordinate transformations ......................................................................................... 14 Clarkes transformation ....................................................................................... 14 Modified Clarkes transformation ....................................................................... 15 Parks transformation .......................................................................................... 15

2.1.1 2.1.2 2.1.3 2.2 2.3 3

Block diagram of FOC ................................................................................................ 16 Space Vector Modulation (SVM) ............................................................................... 17

Mathematical model of PMSM .......................................................................................... 19 3.1 3.2 3.3 3.4 Conditions and assumptions ........................................................................................ 19 Mathematical model in d-q frame ............................................................................... 20 Simulink PMSM model............................................................................................... 21 PMSM electrical parameters measurement ................................................................. 23 RS, pp and PM measurement .............................................................................. 23 Ld, Lq measurement[7] ........................................................................................ 25 Measured parameters .......................................................................................... 26

3.4.1 3.4.2 3.4.3 4

Model of Inverter................................................................................................................ 28 4.1 4.2 4.3 Dead-time effect in PWM inverters ............................................................................ 28 Average model of inverter in Simulink ....................................................................... 29 Measured model of inverter in Simulink..................................................................... 30 PMSM without middle terminal led out .............................................................. 31 PMSM with middle terminal led out ................................................................... 32

4.3.1 4.3.2 5

Identification ...................................................................................................................... 35 5.1 5.2 RS, Ld, identification .................................................................................................... 36 J and F identification ................................................................................................... 37

Simulations ......................................................................................................................... 40 6.1 6.2 FSL_MC_TOOL library ............................................................................................. 40 Simulations.................................................................................................................. 41

Simulation accuracy and performance evaluation .............................................................. 46 7.1 Integration methods ..................................................................................................... 46 Eulers method .................................................................................................... 46 Higher order Runge-Kutta methods .................................................................... 47

7.1.1 7.1.2 7.2

Performance evaluation ............................................................................................... 47

Conclusion .......................................................................................................................... 49

List of figures
Fig. 2-1 Carke's transformation axes distribution ....................................................................... 14 Fig. 2-2 Park's transformation ..................................................................................................... 16 Fig. 2-3 Block diagram of FOC [4] ............................................................................................. 17 Fig. 2-4 Sinusoidal modulation [4] ............................................................................................. 18 Fig. 2-5 Standart Space Vector Modulation [4] .......................................................................... 18 Fig. 3-1 PMSM scheme in Simulink ........................................................................................... 22 Fig. 3-2 Simulink PMSM model ................................................................................................. 23 Fig. 3-3 PMSM dialog box ......................................................................................................... 23 Fig. 3-4 RS measurement circuit ................................................................................................. 24 Fig. 3-5 pp measurement circuit.................................................................................................. 24 Fig. 3-6 BackEMF measurement ................................................................................................ 24 Fig. 3-7 BackEMF measurement courses ................................................................................... 25 Fig. 3-8 d-axis alignment ............................................................................................................ 25 Fig. 3-9 q-axis alignment ............................................................................................................ 25 Fig. 3-10 AC measurement circuit .............................................................................................. 26 Fig. 3-11 AC measurement characteristics ................................................................................. 26 Fig. 3-12 Ld dependency on IDC .................................................................................................. 26 Fig. 3-13 Lq dependency on IDC .................................................................................................. 27 Fig. 4-1 Electric scheme of a 3-phase inverter + motor .............................................................. 28 Fig. 4-2 PWM drive signals with dead-time[8]........................................................................... 29 Fig. 4-3 Dead-time effect on output voltage[8]........................................................................... 29 Fig. 4-4 Inverter transfer characteristic ....................................................................................... 30 Fig. 4-5 Inverter transfer characteristic measurement circuit...................................................... 31 Fig. 4-6 Inverter trasfer characteristic neglected Um ................................................................... 32 Fig. 4-7 Transfer characteristic measurement block diagram ..................................................... 33 Fig. 4-8 Waveforms snapshot ..................................................................................................... 33 Fig. 4-9 Inverter transfer characteristic with Um taken into account ........................................... 34 Fig. 5-1 Identification process..................................................................................................... 35 Fig. 5-2 Step response for 2,5V step ........................................................................................... 36 Fig. 5-3 Step response for 20V step ............................................................................................ 36 Fig. 5-4 RS identified................................................................................................................... 37 Fig. 5-5 Ld identified ................................................................................................................... 37 Fig. 5-6 J and F identification workplace.................................................................................... 37

Fig. 5-7 Comparison of measured and simulated id, iq and wr (inverter neglected) .................... 38 Fig. 5-8 Comparison of measured and simulated id, iq and wr (inverter included) ...................... 39 Fig. 6-1 FSL_MC_TOOL library structure ................................................................................. 40 Fig. 6-2 r during motor start-up ................................................................................................ 42 Fig. 6-3 id, iq during motor start-up ............................................................................................ 43 Fig. 6-4 UDC-bus, SVM output and inverter output voltages during motor start-up ...................... 44 Fig. 6-5 UDC-bus, SVM output and inverter output voltages during motor start-up zoomed ........ 45 Fig. 7-1 Profile report example ................................................................................................... 48

10

List of symbols and acronyms


AC BackEMF Alternating current Back Electromotive Force angle between two phases (120) DC Direct Current friction FOC Field Oriented Control phase currents currents in - frame currents in d-q frame peek-peek value of a sinusoidal current inertia motor inductances in d-q frame torque produced by motor torque load MSE ODE PM PMSM Mean Square Error Ordinary Differential Equation Permanent Magnets Permanent Magnet Synchronous motor number of pole pairs stator resistance period of a sinusoidal signal electrical position of a rotor torque load phase shift between sinusoidal signals phase voltages voltages on output terminals of inverter, in case of etc. stator voltages in d-q frame DC_bus voltage error voltage caused by inverter = 0,

11

voltage of middle terminal against DCbus/2 peek-peek value of a sinusoidal voltage inverter output voltage required by application stator magnetic flux linkages stator magnetic flux linkages in d-q frame magnetic flux of the permanent magnets electrical speed of a rotor mechanical speed of a rotor

12

1 INTRODUCTION
In last few years Permanent Magnet Synchronous Motors (PMSM) are becoming very popular thanks to their advantages. The greatest advantage of PMSM is its efficiency compared to Induction Motors. In addition PMSMs dont require any brush maintenance unlike conventional brushed motors, they have a compact structure, rotor has lower inertia which makes the response faster, etc. Due to these advantages, PMSM can perform at high demanding applications. [1] Despite the advantages, they are quite expansive due to high price of rare-earth permanent magnets (PM). This thesis describes a PMSM model, its parameters and their measurement. Since some of the parameters are difficult to measure, there is a Matlab script which identifies these parameters using the PMSM model. As a practical part of the thesis the model of PMSM was created in Simulink and parameters of a real PMSM TGT3-01030-560 manufactured by TG drives were measured and identified. All measurements were done at Freescale Polovodie in Ronov p. R. Inseparable part of each drive is inverter. Inverters introduce an unwanted dead-time effect to protect themselves. This affect is also described in the thesis and model of inverter wchich takes the dead-time effect into account is implemented in Matlab/Simulink. There are also mentioned basic principles of Field Oriented Control (FOC) which is a new approach of AC drives control and allows separate control of torque and magnetic field. Based on the measured parameters continuous and discrete simulations of FOC have been done in Matlab/Simulink. All previous work results into a FSL_MC_TOOL simulink library which gathers blocks such as PMSM model, coordinate transformations, etc. used in FOC of PMSM. Final part of the thesis deals with accuracy versus perfomance evaluation of the simulations. It focuses mainly on various integration method and simulation step sizes.

13

2 FIELD ORIENTED CONTROL (FOC)


The basic idea of FOC is a distribution of a stator current vector into two orthogonal parts rotating in a coordinate system along the rotor. First part of the stator current vector ( ) together with magnetic flux of PM ( ) creates torque and the second part of the stator current vector ( ) together with determines magnetization of the machine. This implies that the FOC allows us to control torque and magnetization of the motor separately.[2] However the FOC requires an accurate information about rotor position. The rotor position can be obtained from encoder (FOC with sensor) or estimated (sensorless FOC). Whole thesis deals only with the FOC with sensor.

2.1 Coordinate transformations 2.1.1 Clarkes transformation


Clarkes transformation is a projection that modifies stator coordinate system from 3-phase stationary frame to 2-phase orthogonal stationary frame and vice versa. Fig. 2-1 illustrates distribution of abc axes in 3-phase and axes in 2-phase stationary coordinate system. Neglecting one of the three phases can be done only in a balanced system. We assume PMSM which has its stator windings connected in star and the middle terminal is not led out. In addition resistance and inductance of each phase are equal. Then the PMSM is a balanced system i.e. satisfies conditions in (2.1).
B

C
Fig. 2-1 Carke's transformation axes distribution

( ) ( ) ( )

( ) ( ) ( )

( ) ( ) ( ) (2.1)

14

where are stator currents, are stator voltages and are magnetic flux linkages of stator windings. From Fig. 2-1 we can derive a basic relation for the Forward Clarkes transformation (abc) which is in (2.2).[2] ( ) [ ] ( ) [ ( ) ( ) ( ( ( ) ) ( )] ][ ) ( )

(2.2)

where is angle between two phases ( transformation (abc) is described by (2.3).[2] ( ( [ ( ) )] ) [ ( ) ( )

). Then the Inverse Clarkes

( ) ( ) ][ ] ( ) ( )

(2.3)

2.1.2 Modified Clarkes transformation


Modified Clarkes transformation is more convenient because of practical reasons. Since ( ) and ( ) are constants, Forward Clarkes transformation can be rewritten using the substitution from (2.2) into the following form.[3] ( ) [ ] ( ) ( ) [ ( ) ( ) ] (2.4)

and modified Inverse Clarkes transformation [3] ( ) ( ) [ ( )] ( ) [ ( ) ( ) ( ) ( )] (2.5)

There are several ways how to rewrite the Clarkes transformation and sometimes the whole formula in (2.4) is multiplied by 2/3 due to preservation of a power of the 3-phase signal. At transformations in (2.4) and (2.5) amplitude of a signal is preserved because these transformation are used also in Freescale library [3].

2.1.3 Parks transformation


Parks transformation is a projection that modifies stator coordinate system from 2phase stationary frame to 2-phase orthogonal synchronous (rotating) frame and vice versa. The Parks transformation is used to transform stator stationary frame ( coordinates aligned with stator) to rotating frame (d-q coordinates aligned with rotor). Fig. 2-2 illustrates distribution of the axes in 2-phase stationary frame and d-q axes

15

in 2-phase synchronous frame. Angle is a deviation of the d-q frame against the frame (i.e. electrical position of the rotor). q

Fig. 2-2 Park's transformation

Forward Parks transformation ( -> d-q) is defined in equation [4]: [ ( ) ] ( ) [ ( ) ( ) ( ( ( ) ) ][ ] ( ) ) (2.6)

and Inverse Parks transformation (d-q -> )[4]: [ ( ) ] ( ) [ ( ( ) ) ( ) ( ) ][ ] ( ) ( ) (2.7)

2.2 Block diagram of FOC


Fig. 2-3 shows a block diagram of FOC.[4] Whole diagram consists of two main parts: 3-phase Power Stage (PS) which is supplied by DC-bus voltage and driven by 6 PWM signals (one signal per transistor). The PS drives a 3-phase PMSM. The PMSM is equipped with an incremental Encoder and an inbuilt Resolver. These two sensors give us information about rotor position and speed therefore its called FOC with sensors. The second part is usually a Digital Signal Controller (DSC) or Micro Controller Unit (MCU) which performs the FOC. Whole FOC can be done in 7 following steps: 1. Transform the measured 3-phase currents to 2-phase stationary frame using the Clarkes transformation. 2. Transform the currents from 2-phase stationary to rotating frame using the Parks transformation. In fact, this transforms an AC machine to DC machine 3. Perform control algorithms and calculate a control action in rotating frame. 4. Transform the control action from rotating to 2-phase stationary frame. 5. Perform a DC-bus ripple elimination algorithm if needed (this step is optional).

16

6. Transform the control action from 2-phase to 3-phase (e.g. using SVM algorithm). 7. Apply the 3-phase control action to 3-phase motor.
3-phase Power Stage U_DCbus

PMSM

Ia Ib Ic PWM MCU / DSC PWM


Duty cycle A Duty cycle B Duty cycle C

ADC U_DCbus U_comp

ADC

_mech req _mech

SVM Speed controller Iq_req Current q PI controller U_comp Uq Inv Park dq -> Current d PI controller Ud _el U U

DC-bus ripple compensation

Field Id_req weakening controller

Iq Park -> dq Id

I I Clarke abc ->

Ia Ib Ic

Fig. 2-3 Block diagram of FOC [4]

There are two control loops while controlling speed of an electric motor, speed and current control loop. The current control loop is subordinate to the speed control loop therefore dynamics of the speed controller has to be about 10x slower than dynamics of the current controller. Thus there are two sampling loops (fast and slow). The slow loop referring to speed control is displayed in yellow and the fast loop referring to current control and other algorithms is displayed in green in the block diagram.

2.3 Space Vector Modulation (SVM)


SVM is an algorithm which computes appropriate duty cycles for driving the 6 PS transistors from 2-phase control signals usually in frame. Its used for AC current creation in order to drive AC motors at varying speeds. [5]

Resolver

Encoder

17

In Sinusoidal modulation which uses the inverse Clarkes transformation amplitude of the first harmonic of the 3-phase driving signal (from PS to PMSM) is limited to half of a DC-bus voltage ( ). Main disadvantage of the Sinusoidal modulation is that Uph-ph (voltage between two phases) is lower than the although Uph-ph can be generated equal to the . From Fig. 2-4 is evident that Uph-ph is approximately equal to .
B Uph-ph

DC-bus

C
Fig. 2-4 Sinusoidal modulation [4]

Efficiency of the modulation can be improved by Standard SVM. Standart SVM is generated by shifting the 3-phase voltage system. The shifting voltage is the same for all three phases and it has a triangle course. Standart SVM output waveform for all three phases as well as the shifting voltage (green) are shown in Fig. 2-5. Due to the shifting voltage addition the rotating 3-phase system doesnt copy a circle but the blue shape shown in Fig. 2-5. Thanks to the Standart SVM the amplitude of the first harmonic is increased by 15% and Uph-ph is generated as high as the DC-bus voltage.
15% A
Fig. 2-5 Standart Space Vector Modulation [4]

Uph-ph = DC-bus

18

3 MATHEMATICAL MODEL OF PMSM


3.1 Conditions and assumptions
To make the PMSM model easier we will establish a few simplifications:[6] Inductances and resistances of all phases are equal Saturation is insignificantly low Induced electromagnetic field is sinusoidal Hysteresis and eddy currents are insignificantly low Motor is supplied by sine voltage with phase shift 120 degrees The motor is supplied by 3-phase sinusoidal voltage which is needed to create a rotating electromagnetic field [2] ( ( ( ) ) ) (3.1)

Instantaneous value of voltage in each phase can be also expressed as [2]:

(3.2)

are instantaneous stator voltage values, is a phase resistance, are instantaneous stator currents and are stator magnetic flux linkages of each phase. Electrical moment is evaluated according to (3.3), where is magnetic flux of permanent magnets and is number pole pairs. ( ( ) ( ) ( )) (3.3)

where

From (3.3) we can derive that FOC allows a fluent torque control without ripple while supplying by 3-phase sinusoidal current [4]. To build a complete model we also need an equation taking into account external (mechanical) quantities such as external torque load , friction of the rotor shaft and inertia of the whole rotating system . Then the total electric moment generated by the motor is calculated:

19

(3.4)

Conversion between electrical and mechanical speed is defined by number of pole pairs: (3.5)

3.2 Mathematical model in d-q frame


A PMSM model in d-q frame we will be based on equations (3.2) and Parks and Clarkes transformation. Based on these assumptions voltages in d-q frame are calculated as follows: (3.6)

where

are stator currents and stator flux linkages

are: (3.7)

where are stator inductances in d-q frame and is a magnetic flux of permanent magnets and this value is always constant. Substituting (3.7) into the (3.6) we will get the following matrix form of stator voltage equations [2][4]:

][ ]

(3.8)

Electrical moment based on magnetic fluxes is: [ Since usually or ( ) ] (3.9)

is regulated to be zero, (3.9) can be simplified: (3.10)

From (3.4),(3.8) and (3.10) we can write down final equations convenient for simulink implementation [4]:

20

( )

(3.11) (3.12) (3.13)

3.3 Simulink PMSM model


The mathematical model of PMSM has been implemented in the Simulink environment according to (3.11), (3.12) and (3.13). In order to allow user to perform simulations with a locked motor shaft the model motion equation has been enhanced to its final form in (3.14). ( where ( ( ))) (3.14)

is a logical value that indicates whether the rotor shaft is locked or not ( => locked). Programming scheme of the model is shown in Fig. 3-1. It is evident that the model is created in dq frame and input (output) quantities are simply transformed to (from) 3-phase (a,b,c) coordinates using the Clarkes and Parks transformations. There is an unbalanced Clarkes transformation used at the input because the input signal doesnt always have zero mean value (e.g. 0 - 100V). Mechanical position of the rotor Th_r is achieved by integrating the rotor speed w_r and then scaling between 0 2pi. The model is a part of the FSL_MC_TOOL library so its masked and its parameters are specified via dialog box in Fig. 3-3. Inputs to the model are 3-phase voltage Uabc and torque load ML. Outputs are mechanical speed of the rotor w_r, moment generated by motor Me, stator currents Iabc and actual mechanical position of the rotor Th_r.

21

Fig. 3-1 PMSM scheme in Simulink

22

Fig. 3-2 Simulink PMSM model

Fig. 3-3 PMSM dialog box

3.4 PMSM electrical parameters measurement


From Fig. 3-3 its obvious that there are 7 parameters to be measured to determine motor properties. These parameters can be divided into two groups (electrical and mechanical). By measurement its simple to obtain electrical parameters such as , , , and . The mechanical parameters ( and ) have to be identified because their calculation can be pretty challenging or even impossible.

3.4.1 RS, pp and PM measurement


Stator resistance is defined as a resistance of one phase winding. Since the motor windings of the PMSM are connected in star, cant be measured directly if the motor doesnt allow leading its middle point out. The simplest way how to obtain is to

23

measure resistance between two terminals (phases) which is equal to using an ordinary ohmmeter. Measurement scheme in Fig. 3-4 shows the measurement circuit. Measurement between random two phases should be the same and the model assumes so but in fact differs across phases. Nevertheless this small difference can be neglected and values for each phase can be averaged.
a b
Fig. 3-4 RS measurement circuit

Number of pole pairs determines synchronous speed of the motor. According to (3.5) is a ratio between electrical and mechanical speed of the motor. The number of pole pairs corresponds to number of stable positions per revolution while a DC voltage is applied between two phases. In practice at first there is a DC voltage applied to the motor as shown in Fig. 3-5 and then the stable positions are determined while rotating the rotor shaft (e.g. by hand).
a U = b
Fig. 3-5 pp measurement circuit

a U Osciloscope c b
Fig. 3-6 BackEMF measurement

BackEMF voltage is a voltage which works as a counterpart to applied voltage causing limitation of the maximal rotor speed to its base speed. The BackEMF voltage is generated while permanent magnets revolve around stator windings and this effect is used to measure the BackEMF voltage [7]. Measurement circuit is in Fig. 3-6. There is at least one voltage probe needed for measuring the phase voltage. Then an external force (e.g. hand drill machine) rotates the rotor shaft at a constant speed causing a sinusoidal voltage generation at each phase if flux distribution of the motor is sinusoidal. From measured course (Fig. 3-7) the constant can be calculated according to (3.15). (3.15)

24

Fig. 3-7 BackEMF measurement courses

3.4.2 Ld, Lq measurement[7]


To measure ( ) inductances rotor must be aligned with d (q) axis. The d-axis alignment can be chosen along any phase but the q-axis alignment must be orthogonal to corresponding d-axis. To align the rotor axis d with phase a, DC voltage must be applied to the motor phases according to Fig. 3-8. Then alignment with corresponding axis q (orthogonal to phase a) is done according to Fig. 3-9.
a U b
Fig. 3-8 d-axis alignment

c U c a
Fig. 3-9 q-axis alignment

After aligning the rotor with d-axis, rotor shaft has to be locked firmly. Then the can be derived from a frequency response of the R-L circuit shown in Fig. 3-10. Voltage supply is harmonic and its frequency shouldnt be a multiple of 50 Hz. For my measurement the frequency was 140Hz. An oscilloscope with voltage and current probes was needed to examine voltage and current courses (Fig. 3-11). Since the inductances vary with current, their characteristics can be measured by adding an offset voltage to the harmonic input voltage causing an offset in current as well. Then for an exact current offset the can be calculated according to (3.16): ( ) (3.16)

Inductance is measured as bud the rotor shaft has to aligned with q-axis. This technique is called Standstill Frequency Response.[7]

25

Rs L ~ u Rs L L Rs

Fig. 3-10 AC measurement circuit

Fig. 3-11 AC measurement characteristics

3.4.3 Measured parameters


Based on the previous theory a 3-phase PMSM TGT3-01030-560 manufactured by TG drives was used as an example for measurements and identification. Final measured electrical parameters are in Tab. 3-1.
Parameter Value 6,39 3 1,16E-01 11,51 12,36 Unit [] [-] [V.s/rad] [mH] [mH]

(averaged) (averaged)

Tab. 3-1 Measured parameters

As mentioned in 3.4.2 inductances , are dependent on current floating through them. These dependencies measured from -1,5A to 1,5A are in Fig. 3-12 and Fig. 3-13.
Ld [mH] 14 12 10 8 6 4 2 0 -2000 -1500 -1000 -500 0 500 1000 IDC [mA] 1500 2000

Fig. 3-12 Ld dependency on IDC

26

Lq [mH]

14 12 10 8 6 4 2 0 IDC [mA] 0 500 1000 1500 2000

-2000

-1500

-1000

-500

Fig. 3-13 Lq dependency on IDC

27

4 MODEL OF INVERTER
4.1 Dead-time effect in PWM inverters
In recent years a Pulse Width Modulated (PWM) inverters have become one of the most popular power conversion devices thanks to development of power electronics. A 3-phase inverter is used to drive a 3-phase PMSM [8]. Simplified electric circuit of the inverter is in Fig. 4-1. The inverter consists of 6 usually IGBT or MOSFET transistors (2 for each leg). Via these two transistors a single phase can be connected either to or at the time. Since motor windings have an inductive character phase currents can be fluently driven using the PWM. A problem arises while switching the phase voltage between and . If both (top and bottom) transistors were open at the time a short circuit would occur. Switching time of a transistor can be extremely low but it cant be neglected in this case.
PWM up Ta1 Da1 Tb1 Db1 Tc1 Dc1

Ta2 PWM down Da2

Tb2 Db2

Tc2 Dc2

Fig. 4-1 Electric scheme of a 3-phase inverter + motor

To protect the inverter from the short circuit a dead-time is introduced to PWM driving signals. In practice the is a moment between switching when both transistors are set to off (phase is not connected to either or ). An example of the driving signals PWMup and PWMdown for transistors Ta1 and Ta2 respectively are shown in Fig. 4-2, where rising edges of the drive signals are delayed by the deadtime from ideal signals which are shown by dashed lines. During the dead-time the output terminal seems to be floating. However if the output current is continous (normally is), flows through freewheeling diodes Da1 and Da2. Which diode will conduct depends on direction of the output current . If the current flows towards load ( > 0), diode Da2 conducts and voltage appears on the output terminal. If the current flows towards inverter ( < 0), diode Da1 conducts and the voltage appears on the output terminal. As a result the output voltage differs form ideal PWM signals by amount of shaded areas in Fig. 4-2 [8]. If < 0, real output voltage is higher due to increased pulse width by the shaded area (case 2). If > 0, the real output voltage is lower due to decreased

28

pulse width by the shaded area (case 1). Now we can conclude that the error voltage has an opossite phase than output current
Td PWMup PWMdown
decreasing

Td

for > 0
Da2 Ta1 Da2 increasing

for < 0
Ta2 Da1 Ta2

Fig. 4-3 Dead-time effect on output voltage[8] Fig. 4-2 PWM drive signals with dead-time[8]

Based on Fig. 4-2 we can evaluate the dead-time effect quantitatively by averaging voltage deviations over each positive and negative half cycle of the current. Deviation of the one pulse is[9]: (4.1) Then the average voltage deviation over a half cycle is[9]: ( ) (4.2)

where is a number of switching per one cycle of length and is switching frequency of the inverter. Fig. 4-3 shows how the dead-time affects an average sine voltage generated by the inverter. represents the desired sine voltage, is the error voltage caused by dead-time and these two voltages form the real output voltage .

4.2 Average model of inverter in Simulink


Based on the previous theory of quantification evaluation an average model of inverter which takes into account the dead-time effect was implemented in Simulink. Key parameters of the model are dead-time length in seconds and PWM switching frequency in Hz. Inputs of the model are duty cycles for each phase from SVM, DC_bus voltage and output currents of each phase. The model calculates the voltage deviation and adds or subtracts it from the output signal. The model has a characteristic feature that is a constant voltage deviation dependent on output current direction only not on its magnitude which causes voltage steps when the output current changes its direction as in Fig. 4-3.

29

4.3 Measured model of inverter in Simulink


This model is more complex than the model in 4.2 because it takes also transistor voltage drop and its parasitic capacitance into account. Nevertheless a transfer characteristic of the inverter has to be measured. The characteristic describes how the output voltage deviation from the inverter depends on the output current. An example of such a characteristic is on Fig. 4-4. (dotted line) represents voltage required by application. is a real voltage measured on output terminal of the inverter. is a voltage deviation caused mainly by the dead-time effect which is added to so it can be calculated according to (4.3). Only steady states of all voltages are considered. (4.3)

Always it is key to determine (measure or calculate) and . From these two voltages can be calculated according to (4.3). There are two ways how to determine the transfer characteristic. Usual PMSMs have their windings connected in star without its middle terminal led out. Then we cannot examine voltage of the middle terminal . To examine a PMSM with its middle terminal led out has to be used. A 3-Phase AC/BLDC High Voltage Power stage manufactured by Freescale was used for exemplary measurements. Users guide with circuit scheme of the Power stage is in [13].
20 after before error

15

10

U [V]

-5

-10

-15

-20 -2.5

-2

-1.5

-1

-0.5

0 I [mA]

0.5

1.5

2.5

Fig. 4-4 Inverter transfer characteristic

30

4.3.1 PMSM without middle terminal led out


Basic assumption and simplification for this approach is that is equal to zero. We commit an error about 10% by establishing this assumption. This simplification brings an advantage of no need of oscilloscope because all voltages can be determined via FreeMASTER [10]. Required voltage can be obtained directly from application and we are also able to measure phase currents trough shunt resistors. Then voltage can be calculated according to (4.4). Note that the (4.4) holds only if is equal to zero because then output terminal voltage is equal to phase voltage. (4.4) Since all three phases are designed from equal parts, there are only small differences in phase legs properties and it is sufficient to examine only one phase leg and use its transfer characteristic for other two phase legs. Measuring circuit for purpose of getting the transfer characteristic is on Fig. 4-5.
PWM up Ta1 Da1 Tb1 Db1 Tc1 Dc1

Ta2 PWM down Da2

Tb2 Db2

Tc2 Dc2

Fig. 4-5 Inverter transfer characteristic measurement circuit

During all measurements PMSM was driven by 3-phase high voltage power stage with PWM frequency 16 kHz and dead-time 1,5us. DCbus voltage was 99V obtained from DC power supply. Measured transfer characteristic of such a power stage is on Fig. 4-6. From the figure we can see almost linear dependency of on current due to constant which can be determined from equation of the linear approximation as 8,6. (green course) has almost its expected course from Fig. 4-4. However its outer linear parts doesnt have rising character due to the neglection. This imperfection has been improoved in 4.3.2 when was taken into acount

31

30 U [V] 20

10

0 -3 -2 -1 -10 0 1 2

I [A]3

-20

U_a_trm U_req U_err U_a_trm

-30
Fig. 4-6 Inverter trasfer characteristic neglected Um

4.3.2 PMSM with middle terminal led out


This approach does not establish the simplification that has to be equal to zero. We dont commit the 10% error nevertheless the voltage cannot be determined via FreeMASTER because it cannot be calculated according to (4.4) anymore. At this point an oscilloscope with differential probes and waveform measurements function has to be used. A Tek MSO4104B-L oscilloscope, Tek P5050 voltage probe and Tek P5205 differential probes manufactured by Tektronics were used for measurement. There is a measurement block diagram in Fig. 4-7. Necessity of differential probes usage comes out from the fact that negative terminals of input BNC connector of each channel are connected together and grounded. Therefore bringing different potentials to the negative terminals would produce a short and could cause damages. An example of waveforms during switching is in Fig. 4-8. Yellow, cyan, purple and green waveforms in Fig. 4-8 correspond to yellow, cyan, purple and green channels in Fig. 4-7. Yellow waveform represents PWM driving signal for top transistor in phase leg a. This course has been captured to get an overall knowledge about switching but this signal cannot be used for calculation because its already affected by deadtime. has been determined via FreeMASTER again. Cyan waveform represents phase voltage , purple waveform represents and green waveform represents phase current . An inbuilt oscilloscope function CycleMean was used to calculate average values.

32

U_DCbus PWM up Ta1 U_DCbus/2 Ta2 PWM down Tb2 Db2 Tc2 Dc2 Da1 Tb1 Db1 Tc1 Dc1

Tek MSO4104B-L oscilloskope

Tek P5050 voltage probe

voltage

Tek TCP0020 Tek P5205 current probe high voltage differential probes

Fig. 4-7 Transfer characteristic measurement block diagram

Fig. 4-8 Waveforms snapshot

voltage

voltage

current

33

is calculated according to (4.3) again but now output terminal voltage calculated as a sum of and :

is

(4.5) Resulting inverter transfer characteristic is in Fig. 4-9. There is shown also middle terminal voltage to emphasize that it cant be neglected.
30

U [V]

20

10 I [A] 0 -3 -2 -1 -10 0 1 2 U_a_trm U_req -20 U_err U_m 3

-30
Fig. 4-9 Inverter transfer characteristic with Um taken into account

34

5 PARAMETERS IDENTIFICATION
Identification is a process during which the system parameters are estimated based on input and output data. All identifications are done using the model of PMSM from 3.3 and model of inverter from 4.3. Fig. 5-1 shows a block diagram of the identification process. The red branch represents real data which were measured only once and the green branch represents Matlab simulation. Adaptive algorithm (blue) processes a deviation between the real and the simulated output data and then tunes PMSM model parameters in order to minimize the output deviation [11]. Mean Square Error (MSE) defined in (5.1) is used for quantization of the output deviation. Since the outputs are currents and speed the output error has to be weighted due to different units of the outputs. Assuming that the currents , change within interval 0-3A and the rotor speed changes within 0-40 rad/s, weight for current has been set to 40 and weight for rotor speed has been set to 3. Resulting equation for MSE is in (5.2). ( ) ( ) ( ) ( ) (5.1)

(5.2)

where subscript denotes output from model, measurement and is number of samples.
ud, uq dq => abc dq => abc abc => dq abc => dq

indicates output from real

Real inverter

Real PMSM

id, iq, m

MSE

id, iq, m

inverter model

PMSM model

Adaptive algorithm
Fig. 5-1 Identification process

The identification was implemented in Matlab/Simulink. There is a model created in Simulink environment. Before identification an m-file data_sorting.m which sorts measured data from a text file has to be run. Whole identification is done by identification.m which minimizes the output error using a fminsearch() function. The fminsearch() is a matlab inbuild function which finds a local minimum of unconstrained

35

multivariable function using derivative free method [11]. Multivariable function fkrit used for J, F and PSI identification looks as follows:
function f=fkrit(a,y_orig)
load_system('model'); set_param('model/PMSM1','J',mat2str(a(1))); set_param('model/PMSM1','F',mat2str(a(2))); set_param('model/PMSM1','PSI',mat2str(a(3))); weightId = 40; weightIq = 40; weightW = 3; sim('model'); f = weightId * (Id_model-(y_orig(:,1)))' * (Id_model-(y_orig(:,1))) + ... weightIq * (Iq_model-(y_orig(:,2)))' * (Iq_model-(y_orig(:,2))) + ... weightW * (w_r_model-(y_orig(:,3)))' * (w_r_model-(y_orig(:,3)));

when the function is executed, parameters of the model are set at first, then the model is simulated and finally the weighted MSE which is going to minimized is calculated.

5.1 RS, Ld, identification


Correct and , measurement can be checked from a step response of the motor with locked rotor shaft because then the motor acts as a simple R-L circuit. Step response in d-q rotating frame means to apply a voltage step in d or q axis while the other axis is kept to zero and measure an exponential course of output current. Note that voltage step in q-axis produces torque so rotor shaft has to be locked firmly! 16 steps responses with different amplitudes were made (from -20V to +20V with step 2,5V) in each axis. Model used for identification including inverter and all necessary transformations is in appendix 1. Step responses as well as their approximations for steps 2,5V and 20V are in Fig. 5-2 and Fig. 5-3 respectively. In Fig. 5-2 is visible significant distortion which applies for low currents so these step responses (-2,5V and +2,5V) will be neglected for and identification.
Id [mA] 0.05 Id meas Id model 0.04

Id [mA] 2.5 Id meas Id model 2

0.03

1.5

Id(A)
0.005 0.01 0.015 0.02 t(s) 0.025 0.03 0.035 0.04

Id(A)

0.02

0.01

0.5

-0.01 0

-0.5 0

0.005

0.01

0.015

0.02 t(s)

0.025

0.03

0.035

0.04

Fig. 5-2 Step response for 2,5V step

Fig. 5-3 Step response for 20V step

36

Resulting and identifications are in Fig. 5-4 and Fig. 5-5 where x-axis repsents index of measured step response. Index 1 corresponds to step -20V and index 16 corresponds to step +20V. The middle part (index 8 and 9) which corresponds to highly distorted steps -2,5V and +2,5V is neglected and final and are averaged from nearly constant outer parts as = 6,59 and = 13mH which correspond to measured values in 3.4.3.
Rs identified 18
0.035 Ld identified

16

0.03

14
0.025

Rs[ohm]

12

Ld[H]
0.02

10
0.015
X: 4 Y: 0.01309

X: 6 Y: 6.648

Fig. 5-4 RS identified

8 Id[A]

10

12

14

16

0.01 0

Fig. 5-5 Ld identified

8 Id[A]

10

12

14

16

5.2 J and F identification


To calculate motor inertia and friction from its physical dimensions is quite challenging. Since a model of PMSM is available these parameters can be identified from performed measurements. Scheme of measuring workplace is in Fig. 5-6. To perform this measurement a precise load which can measure torque accurately is needed. Whole measurement was done in Freescale Ronov laboratory because it was equipped with a motor bench. We used BLC-303-0025 motor bench manufactured by Vibro-meter Switzerland with ability to provide torque from zero rpm. PMSM from 3.4.3 and Power Stage from 4.3 were used for the measurement. Data were acquired via FreeMASTER online debugging tool.
PMSM USB
3 phase Power Stage Fig. 5-6 J and F identification workplace

1:1,53
Motor bench

FreeMaster

PMSM shaft and load shaft were connected through transmission which was made from aluminum cogwheels and cogged rubber belt. Gear ratio was 1:1,53 and torque

37

load provided by the motor bench was 0,208 Nm. This torque has to be recalculated how it impacts on the PMSM through the transmission: (5.3) Step voltage and zero voltage were applied to inputs of the real PMSM and also to the inputs of PMSM model in order to produce torque and spin the motor. There were no current and speed controllers at this stage to keep the identification process simple. The identification was implemented in Matlab/Simulink. First approach didnt take into account inverter parameters and dead-time effect. Simulink model of the first approach is in appendix 2. It consists of a simple model of PMSM with all necessary transformations but it doesnt contain model of inverter. Identified inertia and friction were and . Comparison of , and measured on a real system and simulated with the identified parameters is in Fig. 5-7. It is obvious that the identification without model of inverter is very inaccurate because simulation outputs and (blue) doesnt copy measured outputs (red).
Id 0.6 0.4 motor model

Id [A]

0.2 0 -0.2 0

0.02

0.04

0.06 t [s] Iq

0.08

0.1

0.12

4 3 motor model

Iq [A]

2 1 0 -1 0 0.02 0.04 0.06 t [s] wr 0.08 0.1 0.12

50 40 motor model

wr [rad/s]

30 20 10 0 -10 0 0.02 0.04 0.06 t [s] 0.08 0.1 0.12

Fig. 5-7 Comparison of measured and simulated id, iq and wr (inverter neglected)

Second approach introduces a model of inverter into simulation. Simulink model of the second approach is in appendix 3. Taking the model of inverter into account significantly improves identification accuracy and simulated outputs match measured outputs much better which is visible from Fig. 5-8.

38

Significant ripple and less significant ripple is a 6th harmonic of rotor electrical speed . There are also shown voltages , and applied to the motor at the bottom of the figure. There are evident teeth caused by dead-time which appear when , and change their directions. Each sinewave has two teeth per period then total frequency of the teeth is the 6th harmonic of which implies that the and ripple is caused by dead-time [14]. Identified inertia and friction at the second approach were and .
Id 0.5
Id [A]

motor model 0

-0.5 0

0.02

0.04

0.06 t [s] Iq

0.08

0.1

0.12

4
Iq [A]

2 0 -2 0 0.02 0.04 0.06 t [s] wr 0.08 0.1

motor model

0.12

50
wr [rad/s]

motor model 0

-50 0

0.02

0.04

0.06 t [s] Uabc

0.08

0.1

0.12

50
Uabc [V]

model 0

-50 0

0.02

0.04

0.06 t [s]

0.08

0.1

0.12

Fig. 5-8 Comparison of measured and simulated id, iq and wr (inverter included)

39

6 SIMULATIONS
6.1 FSL_MC_TOOL library
To make your own simulations of FOC a FSL_MC_TOOL library has been created. This library contains Matlab/Simulink blocks used in motor control. Detailed description of each block is in FSL_MC_TOOL manual (appendix B). For easy usage a help to each block has been created as well. The main library consists of 4 sublibraries: GMCLIB (General Motor Control Library) GFLIB (General Functions Library) GDFLIB (General Discrete Filter Library) MLIB (Math Library)

Structure of the whole library is shown in Fig. 6-1. To be able to use the library include the library in your Simulink Library Browser you have to execute the following steps: 1) Copy a folder mctool (appendix A) to your matlab toolbox folder (matlabroot/toobox) 2) Add the copied folder to matlab search path (e.g. using a pathtool). Instructions how to add a folder to matlab search path are in FSC_MC_TOOL manual (appendix B).

FSL Motor Control Toolbox

Fig. 6-1 FSL_MC_TOOL library structure

40

6.2 Simulations
There are 4 different example simulations of FOC done with different Power Stage models. Each simulation is done in continuous and discrete time domain (together 8 simulations). There is an initialization file FOC_param_cont.m common for all 4 continuous simulations and FOC_param_disc.m common for all 4 discrete simulations. These files set motor parameters, controllers coefficients, etc. The controllers coefficients are designed using a pole placement method. Run FOC_param_cont.m or FOC_param_disc.m before each simulation to set all necessary variables. FOC_param.m also loads the Custom Power Stage characteristic from data_for_PS.mat so if you are using the Custom Power Stage, change data_for_PS.mat or overwrite already loaded variables current and error with your own data in order to replace Power Stage transfer characteristic. At the continuous simulations all blocks run with simulation step specified in configuration parameters (by default between 1-10us). Current and speed controllers are continuous as well. Its not recommended to use longer simulation step than 10us for poor accuracy. At the discrete simulations only the PMSM model runs continuously (by default with simulation step between 1-10us). The output currents and rotor angle from the PMSM are converted to discrete sample time using a fast-loop sampling period (Ts_fast = 100us by default). Thus the current controllers and other blocks except speed controller run in fast-loop as well. The speed controller runs in slow loop which is 10x slower than fast loop because the speed and current controllers are organized in cascade so dynamics of the speed controller has to be slower than dynamics of the current controller (Ts_slow = 10us by default). However the sampling periods can be changed anyway. Signals in the simulations are scaled in real units from measured output currents Iabc to output voltage from the current controllers. Before the Parks inverse transformation the voltage is scaled from -1 to 1. Scaling back to real units is done by Power Stage. The scaling is marked red in the simulation models. Case 1 (FOC_noPowerStage.mdl) Simulation without Power Stage model FOC is directly connected with motor (duty cycles from SVM block are gained and connected directly to motor). Simple gain is used as a Power Stage in this case. The other three simulations come out of this simulation (motor and controller parameters remains the same). Case 2 (FOC_DCbusRipple.mdl) Simulation with average Power Stage model DC-bus voltage drop and DC-bus ripple elimination are included. Simple multiplication of the duty cycles and DCbus voltage is used as a Power Stage model. DCbus voltage drop is realized by DCbus Source block which changes its output voltage according to DCbus current consumption

41

and DCbus Source parameters (amplitude of AC supply, frequency of AC supply and output DCbus capacity). Case 3 (FOC_deadtime.mdl) Simulation with average Power Stage model model of inverter (dead-time effect), DC-bus voltage drop and DC-bus ripple elimination included. The same DC-bus voltage drop and DC-bus ripple elimination modeling technique as in the Case 2 is used. However model of Power Stage (including dead-time) is used in this simulation. This Power Stage model computes a voltage error from dead-time length, PWM frequency, DCbus voltage and phase current direction. The error is then added to the output voltage. Case 4 (FOC_deadtime_customPS.mdl) Simulation with custom Power Stage model model of inverter (dead-time effect, parasitic transistor capacitance and transistor voltage drop), DC-bus voltage drop and DC-bus ripple elimination included. The same DC-bus voltage drop and DC-bus ripple elimination modeling technique as in the Case 2 is used. However more complex model of Power Stage (defined by user via current-error characteristic) is used in this simulation. The characteristic includes all parameters of a real Power Stage. The characteristic is obtained by measuring. For more information see Help for Custom Power Stage block.
350 300 250 200
wr [rad/s]

required measured

150 100 50 0 -50 0

0.05

0.1

0.15

0.2

0.25 t [s]

0.3

0.35

0.4

0.45

0.5

Fig. 6-2 r during motor start-up

An example of the most complex simulation (FOC_deadtime_customPS.mdl) diagram is in appendix 4. Parameters of T2-0040-30-24 PMSM manufactured by TG drives were used for the example simulation. In Fig. 6-2 there is a course of motor startup. There is an undershoot at time 0 because an external torque load applied right from

42

the beginning of the simulation causes opposite spin and it takes some time to stop the motor. After 0,1s there is a step change of required speed. Motor reaches the required speed after 0,1s (not immediately) because output from speed controller (required current) was limited to 10A which limits also acceleration.
0.8 0.6 0.4 0.2
Id [A]

required measured

0 -0.2 -0.4 -0.6 -0.8 0 0.05 0.1 0.15 0.2 0.25 t [s] 0.3 0.35 0.4 0.45 0.5

12 10 8
Iq [A]

required measured

6 4 2 0

0.05

0.1

0.15

0.2

0.25 t [s]

0.3

0.35

0.4

0.45

0.5

Fig. 6-3 id, iq during motor start-up

In Fig. 6-3 there are courses of and during the motor start-up. We examine primarily because creates torque and spins the motor. From 0 to 0,1 there is a current consumption about 7A to keep rotor steady while external torque load is applied. At time 0,1 motor starts-up with maximum acceleration which is limited by maximum current 10A. After reaching required speed (in 0,2s) current falls back to 7A to keep the externally loaded motor rotating. First graph in Fig. 6-4 shows . Course of comes out of the fact that is rectified line voltage with certain capacity on the rectifier output. This capacity supports during falling half-wave of rectified sinewave. during the falling half-wave follows from capacity discharging according to (6.1): (6.1)

where is amplitude and is current consumption from . High current consumtion causes high drop which is visble from 0,1 to 0,2 s when there was the highest current consumption.

43

100 U DCbus 80
U DCbus [V]

60 40 20 0 0 0.05 0.1 0.15 0.2 0.25 t [s] 0.3 0.35 0.4 0.45 0.5

0.8
Duty cycles [-]

0.6 0.4 0.2 0

phase A phase B phase C

0.05

0.1

0.15

0.2

0.25 t [s]

0.3

0.35

0.4

0.45

0.5

80
Output from inverter [V]

60 40 20 0

phase A phase B phase C

0.05

0.1

0.15

0.2

0.25 t [s]

0.3

0.35

0.4

0.45

0.5

Fig. 6-4 UDC-bus, SVM output and inverter output voltages during motor start-up

Second and third graph in Fig. 6-4 show duty cycles from SVM and resulting output voltage of inverter respectively. From zoomed Fig. 6-5 is visible how ripple elimination works. is measured and according to it duty cycles are adjusted to generate higher output voltage when is lower and vice versa. Resulting output phase to phase voltages are then equidistant. There is also visible how the dead-time affects output voltage waveform by adding a tooth to each faling and rising edge.

44

100 95
U DCbus [V]

U DCbus

90 85 80 75 70 0.25 0.255 0.26 0.265 0.27 0.275 t [s] 0.28 0.285 0.29 0.295 0.3

0.7
Duty cycles [-]

0.6 0.5 0.4 0.3 0.25 0.255 0.26 0.265 0.27 0.275 t [s] 0.28 0.285 0.29 0.295

phase A phase B phase C

0.3

Output from inverter [V]

60 50 40 30 20 0.25 0.255 0.26 0.265 0.27 0.275 t [s] 0.28 0.285 0.29 0.295

phase A phase B phase C

0.3

Fig. 6-5 UDC-bus, SVM output and inverter output voltages during motor start-up zoomed

45

7 SIMULATION ACCURACY AND PERFORMANCE EVALUATION


In this section we will focus on accuracy versus performance evaluation. We will compare simulation results obtained by different types of integration and simulation steps. Accuracy will be tested using data measured on a real system and performance will be evaluated as time demands of the simulation.

7.1 Integration methods


Ordinary Differential Equations (ODEs) dont always have an analytical solution (e.g. ). Since models in simulation are pretty complicated and there is no way how to solve them analytically there are several methods for numerical integration implemented in MATLAB/Simulink. Nevertheless only few of them will be discussed and tested in this thesis. The chosen methods are Euler method (ode1) which is the easiest technique for solving ODEs, 4th order Runge-Kutta method (ode4) which is more accurate but also more time demanding and often used Dormand-Prince method (ode5) which belongs to Runge-Kuttas method family. Basic principle of numerical methods is discretization of variables. Solution is not computed analytically but approximates in certain time samples distributed with a fixed time step . ( ) (7.1)

ODEs solving starts at known initial conditions and continues with step by step solving. According to munber of old time stamps taken into account integration methods can be divided into two groups: single-step methods and multi-step methods.

7.1.1 Eulers method


Eulers method is a Runge-Kutta method of 1st order meaning that derivation is approximated only once per step. General ODE has the following form: ( ) (7.2)

Eulers method approximates derivation by difference:[12] ( ) ( ) [ ( ) ( ) ] (7.3)

Then the solution in time ( )

is:[12] [ ( ) ( ) ] (7.4)

( )

46

Eulers method is very simple however its also quite inaccurate. Main inaccuracy is caused by using constant derivation (calculated at the beginning of the step) over the whole step despite the fact that the derivation varies over the step.

7.1.2 Higher order Runge-Kutta methods


Runge-Kutta methods improve accuracy by calculating the derivation approximation more than one time per step and then averaging these approximations. There is an example of 4th order Runge-Kutta method which computes derivation 4 times per step (once at the beginning of the step, twice in the middle of the step and once at estimated end point of the previous step)[12]: [ ( ) ( ) [ ( ) [ ( ) [ ( ) ( ( ] ) ) ] ] (7.5)

( ) ]

Solution for the next step is then calculated[12]: ( ) ( ) ( ) (7.6)

It is obvious that higher order of the method causes higher time demands because more derivations have to be calculated.

7.2 Performance evaluation


First idea how to measure time demands of simulation was using tic, toc commands. The tic command is called just before simulation and sets Matlab timer. The toc command is called right after the simulation and reads time elapsed from the tic command. Nevertheless this technique calculates time including initialization and termination and is strongly dependent on current resources dedicated to Matlab. Better solution is to use a Profiler which generates report about time demands of each block, function and overall progress. An example of the report is in Fig. 7-1. Its visible that the Profiler significantly prolongs simulation in order to record all function calls and determine which functions consume most of the time and resources. from total recorded time. For our purpose of performance evaluation an Execute function duration is important.

47

Fig. 7-1 Profile report example

Tab. 7-1 shows results of the accuracy versus performance evaluation. Tvz is sampling period of measured data and the top row referes to sampling periods of the simulation. For each method there are two rows: first one shows MSE and the other one simulation time. From the Tab. 7-1 it implies that Runge-Kutta methods provides better accuracy than Eulers method. It is also pointless to use Runge-Kutta methods with shorter simulation steps because accuracy is not improved. The best choice is 4th order Runge-Kutta method.
Tvz MSE e-5 time [s] Runge MSE e-5 Kutta 4th time [s] Dormand MSE e-5 Prince time [s] Euler 6,057 1,89 4,164 3,74 4,167 5,41 0,5 Tvz 0,1 Tvz 0,05 Tvz 4,783 4,246 4,204 2,36 10,75 22,14 4,165 4,167 4,167 7,64 35,85 71,48 4,167 4,167 4,167 10,9 53,68 106,75

Tab. 7-1 Performance vs. accuracy evaluation

48

8 CONCLUSION
Master thesis deals with a PMSM modeling and FOC. A mathematical model of PMSM has been described and then the model has been implemented in the Simulink environment. Electrical parameters of the model such as Rs, Ld, Lq, pp, PM were measured. Mechanical parameters such as friction and inertia were identified using the PMSM model. During the identification proces a problem with inverter transfer characteristic arises. First approach was assuming zero voltage at middle point of the motor . This approach brought a great advantage of possibility to measure all voltages necessary for the transfer characteristic construction via FreeMASTER. However dead-time effect causes that the is never zero so it turned out that this approach was wrong. A proposed solution was to use a motor with its middle terminal led out in order to examine as well as phase voltage and phase current . Transfer characteristic obtained by this measurement was already correct and identification which used the characteristic brought right results finally. A Simulink library FSL_MC_TOOL gathering algorithms used in FOC has been created. A documentation describing the library and a Help for each block from the library has been done as well. There are example continuous and discrete simulations of FOC created from the library blocks. In final part of the thesis accuracy vs. performance of the simulations was ealuated. Matlab commands tic, toc were used for performance evaluation at first but this idea turned out to be strongly dependent on operating system and gave us incorret results. Then Simulink tool called Profiller was used to determine time consuption of each block and total time of execution. Three integration methods were tested resulting to the fact that it is more convenient to use higher order integration methods with longer simulation step rather than simpler lower order method with shorter simulation step. An optimal choice was 4th order Runge-Kutta method with short simulation step. Future plan with the thesis is to describe the dead-time more deeply and propose and implement some dead-time elimination technique.

49

References
[1]

Islam, M.: Cogging torque, torque ripple and radial force analysis of permanent magnet synchronous machines [online]. University of Akron: May, 2009. Available on URL: http://www.scribd.com/doc/71410767/3/Advantages-ofPMSM Caha, Z.; ern, M.: Elektrick pohony. Praha, 1990. Group of authors: Motor Control Library. Library reference manual of Freescale company. May, 2011. Available on URL: http://www.freescale.com/files/microcontrollers/doc/user_guide/56800E_M CLIB.pdf Filka, R.: PMSM Field Oriented Control on MPC5604P. Freescale company presentation. Neacsu, D.: Space Vector Modulation An introduction. Tutorial at IEEE annual conference. November 2001. Available on URL: http://et.upt.ro/admin/tmpfile/fileM1224954797file490353adde0d4.pdf Arroyo, E. L.: Modeling and simulation permanent magnet synchronous motor drive system. Masters thesis. University of Puerto Rico, 2006. Available on URL: http://www.ieee.hr/_download/repository/lres_tema5_2.pdf Bobek, V.: PMSM parameters measurement. Freescale company presentation. November 2011. Jeong, S. D.; Park M. H.: The Analysis and Compensation of Dead-Time Effects in PWM Inverters. April 1991. Available on URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=88903 Chen, L.; Peng F. Z.: Elimination of Dead-time in PWM Controlled Inverters. Michigan State University. April, 1991. Available on URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=4195735

[2] [3]

[4]

[5]

[6]

[7]

[8]

[9]

[10] Group of authors: FreeMASTER Real-time debugging tool. Freescale company brochure November, 2012. Available on URL: http://www.freescale.com/freemaster [11] olc, F, Vclavek, P, Vavn, P.:zen a Regulace II. Brno University of Technology: 2006. University textbook

50

[12] Blaha, P.:Teorie dynamickch systm. Brno University of Technology: 2008. Lecture slides [13] Frgal P.: 3-Phase AC/BLDC High Voltage Power Stage Board Users guide. Freescale Semiconductor. January, 2007. Available on URL: http://www.freescale.com/files/microcontrollers/doc/user_guide/3PHACBL DCHVPSUG.pdf [14] Hwang, S. H.; Km J. M.: Dead Time Compensation Method for Voltage-Fed PWM Inverter. Pusan National University. March, 2010. Available on URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=05308357

51

Appendix 1

Appendix 2

Appendix 3

52

Appendix 4

53

List of appendixes on attached CD


Appendix A. FSL_MC_TOOL Appendix B. FST_MC_TOOL documentation Appendix C. Identification scripts Appendix D. Electronic version of this thesis

54

You might also like