Lab 8. PMSM – Sinusoidal Commutation

Updated Sp14, ADH

8.1 Introduction

In the last laboratory experiment, you have implemented the commutation logic for a Brushless DC motor (BLDC). The BLDC machine uses low-resolution position sensors (Hall Effect devices) to maintain the stator current space vector at an angle of approximately 90 degrees from the rotor field. Due to the low resolution position sensor, however, the phase currents are trapezoidal, and torque ripple is inevitable. In contrast, the Permanent Magnet Synchronous Motor (PMSM) utilizes a high resolution position sensor, such as an encoder, to maintain the current space vector at exactly 90 degrees from the rotor field. That is, the phase currents can now be sinusoidal. Thus, higher performance (low torque ripple) can be obtained with the PMSM although overall cost is higher.

In this experiment, the voltage control of a three-phase Permanent Magnet Synchronous Motor (PMSM) will be studied. Real-time Simulink and layout files are used to perform a basic voltage control of the PMSM in this experiment. The objective is to understand how maximum electromagnetic torque from the motor is achieved, when stator current space vector is maintained perpendicular to the rotor magnetic field. This angle can be changed in real-time (using ControlDesk) to verify the decrease in electromagnetic torque.

Referring to the motor model shown in Fig. 1, and as discussed in class, the current space vector is chosen so that

. (1)

In eq. (1), addition is used for CCW torque, and subtraction for CW torque. Therefore,

. (2)


From (1) and (2), the actual phase currents can be determined:

(3)

This equation demonstrates that the stator currents are “synchronized” (hence the term “synchronous motor”) with the rotor angle, and it is the rotor position feedback that advances the phase currents through a complete cycle. It is also important to understand that the rotor angle used in (3) is measured in electrical (or magnetic) degrees, and that electrical and mechanical angles are related by the number of poles in the motor:

(4)

The encoder used in this experiment (the most widely used type of encoder) is commonly called an incremental encoder. Incremental encoders provide a set of quadrature pulses (quadrature allows direction of rotation to be determined) as they are rotated. Counting the pulses since gives rotor position since system powerup, but the absolute position is not known unless the initial position (at system powerup) is known. In practice, this problem is addressed in one of several ways:

One common method is to use an index pulse from the encoder. The index pulse is a once-per revolution pulse that is aligned at installation (or commissioning of the system) so that it occurs at a known position[1]. Therefore, at startup, the motor is advanced slowly in one direction for at least one full revolution (mechanical) until the index pulse occurs. At this point, the rotor position is reset to its known value, and the pulses counted from that point forward will yield the absolute rotor position (since initial condition is known).

Another way to address this issue is to excite two phases (similar to what we did in the BLDC lab) to “lock” the rotor in a known position. While the rotor is locked in the known position, the rotor position is initialized. The rotor is released, and the counting of encoder pulses from the initial position will again yield absolute rotor angle from that point on. We will use this latter approach in this laboratory. Specifically, we will put + current into phase A, and negative currents (of equal value) into phases B and C. This will lock the rotor to 0 degrees, and we will initialize the encoder position to zero after locking the rotor to that position.

8.2 Procedure

8.2.1 Connections

Connect the encoder of the PMSM motor (8 pin round connector) to the DSPace connector panel using the supplied cable. At the connector panel, the cable plugs into the INC1 (encoder). The other cable end (37 pin D connector) need not be plugged in since we are not using the Hall Sensor Feedback.

Connect the 42V Power Supply to the Converter Board using two banana connectors. Also, connect phases A1, B1, and C1 of the converter board to the BLDC Motor: If using an older motor (round enclosure) A1 goes to the BLDC phase A (we will consider the RED jack to Phase A), B1 goes to Phase B (the YELLOW jack), and C1 goes to Phase C (the BLUE jack).

If using a newer motor (square enclosure) A1 goes to the BLDC phase A (the GREEN jack), B1 goes to Phase B (the YELLOW jack), and C1 goes to Phase C (the BLUE jack). Do not turn on the 42V supply until you are ready to test the motor.

