Creating a Real-Time Simulator for Power Quality Signals

  Read in   |   Print Print

"In academia, the cost associated with laboratory construction and maintenance was once high in the short and long term. The cRIO-9082 system represents an alternative to teach real-life scenarios for training future professionals at a low cost in the long term."

- Davis Montenegro Martínez, Universidad de los Andes

The Challenge:
Developing real-time hardware tools to reproduce real scenarios to teach power quality disturbances in electrical engineering education.

The Solution:
Using NI LabVIEW software, the NI LabVIEW Real-Time Module, and NI CompactRIO hardware to develop a real-time emulator for students to re-create scenarios for measuring power signals that carry power quality disturbances in a controlled environment where they can mix the disturbances for different situations.

Davis Montenegro Martínez - Universidad de los Andes
Gustavo A. Ramos - Universidad de los Andes
Miguel Hernandez - Universidad de los Andes


In the electronics industry, computer-aided engineering supports rapid methodology development, technologies, and solutions to the challenges in this field. For this reason, we need to expose future electrical engineers to exercises that bring them closer to measurements found in the real world in controlled scenarios and at a low cost. We created a system using NI LabVIEW and NI CompactRIO that includes power quality (PQ) generation algorithms to simulate real-world situations to teach electrical engineering students how to measure power signals.

Hardware Architecture

We selected the NI cRIO-9082 high-performance controller with an Intel Core i7 main processor (two cores, four threads) at 1.33 GHz to run the OS and the programmed tasks using LabVIEW software. Although the hardware works with the LabVIEW Real-Time OS, we created an embedded OS using Windows 7 that we call WES7. WES7 gives us the power of an embedded graphic interface for user interaction.

One of the advantages of working in the WES7 OS is that with this option, a user does not need an external computer to program the real-time hardware. The user can program directly in the real-time hardware to achieve more autonomy for the programming and debugging process.

With the hardware capabilities, we dedicated each core to one very complex process to guarantee completion in deterministic computing cycles. We can complete up to four very complex processes in parallel (four threads) in deterministic computing cycles without affecting the data acquisition and generation stage that runs on the FPGA.

To reproduce the PQ programmed signals in real time, we need to use sample rates greater than 32 samples/cycle to minimize the error involved in the power signal acquisition. In this case, we used a 36 kS/s sample rate (fs) (600 samples/cycle) and a 3,000-sample time window (S) based on previous works. In this particular case, other authors, agreed with these selections, which met the hardware capabilities.

Tool Development

To develop the PQ generation tool, we defined two main modules. The first module is the data generation module (DGM), which generates the time window every 83.33 ms depending on the user selection. The second module is the signal generation module (SGM), which deterministically converts the data generated from the DGM to voltage levels every 27.28 μs.

Both modules are connected using an intermediate buffer (IB) of 3,000 locations. The IB is an array declared like a global variable to communicate data from the DGM to the SGM. The system sends the information using the IB every 83.33 ms, which is the time it takes the SGM to convert 3,000 samples to voltage levels according to fs synchronized with the DGM.

To guarantee the proposed operation, we dedicated one of the cores of the cRIO-9082 controller to the DGM and the other core to the SGM. Additionally, the system makes the number data to voltage conversion using the FPGA to guarantee deterministic response. The specified model is implemented using the Timed Loop structure in LabVIEW.

To validate the generated signals, we used a RIGOL DS1102E oscilloscope with a bandwidth of 100 MHz.

To connect loads and evaluate the behavior of the external systems when there is a PQ disturbance in the supply signal, we added a power amplifier after the CompactRIO analog output module. With this, the user can reproduce many scenarios at a low cost so students can experiment with external equipment and document the effect of PQ disturbances on different types of loads. In addition, the students can identify the different waveforms related with PQ disturbances supported by the cRIO-9082 real-time hardware-in-the-loop emulation.


CompactRIO gave us a powerful tool to develop and test systems with emulated real scenarios at a low cost. We are especially pleased with the performance of the emulated signals and behaviors.

In academia, the cost associated with laboratory construction and maintenance was once high in the short and long term. The cRIO-9082 system represents an alternative to teach real-life scenarios for training future professionals at a low cost in the long term.

With the interoperability between the CompactRIO systems and external equipment, students can take advantage of practical validation of theoretical concepts using common equipment in a controlled emulation.

The LabVIEW graphical user interface makes the interaction between any user and the developed system easier, and the multicore CompactRIO hardware architecture guarantees optimal execution of concurrent processes in real time.

Author Information:
Davis Montenegro Martínez
Universidad de los Andes

Bookmark and Share

Explore the NI Developer Community

Discover and collaborate on the latest example code and tutorials with a worldwide community of engineers and scientists.

‌Check‌ out‌ the‌ NI‌ Community

Who is National Instruments?

National Instruments provides a graphical system design platform for test, control, and embedded design applications that is transforming the way engineers and scientists design, prototype, and deploy systems.

‌Learn‌ more‌ about‌ NI