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.

## Design Requirements and System Components

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.

## Induction Motor Physical Equations

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.

\[T_{em}=k_T\cdot i_a\]

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 \(\omega_{syn}\). Winding speed is the sum of the electrical rotor speed \(\omega_m\) and slip frequency \(\omega_{slip}\). The subscripts \(s\) and \(r\) represent the stator and rotor, respectively.

The equations are as follows:

Clarke Transform:

\[i_d=\frac{2}{3}i_a-\frac{1}{3}i_b-\frac{1}{3}i_c\] \[i_q=\frac{\sqrt{3}}{3}(i_a-i_c)\]

Synchronous Speed and Angle:

\[\omega_{syn}=\omega_m+\omega_{slip}\]\[\theta_{syn}=\int\omega_{syn}\,dt\]

Park Transform:

\[i_{sd}=i_dcos(\theta_{syn})+i_qsin(\theta_{syn})\]\[i_{sq}=-i_dsin(\theta_{syn})+i_qcos(\theta_{syn})\]

Note that the electrical rotor frequency \(\omega_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 \(\nu\), flux linkages \(\lambda\), currents \(i\), and electromagnetic torque \(T_{em}\), follow the equation below. Finally, note that the per-phase machine parameters \(p\) correspond to the number of machine poles. \(L_m\) corresponds to the magnetizing inductance, \(L_s\) corresponds to the stator combined leakage and magnetizing inductance, \(L_r\) corresponds to the rotor combined leakage and magnetizing inductance, \(R_s\) is the rotor resistance, and \(R_r\) is the stator resistance.

\[\begin{bmatrix} \nu_{sd}\\\nu_{sq} \end{bmatrix} = R_s \begin{bmatrix} i_{sd}\\i_{sq} \end{bmatrix} +\frac{d}{dt} \begin{bmatrix} \lambda_{sd}\\\lambda_{sq} \end{bmatrix} +\omega_{syn}\begin{bmatrix} 0&-1\\ 1&0 \end{bmatrix} \begin{bmatrix} \lambda_{sd}\\\lambda_{sq} \end{bmatrix}\]

\[\begin{bmatrix} \nu_{rd}\\\nu_{rq} \end{bmatrix}=R_r \begin{bmatrix} i_{rd}\\i_{rq} \end{bmatrix} +\frac{d}{dt} \begin{bmatrix} \lambda_{rd}\\\lambda_{rq} \end{bmatrix} +\omega_{slip}\begin{bmatrix} 0&-1\\ 1&0 \end{bmatrix} \begin{bmatrix} \lambda_{rd}\\\lambda_{rq} \end{bmatrix}\]

\[\begin{bmatrix}\lambda_{sd}\\\lambda_{sq}\\\lambda_{rd}\\\lambda_{rq}\end{bmatrix}=\begin{bmatrix}L_s&0&L_m&0\\0&L_s&0&L_m\\L_m&0&L_r&0\\0&L_m&0&L_r\end{bmatrix}\begin{bmatrix}i_{sd}\\i_{sq}\\i_{rd}\\i_{rq}\end{bmatrix}\]

\[T_{em}=\frac{p}{2}(\lambda_{rq}i_{rd}-\lambda_{rd}i_{rq})\]

We can further simplify the above equations. When the windings of the IM rotor are short-circuited, both \(\nu_{rd}\) and \(\nu_{rq}\) equal zero. For FOC control, we will align the d-axis with the machine flux so that \(\lambda_{rq}\) and \(d/dt(\lambda_{rq})\) both equal \(0\). Knowing this, we can calculate the machine slip \(\omega_{slip}\) and simplify the electromagnetic torque equations.

\[\omega_{slip} = \frac{L_m}{\tau_r\lambda_{rd}} i_{sq}\]

\[\tau_r=\frac{L_r}{R_r}\]

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

\[T_{em}=\frac{p}{2}\;\frac{L_m^2}{L_r}\;i_{sd}\;i_{sq}\]

\[T_{em}=k_T\cdot i_{sq}\]

## Controlling the Induction Machine

From the IM equations, we know that if we independently control the flux-producing current \(i_{sd}\) and torque-producing current \(i_{sq}\), we will generate the electromagnetic torque (Figure 2). We can make tradeoffs when selecting the ideal flux- and torque-producing current components. For example, at light loads it may be desirable to reduce the flux-producing current to reduce system losses, or to control the two currents to obtain the peak torque-per-machine ampere.

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 \(\nu_{sd}\) and \(\nu_{sq}\). We then use \(\nu_{sd}\) and \(\nu_{sq}\) to calculate the duty cycle commands that feed the three-phase inverter using a space vector modulation technique.

## Building and Implementing the Closed-Loop IM and DC Dynamometer System

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

### Determining Motor Parameters

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 \(L_s\), rotor combined leakage and magnetizing inductance \(L_r\), rotor resistance \(R_s\), stator resistance \(R_r\), rated mechanical speed, rated voltage, and rated slip speed.

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.

### Creating the System Model

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.

### Interfacing the IM and DC Controller Models to Hardware

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^{®}.

### Describing the Final Design and Control System

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 \(i_a\) and \(i_b\), rotor speed \(\omega_{mech}\), and DC bus voltage \(v_{bus}\).

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 \(i_a\) and \(i_b\), rotor speed \(\omega_{mech}\), and DC bus voltage \(v_{bus}\). It also consists of the estimated torque \(tq_{est}\) and the synchronous phase d and q axis currents \(i_{sd_fb}\) and \(i_{sq_fb}\).

Figure 8 shows the final deployed system.

## Summary and Next Steps

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.