Connect the CURR. A1 (phase-current measurement port) on the drives board to the Channel ADCH5 of CP 1104 I/O board. Also, connect the encoder output (mounted on the DC-motor) to the INC1 9-pin DSUB connector on CP 1104 I/O board and the +/- 12V supply to the board connector. Make certain that the 12V supply does not exceed 12V (more than 12 can damage the board). After the voltage is verified to be 12V, turn on the ANALOG power switch on the board – the LED indicator for ANALOG POWER should now be lit.

If you rotate the BLDC motor shaft slowly, you should see the Incremental Encoder Sensor signals changing on the LEDs of the connector panel. If not, consult your instructor.

8.2.2 Software Setup

·  Launch Matlab (same procedure as previous labs) and then Simulink.

·  In Simulink, open a new model. [File → New → Model]

·  Create a new file folder (e.g. PMSM_LAB). Always remember to point the Matlab path to this folder used to hold your current file.

·  Set the Simulation Parameters using Simulation→Configuration Parameters: set stop time to inf, fixed step size is .0001 sec., solver is ODE4 (Runge-Kutta), and all optimization is disabled. To disable all optimization, all blocks at the top of the menu under the Simulation and Code Generation section should be unchecked and the compiler optimization level at bottom of menu set to “optimizations off”. Also, the Real Time Workshop Target Selection system target file should already be set to rti1104.tlc. If not set it as such.

·  Construct the simulink model as shown in Fig. 8.1.

·  Some of the specific block settings, if they are not shown in the figure are given below:

o  Rather than building a new “averaging block”, again, you should use the one from your previous Lab MDL files. Otherwise, you must construct it again, and it should look similar to Fig. 8.2

o  In the PWM block, the PWM frequency should be set to 40000, and the dead time set to 0.

o  The DS1104ENC_POS_C1 block and DS1104 ENC_SETUP blocks can be found in the dSPACE library RTI1104→ MASTER PPC. The default parameters for these blocks are suitable for this application.

o  The blocks labeled Fcn through Fcn2 implement part of Eq. 3. However, mathematical blocks in simulink assume angles are in radians, so eq. 3 must be modified accordingly (as indicated in Fig. 8.1) A Function Block (Fcn) operates on an input vector. In this case, the vector consists only of one variable (the rotor angle). This variable is accessed as u(1). If the input vector contained several variables, the second element would be accessed by using u(2). Fig. 8.3 shows an example of how to set up one of the Fcn blocks. The function blocks can be found in the User-Defined Functions Library.

o  Set up the Switch blocks (Switch, Switch1, and Switch2) as in Fig. 8.4. Be sure to set “criteria for passing first input” in that block to the setting shown in Fig. 8.4 (I.e. u2~=0). This block is found in the Commonly Used Blocks library.

o  The set up the Fcn3 block as shown in Fig. 8.1. This block produces a “modulo” output that will “wrap” the rotor angle from 2*pi to zero. The equation in the block should be: rem(u(1),2*pi)

o  Set all gains as indicated in Fig. 8.1.

o  The Detect Change block can be found in the Logic and Bit Operations library.

o  The counts_per_rads block (in Fig. 8.1) should have its gain set to:

-((poles/2)/1000) * 2*pi

For 1000 encoder pulses per mechanical revolution, this gain has output units of radians. The negative sign is necessary to match the encoder wiring (direction) to the model of the PMSM. Note also that you should have determined in the BLDC lab that the older machines (round enclosure) has 10 poles. The newer machines (square enclosure) has 8 poles. SET YOUR GAIN BLOCK APPROPRIATELY! Fig. 8.1 is representative of the 10 pole setup. Adjust it accordingly is you have the 8 pole machine

o  The gain of the block after the voltage input Vpmsm should be set to 1/Vd as usual

o  The Gain4 block in Fig. 8.1 should be set to 2*pi/(1000*.0001). This converts encoder pulses per sample period into mechanical radians per second (speed output)

·  Name all blocks something similar to the names given in Fig. 8.1 (with exception of any block labeled DS1104xxxxx).

·  The model obtained should look like the one shown in Fig. 8.1. Before building the real-time model, don’t forget to define and Vd as global variables at Matlab prompt. Set Vd=36 Volts by typing Vd=36 at the Matlab prompt.

