Developing a Functional Smart Grid Prototype Using NI LabVIEW, NI CompactRIO, and NI DAQ

Peng Huat Cheah, Nanyang Technological University

"We used LabVIEW, CompactRIO FPGA, and DAQ modules to easily integrate the BESS, PV system, BEMS, and HEMS into the microgrid prototype. The FPGA-based technology offers a direct interface for sensing, Xilinx interface to import the logic to hardware, and LabVIEW GUI for debugging and validation."

- Peng Huat Cheah, Nanyang Technological University

The Challenge:

Developing a reliable, cost-effective, and secure smart grid infrastructure to integrate distributed energy resources (DERs) such as solar photovoltaic (PV) systems, battery energy storage systems (BESSs), and demand-response management (DRM).

The Solution:

Using NI LabVIEW software, CompactRIO hardware featuring FPGA technology, and NI DAQ hardware to create a maximum power point tracking (MPPT) module of the PV system and control scheme of the BESS to integrate home and building energy management systems (HEMS, BEMS), solar PV technology, and energy storage with the microgrid.


Peng Huat Cheah - Nanyang Technological University
B. Sivaneasan - Nanyang Technological University
K. V. Ravi Kishore - Nanyang Technological University
G. Anima - Nanyang Technological University
M. K. Foo - Nanyang Technological University
H. B. Gooi - Nanyang Technological University


The Laboratory for Clean Energy Research (LaCER) at the School of Electrical and Electronic Engineering at Nanyang Technological University houses the award-winning Microgrid Energy Management System (MG-EMS) prototype, which incorporates software applications that manage sensing data and perform load and generation management. To extend the microgrid to a full-fledged smart grid prototype, we need to integrate the HEMS and BEMS with renewable energy resources, typically PV systems and BESSs, with the microgrid (see Figure 1).


By integrating the consumer loads and their DERs with LabVIEW supervisory control and data acquisition (SCADA), we can easily perform smart grid applications such as DRM, time-of-use (TOU) electricity pricing schemes, power quality monitoring, power system optimization, DER scheduling, load forecasting, and electricity billing.


FPGA-Based Battery Energy Storage System

We used an NI CompactRIO module, NI voltage sensing module, and NI digital I/O driver to implement the BESS and increase the reliability as well as life span of the battery pack (see Figure 2).


An NI PS-15 supplied power to the NI cRIO-9082 module. The NI 9225 and NI 9401 modules measured the voltage and controlled the parallel switch of each battery every second. Vital to the system, the cRIO-9082 integrated the voltage sensing module and digital I/O channel. We implemented the balancing logic on FPGA hardware with the help of a Xilinx interface with LabVIEW.


We created a LabVIEW VI to control the balancing of the BESS. In passive balancing, the parallel switch was ON until its voltage equaled the minimum voltage. In auto mode, passive balancing was active when the voltage difference between maximum and minimum was greater than the threshold preset through the LabVIEW GUI. In manual mode, passive balancing was independent of voltage difference, which was the case of 0 V threshold in auto mode (see Figure 4). Figure 5 shows the LabVIEW VI diagram for the balancing algorithm.

Photovoltaic System Based on MPPT

We developed an MPPT system using NI DAQ modules, and could directly measure PV voltage and current with the NI 9225 and NI 9227 C Series modules. We could use the acquired instantaneous voltage and current to implement the MPPT.


The operating point of PV panels usually depends on the load connected to it. To ensure the operation occurred at a maximum point, we needed to use an MPPT controller at the boost converter stage (see Figure 6).

We implemented the MPPT with the perturb and observe algorithm. The system compared the present and previous real-time values of voltage and power by perturbing the duty cycle of the boost converter. The system instantaneously incremented or decremented the duty cycle. The NI USB-6215 M Series multifunction DAQ module issued the PWM gating signals required for the boost converter. The operating point reached maximum power in 3 s (see Figure 7).


BEMS Setup

We developed a real-time BEMS that monitors, manages, and controls every load and energy source installed in a commercial building (see Figure 8). The system integrates the BEMS with the communication and control hardware components to perform DRM. We used NI-VISA to interface between the BEMS and ZigBee end devices through the ZigBee USB dongle (coordinator). We used the USB-6215 to read data from temperature- and water-level sensors and generate analog output signals that control the speed of the fan motor in the air handling unit (AHU) through a variable speed drive (VSD). The three DRM functions include:

  1. Load shedding: Each load holds a preassigned priority (see Figure 9). When the main supply is about to exceed the contracted capacity, the system automatically sheds lower priority loads.
  2. VSD control: The BEMS can reduce AHU energy consumption based on the temperature data collected from the temperature sensors. Figure 10 shows the VI diagram for the implementation of the VSD-based DRM algorithm and the laboratory setup.
  3. Sump pump scheduling: The BEMS performs pump scheduling to take advantage of the lower electricity price by shifting loads to off-peak periods and reduces the overall energy cost.

HEMS Setup

We created a ZigBee-based HEMS consisting of three main components: the smart meter, an Ethernet-ZigBee gateway, and SCADA. We used LabVIEW to create the software modules, such as DRM, scheduling function, and database. With the HEMS, home users can centrally manage and monitor the energy use of their electrical devices through load control modules (LCMs).


We used NI-VISA to interface between the LCMs, smart meter, and SCADA through a ZigBee-based USB dongle. The system captures data such as energy consumption and the status of each home appliance from LCMs developed with LabVIEW for automatic intelligent window blind control, room temperature control, and smart lighting control (see Figure 11).

To fulfill the key function of the smart grid application, we designed DRM algorithms using LabVIEW (see Figure 12). The DRM algorithm interrupts the home appliances based on maximum demand or TOU electricity pricing. Home users can set or schedule the sequence of home appliance interruption through the GUI we developed.


Easy System Integration

We used LabVIEW and CompactRIO FPGA and DAQ modules to easily integrate the BESS, PV system, BEMS, and HEMS into the microgrid prototype. The FPGA-based technology offers a direct interface for sensing, Xilinx interface to import the logic to hardware, and LabVIEW GUI for debugging and validation. These tools saved us time when selecting the microcontroller, programming tool, debugging tool, and sensors for operating range.


This work is part of the fundamental blocks of the Intelligent Energy System project initiated by the Energy Market Authority to explore aggregating the small, noncontestable loads of buildings and homes of a district in a sizable capacity to participate in the frequency regulation and demand-response markets of the National Electricity Market of Singapore.


Author Information:

Peng Huat Cheah
Nanyang Technological University
School of EEE (S2-B7c-05), 50 Nanyang Ave
Tel: 65 6790 5481
Fax: 65 6793 3318

Figure 1: Smart Grid Architecture
Figure 2: Application Block Diagram
Figure 4: BESS Hardware Setup in LaCER
Figure 5: BESS Balancing Algorithm in LabVIEW: (a) VI Diagram and (b) GUI
Figure 6: PV System Hardware Setup
Figure 7: MPPT in LabVIEW: (a) VI Diagram (b) GUI
Figure 8: BEMS in LabVIEW
Figure 9: Load Shedding in LabVIEW: (a) VI Diagram (b) GUI Showing DRM’s Algorithms
Figure 10: VSD DRM in LabVIEW: (a) VI Diagram (b) Laboratory Setup
Figure 11: HEMS in LabVIEW: (a) VI Diagram (b) GUI Showing Intelligent Control Systems
Figure 12: DRM in LabVIEW: (a) VI Diagram (b) Front Panel showing the DRM’s GUI and algorithms