You are on page 1of 7

Creating a Microgrid Energy Management System Using NI LabVIEW and DAQ

"When formulating and processing matrix


calculations, LabVIEW provides programming tools
to code power system applications more easily,
which saves programming time."
- Gooi Hoay Beng, (www.ntu.edu.sg)

The Challenge:
Meeting Singapores energy needs by exploring sustainable energy resources and enhancing the efficiency of the current supply system.

Read the Full


Case Study

The Solution:
Using NI LabVIEW software and NI data acquisition (DAQ) hardware to develop a low-cost microgrid energy management system (MEMS) that
includes information and communications technology (ICT), smart meters, and advanced optimization applications to manage distribution systems
that serve as a platform for incorporating renewable energy resources.
Author(s):
Cheah Peng Huat - (www.ntu.edu.sg)
Siow Lip Kian - (www.ntu.edu.sg)
Liang Hong Zhu - (www.ntu.edu.sg)
Vo Quoc Nguyen - (www.ntu.edu.sg)
Nguyen Dinh Duc - (www.ntu.edu.sg)
Gooi Hoay Beng - (www.ntu.edu.sg)
Students at the Laboratory for Clean Energy Research (LaCER) in the School of Electrical and Electronic Engineering (EEE) at Nanyang Technical
University (NTU) created a microgrid prototype. It consists of energy resources such as solar photovoltaics (PVs), wind turbines, fuel cells, and battery
banks. The entire microgrid is controlled by the Web-based MEMS server, which controls and monitors different aspects of power management.
We developed software programs to manage information collected from the sensors and perform load control and generation dispatch. Figure 1 shows the
interface diagram between the database and different software modules. We used LabVIEW (http://www.ni.com/labview/) software to develop modules for
advanced sensing and communication, load forecasting, unit commitment, state estimating, and optimal power flow.

Advanced Sensing and Communication System


In a microgrid, integrating and interfacing sensing and control devices is challenging because it involves different communication protocols such as RS232
serial communication and RS422/485 modbus communication. To overcome this challenge, we converted the information into one standard protocol
Ethernet. We easily and economically made the conversion by using a communication protocol converter.
Our main design tasks included sensing and communicating between the MEMS server and power sensors, as well as other controlling devices such as
circuit breakers, programmable AC sources, and programmable logic controllers (PLC). We installed 32 power sensors that support the Modbus protocol
throughout the microgrid network for power monitoring measurements such as voltage, current, active power, reactive power, and circuit breaker status.
To deploy a cost-effective solution for communicating between the MEMS server and all the power sensors, we divided the sensors into four groups with
eight sensor units per group. Each group eventually connects to an RS485-to-TCP/IP converter where the Modbus protocol is converted to Modbus TCP
running on the Ethernet LAN network. We issue a unique IP address to each converter and each group of power sensors along with a respective ID.
The system extracts power measurements using the LabVIEW Datalogging and Supervisory Control (http://www.ni.com/labview/labviewdsc/) (DSC)
Module by entering the IP address, sensor ID, and register address of the desired power sensor. Users do not need to define the exact Modbus messages
to retrieve the information, which saves valuable time. The system sends all power measurements to the respective global variables in LabVIEW where
they are displayed in the main GUI for monitoring (see Figure 2). Other applications also can easily use the measurements via global variables. The PLC
uses the same technique for controlling circuit breakers in the microgrid.
The microgrid testbed uses a programmable AC source to test the stand-alone microgrid. To communicate with the power source, we used the TCP
function block in LabVIEW. Users enter the power sources IP address without including tedious programming code to monitor and control the power
source.

Load Forecasting
The objective of load forecasting is to predict the total customer load 15 minutes in advance. It has a significant market impact on efficiently operating,
controlling, and planning microgrids. Accurate forecast values result in economic savings and enhance system operation security.
The prediction method is based on the artificial neural network (ANN), which we developed using LabVIEW (see Figure 3). To enhance the performance
of the load forecasting algorithms, we added the following special features:
Data preprocessing to identify bad and irregular data so we can remove or adjust it before using it for training.
Early stopping to speed up convergence and prevent over-fitting the training data.
Abnormal days scheduling to identify days that have abnormal load profiles and to exclude them in the training so the load model isnt corrupted. Users
can update the abnormal days from the GUI.
Correlation and linear regression analysis to discover the linear relationship between input and target data by using a straight line.
We use the NI USB-6215 (http://sine.ni.com/nips/cds/view/p/lang/en/nid/203483) DAQ device to collect historical load data from the Wee Kim Wee School
of Communication and Information building at NTU. We process and store the data in a database we developed using LabVIEW. To collect the daily load
data, we connect the analog inputs of the DAQ device to the distribution grid in the building through a step-down voltage transformer, which is connected
to additional current and voltage sensors to obtain the voltage and current data, respectively.
We successfully integrated the load forecasting algorithm with the software modules in the MEMS unit. The implemented forecasting system is reliable
and accurate.

Unit Commitment
The unit commitment software module is an essential component of MEMS. Based on a forecasted demand profile, the software module assists the
microgrid operators in finding an optimized power generation schedule that minimizes the total operating cost if the microgrid is isolated or maximizes the
total benefit if the microgrid is connected to the main grid. Once the optimization process is complete, the results, including the on/off status and the
amount of kW dispatched from the generating sources, are sent to the MEMS optimal power flow module for processing. Unit commitment is one of the
most complex optimization problems in power system management. By using the scripts we created using the LabVIEW MathScript RT Module (
http://sine.ni.com/nips/cds/view/p/lang/en/nid/207267), it takes the software only seconds to determine the optimized solution of the formulated problem
based on several constraints and hundreds of variables (see Figure 5).
The software module includes the following features:
By using the LabVIEW MathScript RT Module, it can solve a complex unit commitment problem within seconds.
With the GUI built in LabVIEW, users can easily run the unit commitment module with default/customized settings.
By using the real-time capturing function of LabVIEW, the software automatically executes at a user-defined start time.
Once the optimization completes, the results are automatically saved in a user-defined path on the server and sent to the MEMS optimal power flow

1/7

www.ni.com

Once the optimization completes, the results are automatically saved in a user-defined path on the server and sent to the MEMS optimal power flow
module.

State Estimation
State estimation is a MEMS real-time function that uses measurements, circuit breaker status, and voltage regulator tap positions collected by Supervisory
Control and Data Acquisition (SCADA) to verify and estimate bus voltages in power systems. The estimated bus voltage magnitudes and voltage phase
angles are considered reliable state values of the system and are used as one of the inputs to the optimal power flow module. Its processed bus load
values are used as inputs to the load forecasting module.
The state estimation module has three subfunctions coded in the The MathWorks, Inc. MATLAB programming language based on the LabVIEW platform:
1. Topology processor determines network configuration by converting a node-oriented network into a bus-oriented network.
2. State estimation calculates bus voltage magnitudes and angles.
3. Bad data detection and identification verifies that the raw measurements are good before using them in the state estimation module.
When coding the state estimation module, it is challenging to ensure that it runs in any power network. Therefore, we used script blocks to increase the
flexibility when describing complex algorithms. Each subfunction is implemented using script blocks in LabVIEW. The inputs and outputs (1D and 2D)
transfer data between script blocks or to the front panel to display the results. A feedback node is also used to detect and identify bad data.
When formulating and processing matrix calculations, LabVIEW provides programming tools to code power system applications more easily, which saves
programming time.
We successfully incorporated the state estimation function with other MEMS functions and the microgrid hardware setup at LaCER, NTU (see Figure 6).

Optimal Power Flow


Optimal power flow is one of the MEMS online functions. The optimal power flow module finds the optimal settings of a given power system network, such
as total generation cost or system loss, while satisfying its power flow equations and equipment operating limits, such as bus voltage constraints, branch
flow limits, and generation source capacity limits. The input data for the optimal power flow module includes network configuration and load information
that are defined by the state estimate module. As part of the output results, the optimal power flow module recommends values for:
Active/reactive power source outputs
Tap ratios of on-load tap-changing transformers
These parameters are sent to the circuit breaker CB controllers, inverter controllers, generator controllers, and load tap controllers to keep the system
running in a more economical and efficient mode.
We used quadratic programming to solve the optimal power flow problem. We coded this algorithm in MATLAB then integrated it with LabVIEW through
the MATLAB script function. We used LabVIEW to link optimal power flow to both state estimation and SCADA to control certain microgrid components.
Figure 7 shows how we used LabVIEW toolkits for the main optimal power flow GUI for the microgrid in the LaCER, NTU.
The LF algorithm has been successfully integrated with UC of MEMS. The implemented forecasting system performs reliably with a satisfactory accuracy.

Unit Commitment
The Unit Commitment (UC) software module acts as one of the essential components of MEMS. Based on a forecasted demand profile, the software
module is able to assist the microgrid operators to find an optimized power generation schedule that minimizes the total operating cost while the microgrid
is isolated or to maximize the total benefit while the microgrid is connected to the main grid. Once the optimization process is complete, the results which
include the on/off status and the dispatch kW amount of the generating sources will be sent to the Optimal Power Flow (OPF) module of MEMS for
processing. UC is one of the most complex optimization problems in power system management. By using the MATLAB Script function of LabVIEW, the
software is able to determine within seconds the optimized solution of the formulated problem with several constraints and hundreds of variables. The
main GUI of UC is shown in Figure 5.
The software module has the following features:
By using MATLAB Script function of LabVIEW, a complex UC problem can be solved within seconds.
With the graphical interface built in LabVIEW, users can easily run the UC optimization with default/customized settings via simple clicks.
By using the real-time capturing function of LabVIEW, the software can be executed automatically at a user-defined Auto Start time.
Once the optimization completes, the results are automatically saved in a user-defined path of the server system and at the same time they are sent to
OPF of MEMS.

State Estimation
State Estimation is a MEMS real-time function which uses measurements, circuit breaker status and voltage regulator tap positions collected by SCADA to
verify and estimate bus voltages in power systems. The estimated bus voltage magnitudes and voltage phase angles are considered as the trustable state
values of the system and will be used as one of the inputs to OPF and its processed bus load values as inputs to Load Forecasting.
State Estimator has 3 sub-functions coded in Matlab programming language based on the LabVIEW platform.
1. Topology Processor: It determines network configuration by converting a node-oriented network into a bus-oriented network.
2. State Estimation: It calculates bus voltage magnitudes and angles
3. Bad Data Detection and Identification: It verifies that the raw measurements are good before using them in State Estimator.
When coding State Estimator, it is a challenge to ensure that it runs in any power networks. Therefore using script blocks is a way to increase the flexibility
when describing complex algorithms. Each sub-function is implemented by using script blocks in LabVIEW. The inputs and outputs (1D and 2D) are
created to transfer data from the script blocks to others or to Front Panel for displaying the results. A feedback node is also used as a filter of Bad Data
Detection and Identification.
When formulation and processing are based on matrix calculations, LabVIEW provides programming tools to code power system applications more easily
so it can save time for programmers.
The SE function has been successfully demonstrated in corporation with other MEMS functions and the microgrid hardware setup in the Laboratory for
Clean Energy Research, NTU. The main GUI for State Estimator is shown in Figure 6.

Optimal Power Flow


Optimal Power Flow (OPF) is one of the MEMS online functions. The objective of OPF is to find the optimal settings of a given power system network that
optimize the system objective function such as total generation cost or system loss while satisfying its power flow equations and equipment operating
limits such as bus voltage constraints, branch flow limits and generation source capacity limits. The input data for OPF includes network configuration and
load information that are defined by SE and as part of the output results, OPF will advise the recommended values for
1. Active/reactive power outputs of sources
2. Tap ratios of on-load tap-changing transformers
These parameters will be sent to CB controllers, inverter controllers, generator controllers and load tap controllers to keep the system running in more
economical and efficient mode.
The quadratic programming is used to solve the OPF problem. This algorithm is coded in MATLAB and then integrated into LabVIEW through the
MATLAB Script function. Based on the LabVIEW platform, OPF is linked to both SE and SCADA to take control over certain microgrid components. By
using LabVIEW toolboxes, the main OPF GUI for the Microgrid in the LaCER, NTU is created as shown in Figure 7.
MATLAB is a registered trademark of MathWorks, Inc.

2/7

www.ni.com

Author Information:
Gooi Hoay Beng
(www.ntu.edu.sg)
School of Electrical and Electronic Engineering (S2-B7c-05) Nanyang Technological University
Singapore 639798
Singapore
Tel: +65-67905481
Fax: +65-67933318
ehbgooi@ntu.edu.sg (mailto:ehbgooi@ntu.edu.sg)

Figure 1: MEMS Data Interface Block Diagram

3/7

www.ni.com

Figure 2: MEMS Main GUI developed using LabVIEW 2009 for monitoring all the power sensors installed.

Figure 3: Artificial Neural Network training GUI developed using LabVIEW

4/7

www.ni.com

Figure 4: Load Forecasting Main GUI developed using LabVIEW

Figure 5: GUI for Unit Commitment developed using LabVIEW

5/7

www.ni.com

Figure 6: Main GUI for State Estimation Function developed using LabVIEW

6/7

www.ni.com

Figure 7: Main GUI for Optimal Power Flow Function developed using LabVIEW
Legal
This case study (this "case study") was developed by a National Instruments ("NI") customer. THIS CASE STUDY IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (
http://ni.com/legal/termsofuse/unitedstates/us/ (http://ni.com/legal/termsofuse/unitedstates/us/)).

7/7

www.ni.com

You might also like