Design, Simulation and Implementation of a PMSM Drive System

Thesis for the Degree of Master of Science in Engineering

Division of Electric Power Engineering Department of Energy and Environment Chalmers University of Technology

Göteborg, Sweden 2011

Thesis for the Degree of Master of Science in Engineering


Division of Electric Power Engineering Department of Energy and Environment Chalmers University of Technology

Göteborg, Sweden 2011

Design, Simulation and Implementation of a PMSM Drive System
Thesis for the Degree of Master of Science in Engineering


Division of Electric Power Engineering Department of Energy and Environment Chalmers University of Technology

SE-412 96 Göteborg Sweden Telephone: + 46 (0)31-772 1000

Cover: Picture of the experimental drive system setup Chalmers Bibliotek, Reproservice Göteborg, Sweden 2011

I have to express here my acknowledgement to so many people in Spain. as a family. with whom I have spent my life. During the development of the thesis. the unexpected surprise. Frölunda People. apart from Saeid. Massimo Bongiorno and Robert Karlsson. Extraordinary year! Somehow. help and technical support throughout these months have been essential. within the department of Energy and Environment. Högsbogatians always there and Masthugget BK. In this section. some problems arose and some help was needed. An entire life support is priceless. May 2011 David Vindel Muñoz I . I wish to express my gratitude to Saeid Haghbin. To all these special people. the person that gave me the opportunity to carry out such a challenging project. Love you Padres! Göteborg. for this academic experience in Chalmers University of Technology. I have to declare an immense gratitude to Stefan Lundberg.Acknowledgments In first place. thanks for all the unforgettable moments we have lived together. His guidance. A special mention to all the friends I met here in Sweden and have shared such a great year. Finally. Also thank to Ola Carlson and the division of Electric Power Engineering. thank my family because they make this real.


current transducers and resolver. Drive System. III . Isolated Charger. Experimental results show that the drive system has a good dynamic response in terms of speed response and torque ripple. For the system control dSpace is used and Matlab/Simulink is used for the program development and implementation. Simulation and Implementation of a PMSM Drive System Thesis for the Degree of Master of Science in Engineering DAVID VINDEL MUÑOZ Division of Electric Power Engineering Department of Energy and Environment Chalmers University of Technology ABSTRACT Field oriented control (FOC) of permanent magnet synchronous motor (PMSM) is one of the widely used methods for the speed control of the motor.Design. A PMSM drive system based on FOC is designed. simulated and implemented. Simulation results show that the speed controller has a good dynamic response. voltage transducers. Key words: PMSM. The drive system will be extended to serve as an isolated high power battery charger. A lab setup is designed and implemented based on a six-pole 2 kW PMSM. FOC. The aim of the drive system is to have speed control over wide speed range. The whole drive system is simulated in Matlab/Simulink based on the mathematical model of the system devices including PMSM and inverter. are explained in this report. The measurement devices.


4 Measurement interfaces 3.3 Background of the study Objectives of the study Outline of the thesis I III V 1 1 1 1 2 MODELLING AND FIELD ORIENTED CONTROL OF PERMANENT MAGNET SYNCHRONOUS MACHINE 2 2.1 Voltage measurements 3.2 Current measurements 3.1 2.Table of Contents ACKNOWLEDGMENTS ABSTRACT TABLE OF CONTENTS 1 INTRODUCTION 1.7 4 Connection to the grid By a relay dSpace system Experimental results CONCLUSIONS AND FUTURE WORK 4.4.3 General hardware overview PMSM Inverter 3.2 2.3 3 Mathematical model of PMSM Field oriented control of PMSM Simulation results 2 5 9 16 16 19 20 21 22 25 26 29 30 33 36 36 36 37 38 V PRACTICAL IMPLEMENTATION OF A PMSM DRIVE SYSTEM 3.1 3.1 4.5 3.2 1.2 Conclusions Future work REFERENCES APPENDICES .3 Position and speed measurements 3.6 3.1 1.

Reference frame conversion Appendix B. Data sheet of experimental equipments Appendix E.Appendix A. Lab setup diagrams Appendix D. Matlab code and Simulink block diagrams Appendix C. dSpace software implementation 38 40 45 49 72 .



