Professional Documents
Culture Documents
Tkadlec Josef 2013
Tkadlec Josef 2013
DIPLOMOV PRCE
MASTERS THESIS
AUTOR PRCE
AUTHOR
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
Vedouc prce: doc. Ing. Pavel Vclavek, Ph.D. Konzultanti diplomov prce: Ing. Radim Viinka
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.
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.
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
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
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
Simulation accuracy and performance evaluation .............................................................. 46 7.1 Integration methods ..................................................................................................... 46 Eulers method .................................................................................................... 46 Higher order Runge-Kutta methods .................................................................... 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
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
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)
( ) ( ) ][ ] ( ) ( )
(2.3)
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].
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
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
ADC
SVM Speed controller Iq_req Current q PI controller U_comp Uq Inv Park dq -> Current d PI controller Ud _el U U
Iq Park -> dq Id
Ia Ib Ic
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.
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.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)
where
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)
From (3.4),(3.8) and (3.10) we can write down final equations convenient for simulink implementation [4]:
20
( )
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
22
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
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
(averaged) (averaged)
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
26
Lq [mH]
-2000
-1500
-1000
-500
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
Tb2 Db2
Tc2 Dc2
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 .
29
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
30
Tb2 Db2
Tc2 Dc2
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
-30
Fig. 4-6 Inverter trasfer characteristic neglected Um
32
U_DCbus PWM up Ta1 U_DCbus/2 Ta2 PWM down Tb2 Db2 Tc2 Dc2 Da1 Tb1 Db1 Tc1 Dc1
voltage
Tek TCP0020 Tek P5205 current probe high voltage differential probes
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
-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
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.
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
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
8 Id[A]
10
12
14
16
0.01 0
8 Id[A]
10
12
14
16
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]
50 40 motor model
wr [rad/s]
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]
motor model
0.12
50
wr [rad/s]
motor model 0
-50 0
0.02
0.04
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).
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
0.05
0.1
0.15
0.2
0.25 t [s]
0.3
0.35
0.4
0.45
0.5
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
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.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
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
0.3
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
0.3
Fig. 6-5 UDC-bus, SVM output and inverter output voltages during motor start-up zoomed
45
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.
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.
( ) ]
It is obvious that higher order of the method causes higher time demands because more derivations have to be calculated.
47
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
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
54