Introduction to DNP3



DNP3 (Distributed Network Protocol) was developed by GE Harris to create a protocol specification for vendors of power grid SCADA (Supervisory Control and Data Acquisition) components to standardize on.  Since 1993, this open and public protocol has been managed by the DNP3 Users Group.  DNP3 is commonly used in North American electric and water utilities for communication between SCADA masters and outstations like Remote Terminal Units (RTUs).  A typical set-up involves master station computers that monitor all the system equipment and control their behavior based on the collected data.  Outstations are remote computers in the field that collect the sensor data and perhaps run local analysis to pass onto the master.

System and Message Architectures

DNP3 has the flexibility to connect a single master with one or more outstations over serial and Ethernet physical media. Other possible architectures include multiple master connections to a single outstation and peer-to-peer operations. Typically, the master initiates control commands for requesting data from or actuating devices managed by the outstation. The outstation responds to the master by sending the appropriate information or confirmation.

Using an enhanced OSI 3-layer model, the protocol consists of a Data Link Layer, Transport Function, Application Layer, and User Layer. The Data Link Layer makes the physical link more reliable with addressing and error detection. The Transport Function assembles Link Layer frames into larger Application Layer fragments. The Application Layer interprets the complete message and indicates what data is desired to the User Layer. Each message can contain multiple data types, such as binary, analog, and counter inputs and outputs.

Figure 1. Enhanced 3-layer OSI model for DNP3.

Polling and Prioritization

The master stations use polling to keep their databases updated with the latest system states, closed-loop control, alarm notification, and more.  DNP3 allows you to specify what kinds of data the master wants to receive.  Static data refers to the most recently measured or calculated data points, whereas event data refers to any significant activity, such as state changes, new information, and data that has past certain thresholds.  To get static data, a master requests class 0 data from an outstation to receive present values.  When requesting event data, DNP3 allows you organize or prioritize them into classes 1, 2, or 3 for greater granularity.  Outstations can also be allowed to send unsolicited responses for automatically updating the master with any crucial data changes.

DNP3 also has basic time synchronization functions, such as setting an outstation’s clock, time-stamping data points, and “freezing” certain input values so that the master can view data existing in multiple outstations at the same instant in time.

National Instruments DNP3 Tools

National Instruments provides a user level software called NI-Industrial Communications for DNP3 for programming LabVIEW targets as DNP3 outstation devices with advanced functionality, such as power quality monitoring, phasor measurements, and other smart grid-related analysis.  These targets include (as of NI-Industrial Communications for DNP3 14.0) NI PXIe Windows controllers and NI real-time CompactRIO, Single-board RIO, PXI, and PXIe controllers.  NI-IndCom for DNP3 is installed on these targets and then utilizes the native Ethernet port to communicate with DNP3 masters.  NI-IndCom for DNP3 cannot be used on a non NI PXIe Windows Target, such as a Windows PC.

In general, the programming API uses LabVIEW VI functions for performing an action, such as reading and writing from data points.  The API uses LabVIEW property nodes for setting and getting DNP3 properties.  For example, outstation session property nodes are used to set scan periods, unsolicited responses, and event configuration.

Figure 2. LabVIEW VI function palette for NI-IndCom for DNP3.

Figure 3. LabVIEW property nodes for NI-IndCom for DNP3.

Implementation Level

DNP3 has defined four levels of implementation, such that each level determines which data types, function codes, and qualifier codes can be used.  For example, a Level 1 master only supports the most basic types and functions – such as binary, analog, and counter inputs and events – which comprise of about one-third of the total DNP3 definitions.  NI-IndCom for DNP3 1.1 has Level 3 outstation support.

Example Program: Analog Input

Below is the analog input example program that is included in the driver software.  The section steps through the basic functions and properties used for programming a DNP3 outstation in LabVIEW.

Figure 4. DNP3 analog input example program.

  1. The Create Outstation function turns the LabVIEW target into a DNP3 outstation and sets the scan rate for checking inputs and sending responses.
  2. The Create Channel function creates a communication channel which encapsulates the physical layer, link layer, and transport function of DNP3. It also sets the ports or IP addresses for masters that are allowed to connect to the outstation. Multiple channels may be created per outstation. 
  3. The Create Session function creates a connection between a local device (server) and a remote device (client) within a communication channel. Multiple sessions may be created per communication channel. 
  4. The Write function writes to a certain data point index using one of eight data types, including analog input. It can also generate an associated event or object flag. 
  5. The Destroy Session function destroys the session created by the Create Session function. 
  6. The Destroy Channel function destroys the channel created by the Create Channel function. 
  7. The Destroy Outstation function destroys the outstation reference created by the Create Outstation function.

For file transfer functions, NI-IndCom for DNP3 allows the master station to upload and download files from the LabVIEW-programmed outstation.  For outstation time synchronization, use the Clock Time properties to set the frequency of clock synchronization or to manually request a re-synchronization.

Related Links:
NI-Industrial Communications for DNP3