Technical Articles and Newsletters |

By Kerry Grand, MathWorks

With nearly 50% of the world's electricity consumed by electric motors, more and more companies and universities are researching and developing energy-saving solutions like variable frequency drives (VFDs).

A VFD regulates motor speed and torque by varying motor input frequency, voltages, and currents. It usually consists of an embedded controller, an inverter to convert DC voltage to three-phase AC voltage, and a three-phase motor. The motor typically is a permanent magnet synchronous machine (PMSM) or an induction machine (IM). For both research and control law development, VFD systems must be tested on a dynamometer. A full-power dynamometer is a costly solution. It is, therefore, desirable to use a lower-cost dynamometer system that is capable of running at lower DC bus voltage using a current limited supply, reducing safety and system damage concerns.

This article describes a workflow using Model-Based Design with MATLAB^{®} and Simulink^{®} to develop a desktop or lab dynamometer. We begin by outlining the hardware and software configuration used to create this closed-loop system, the physical equations governing the IM, and the underlying control principles. We then describe the main steps in the workflow: developing and simulating the model, converting the control law to embedded target code, testing the motor controller software in speed or torque mode, and deploying the code on a dynamometer test system.

The fundamental goal of our dynamometer system is to provide a safe and low-cost test environment. Requirements include:

- The ability to supply a low-voltage (42 V or less) DC power supply for the inverter so as to reduce the energy potential of the DC bus, as well as shock hazards
- Safe mechanical housing and fixtures for the IM and DC motors, protecting the operator against coupling failure, unintended torque commands, or other system failures
- Remote control and calibration capabilities

Figure 1 shows the final configuration of the system, including software and hardware components.

We use a single Sorensen XPH-10 DC power supply to feed both inverters. This setup, which allows for energy recirculation, enables us to use a smaller power supply. When the IM is running as a motor, the DC motor acts as a generator; effectively, the DC power supply only has to account for system losses. The two inverters and TI F28335 controllers are Spectrum Digital DMC1500. The DMC1500 AC input is directly connected to the DC power supply, enabling the inverter DC bus voltage to be current-limited by the Sorensen power supply. CAN-based control is achieved using the Vector CANcaseXL. The enclosed motors are supplied by the Motorsolver Dyno Kit and Torque Transducer.

For this application, we will use field-oriented control (FOC). In FOC, the winding current can be regulated so that the torque is proportional to a torque constant multiplied by winding current.

To regulate FOC for an IM, we need to transform the three-phase currents into a two-phase equivalent and convert the two-phase equivalent to a DC model. We begin by converting the three-phase currents ABC to a direct and quadrature axis. This is done using the Clarke and Park transforms with the synchronous winding speed of ω* _{syn}*. Winding speed is the sum of the electrical rotor speed ω

The equations are as follows:

Clarke Transform:

Synchronous Speed and Angle:

Park Transform:

Note that the electrical rotor frequency ω* _{m}* is measured in the electrical domain, which means it is the product of the mechanical rotor frequency and machine pole pairs. In addition, in vector form, the governing equations of the induction machine that relates stator and rotor voltages

We can further simplify the above equations. When the windings of the IM rotor are short-circuited, both *v _{rd}* and

where

Finally, under steady-state operation (*i _{rd}* = 0) and at rated flux, we derive the DC motor torque equation.

From the IM equations, we know that if we independently control the flux-producing current *i _{sd}* and torque-producing current

We will run the machine at its rated flux until field weakening occurs. After entering the rated speed for field weakening, we will reduce the current *i _{sd}* inversely as a function of rotor speed.

To control the machine we need to transform the stator feedback currents to their synchronous DC equivalents using mechanical speed and Clarke and Park transforms. Regulation of the stator currents requires the use of an induction machine motor model to estimate the machine flux. Using proportional-integral (PI) control, we transform the two currents into the stator DQ voltages *v _{sd}* and

To implement the dynamometer system, we do the following:

- Extract IM parameters using finite element analysis (FEA)
- Simulate a closed-loop system model consisting of the IM controller and the plant
- Generate code to deploy the IM and DC motor controllers to the TI F28335
- Control, calibrate, and monitor the system with a Vector CANalyzer

Often, the first step in creating the dynamometer setup is the most difficult. This step entails calculating or measuring the following internal motor parameters: magnetizing inductance *L _{m}*, stator combined leakage and magnetizing inductance

