# Measurements for Field-Oriented Control

### Introduction

This application note provides guidance for making measurements1 related to field-oriented control (FOC) of electric motors and presents an example use case that illustrates how these are accomplished using a power analyzer and/or a ScopeCorder. Specifically addressed are direct and quadrature currents of a surface mounted permanent magnet motor (SMPM) with field weakening applied. The techniques illustrated can also be applied to other FOC variables, algorithms, and motor technologies.

1Measurement, in this context, can also mean computations based upon a combination of actual measurements, equations, and constants. It is important to note that each of these carry their own uncertainty and assumptions.

#### Background

FOC is used by motor controllers (inverters) to simplify the control of multi-phase motors by applying a DC control model at the input of a complex AC commutation output. This allows an inverter’s PI control loop to regulate a handful of non-time-varying (DC) variables. This simplifies processing by essentially controlling an AC motor like a DC motor. A wound DC motor has a stator winding and an armature winding. The stator winding is responsible for creating magnetizing flux, while the armature winding produces torque. In field-oriented control, these modeled winding currents are controlled to regulate torque and speed.

The rotor of a permanent magnet motor has its own magnetic field generated by the magnets mounted on the surface or interior of the rotor. AC current is applied to the stator windings to produce a rotating magnetic field, causing the rotor to “chase” the stator. This stator current is often represented in polar coordinates for the purposes of FOC. The vertical axis represents the quadrature current and the horizontal axis is the direct current. The angle between the stator current with respect to the quadrature or direct axis is referred to as the electrical angle or load angle (θ). This angle also represents the displacement of the magnetic fields of the rotor and stator.

In a SMPM motor, the portion of the current oriented in the positive quadrature direction (Iq) produces torque (DC armature current) and a negative current in the direct axis (Id) reduces torque (DC magnetizing current). To maximize torque in this type of motor, the stator current should be oriented 90 degrees from the direct axis (no direct axis current Id = 0, full stator current = quadrature current).

Figure 1. Full torque, Id=0.

Sometimes a user chooses to operate a motor at a higher speed while sacrificing torque generation. When this takes place, the inverter becomes limited by the back electromotive force (BEMF) generated by the rotor’s magnetic flux as it approaches the DC supply bus voltage and/or component limits, such as capacitor voltages or conductor sizes. The BEMF can be reduced by positioning the stator flux such that it opposes the rotor’s magnetic flux. This technique is called field weakening, as it reduces the overall flux in the airgap of the motor. This is achieved in an SMPM by applying a negative direct current, which shifts the the load angle of the stator current with respect to the rotor position (referenced to the direct or quadrature axis).

Figure 2. Negative Id under field weakening of a SMPM.

Figure 3. Visual representation of direct and quadrature axis with two-pole motor.

#### Id, Iq in Motor Control

Motor controllers make instantaneous measurements of voltages, currents, and rotor position, and compute the direct and quadrature currents in real-time. The PI controllers use these DC values to compare against user- or algorithm-defined setpoints, compute error terms, and apply corrections to the voltage signals accordingly.

Clarke and Park transforms define the equations for computing the direct and quadrature currents from the instantaneous values of phase currents and rotor position. The Clarke transform allows for a three-phase system to be represented by two-phase orthogonal variables (α and β) in a stationary reference frame. The Park transform also utilizes these variables along with rotor position (electrical angle Θ) to compute the direct and quadrature currents referenced to the rotating reference frame.

Figure 4 shows an example diagram making these measurements and the associated waveforms along with example equations for Clarke and Park transforms.

Figure 4. Motor control diagram showing direct and quadrature currents, example Clarke and Park equations. Note equations are simplified versions commonly used in microcontroller libraries provided by semiconductor manufacturers.

#### Sensing Requirements

To compute the direct and quadrature currents, an instrument will need to measure phase current and the mechanical position of the rotor. Phase currents are typically measured by a current probe, current transformer, or direct instrument input. The mechanical rotor position is usually obtained by fitting the motor with a rotary encoder or a resolver. Often, the motor itself will have these devices embedded, or they can be fitted to the motor or load motor side of a dynamometer. The instrumentation should be capable of current magnitude and phase as well as computing positional information and displacements from the raw sensor signals.

#### Power Analyzer Computations

Power analyzers are unique instruments that typically provide magnitude and phase information in a real-time compute and average format with numeric results vs. the instantaneous waveform capture and compute methods employed by oscilloscopes or data acquisition (phasor format vs. waveform format). To make real-time direct and quadrature computations, a power analyzer uses the measured magnitudes, angular displacements, and simple trigonometry.

Figure 5 shows example equations for computing direct and quadrature currents and a diagram supporting the trigonometry.

