From 08:00 PM CDT Friday, August 12 - 01:00 PM CDT Saturday, August 13, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

# Teaching Electrical Drives and Power Electronics Control With CompactRIO

Mats Alaküla, Lund Univerisity

## The Challenge:

Teaching students the functionality of electrical drives and power electronics, how to write control code for them, and controlling voltages within 10 to 100 µs.

## The Solution:

Adopting the NI CompactRIO platform with the electrical current control implemented on the FPGA to more realistically portray high-speed theory in a suitable real world control system to help students gain a deeper understanding of how theory applies to real-world controls problems.

As a professor at Lund University, I teach my students the functionality of electrical drives and power electronics and how to write control algorithms for them. We work with electrical motor drives for power electronics systems that have time constants on submillisecond levels. The voltages need to be controlled within 10 to 100 µs to keep the currents within the acceptable intervals. Previously, we used The MathWorks, Inc. MATLAB® and Simulink® software and DSpace control hardware. However, we found that as we encountered an increasing number of electrical drives running at higher and higher fundamental frequencies, we required correspondingly faster control systems, which the platform could not provide. We examined possible solutions to accommodate for the increase in performance needed and adopted the NI CompactRIO platform with the NI LabVIEW Real-Time Module and LabVIEW FPGA Module.

When teaching control of electrical drives in the classroom, we discuss how they would work with a “fast computer,” meaning a computer that needs no computation time and gives an immediate response. Previously, we also taught the practical aspects of how the slower logic made the real-world solution differ from the theoretical response. But with the lightning speed response of the CompactRIO FPGA, this is no longer necessary because the loop rates are so high the real-world system now complies with the theoretical models of a fast computer. We now truly teach theories that are applicable in real-world control problems.

We also needed a completely self-contained system, which was another reason for the platform change. We often want to monitor the system continuously, but it is important that this monitoring not interfere with the control algorithms. Using a Simulink system, we frequently ran into problems with the Windows OS interfering with the control system. The CompactRIO real-time system can operate on its own but still provide live updates to a host computer.

### Implementation

We use the NI systems as lab systems to control the power electronics and electrical drives, including related measurements. The application includes three layers, which use the best of each of the three RIO computational domains—the FPGA, the real-time processor, and Windows.
We implemented the most time-critical part, the current control, on the FPGA. The real-time processor handles slower control loops such as the engine speed (to follow a specific trajectory) and continuously recalculates PID parameters for optimal levels. We originally completed the postprocessing with a MATLAB application running on the host computer, but we ported this to the real-time processor as well. The only thing that the host computer still needs to handle is the visualization and storage of the test data.

The CompactRIO offers other advantages in addition to providing a quick and reliable control system. A normal electric drive requires sensors to perform phase currents, DC link voltages, and rotor position measurements. For example, the rotor position measurement is done with a resolver that needs a high-frequency input signal that, with additional measured signals, is used for position estimation. Normally we could accomplish this with a separate dedicated circuit. However, the speed of measurement and control with the CompactRIO, as well as the possibility of using the I/O ports, made the additional circuit unnecessary since the CompactRIO now handles this.

The speed of the CompactRIO makes it possible to use hysteresis control (direct current control) of the current. We can graph and visualize the three phase currents we use in a real-imaginary plane at all times. With the rapid measurements and control of the FPGA, we can keep the current within the hysteresis bounds.  This requires extremely fast measurements that the old solution could not handle. The time between samples with the previous solution was far too long.

Using LabVIEW and CompactRIO has also proved to be valuable in our research. We have published papers for the International Conferences on Electrical Machines (ICEM) on dynamic control of electrical drives and mentioned this control system. We are also in the process of commercializing a dynamic test method for electrical machines. The method requires fast measurement and control systems and we are using CompactRIO. We are happy to teach a method that we are confident in using ourselves for advanced research.

### The Benefits of Teaching With Our New System

We can work in the lab with the most demanding control challenges for electrical drives—even at the undergraduate level—with this intuitive platform. By implementing the most time-critical functionality on the FPGA, we created a control system with such a short response time that we can treat it as negligible, and we have lab systems that work just like they should in the theory we teach.