There are two common approaches to the determination of motor parameters: calculating from a finite element analysis model, and taking a physical measurement with load and no-load tests. We will use the FEA approach, which enables us to obtain the rotor- and stator- rated voltages, currents, and flux, decomposed to the direct and quadrature axis. Once we know the relationship between flux and current, we can calculate the rated stator d-axis current from the equations.

When the motor parameters are established, we convert them into Simulink data objects. We can then specify numerical value, valid ranges, data types, and other important attributes, and tune model gains without manipulating the model files.

The next step involves creating a closed-loop IM controller and plant system using the topology described in the section "Controlling the Induction Machine." This step is illustrated in Figure 3. Note that the core control law is a reusable Simulink library component, easing the transition from a closed-loop system model to an embedded controller target model. We recommend abstracting the core controller model from its inputs and outputs so that when we translate from the system model to the controller model, the internal control law remains unchanged. We analyze system performance using Simulink signal logging and a MATLAB script, since simulating down to the switching frequency produces a large data set.

Once the IM and DC controller system-level simulation models are complete, we incorporate the models into a framework for production code generation. This involves replacing the input and output processing layers with physical F28335 target blocks. We interface both the IM and DC controllers to the external current measurement (the ADC block), DC voltage measurement (the ADC block), speed measurement (the eQEP block), and PWM output (the ePWM block).

Both the IM and DC controllers execute at a 10 kHz rate that is synchronized with the PWM period and end of ADC conversion (Figures 4 and 5). The ePWM outputs must be aligned using the Sync output selection (Figure 6). Both models are now ready for production code generation with Embedded Coder^{®}.

We use the Vector CANalyzer for dynamometer system control data acquisition for both the IM and DC motors (Figure 7).

The DC motor control consists of two modes of operation: speed mode and duty cycle control. The duty cycle control enables us to test and integrate the pulse width modulation for the DC motor in a controlled fashion. Following DC motor system integration, the DC motor will run in speed mode, allowing the IM to run in torque mode. DC motor and inverter monitoring consists of the phase currents *ia* and *ib*, rotor speed ω* _{mech}*, and DC bus voltage

Like the DC motor, the IM motor control uses two modes of operation: torque and voltage/frequency (V/F) mode. V/F mode allows the integrator to test the inverter and IM motor running at a constant speed. Once integration is complete, the motor will run primarily in torque mode. IM motor and inverter monitoring consists of the phase currents *ia* and *ib*, rotor speed ω* _{mech}*, and DC bus voltage

Figure 8 shows the final deployed system.

This article describes a workflow for developing a low-cost desktop dynamometer system that lets an engineer develop motor control algorithms in a safe environment. Model-Based Design enables the development of controllers against an IM plant model. These controller models are deployed to TI F28335 DSPs interfacing to a Spectrum Digital DMC1500 inverter. Both the DC and IM motors are supplied by Motorsolver. Finally, control and calibration is obtained using Vector CANcaseXL.

This scope of this work could be extended by introducing additional motor technologies such as PMSM or switched reluctance as supported by Motorsolver.

The methods used in this system could be refined through incorporating CAN Calibration Protocol for instrumentation, which removes the need to physically route signals and parameters. Additionally, a detailed development of PWM switching algorithms, such as dead time compensation, would provide a lower sine wave distortion for the motor phase currents.

Kerry Grand is a principal consulting engineer in MathWorks Consulting Services. He has 19 years of automotive control design experience, working at two major U.S. automakers on the design and development of production software for electric vehicle and embedded control systems, with 14 related patents. His areas of specialty at MathWorks include power systems, electric motor control, automatic code generation, and tool development in the aerospace and automotive industries. Kerry holds an M.S. in electrical and computer engineering from Oakland University and a B.Sc. in electrical engineering from Lawrence Technological University.

Published 2013 - 92129v00

- Mohan, Ned.
*Advanced Electric Drives: Analysis, Control and Modeling Using Simulink,*MNPERE, 2001. mathworks.com/support/books/book48396.html - Trzynadlowski, Andrzej M.
*The Field Orientation Principle in Control of Induction Motors (Power Electronics and Power Systems)*, Kluwer Academic Publishers, 1994.