Figure 5. Example Id and Iq diagram and equations using magnitude and displacement.

#### Understanding Encoder/Resolver Alignment

Measuring the position of the rotor shaft is necessary to understand the relative angular position of the stator current (Is) and to compute Id and Iq components. The accuracy of this position depends upon how the sensor itself has been fitted to the shaft of the rotor relative to the magnets inside of the rotor (direct axis). Ideally, the sensor position would be directly referenced to the direct or quadrature axis. However, fitting a sensor in a test situation by hand may not be possible and it must be compensated for in Id and Iq computations.

Figure 6. Sensor orientation with respect to rotor position.

One method for compensating for the alignment of the sensor is to compare its positional information with the BEMF voltage of the motor when it is spun unloaded (disconnected inverter, unloaded shaft). With no load, Id and Iq = 0 and the zerocrossing of the BEMF voltage waveform can be used as a reference. The peak phase voltage of the BEMF signal occurs when aligned with the direct axis of the rotor, where the zerocrossing of the BEMF occurs when aligned with the quadrature axis (90 degrees).

One must be careful to also recognize that if line-to-line voltage is used for BEMF measurement, an additional 30-degree shift must be added to this value due to the angular spacing between phase current and phase voltage in a delta connection (see vector diagrams for delta wired voltmeters). This 30-degree offset should be programmed into the instrument as a correction value in addition to any additional displacement (such as zero-crossing to Z pulse).

Figure 7. Direct and quadrature axis relative to BEMF voltage.

Another way to “calibrate” the offset is to fit an encoder or resolver on the dyno that is dedicated for instrumentation purposes only. In this configuration we can set the angular offset between the z pulse and the q axis while the motor is under load being driven by the inverter using its own positional feedback device (e.g., encoder, resolver, hall, pll). With the inverter, motor, instrumentation, and encoder or resolver connected and running, the inverter can demand a positive quadrature current and a zero direct current (Iq > 0, Id=0). This will locate the sensor’s reference to the quadrature axis as known by the inverter, which means the direct axis will be 90 degrees away from the quadrature axis.

This can also compensate for motor controllers, which perform an alignment on each startup. That could effectively move the inverter’s reference point, which could be an offset count of A and B pulses rather than the Z pulse. Figure 8 shows an example of this using the Z pulse of an encoder.

Figure 8. Example of encoder Z pulse offset from Q and D axis under load phase A when inverter command is Id = 0.

#### Power Analyzer Electrical Angle Measurements

In the case of a power analyzer, electrical angles are measured by fitting the motor with an ABZ rotary encoder, where A and B provide speed and direction information and Z provides the rotor’s positional index to the power analyzer. The power analyzer measures an angular difference Θ, between the Z pulse of the encoder (one per rotation) and the zero-crossing of the phase current or voltage usually referenced to the first phase of a polyphase system (phase A, for example). To understand the placement of the encoder on the rotor relative to the direct or quadrature axis (the encoder’s Z index relative to the rotor pole position), the power analyzer must be given an offset value. This offset represents how far away the falling edge of the Z index is from the quadrature axis or zero-crossing (rotor pole vs. stator pole alignment). This value can be arbitrary and based upon where the sensor was fitted. Figure 10 shows these measurements using an oscilloscope and a power analyzer and the unloaded BEMF signal generated by spinning the motor. The power analyzer has an auto-correction feature that essentially “zeroes out” the offset with respect to the quadrature axis.

Figure 9. 165-degree displacement from quadrature axis and Z pulse of encoder. If voltmeters are connected line-to-line, an additional three-degree shift must be compensated for.

#### Power Analyzer Setup

Once sensor alignment is complete, the user-defined math functions can be set up to make computations based on the measured magnitudes, angular displacements, and trigonometry.

One critical feature of a digital power analyzer is the ability to isolate harmonic components with high accuracy. To accomplish this, power analyzer hardware must be built such that the zero-crossing of a waveform can be accurately detected without sacrificing total bandwidth. Fast Fourier Transforms (FFT) must be performed in real time with minimal spectral leakage for each component (harmonics measured with published accuracy). Power analyzers accomplish this via dedicated zero-crossing hardware, phase-locked loop fundamental detection, and real-time digital signal processing.

Current delivered at the fundamental frequency (rotor speed for a synchronous motor) carries the torque-producing components of the stator current. Spectral content outside of this frequency (e.g., switching transients, PWM ripple, etc.) can be isolated from this signal before computing the corresponding direct or quadrature current. This is accomplished by simply selecting the current measurement for the fundamental frequency, denoted by (1). This current represents the hypotenuse of the triangle formed by Id and Iq vectors depicted in Figure 2.