·  Build (CTRL+B) the Simulink model.

Fig. 8.1: PMSM Control Model

Fig. 8.2: Averaging Model Block

Fig. 8.3: Configuring a function block

Fig. 8.4: Switch Settings

8.2.3 Creating Control Desk Layout

·  Start Control-desk and create a new project and experiment in the same working directory as that of Simulink file. Set the working root to your file folder. Load the variable file (*.sdf) which should have been written by Simulink.

·  To your layout, drag all necessary controls (a slider gain control, displays, checkbox, and a plotter onto the layout so that it looks similar to Fig. 8.5.

Fig. 8.5: ControlDesk Instrumentation Layout for PMSM Experiment

·  Drag and drop V_pmsm from the variable browser onto slider gain control.

·  Assign the phase current to the plotter. The phase current will be available at the output of the gain block that multiplies the ADC output by 20.

·  Assign the checkbox to the output of the “Zero Position” constant (as labeled in Fig. 8.1. The purpose of this checkbox is to force the rotor to a known location (0 degrees) and to reset the encoder (i.e. a home location).

·  Assign the display to the rotor angle in degrees (the rads_to_deg block in Fig. 8.1)

·  Assign the rotor speed to the other display. This will be the output of the averaging block.

·  Using the Variable Properties menu (right click) for the VOLTAGE COMMAND slider, set the voltage command limits to +/- 10 volts. This will prevent unnecessarily high voltage commands.

·  You may also wish to add a NUMERICAL INPUT block into your layout for a more precise command voltage.

The experiment should look similar to the one shown in Fig. 8.5.

8.2.4 Initializing the Rotor Position

In this part of the experiment, you will initialize the rotor position to a known position, and then initialize the accumulated encoder count so that it matches the known rotor angle. This is necessary because the laboratory setup uses an incremental encoder, as described in the introduction to this experiment.

·  Go online and click "Start Measuring."

·  Make sure that the “zero position” checkbox is selected on the layout screen.

·  Turn on the 42 volt power supply, and adjust the voltage to 36 V.

·  Try to turn the rotor (carefully, by hand). You should feel that it is locked into a known position by the selected stator currents. The position is known because we know which phase coils are activated, and the polarity of the phase currents. If the rotor freely rotates when the “zero position” checkbox is selected, consult with your instructor.

·  Put the voltage command slider exactly at 0 volts.

·  Deselect the “zero position checkbox”

·  Rotate the rotor shaft by hand. You should be able to rotate it now. Slowly rotate the shaft one revolution, while looking at the CP1104 connection panel LED for the INDEX of the encoder. When you see the INDEX pulse light, record the angle (as displayed on the ControlDesk Layout) at which the Index pulse from the encoder pulse occurs. Compare this value with that given at the bottom of page 2 (of this handout) for your PMSM. Record the value below.

PMSM Motor # (on baseplate) ______

Angle at which index pulse occurs: ______

Note that the encoder index pulse occurs once every mechanical revolution,

as opposed to once per electrical (or magnetic) cycle.

8.2.5 Operating the PMSM

Now that the rotor position is known, we are prepared to use it to align the stator current space vector exactly 90 degrees from the rotor field to produce optimum torque. This is accomplished with eq. (3), and implemented in the simulink model.

·  Set the voltage command to as close to 1V as possible. The motor should now be rotating continuously. If not, consult your instructor.

·  Record the Speed (in rad./sec) in Table I under the V_pmsm=1 column.

·  Record the Speed in Table I for each voltage command indicated in the table.

·  Plot the voltage vs. speed curve (using Matlab) and find the slope of the curve. Voltage must be on the Y axis, speed on the X axis. Save this plot.

You can also use a Matlab plot to determine the equation of the best fit curve to your data (use Tools→ Basic Fitting, then, assuming linear data, choose linear fit, check the show equations box, and choose at least 3 significant digits). The equation describing the data will then be displayed on the plot, and you can pick the slope of the line from the standard y=Mx+b form of a line. To save a copy of the Matlab plot, you can use the “Save As” to either a JPG or TIF file.