When used in an appliance, a permanent magnet synchronous motor (PMSM) provides very good efficiency because of its constant rotor magnetic field, which is produced by a permanent magnet on the rotor. In addition, its stator magnetic field is generated by sinusoidal distribution of the windings. Compared to induction motors, PMSMs have a very high power/size ratio. They also produce less electrical noise compared to dc motors since brushes are not used.
In PMSM-based appliances, field-oriented control (FOC) offers a great cost benefit because it eliminates the position sensors. The sensorless FOC technique also overcomes restrictions placed on some applications that cannot deploy position or speed sensors, such as those in which the motor is immersed in oil. Although proprietary FOC designs using ASICs are available, a new generation of digital signal controllers (DSCs) offer a low-cost alternative for implementing the FOC algorithm.
DSCs are suitable for appliances like washing machines because they feature peripherals tailored for motor control such as pulse width modulators (PWMs), analog-to-digital converters (ADCs) and quadrature encoder interfaces. When executing controller routines and implementing digital filters, DSCs help designers optimize code execution by being able to carry out the multiply-accumulate instructions and fractional operations in a single cycle. Also, for operations requiring saturation capabilities, DSCs help designers avoid overflows by offering hardware saturation protection.
DSCs need fast and flexible ADCs for current sensing, a crucial function in motor control. For example, the Microchip dsPIC DSC family features ADCs capable of converting inputs at a 1-Msample/sec rate and handling up to four inputs simultaneously. Multiple trigger options on the ADCs enable the use of inexpensive current-sense resistors to measure motor phase-winding currents. Triggering ADCs with PWM modules enables inexpensive current-sensing circuitry, by sensing inputs at specific times where switching transistors allow current to flow through the current-sense resistors.
The FOC motor-control firmware discussed in this article was developed based on Microchip's dsPICDEM MC1 Motor Control Development Board. Microchip's data monitor and control interface (DMCI) tool, which is a module within the MPLAB Integrated Development Environment (IDE), was used to test and debug the FOC algorithm. The DMCI tool provides a quick and dynamic IDE, which allows designers to graphically represent the application feedback. For instance, DMCI's IDE provides project-aware navigation of program symbols (variables) that can be dynamically assigned to any combination of slider, direct input or Boolean controls. These controls can be used interactively to change the values of program variables within the DMCI IDE. Further, the graphs can be dynamically configured for viewing program-generated data.
In the system overview block diagram (Fig. 1), it can be seen that no position sensors are attached to the motor shaft. However, there are some sensors used for current measurements on the motor. These sensors feature low-inductance resistors that are part of the inverter function block. A three-phase inverter stage drives the motor windings (Fig. 2).
The FOC Algorithm
The following is a step-by-step summary of the FOC (or vector-control) algorithm:
Measure the stator currents phase currents iA and iB. Calculate iC from the fact that iA + iB + iC = 0 and calculate the currents from the two current sensors.
Convert the set of these three-phase currents onto a two-axis system. This conversion provides the variables iα and iβ from the measured iA, iB and iC values; iα and iβ are time-varying quadrature current values, as viewed from the stator's perspective. This step is called Clarke Transformation.
Rotate the two-axis coordinate system to align with the rotor flux, using the transformation angle calculated at the last iteration of the control loop. This conversion provides the iD and iQ variables from iα and iβ. Now, transform the quadrature currents, iD and iQ, onto the rotating coordinate system. During steady-state conditions, iD and iQ will remain constant. This step is called the Park Transformation.
Error signals are formed using iD, iQ and reference values for each. The iD reference controls rotor-magnetizing flux. The iQ reference controls the torque output of the motor. The error signals are input to proportional and integral (PI) controllers. Then, the PI controller's output provides VD and VQ, which is a voltage vector that will be sent to the motor.
Estimate the new coordinate transformation angle, where Vα, Vβ, iα and iβ are the inputs. The new angle guides the FOC algorithm as to where to place the next voltage vector.
Rotate the VD and VQ output values from the PI controllers back into the stationary reference frame, using the new angle. This calculation provides new quadrature voltage values, Vα and Vβ.
Transform the Vα and Vβ values back to three-phase values VA, VB and VC. The three-phase voltage values are used to calculate new PWM duty-cycle values that generate the desired voltage vector. The entire process of transforming, PI iteration, transforming back and generating PWM is shown in Fig. 3.
Sensorless FOC for PMSMs
The sensorless control technique implements the FOC algorithm by estimating the position of the motor without using speed or position sensors. Fig. 4 shows a simplified block diagram of the position-estimator function. The FOC algorithm is executed at the same rate as that of the PWM duty-cycle algorithm. In the FOC algorithm, the PWM triggers two respective ADC conversions for the two winding-current shunt resistors. Then a potentiometer is used to set the reference speed of the motor. The ADC interrupts generate the data samples needed to execute the algorithm.
From the motor model in Fig. 5, the input voltage can be obtained:
And solving for iS gives the motor current:
where iS equals motor current vector, vS equals input voltage, eS equals back-EMF vector, R equals winding resistance and L equals winding inductance.
In the digital domain, this equation becomes:
Again, solving for iS yields:
Current Observer Model
A current observer model enables the indirect measure of the back EMF by ensuring that the input to the system (motor) is equal to the input to the motor model. Here is how it works: The motor and motor model are fed with the same input, but the motor model has a closed-loop controller to ensure that the estimated value matches the measured value. For example, at any given time, if the actual motor input voltage and current are the same as the model, then we can “observe” the back EMF by solving for eS.
For the observer model compensation, a sliding-mode controller can track the input reference and force the error to zero between the measured current iS and the estimated current iSESTIMATED. Depending on the error sign, the sliding-mode controller will apply either a positive feedback gain (K) or a negative feedback gain (-K) to get the estimated current to match the measured current. Because the input voltages are the same for both the motor and its model, the back EMF can be calculated when the estimated and measured currents match.
Once the input currents and voltages of the model and the actual motor match, the correction factor z from the motor model can be filtered to get the back EMF. For this step, we use a first-order digital low-pass filter, with the equation:
To filter z to get eSESTIMATED, we substitute the value of fPWM in the equation below:
where e[n] equals the next estimated back-EMF value, e[n-1] equals the last estimated back-EMF value, fPWM equals the PWM frequency at which the digital filter is being calculated, fC equals the cutoff frequency of the filter and z[n] equals the unfiltered back EMF, which is output from the sliding-mode controller
Solving this equation for e[n] yields the updated back-EMF value. The value of the cutoff frequency can be determined through trial and error, depending on the selection of the sliding-mode controller gain. The relationship between back EMF and the rotor's updated position is given by:
Due to the filtering function applied during the theta calculation, some phase compensation is needed before the calculated angle can be used to energize the motor windings. The amount of theta compensation is dependent on the rate of change of θROTOR, or the speed of the motor (ωROTOR). The compensation for θROTOR is performed in two steps: First, the speed of the motor is calculated based on the uncompensated theta calculation; second, this speed is used to calculate the amount of compensation. The speed can be calculated by summing θROTOR values over M samples, and then multiplying the summed values by a constant. This is given by:
where ωROTER[n] equals angular velocity of the motor, θROTOR[n] equals current rotor position value, θROTOR[n-1] equals previous rotor position value and K equals amplification factor for desired speed range.
Because the sensorless FOC algorithm is based on the back-EMF calculation, the motor needs to run at a minimum speed to get the back-EMF value. Therefore, energizing motor windings with the appropriate estimated angle is required. To handle this, a motor startup subroutine was developed and works as follows: When motor is at standstill, and with the start/stop button pressed, the dsPIC DSC generates a series of sinusoidal voltages to set the motor spinning. While the motor spins at a fixed acceleration rate, the FOC algorithm controls the currents iD and iQ. The value of θ is incremented based on the acceleration rate.
Software State Machine
It is helpful to visualize the FOC algorithm as a software state machine (Fig. 7). First, the motor windings are de-energized and the system awaits the user to press the start/stop button. Once the user presses the start/stop button, the system enters the initialization state where all variables are set to their initial value. Then, the startup subroutine is executed. The current components for torque (iQ) and flux production (iD) are being controlled by the FOC, and commutation angle (θ) is being generated in a ramp fashion, to get the motor spinning and reaching the minimum speed required to run the estimator.
After going through the startup subroutine, the system switches over to sensorless FOC control, where the speed controller is added to the execution thread, and the sliding-mode controller (SMC) starts estimating θ, as previously explained.
Upon entering the sensorless FOC control state, the reference speed is continuously read from an externally connected potentiometer, and the start/stop button is also monitored to determine whether or not to stop the motor.
In addition to the stop/start button being pressed while the motor is running, any fault in the system will cause the motor to stop and return to the “motor stopped” state. The motor remains stopped until the start/stop button is pressed again.
DSC-Based FOC Control
A major advantage of deploying DSCs in motor control is the practicality of a common design platform, which can lower production costs. This means appliance makers now have an economical way to offer a range of appliance models that use PMSMs, or other motor types, with sensorless FOC algorithm control. These software-based motor-control designs enable rapid customization to address multiple applications.
Firmware IP protection is a major issue for manufacturers with design teams across many geographies. Design teams based in different locations could work in tandem to implement FOC firmware, develop the appliance front panel and complete the final system integration. Furthermore, in developing their designs, these teams will generate their own IP. Microchip's dsPIC DSC family offers the CodeGuard feature, which helps to protect IP in collaborative design environments by securing IP segments separately.
Since programming DSCs is similar to programming microcontrollers, appliance designers can quickly design their motor-control algorithm and test their prototypes. Best of all, fine-tuning the motor control has been simplified through the use of IDE-based tools such as the DMCI, which allows designers to easily port their algorithms across a variety of motor platforms including PMSM, brushless-dc, brushed-dc and ac-induction motors.
The dsPICDEM MC1 Motor Control Development Board is available at www.microchipdirect.com.
See www.microchip.com/codeguard for information on the CodeGuard security feature, including how it can be used to improve IP protection.
See www.microchip.com for application notes on motor control of ac induction (AN984, AN908 and GS004) and brushless dc (AN901, AN957, AN992, AN1017) motors, based on the dsPIC30F motor-control family.