Figure 10 shows an example of user-defined math based upon the equations defined in Figure 5. Note that these equations can be implemented on the power analyzer itself, power analyzer analysis software, or in post-processing software such as Excel or MATLAB.

Figure 10. Example user-defined math function equations for Is, Id, and Iq for power analyzer.

#### Power Analyzer Setup Checklist

Below is a brief checklist to set up power analyzer computations. Employing a methodical step-by-step approach that includes data review and validation before moving to the next step is highly recommended.

1. Wire and configure the power analyzer for multi-phase power measurement for electric motor evaluation per Yokogawa manuals and instructional materials.
2. Set harmonic measurement capability per Yokogawa manuals and instructional materials (PLL source set to current).
3. Wire and configure the encoder in the motor menu per Yokogawa manuals and instructional materials. Configure the number of poles and synchronization source current of phase A and set up a pulse filter starting at 1MHz to remove any potential disruptive noise from the Z pulse signal.
4. Turn on electrical angle measurement, use autocorrect via the BEMF method or inverter-driven method to set angular displacement of Z pulse to Q axis location, or manually enter a correction from a known displacement or oscilloscope-based measurement. Harmonic computation on the Z pulse should be set.
5. Enter equations similar to those in Figure 11 into power analyzer, power analyzer software, or post-processing software.

#### Power Analyzer Software Tools

PC software tools can be used for the setup, collection, and analysis of direct and quadrature computations. Additionally, these tools can offload the math functions from the power analyzer and allow for more advanced computations (such as trigonometric) that may not be available on the power analyzer itself. Figure 12 illustrates an example implementation of the equations shown in Figure 11.

Figure 11. User-defined equations for PC analysis tools per Figure 6.

#### ScopeCorder Computations

The ScopeCorder is a hybrid instrument that bridges the gap between an oscilloscope and data acquisition. It provides streaming or triggered waveforms. ScopeCorder capabilities extend beyond those of traditional instruments in that they offer a variety of input types and advanced computations specific to mechatronic systems. In the case of computing direct and quadrature components, support for the real-time encoder and resolver decoding and advanced math enable the calculation methods similar to those used by motor controllers as seen in Figure 12. It is worth noting that the ScopeCorder is also capable of computing the vector-based equations show in Figure 5.

Figure 12. Example Clarke and Park equations and resulting waveforms.

#### ScopeCorder Electrical Angle Measurements

In the case of a ScopeCorder, the rotor position is measured by fitting the motor with a variety of rotational position devices such as a resolver or a variety of rotary encoders. The ScopeCorder utilizes embedded digital signal processing to take the raw analog signals from these sensors and convert them to real-time position waveforms (Figures 13 and 14). As previously discussed, it is important to understand the difference between the “zero degrees” position by which the sensor was installed vs. the position of the direct axis (rotor magnet pole) and quadrature axis. Any offset in these positions needs to be included in the electrical angle equations for the direct and quadrature computations. The instantaneous electrical angle is dynamic and proportional to the rotor position. This is different to the electrical angle measurement made by the power analyzer (static displacement from an axis). The instantaneous electrical angle will have a proportional number of cycles in as the number of pole pairs, as shown in Figure 15.

Figure 13. Example plot of instantaenous mechanical angle (yellow) computed in real time from ABZ encoder signals (blue, purple).

Figure 14. Example plot of instantaenous mechanical angle (yellow) computed in real time from sine, cosine, and carrier signals (green, purple, yellow).

Figure 15. Example plot of instantaenous mechanical angle (brown) vs. electrical angle (orange) from inverter driving a ten-pole motor (five pole pairs).

#### ScopeCorder Setup

ScopeCorders require an external sensing device such as a clamp, current transformer, or shunt, creating a proportional voltage for current measurement (Ia, Ib, Ic). Current sensing devices and long wiring runs can be susceptible to radiated or conducted electromagnetic noise. A low-pass filter should be configured on the ScopeCorder input, to provide a more sinusoidal waveform representative of the fundamental frequency. Figure 16 shows an example of linear scaling applied for current measurement and low-pass filtering.

Figure 16. Low-pass filter and linear scaling for current measurement.

To measure rotor position, the real-time math feature must be configured to decode angular position (Θ) based upon a resolver or encoder signals, as seen in Figure 17.

Note that the angular position is scaled by the number of pole pairs (five) in the motor such that an instantaneous electrical angle is produced (Θe) to simplify the equations for the direct and quadrature currents.

Figure 17. Real-time math configured to produce angular position from an encoder. Scaled by five pole pairs (360º x 5 = 1800º).