13]. Since the battery charging and traction power is not happening simultaneously it is possible to use inverter and motor in charger circuit to reduce the price.3 Outline of the thesis After this introduction chapter. this current subproject is defined to be extended later on. To charge the battery the grid power is utilized in some vehicles called grid-connected version. Master´s Thesis 1 . 1. An isolated high power integrated charger is proposed in [9] that is based on a special ac motor winding configuration. ac drives in vehicle applications are gaining attention due to pollution and fuel price problems. This is called integrated charger. Recently. the lab setup diagrams and components datasheets and dSpace programming are presented in appendices. 1. CHALMERS.1 Background of the study Many types of electric motors have been used in the industry for different purposes: cranes. Reference frame theory. Energy and Environment. objective of the project and the thesis outline is described in this introductory chapter. Based on the simulation results. Conclusion and future works are presented in chapter 4. the motor is producing torque from the battery through the inverter. the mathematical model of PMSM and the field oriented method is explained in chapter 2. weight and space of the charger. Several appendices are added to the report as a part of the thesis. In the electrical system of an electric or hybrid electric vehicle based on an ac motor. a practical system is designed and implemented that is explained in the report. The simulations are conducted in Matlab/Simulink software. 1.1 Introduction The project background. volume. AC motors are widely used and ac drives are subject of study for many researchers [4. Matlab code used for the simulations. as well as the Simulink blocks of every subsystem. public transportation and so on [3]. dSpace control system is used to control the whole drive system. To implement a practical system of the proposed integrated charger. spinning machines. Later on the system will be used as an integrated charger. Chapter 3 includes design and description of the practical system.2 Objectives of the study The goal of this thesis is to design and implement a normal drive system of a permanent magnet synchronous machine (PMSM). The stator has double set of winding as explained in [12]. The drive system simulation and the hardware implementation is explained in this thesis.

reliability and low cost of the power electronic converters required for controlling the machine [1]. The high efficiency. high steady state torque density and simple controller of the PM motor drives compared to the induction motor drives make them a good alternative in certain applications. A mathematical model of PMSM is introduced in this chapter first. Then the FOC method is explained. 2 CHALMERS. high efficiency. Figure ‎ 2. All these facts make the PMSM an excellent candidate for being used in many applications. while the SM machine has quite a fixed reluctance for any rotor angle. That leads in a uniform air gap. Energy and Environment. Finally Matlab/Simulink based simulation results are presented for this scheme. Other advantages of the PMSM are low inertia. 2.2 Modelling and field oriented control of permanent magnet synchronous machine Permanent magnet synchronous motors (PMSM) have attracted increasing interest in recent years for industrial drive applications [3]. so the mathematical model of the PMSM is presented for this kind of machine. IM) or surface-mounted magnets (without saliency.1 Mathematical model of PMSM A surface-mounted synchronous machine is used in this project. We can distinguish between two main kinds of PMSM: internal-mounted magnets (with saliency. and thus. an equal magnetizing inductance for the direct and quadrature axis (Ld and Lq) [2]. Master’s Thesis . SM). Field oriented control of PMSM is one of the widely used methods in drive applications [14] that is considered in this thesis. The main difference is that the IM machine has a variable reluctance which varies with the rotor angle.1 show a cross section of the rotor and stator of a PMSM.

Master´s Thesis 3 . the voltage equation in the dq domain (reference frame transformation is explained in Appendix A.Figure ‎ 2.1: View of a three phase. quadrature axis and zero component of the variables respectively. The flux linkage in the dq frame can be calculated as follows: (2.1) Where p is the differentiating operator . q and 0 denote direct axis. Considering a two-pole three phase PMSM. two-pole PMSM.2) Where the inductance matrix is expressed: (2. Energy and Environment. The indexes d. Reference frame conversion) is expressed as follows [2]: (2.3) CHALMERS.

Master’s Thesis . The magnetizing flux has the following expression: (2.5) (2. ωr the rotor rotational speed and λpm the permanent magnet flux.2) is substituted in the torque equation.8) Considering a non-salient rotor. Ls the stator inductance. Energy and Environment. in the dq reference frame.6) Where Rs is the stator resistance. The electromagnetic torque of the machine can be expressed. 4 CHALMERS.4) A usual way to write the equation (2. which refers to the stator. The notation dq is change for s.1) is in its expanded form. the d and q components of the inductances are the same. where the inductances are equal. The voltage equations for d and q axes are: (2. It shows that the only component involved in torque production in a PMSM without saliency is the stator q-axis current.7) If the equation (2.For SMPM. it is obtained: (2. as follows: (2. the final expression of the electromagnetic torque is: (2. As far as the stator windings are wye-connected (with a neutral point) and supplied with balanced three phase currents. the zero-axis components are neglected [2].9) This result is quite interesting.

Energy and Environment. and one speed regulator.2.2 Field oriented control of PMSM Field oriented control of PMSM is one important variation of vector control methods [14]. The aim of the FOC method is to control the magnetic field and torque by controlling the d and q components of the stator currents or relatively fluxes. CHALMERS. Figure ‎ 2. With the information of the stator currents and the rotor angle a FOC technique can control the motor torque and the flux in a very effective way. Master´s Thesis 5 . The implementation of this technique will be carried out using two current regulators.2 shows a block diagram of the FOC method. one for the direct-axis component and another for the quadrature-axis component. The main advantages of this technique are the fast response and the little torque ripple [5].

Master’s Thesis .Figure ‎ 2. 6 CHALMERS.2: Diagram of the implemented FOC with feedforward compensation. Energy and Environment.

One is for the mechanical system (speed) and two are for the electrical system (d and q currents). those reference voltages are used by the PWM unit to generate the inverter‟s‎command‎signals. Iq. Vd. there are three PI regulators in the control system.ref and Vq. The‎tuning‎of‎the‎PI‟s‎(setting‎the‎P‎and‎I‎parameters)‎has‎bee n carried out with the following method proposed by [7].11) (2.17) (2. is used as an input for the PI regulator. The reference value is compared with the measured and then fed to the PI regulator.13) (2.ref [2]. The reference value.10) Where J is the inertia of the motor.18) CHALMERS. The PI outputs.15) (2. ωref. is compared with the measured speed. The d component error of the current.16) (2. Id. Feedforward compensation is used in d and q PI regulators according to equations (2. and the error signal. Reference frame conversion).5) and (2. This regulator compares the actual and reference speed and outputs a torque command. is fed to the speed PI controller. Then. εω. Tm is the mechanical torque applied in the shaft (load) and Te is the electrical torque developed by the motor. ωr. is zero in this thesis since there is no flux weakening operation.As shown in the figure. Moreover. with the equation (2. B is the viscous coefficient. At first. The torque is related to the speed by the mechanical equation of the motor: (2. there is another PI controller to regulate the q component of the current. Master´s Thesis 7 . εd.ref. Energy and Environment. (2. Once is obtained the torque command.ref.12) (2. to enhance the system performance.14) (2.9) can be turned into the quadrature-axis current reference.6). There is a PI controller to regulate the d component of the stator current. the reference speed. are first transformed to abc domain by the use of inverse Park and Clark transformations (see Appendix A.

and when the value of the current reaches its maximum. This causes a problem. A saturation block has been included to avoid exceeding the maximum torque and voltages allowed in the machine. 7. the integrator has wound up so that the voltage remains large [7]. 6. When these limits are reached. Master’s Thesis . All the current and speed regulators have been implemented taking care of the torque and voltage limits.Where αcurrent amd αspeed are the‎ controller‟s‎ bandwith‎ and fs is the switching frequency of the inverter (same as the sampling frequency of the system). the regulators control that the torque or voltage values do not overpass their maximum values. As it can be seen in the Simulink block diagram. 3. With the speed regulator. But whenever this value is overcome. With these values are computed the PWM signals required for driving the inverter. The integral term of the regulator keeps accumulating the error during the time of maximum voltage output. 4. so the response of the regulator is faster [7]. the q-current control the torque production. The voltage references are turned back into abc domain. a large overshoot of the current values caused by the integrator windup. To conclude with this chapter. anti-windup technique is used in the controllers. 2. the performance of the FOC block diagram can be summarized in the following steps [6]: 1. The current error signals are used in controllers to generate reference voltages for the inverter. a proportional value of the difference is added to the integrator. 8 CHALMERS. The reference value of torque or voltage is used to update the integral term of the regulator. The αβ currents are converted into a rotor reference frame using Park Transformation. Energy and Environment. To prevent this problem. 5. This dq values are invariant in steady-state conditions. as far as the voltage command is below its maximum value. The stator currents are measured as well as the rotor angle. the anti-windup loop returns a zero value to the integrator. a quadrature-axis current reference is obtained (the direct-axis reference is zero for operation below rated speed). The stator currents are converted into a two-axis reference frame with the Clark Transformation. The d-current controls the air gap flux.

3: Simulink model of the inverter.. the motor‎parameters.3 shows‎the‎inverter‟s‎Simulink‎model. CHALMERS.3 Simulation results Once reviewed all the theoretical aspects involved in this thesis..1 and the motor parameters are shown in Table ‎ 2.2. Finally.‎as‎well‎as‎other‎needed‎parameters‎to‎run‎the‎PI‟s‎or‎the‎inverter‎ is set in a Matlab file that runs before starting the simulation (see Appendix B. As an activation signal for each switch is used the PWM signal. Energy and Environment. Each subsystem such as motor. Figure ‎ 2.4 shows the motor model used. speed controller. PWM generation. the inverter and the reference frame transformation blocks.2. Inverter model Figure ‎ 2. according to their fundamental equations.‎ One switch per phase is used to set Vdc or –Vdc on the phase. Master´s Thesis 9 . Motor model The motor equations explained before are used to establish the motor model in Simulink.etc. the motor block. have its own model in Simulink. Matlab code and Simulink diagram blocks). The control parameters are presented in Table ‎ 2. Figure ‎ 2. an implementation of the whole system is be done using the software tool Matlab and Simulink. The whole system is composed of the controller block. inverter.

The proportional.4: Simulink model of the PMSM. Controller model In Figure ‎ 2. integral and anti windup parts as well as a saturation blocks for the torque limit are shown in the figure. Energy and Environment. Master’s Thesis . 10 CHALMERS.5 the whole controller system is presented.Figure ‎ 2.

Master´s Thesis 11 .5: Control diagram for FOC of PMSM.Figure ‎ 2. Energy and Environment. CHALMERS.

906 0 17.453 3 d-axis current command Speed reference for the first step Time when first step happens Speed reference for the second step Time when the second step happens *Variable step.time 2nd step.12 0. solver ode45 Table ‎ 2. Master’s Thesis .1 30e-3 30e-3 3 0.1: Control parameters Parameter fs Vdc Kpc_d Kic_d Kpc_q Kic_q Kpw Kiw Id_ref 1st step.time Unit Hz V ------A rad/s s rad/s s Value 5.000 400 Description Switching frequency DC bus voltage Proportional constant of d-axis current regulator Integral constant of d-axis current regulator Proportional constant of q-axis current regulator Integral constant of q-axis current regulator Proportional constant of speed regulator Integral constant of speed regulator 0 34. Energy and Environment.value 2nd step. max step size of 5e-5 s.002 5. Parameter Rs Ld Lq p phi_pm B J Unit Ω H H -Vs Ns/m kgm2 Value 7.Table ‎ 2.8e-4 Description Stator resistance Direct-axis inductance Quadrature-axis inductance Pole pairs Permanent magnet flux Viscous coefficient Inertia 12 CHALMERS.value 1st step.2: Motor parameters.

6: Mechanical speed (command in blue.7.6 shows the speed response of the system due to a step change in the command. 35 30 25 Mechanical Speed (rad/s) 20 15 10 5 0 0 1 2 Time (s) 3 4 5 6 Figure ‎ 2.9 respectively. CHALMERS. Figure ‎ 2. the system has a good dynamic response. Master´s Thesis 13 . actual in green). Energy and Environment. the results of the simulation are presented.Simulation Results Now. As it is shown in these figures. Figure ‎ 2. The electrical torque and the stator currents are shown in Figure ‎ 2.8 and Figure ‎ 2.

8: Motor stator current in abc domain.7: Electrical torque. Energy and Environment. 6 4 2 Stator Currents (A) 0 -2 -4 -6 0 1 2 3 4 5 6 Time (s) Figure ‎ 2.4 3 2 1 Torque (Nm) 0 -1 -2 -3 -4 0 1 2 3 4 5 6 Time (s) Figure ‎ 2. 14 CHALMERS. Master’s Thesis .

Energy and Environment. CHALMERS.94 2.98 3 3.9: Motor stator currents due to a speed step change.04 3.06 3.96 2.08 3.02 3. Master´s Thesis 15 .12 Time (s) Figure ‎ 2.5 4 3 2 Stator Currents (A) 1 0 -1 -2 -3 -4 -5 2.1 3.

Energy and Environment.Seven current sensors LEM LA 50-S for current measurements . Resolver coils are available from the motor through a 12-pin connector installed in the motor housing.1 shows a simple schematic diagram of the system. current.DC voltage source that provides the equipments with . grounding and so on All these equipment are installed/organized in the following way:  A measurement box that includes: .Two CP1103 dSpace board with analog and digital I/O .Connector terminals to electrically link different components The inverter box which includes: . Control system is based on the dSpace.A resolver-to-digital converter that measures rotor angle and speed .A CLP1103 dSpace board with luminous LEDs that show the state of the different signals    16 CHALMERS. Master’s Thesis .3 Practical implementation of a PMSM drive system An experimental system is designed to implement FOC of IPM that is explained in this chapter. Practical measurements results are added also.Three voltage transducers UMAT2 with three channels for voltage measurements each one . 3.A relay (C3-A 30) for the PMSM secondary winding connection to the grid . the hardware components are presented. including the following parts: .A voltage source that supplies the inverter control system . System architecture is presented firstly. Afterwards. rotor angle and speed measurement equipments dSpace DS1103 control system 24V relay An optocard for over current protection Various electrical items such as wires.A four leg switch-mode inverter that uses Mosfet switches (one leg is spare) .A designed electronic board to drive the relay The PMSM with double stator windings and the resolver already installed on the shaft.1 General hardware overview Figure ‎ 3.A voltage source that feeds the grid contactor . The equipments used in the lab setup of this thesis are listed below:        Permanent magnet synchronous machine Inverter Voltage. connectors.

So the secondary winding voltages and currents are measured by the transducers. the control system will be expanded to serve as an integrated charger described in [9]. that in case of over current in inverter. As mentioned before. there is a relay for connecting the three-phase grid voltages to the secondary set of windings. Energy and Environment. Moreover. CHALMERS. Master´s Thesis 17 . Lab setup diagrams. see Appendix C. shuts down the PWM signal to the transistors of the inverter to avoid damaging the converter A DIO interface card that receives the measurement signals and send an error signal to the optocard in case of over currents To check all the connections inside each subsystem and between them.- - The optocard.

Master’s Thesis .Figure ‎ 3. Energy and Environment.1: Simple schematic diagram of the drive system. 18 CHALMERS.

For PMSM. The primary side stator windings have wye connection. B and C) are called‎primary‎windings‎and‎the‎other‎(A‟. That means. Anyhow.1 Description Rated power Rated voltage Max. Speed Rated torque Max. Torque Stator phase resistance Direc-axis inductance Quadrature-axis inductance 0.2 3 Permanent magnet flux Pole pairs Inertia 0. This division is one of the key points of the „Isolated‎Integrated‎Charger‟‎that is explained in [9].‎B‟‎and‎ C‟)‎ are called secondary windings [9]. CHALMERS.3.5 1 000 5 000 3 5 7. The magnetic flux created by the permanent magnets has a fixed value. this thesis only related with the speed control of the motor and these secondary windings are not used. Master´s Thesis 19 . Table ‎ 3. each phase winding has been divided in two equivalent parts. One part of the three phase windings (A.1. The motor parameters used in the practical set up are listed in Table ‎ 3.1: PMSM parameters Parameter Pn [W] Un [V] Imax [A] ωn [rpm] ωmax [rpm] Tn [Nm] Tmax [Nm] Rs [Ω] Ld [H] Lq [H] [T] p J [kgm2] B [Nms] Value 2 000 420 1. Current per winding Rated speed Max. the inductances in direct and quadrature axes are the same values. Energy and Environment.2 PMSM The machine used in the practical setup is a surface mounted permanent magnet synchronous motor.002 Viscous coefficient The most innovative feature of this PMSM is its double stator winding.

2: Inverter characteristics. Output power Max.2: Inverter. Master’s Thesis . Switching frequency Figure ‎ 3. Detailed information can be found in [10]. Table ‎ 3. Table ‎ 3.‎The‎connection‎between‎the‎inverter‟s‎control‎circuit‎and‎dSpace‎is‎ done by a 25-pin D type connector that transmits six PWM signals. in the dSpace software section.3 Inverter A 4-leg inverter is used in the lab setup where one leg is left without use. Both are explained below. Energy and Environment.2 summarizes the inverter specifications. as well as two 20 CHALMERS. The duty cycle of each period is set by the controller and a conversion block. with 12 kHz period. The‎ control‎ of‎ the‎ inverter‟s‎ switching‎ is carried out by PWM pulses generated by dSpace three-phase PWM block. Current Max.3. Parameter VDC [V] In [Arms] Imax [A] Pmax [W] fmax [Hz] Value 0-600 10 15 7 000 20 000 Description Input DC voltage Rated rms current per phase Max.

Now. a deeper and detailed overview of the measurement hardware used will be presented. the following steps should be taken:      Connect all necessary cables (+15V. 3. To start up the inverter.3 it is shown where all those measurements are taken. Figure ‎ 3. All this data is obtained by means of the measurement equipment listed at the beginning of this chapter. In the Figure ‎ 3. Turn on the relay when the DC voltage has reached the desired level (~1s) 2. Master´s Thesis 21 . In this sketch there are other current and voltage measurements that are not needed for the purpose of this thesis. control system and load) Turn on the control system Turn on the low voltage supply Turn on the high voltage supply Start the control system by: 1.4 Measurement interfaces The‎ controller‎ of‎ the‎ motor‟s‎ speed‎ requires‎ certain‎ measurements‎ of‎ different‎ variables as voltages. Set FLT_CLR high 3. As it has been seen in chapter 2 (Figure ‎ 2. angle or speed. CHALMERS. currents.more command signals (relay and‎ fault‎ clear)‎ needed‎ for‎ the‎ inverter‟s‎ start‎ up‎ process. for the speed control of the PMSM is only needed to know the abc currents supplied to the motor and the speed and position of the rotor. Start switching 4. Energy and Environment.3: Schematic of the voltages & currents measurement points. DC supply. but are useful in future works with this setup (integrated charger for a plug-in hybrid vehicle). the inverter is ready for normal use [10]. That is the reason why these extras have been already installed. Set FLT_CLR low Once these steps are done.5).

Energy and Environment. as can be seen in Figure ‎ 3.4.4: Voltage transducer UMAT2.5: Sketch of the resistor ladder of the UMAT2 transducer. for measuring the DC voltage input of the inverter. For this purpose and considering that the voltage range to be measured is and the output signals of the transducers should be in the range .3. two of the transducers are used for two different three phase voltage measurements and the third transducer has only one channel in use. the following procedure has been performed: Figure ‎ 3. Each transducer has three different channels. with a common neutral point for three phase voltage measures. Figure ‎ 3. the input voltage goes through a resistor ladder that reduces the voltage level. three voltage transducers UMAT2 have been used. 22 CHALMERS. the reduced signal goes to the AD210 electronic device. As far as it is only needed 7 channels. an isolated amplifier.5 shows the used resistors ladder network.4. After. The transducer cards work as follows: first.1 Voltage measurements For the voltage measurements. Master’s Thesis . Figure ‎ 3. Resistors ladder design The resistor ladder had to be designed and soldered before the testing and mounting of the transducer.

The goal of these tests is to check the linear relation between the input and output voltages and also.3). Note that the way the transducer cards are named correspond to their position in the measurement box.2). 15 voltage measurements within the range 10-420 VDC have been performed.where the initial conditions are: (3. that the slope of this relation adjust to the theoretical slope obtained in equation (3.3). Energy and Environment. For that purpose. And the relation between both voltages corresponds to a voltage divider: (3. Testing of the voltage transducers Each channel of each voltage transducer has been tested before the final mounting. Master´s Thesis 23 . the resistors values chosen are: This gives the proportion between input and output voltage: (3. In Figure ‎ 3.6 are presented the results of the tests for each voltage transducer. According to (3.2). CHALMERS. connecting the transducer to a high voltage source.1).

291%.189%.02411.02485. Master’s Thesis Error = 1. slope = 0. The errors computed correspond to a nominal voltage measure (400 V). For the lower transducer the slope is: 24 CHALMERS. Channel 2.02408.681%.886%. Channel 3.877%. For the mid transducer the slopes of each channel are: Channel 1. slope = 0. Energy and Environment.02411.2 red = chan. Channel 3.1 green = chan. For the upper transducer the slopes of each channel are: Channel 1.02488. .3 450 400 400 350 350 300 300 U2 [V] 250 U2 [V] 0 2 4 6 8 10 12 250 200 200 150 150 100 100 50 50 0 0 0 2 4 6 8 10 12 U1 [V] U1 [V] black = theor.3 450 400 350 300 U2 [V] 250 200 150 100 50 0 0 2 4 6 8 10 12 U1 [V] Figure ‎ 3. Now. Error = 1. Error = 1. Error = 0. Channel 2.02459. blue = chan. slope = 0.3 450 black = theor. the real slope of each channel is computed.189%.6: Voltage transducers test.2 red = chan. The voltage transducers have a good performance in terms of linearity and error. slope = 0. Error = = theor. slope = 0. Error = 1.1 green = chan. blue = chan. slope = 0. red = chan. in order to use that value in the future programming for the real time application that will control the lab tests.

This I2 flows through a resistor (Rmeas) producing a voltage drop (Umeas).8 a real picture of the modules is shown. This device.7 can be seen a sketch of the working principle of the LEM module. outputs a secondary current (I2) proportional to the current that is measured (I1). Figure ‎ 3.02426. This voltage is the signal that dSpace receives. Figure ‎ 3. LEM LA 50-S/SP1. In Figure ‎ 3. Error = 0. with galvanic isolation between the primary and the secondary circuit.Channel 3.499%. seven LEM LA 50-S/SP1 modules are used.8: Current probes. Master´s Thesis 25 .4.2 Current measurements For measuring the currents. 3. slope = 0. Energy and Environment. In Figure ‎ 3.7: Current measurement using LEM module. CHALMERS.

6) If we choose a Rmeas =‎200‎Ω.9966 3 0. shown in Table ‎ 3. LEM module Experimental slope [V/A] 1 1. generates and sends a 26 CHALMERS.3 Position and speed measurements Both. are the value used in the lab tests. For nominal currents below 50 A.Parameters design The voltage signal Umeas should be between . Master’s Thesis .4) Where N is the number of turns.4. the relation between the secondary current and the output voltage has to be used to compute Rmeas: (3.‎the‎linear‎relation‎between‎I1 and Umeas is unitary.‎ according to the data sheet). The results of these tests showed that a good linear relation exists between the input current and the output voltage and that the experimental slope of this relation is almost the expected value (less than 1% error in the worst case). according to the data sheet of the LEM module is: (3.4) and (3. So N = 10 turns is selected. the relation between the input and output currents. To begin with. a better accuracy is obtained by having several primary turns.5) Combining equations (3.0060 5 0. Table ‎ 3. Anyway. This converter. pictured in Figure ‎ 3.9773 4 1. Energy and Environment. It is needed to choose an appropriate number of turns of the primary circuit as well as a value for R meas (between 0-300Ω. Now.5) it is obtained: (3. so the relation between the output voltage and the input current is determined.9: Resolver-to-digital PBC.3. rotor position and speed are measured with a resolver-to-digital converter. the experimental slopes.9833 6 1. Testing of the current modules Each current module has been tested with 26 different current values between 0-6 A.3: Experimental slopes of the LEM modules..9906 3.0026 7 0.0040 2 0.

input Max R1 R2 C1 C2 R4* R3 C3 R6** Typ. Components selection Components HF Filter Gain scaling AC coup of ref. These two measured signals are processed by the resolver-to-digital converter. VCOrate=trackin Comments May be omitted.400E+04 2. Finally.4.000E+05 1.sinusoidal reference waveform to a coil mounted in the rotor. Table ‎ 3. In the board of the converter there is an option for choosing the resolution. and the angle is extracted in a digital word.400E+04 6. The number of digital bits for the angle measurement is programmable by the device.631E-10 1. The selection is shown in Table ‎ 3.9: Resolver-to-digital PBC.6 k 15 . Master´s Thesis 27 . In our case the appropriate resolution is 12 bit. Then.333 Unit s Ω Ω F F Ω Ω Ω F rps CHALMERS.631E-10 6. Then. Some other trimming had to be done to tune the reference wave generation or remove the offset in the output. and measure induced voltages in the two coils mounted on the stator. C1=C3 If R1 & C2 are used If R1 & C2 aren't used Value For 12-bit 2.333E+05 4. R2=R3 Same value than R1 Same value than C2 May be omitted.4: External component selection for the resolver-to-digital PBC. Figure ‎ 3.000E+05 1. Values 15 . which is AD2S83 in this case. which is the highest one that permits measuring up to 5000 rpm.6 k / πR1fref) 1/(2πR1fref) Edc/(300e-9) Edc/(100e-9) k > 1/(R3fref) T = VCOrate/(2N) R3 in ohms N=resolution. some external components have to be mounted in the printed circuit board.000E-09 83. Energy and Environment.

063 20.667 4.500 16.016 6.078 24.008 4.800 5.333 66.141 40. resolution.200 8.125 36.333 12.81e10/(Tn ) 21/(R6fbw2) 5C4 4/(2πfbwC5) rate(rps) n=bits per revolution.333 41.667 75.000 58.167 8.400 0.667 50. Master’s Thesis .400 3.995E+05 1.684E-11 8.000 4.600 2.800 1. Speed rpm 100 250 500 750 1000 1500 2000 2500 3000 3500 4000 4500 5000 Hz 1. With‎these‎component‟s‎values.047 16.‎the‎output‎from‎the‎speed‎meter‎ is presented in Table 3.667 25. min R6 6 k Choose fbw according to resolution 1.094 28.400 7.160 0.200 4.000 33. ‎ Table ‎ 3.track rate Closeloop BW select C4 C5 R5 R6=6.110 32.000 83. Energy and Environment.024E+06 Ω F F Ω Where: * ** for 12 bit resolution bits per revolution should be 4 times lower than for a 12 bit Note: according to the data sheet.803 2.333 Current µA 0.024 8.031 12.600 6.200 1.5: Output voltage for different rotor speeds.5.421E-11 3.157 Vout V 0.000 Testing and tuning of the resolver-to-digital transducer 28 CHALMERS.

this lab setup will be used for charging purposes.5 Connection to the grid by a relay In future works. but this signal is 5 V and the relay control system needs 24 V to close the contacts. after the conversion from mechanical to electrical angle. This circuit receives the TTL signal and a 24 V signal. For the machine rotating at no-load.10. angle. Master´s Thesis 29 .11 and Figure ‎ 3.10:‎Rotor‎angle‎(left‎bottom). CHALMERS. the phase A voltage (red wave) peak is aligned with the 0 rad. In order to solve this voltage difference. Energy and Environment. The Clark and Park transformations are used to transform three-phase voltages to the stationary and rotating reference frames αβ and dq. The TTL signal activates the transistor allowing the 24 V signal reach the relay control circuit. As it can be seen in Figure ‎ 3. and once both voltages are synchronized.12 shows the implementation. A scheme of the circuit can be seen in Figure ‎ 3.‎αβ‎voltage‎(right‎top)‎and‎dq‎voltage‎ (right bottom). Some control has to be done to achieve this goal. That means that we can suppose the voltage to follow a sinusoidal waveform. 3. This threephase relay is activated by a TTL signal sent by dSpace. secondary and grid voltage should be synchronized (amplitude and phase).The measuring of the rotor angle was tested and tuned (there was need to synchronize the 0 rad output with a magnet axis) running the machine as a generator and measuring the angle and voltages induced. Figure ‎ 3. the voltage has just q component and d component is zero. In order to connect the secondary windings of the motor to the grid. The resolved angle output is compensated by an offset angle. the relay closes the connection. an electronic circuit has been designed.‎abc‎voltage‎(left‎top).

as well as send signals from the computer to the devices in order to control them. It is used to connect different kind of signals (analogue or digital) that measurement devices obtain to a computer. 30 CHALMERS. with different analogue I/O and digital I/O. Figure ‎ 3.24 V TTL (5 V) 1 kΩ 100 kΩ 0.6 dSpace system The dSpace system is a tool used to build real-time control systems. Energy and Environment.. inverter. by means of the analogue and digital I/O. measure sensors. 3.. The dSpace system model used in this setup is CP1103 system.11: Scheme of the relay activation circuit.1 µF 15 V 0V Figure ‎ 3. Master’s Thesis . The controller has to be programmed and then.) and the computer. The dSpace system is the interface between the physical world (motor. some command signals are sent to the system and the measured values are received.12: Three-phase relay (left) and relay activation circuit (right). from where the lab tests is controlled and the results are plotted.

the controller block is triggered with an interrupt generated within the measurement block. This is a square signal that indicates when the data in the resolver transducer has to be updated and when has to be sent to dSpace. Special attention should be placed in the Simulation > Configuration Parameters. The resolver is driven by the inhibit signal. and these signal are the input to the PWM block. This inhibit signal (12 kHz square) is also used to trigger the interrupt that drives the controller block. The purpose of that is to synchronize all the measurements with the peak of the carrier wave (triangular wave) of the PWM. The‎inverter‟s‎model‎ is removed. The‎solver‎type‎should‎be‎“Fixed-step”. a gain of 190 has to be added because dSpace reduces in 10 times the input value (a input correspond to in Simulink). The solver is‎“ode1 (Euler)”. The next modifications should be done before running a real time application:     The stop time is set‎to‎“inf”. Then. Only few parts have been changed. the program would return an error message when trying to compile. data is being updated. where it is obtained the duty cycle of each phase of thee PWM. The PWM block is changed for the PWM three-phase generation that includes the RTI library in Simulink. Some blocks are added to initialize the inverter. The controller. The modifications carried out to the original Simulink program (the one used for the simulations in chapter 2) are as following:  Some ADC block are added for receiving the voltage. All the changes performed to the original Simulink blocks of chapter 2 can be seen in Appendix E. The measurement block is triggered with the PWM interrupt block. current and speed measurements. When inhibit is low data is sent and when is high. A new block dedicated to the resolver has to be added.Software part The dSpace programming has been carried out using Simulink. Apart from the linear conversion mentioned in the measurement equipment description. so when the data capture is finished all the operations required for the control will begin.      The system has been organized in two main blocks: measurements and controller. as well as the Clark and Park transformations remains the same. These modifications are shown in Appendix E. Now the voltage command get to a conversion block. added or removed. Without these modifications. dSpace software implementation. Master´s Thesis 31 . The motor model is removed. CHALMERS. Most of the model is equal to the one used in chapter 2 for the simulations. Instead there is the real PMSM. Energy and Environment. dSPace software implementation. All the measurements are captured at the same time (with a sampling time of 12 kHz). The block reduction option in the optimization menu should be unmarked. Instead there is the real inverter.

13: Layout of the dSpace instrumentation panel. slide bars. Energy and Environment. By connecting the Simulink variables to plotters.‎the‎inverter‟s‎initialization‎commands‎ and the grid contactor operation 32 CHALMERS. Figure 3.The other software tool used is ControlDesk. Hardware part The dSpace boards CP1103 and CPL1103. Lab setup diagrams):      One analogue input for the speed Two analogue inputs for the DC current and voltage (input of the inverter) Three analogue inputs for the three phase currents which feed the PMSM The master digital I/O for controlling the resolver-to-digital board.13 shows the instrumentation panel used for this experiment. With ControlDesk is possible to create instrument panels whit control. display and plotting possibilities. leds. displays. as well as the master and slave digital I/O. shown in Figure ‎ 3. Then. speed or torque waveforms.. or check the current. ‎ Figure ‎ 3. these boards provide some inputs and outputs to be connected to the external devices. In this project 6 analogue inputs (ADC) are being used. Master’s Thesis . The connections are the following (and can be seen also in Appendix C..14.etc the user can modify constants or command values. are connected to the host PC. and read the 12-angle bits The‎slave‎digital‎I/O‎for‎the‎PWM‎pulses.

16 shows the speed response of the system due to a step change in the speed command. when the charging tests are performed. respectively.14: dSpace connections boards CP1103 and CPL1103. Figure ‎ 3. As it is shown in these figures. 3. Figure ‎ 3. Master´s Thesis 33 . Energy and Environment.The hardware system is already prepared to use another 9 analogue inputs that measure the three phase secondary currents and voltages as well as the grid voltage. CHALMERS. The zoomed stator currents for each speed step are shown in Figure ‎ 3.17 and Figure ‎ 3.18. the results of the experimental test are presented. the system has a good dynamic response.15 and Figure ‎ 3.7 Experimental results Now.

Master’s Thesis .16: Electrical speed. Figure ‎ 3. 1st step.Figure ‎ 3. Energy and Environment. 34 CHALMERS.15: Electrical speed. 2nd step.

Figure ‎ 3. Master´s Thesis 35 .Figure ‎ 3. Energy and Environment.18: Stator currents in abc domain due to the second speed step.17: Stator currents in abc domain due to the first speed step. CHALMERS.

inverter.1 Conclusions Field-oriented control of a permanent magnet synchronous motor is designed. To improve the system performance in terms of torque ripple. Energy and Environment. Master’s Thesis . some lab tests were carried up to check the validity of the simulation results. as well as models for the PWM signal generator.2 Future work The current hardware will be extended to implement an isolated integrated charger as explained in [9]. Afterwards a lab setup was implemented using a 2 kW PMSM and dSpace as the computer-system interface.4 Conclusions and future work 4. After the calibration of every measuring device and the proper corrections of the controller model. 4. power quality and better DC voltage utilization. The results show that the system has a good dynamic response. the whole drive system is simulated by the use of Matlab/Simulink. 36 CHALMERS. The speed estimation can be improved by the use of Kalman filters. The results of the simulation show the good response of the model when tracking a command speed. simulated and implemented in this thesis. a model for the machine has been developed in Simulink. With the motor equations. The classical PWM method is used to generate the requested motor voltages. controller and Clark and Park transformations. Firstly. The speed is estimated by the measurement of the position. space vector modulation can be employed.

Ohio State University.‎S. Vol.‎ Master‎ of‎ Science‎ Thesis‎ in‎ Chalmers‎ University‎ of‎ Thechnology.‎Applied‎signal‎ processing‎ and control. [8]‎ Sylvain‎ Lechat‎ Sanjuan. Firouzjah‎ amd‎ S.‎ “Sensorless‎ Field‎ Oriented‎ Control‎ of‎ PMSM‎Motors”. Gary‎L.‎Microchip‎Technology‎Inc.‎ Front.‎“Control‎ of‎Variable-Speed Drives”. China. A.‎ Microchip‎ Corporation. 5. Department of Electrical and Computer Engineering. Göteborg.‎ “Trends‎ in‎ AC‎ Drive‎Applications.‎ Thesis for the degree of Doctor. 2010. February 2002. Göteborg. 2008. Master´s Thesis 37 . 1999.‎ “Predictive‎ FieldOriented Control of PMSM with Space‎ Vector‎ Modulation‎ Technique”. Sonja Lundmark. division of Electric Power Engineering. 2. Sweden.‎ Chalmers‎ University‎ of‎ Technology. [12] Saeid Haghbin. 90. division of Electric Power Engineering. [7]‎Lennart‎Harnefors.‎Chan. Construction and Evaluation”.‎ “Nonlinear Backstepping Control of Permanent Magnet Synchronous Motor (PMSM)”. division of Electric Power Engineering. Ola Carlson‎ and‎ Mats‎ Alaküla. Vol. Standard Drives Division..‎ Master‎ of‎ Science‎ Thesis‎ in‎ Electric‎ Power‎ Engine ering. September/October 1991. Göteborg. Mälardalen University. Engineering and Technology 45. department of Energy and Environment. [9]‎ Saeid‎ Haghbin.‎ Rockwell Automation.‎World‎Academy‎ of Science.‎ Chalmers University of Technology.‎“Position-sensorless control of permanent magnet synchronous machines over‎wide‎speed‎range”.‎Merzoug‎and‎F.‎Schlegel.‎ “An‎ Isolated‎ Integrated‎ Charger‎ for‎ Electric‎ or‎ Plug-in Hybrid Vehicles”‎ thesis‎ for‎ the‎ degree‎ of‎ licentiate‎ of‎ engineering. 2010.‎Skibinski‎and‎David‎W. September 2002. Chalmers University of Technology.‎ department of Energy and Environment.‎ Lesan.‎ “Four‎ Phase‎ Switch-Mode Inverter. 27.‎ ” [4] Russel J.‎ “Voltage‎ Oriented‎ Control‎ of‎ Three -Phase Boost PWM Converters”. Göteborg. Sheikholeslami. Eng.‎ Electron. G. K.References [1] Merzoug and Benalla. 2011 [13] Pragasen Pillay and Ramu‎ Krishnan. 2010. [6]‎ Jorge‎ Zambada.‎2007.‎ Electr. [14]‎M. Heydari. department of Energy and Environment. Sweden.‎IEEE‎Transactions‎of‎ Industry Applications. [11]‎C.‎Naceri.‎“Comparison‎of‎Field-Oriented Control and Direct Torque‎Control‎for‎Permanent‎Magnet‎Synchronous‎Motor‎(PMSM)”. department of electronics. Energy and Environment.‎C.‎“The‎State‎of‎the‎Art‎of‎Electric‎and‎Hybrid‎Vehicles”. Sweden. [2] Song‎Chi. [3] Victor‎ R.‎ “A‎ Combined‎ Motor/Drive/Battery Charger Based on a Split-Windings‎PMSM”.‎”AC‎Drives:‎Year‎2000‎(Y2K)‎and‎Beyond”. No. Kerkman. 2011. No.‎ “Application‎ Characteristics‎ of‎ Permanent‎ Magnet‎‎Synchronous‎and‎Brushless‎dc‎Motors‎for‎Servo‎Drives”. Algier 2010. [5] F.‎ Department of Electrical Engineering. [10]‎ Kristoffer‎ Berntsson.‎Proceedings‎of‎ the IEEE.‎ Stefanovic. CHALMERS. University of Mentouri Constantine.

This format is called space vector: (A. Reference frame conversion First of all. real and imaginary. this three phase system can be written with only two components. the transformation will have certain characteristics.1) Now.2) The K factor is a scaling constant. Energy and Environment. The transformation is given by the following matrix: (A.4) The typical values for the K constant are: 38 CHALMERS. and depending on the value that takes.Appendices Appendix A. it should be defined a three phase magnitude (can be either voltage or current) as follows: (A.3) And the inverse transformation is given by the matrix: (A. Master’s Thesis .

the previous varying values of flux.8) (A. Master´s Thesis 39 .5) Where . voltages or currents are converted into constant values. The transformation matrices are the following: (A.9) Sources [2. Energy and Environment.‎ This‎ transformation‎ “makes”‎ the‎ previous‎ stationary axis to spin with frequency and so.Table A.6) (A.1: K constant choices Amplitude invariant RMS-value invariant Power invariant To convert from the three phase or the stationary two-axis reference frames to the rotating two-axis reference frame (dq axis) is applied to the previous space vector the next transformation: (A.7) And the inverse transformation matrices are: (A.‎ the‎ electrical‎ angle. 8] CHALMERS.

p = 3. Lq = 30e-3. phi_pm = 0. constant of d-axis current reg. Kpc_q = alpha_i*Lq. constant of speed reg. Kic_q = alpha_i*Rs. constant of q-axis current reg. %Parameter used for Kp & Ki %Prop. %Stator resistance %d-axis inductance %q-axis inductance %Permanent magnet flux %Pole pairs %Inertia %Viscous coefficient %Base speed %Max. Matlab code and Simulink block diagrams Matlab code of the file Parameters.12. Kpc_d = alpha_i*Ld. Wbase = 1000*pi/30. 40 CHALMERS. % Current PI parameters Fs = 10e3. Ld = 30e-3.Appendix B.1. B = 0. % Speed PI parameters alpha_w = alpha_i/10. Kic_d = alpha_i*Rs. constant of speed reg. Master’s Thesis . speed %Rated power %Rated torque %Inverter's Swithcing frequency 10[kHz] %Parameter used for Kp & Ki %Prop. Kiw = alpha_w*B.constant of d-axis current reg.002. % Electric Power Engineering Department % Chalmers Tekniska Högskola % % March 2011 %//////////////////////////////////////////////////////////////////// clear all % PMSM parameters Rs = 7. Prated = 2000. % Controller parameters Vdc = 400.m %//////////////////////////////////////////////////////////////////// % 2 kW motor parameters % % Master thesis student David Vindel Muñoz. Trated = 3. %Int. alpha_i = 2*pi*Fs/10.8e-4. Wmax = 5000*pi/30. Energy and Environment. %Prop. constant of q-axis current reg. J = 5. %Int. %Int. Kpw = alpha_w*J.

Energy and Environment. Master´s Thesis 41 .Simulink diagram blocks: 1. Main system CHALMERS.

Energy and Environment.2. Master’s Thesis . Speed controller 42 CHALMERS.

Master´s Thesis 43 .3. Clark & Park reference frame conversion (direct) 4. Energy and Environment. PWM generation CHALMERS. Clark & Park reference frame conversion (inverse) 5.

6. Permanent magnet synchronous machine model 44 CHALMERS. Inverter 7. Master’s Thesis . Energy and Environment.

Energy and Environment.Appendix C. Lab setup diagrams CHALMERS. Master´s Thesis 45 .

Energy and Environment.46 CHALMERS. Master’s Thesis .

Master´s Thesis 47 .CHALMERS. Energy and Environment.

48 CHALMERS. Energy and Environment. Master’s Thesis .

datasheetcatalog. as well as in other similar pages. the data sheet of each component is presented.1. Device Voltage PBC AD210 Current Probes LA50S/SP1 AD2S83 XR2206 Resolver PBC L272M LM234 PBC scheme C3 A30 Three-Phase Relay IRF830 Mosfet for the driving circuit 3-port isolation amplifier LEM modules for current measurements Resolver to digital transducer Monolithic function generator Dual operational amplifier Low quad operational amplifier Overall scheme of the PBC 3-phase relay Component UMAT2 Description Voltage transducer for voltage measurements Below. so only the first pages are included. or part of it of each component is attached. the data sheet of one component is too extensive. Master´s Thesis 49 . Energy and Environment. Each device is constructed with different components as mentioned in D. In case of need of the whole document. the data sheet. Data sheet of experimental equipments The experimental equipment used in this thesis is introduced in chapter 3. Table D.Appendix D. In some cases.1: devices and components. it can be found in the web page www. In this appendix.

Master’s Thesis .CURRENT PROBE LEM LA 50-S/SP1 50 CHALMERS. Energy and Environment.

Master´s Thesis 51 . Energy and Environment.CHALMERS.

VOLTAGE TRANSDUCER UMAT2 52 CHALMERS. Energy and Environment. Master’s Thesis .

CHALMERS. Energy and Environment. Master´s Thesis 53 .

Master’s Thesis . Energy and Environment.54 CHALMERS.

Master´s Thesis 55 .CHALMERS. Energy and Environment.

Master’s Thesis . Energy and Environment.RELAY C3-A30 56 CHALMERS.

MOSFET IN RELAY ACTIVATION CIRCUIT (IRF830) CHALMERS. Master´s Thesis 57 . Energy and Environment.

Energy and Environment.RESOLVER. Master’s Thesis . RESOLVER-TO-DIGITAL CONVERTER (AD2S83) 58 CHALMERS.

CHALMERS. Energy and Environment. Master´s Thesis 59 .

Master’s Thesis . Energy and Environment.60 CHALMERS.

CHALMERS. Master´s Thesis 61 . Energy and Environment.

62 CHALMERS. Energy and Environment. Master’s Thesis .

Master´s Thesis 63 . Energy and Environment.RESOLVER. FUNCTION GENERATOR (XR-2206) CHALMERS.

Energy and Environment. Master’s Thesis .64 CHALMERS.

CHALMERS. Master´s Thesis 65 . Energy and Environment.

DUAL OPERATIONAL AMPLIFIER (L272M) 66 CHALMERS. Energy and Environment.RESOLVER. Master’s Thesis .

CHALMERS. Master´s Thesis 67 . Energy and Environment.

Energy and Environment. Master’s Thesis .68 CHALMERS.

POWER QUAD OPERATIONAL AMPLIFIERS (LM324) CHALMERS. Master´s Thesis 69 . Energy and Environment.RESOLVER.


CHALMERS, Energy and Environment, Master’s Thesis

CHALMERS, Energy and Environment, Master´s Thesis

Appendix E. dSpace software implementation.
1. Main real-time system.

2. Current and DC bus measurements.


CHALMERS, Energy and Environment, Master’s Thesis

3. Analogue inputs reading.

4. Angle measurement.

CHALMERS, Energy and Environment, Master´s Thesis

6. Master’s Thesis . Speed calculation. Operations. Energy and Environment.5. 74 CHALMERS.

Inverter‟s‎initialization‎blocks. CHALMERS. Master´s Thesis 75 .7. Energy and Environment.