Figure 18. Real-time math configured for computing Iβ based upon equations in Figure 5.

Figure 18 shows the Iβ computation setup using realtime math through a simple multiply and sum operation of constants and channels.

Figures 19-21 provide examples of direct and quadrature current equations entered into the user-defined math, along with the constants representing the angular offset of the rotary sensor position and a conversation from degrees to radians.

Figure 19. User-defined math configured to compute direct currents from the equations in Figure 12.

Figure 20. User-defined math configured to quadrature currents from the equations in Figure 12.

Figure 21. Constants for equations K1 (degrees to radians conversion) and K2 (sensor angular offset in degrees).

#### ScopeCorder Software Tools

Software tools can be very efficient and flexible tools for analysis and display. It is highly recommended to first collect the raw current and angular position signals and then enter the direct and quadrature computation equations in the PC analysis software before porting them to math functions on the ScopeCorder. Entering and manipulating equations is easier on the PC and the computational results are instantaneous, providing a more efficient method for spotting syntax errors, scaling, or sensor alignment. Figures 22-24 show user-defined math equations and example displays including time and XY plots.

Figure 22. User-defined math equations entered into PC analysis tools.

Figure 23. PC analysis tool showing Ia, Ib, Ic, Iα, Iβ, Θe, Id, and Iq waveforms.

Figure 24. PC analysis tool showing Id and Iq waveforms and XY plot (X axis direct, Y axis quadrature).

#### ScopeCorder Setup Checklist

Below is a brief checklist to set up power analyzer measurements to port over to a ScopeCorder. Employing a methodical step-by-step approach that includes data review and validation before moving to the next step is highly recommended.

1. Wire and configure the current sensing devices per Yokogawa manuals and instructional materials. Turn on low-pass filters to reduce EMI and produce sinusoidal currents (20-500kHz).
2. Wire and configure angular position sensors per Yokogawa manuals and instructional materials.
3. Use the BEMF method or inverter-driven method to measure angular displacement of the sensor to direct axis, or manually note the correction from a known displacement or oscilloscope-based measurement.
4. Enter math equations Iα and Iβ and collect data for PC analysis software.
5. Enter math equations for Id and Iq into PC analysis software including constants for radians and offset.
6. Once satisfied with PC results, port equations and syntax into the math on the ScopeCorder.

#### Example Results

Figures 25-29 show example data of direct and quadrature currents collected from an inverter driving an SPSM motor into field weakening by commanding a negative direct axis current. The computations were based upon the example equations given in Figures 11 and 12.

This data illustrates how a ScopeCorder and power analyzer enable these computations by providing the critical raw measurement information that is required (i.e., currents, fundamental current, angular position, angular displacement).

Additionally, the user-defined math and software tools allow flexibility in these computations, which could similarly extend to other motor variables of interest such as direct and quadrature voltages, inductances, and motor flux constants.

Figure 25. Data overlay of power analyzer Id Iq calculations and inverter reported values.

Figure 26. Data log from inverter software showing a step Id command of -1.2A.

Figure 27. Power analyzer showing step changes of Id to -1.2A and increased motor speed.

Figure 28. ScopeCorder screenshot of Ia, Ib, Ic, Iα, Iβ, Θe, Id, and Iq waveforms.

Figure 29. ScopeCorder screenshot of Ia, Ib, Ic, Iα, Iβ, Θe, Id, and Iq waveforms and XY coordinate plot of Id and Iq over time.

### Conclusion

In this application note, two methods for computing direct and quadrature currents in a SMPM motor under field weakening conditions using the Yokogawa power analyzer and ScopeCorder platforms have been discussed. The key instrument features that enable these computations include support for angular position sensors such as encoders and resolvers, user-defined math computations, and software analysis tools for real-time viewing and post-analysis. The same techniques can be applied to other FOC variables, algorithms, and motor technologies. These measurements enable engineers to quickly gain insight on the actual performance results of motor control algorithms without heavy post-processing or relying upon simulations or estimates.

### Related Products & Solutions

#### DL950 ScopeCorder

The Yokogawa Test&Measurement DL950 ScopeCorder captures and analyzes a wide variety of electrical, physical sensor signals, and serial buses. It offers a unique combination of high sampling rates, for a detailed view and long recording times to monitor trends over time.

#### WT5000 - Precision Power Analyzer

• Precision power analyzer with superior accuracy
• 7 swappable input elements
• 4 motor inputs
• Harmonics test compliant to IEC 61000-3-2

#### Power Analyzers and Power Meters

Measure characteristics of devices that generate, transform or consume electricity. Also called power meters or wattmeters, these devices measure parameters such as true power (watts), power factor, harmonics, and efficiency.

Top