Documentation search search close
CONTENTS
https://www.speedgoat.com/help/slrt/page/icon_documentation.jpg
v10.0.1.x for R2026a
View other versions

DNP3 Usage Notes

DNP3 Usage Notes — Detailed information about the DNP3 blockset and the DNP3 protocol

Introduction to DNP3

Distributed Network Protocol 3 (DNP3) is a TCP/IP-based communication protocol and allows interoperability between components in electric grids. These components are either client (DNP3 client) or server (DNP3 server). One DNP3 client connects to multiple DNP3 servers to read and write binary data, analog data and counters. Typical client stations are human machine interfaces (HMI) and supervisory control and data acquisition (SCADA) systems. Typical servers are remote terminal units (RTU) and intelligent electronic devices (IED).

In DNP3 networks, each physical device has a unique IP address. Servers normally listen on TCP port 20000 for incoming connection requests from clients. TCP port numbers on the client side are random. In addition to physical connection, there is a logical layer, namely link layer, where each DNP3 station has a unique DNP3 address. The DNP3 address is an integer number between 0 and 65519. Instead of "DNP3 address", the terms "Client ID" and "Server ID" are used in Speedgoat block masks and documentation. This is for the sake of clarity and to distinguish from "IP address".

Typical Target Machine Configurations

For DNP3 communication with Speedgoat target machines, you can use onboard Ethernet interfaces and plug-in Ethernet I/O modules.

Use the Ethernet Configuration Tool to assign IP addresses to these Ethernet interfaces.

For DNP3, you can use any Ethernet interface whose Configuration is set to IP Protocols.

One real-time target machine can perform multiple DNP3 clients and servers. There are four possible configurations:

One IP Address per Ethernet Interface

One IP address is assigned to one Ethernet interface. This Ethernet interface acts as either one DNP3 client or one DNP3 server in the network. You can install multiple Ethernet I/O modules (providing up to 4 interfaces each) or use additional onboard Ethernet interfaces in order to set up multiple DNP3 clients and servers. As all the Ethernet interfaces of a target machine must be associated with different Ethernet subnets, each DNP3 station must operate in another Ethernet network. If an application requires multiple client stations to communicate with different DNP3 networks, then this target configuration is the correct choice. In contrast, if the simulation of a DNP3 network with multiple servers is required, this setup cannot be used.

Subnet dedication of an Ethernet interface is defined by IP address and subnet mask.

Multiple IP Addresses per Ethernet Interface (IP Aliasing)

IP aliasing can be used to assign multiple IP addresses to a single physical interface. This allows multiple DNP3 clients and servers to be operated on the same Ethernet I/O module or the same onboard Ethernet interface. As the related IP addresses are always associated with the same Ethernet subnet, this configuration is ideal for simulating a DNP3 network containing multiple servers. Even mixed operation (client and server) is possible for the purpose of loopback testing. Alias addresses can be configured in the advanced settings of the Ethernet Configuration Tool or by functions.

Enter the following in the MATLAB command window to manage IP aliasing:

>> ipAliasObj = speedgoat.IpAliasConfiguration()
>> ipAliasObj.add('ETH2', {'192.168.10.31','192.168.10.32','192.168.10.33'})
>> ipAliasObj.remove('ETH2', {'192.168.10.33'})
>> ipAliasObj.add('Host Link', {'192.168.1.15','192.168.1.19'})

Enter the following in the MATLAB command window to check the available Ethernet interfaces and configured IP aliases:

>> ipAliasObj.show()
Interface Name      IP Address          Subnet Mask
---------------     ---------------     ---------------
ETH2                192.168.10.1        255.255.255.0
                    192.168.10.31       255.255.255.255
                    192.168.10.32       255.255.255.255
                    192.168.10.33       255.255.255.255
Host Link           192.168.1.14        255.255.255.0
                    192.168.1.15        255.255.255.255
                    192.168.1.19        255.255.255.255

Multiple TCP Ports per IP Address

This is the normal operation for client stations as each connection of the client to a server requires a separate TCP port. Consequently, you can set up multiple client stations with the same IP address but different TCP ports and different Client IDs. All these client stations would then act in the same subnet.

For testing and simulation, you can even ignore the default server port 20000 and allow multiple servers to listen on different TCP ports. All these servers would then act in the same subnet too.

Multiple DNP3 Nodes per TCP port

According to the DNP3 standard, one TCP port can perform multiple DNP3 nodes on the link layer. The Speedgoat DNP3 blocks do not currently support this type of multi-channel operation.

Runtime License

DNP3 blocks require a runtime license installed on the target machine. Please refer to the Runtime Licensing help.

DNP3 Data Exchange

DNP3 data is mainly exchanged in request-response fashion. The client sends a request frame to the server. The server sends a response frame to the client. The following request types (commands) are supported by the Speedgoat DNP3 blockset:

  • Read request

  • Control request

  • Freeze request

  • Class assignment

  • Enable unsolicited messages

  • Integrity poll

For certain events, the server can send out so-called unsolicited messages. In this case, single read requests are not required.

The header of a DNP3 request contains four essential items of information:

ItemDescription
GroupDefines the data area or rather the type of data to which the request refers
VariationDefines the data type (unsigned integer, float, etc.) and requests additional meta data (timestamp, flags)
Function codeDefines the type of operation (read, write, freeze)
Qualifier codeAddressing mode: all, limited quantity, start-stop index, etc.

The corresponding DNP3 response includes an appropriate response function code, as well as the same values for group and variation as the request.

The DNP3 server manages several data areas (groups). Inputs and outputs are stored in point groups, and data changes are stored as events in event groups. Points and events can be frozen by the client via the freeze command. Frozen point and event values are stored in additional areas (frozen point groups, frozen event groups). The Speedgoat DNP3 blockset for client and server supports the groups below.

GroupName
01Binary inputs
02Binary input events
03Double-binary inputs
04Double-binary input events
10Binary outputs
11Binary output control
12Binary output events
13Binary output control events
20Counter inputs
21Frozen counter inputs
22Counter input events
23Frozen counter input events
30Analog inputs
31Frozen analog inputs
32Analog input events
33Frozen analog input events
40Analog outputs
41Analog output control
42Analog output events
43Analog output control events

Command Overview

GroupVariationFunction CodeQualifier CodesDescription
0101*01 Read binary input
010201 Read binary input with flag
0201*01 Read binary input event
020201 Read binary input event with absolute time
020301 Read binary input event with relative time
0301*01 Read double-binary input
030201 Read double-binary input with flag
0401*01 Read double-binary input event
040201 Read double-binary input event with absolute time
040301 Read double-binary input event with relative time
1001*01 Read binary output
100201 Read binary output with flag
1101*01 Read binary output event
110201 Read binary output event with time
1201*05 Control Relay Output
1301*01 Read relay output control event
130201 Read relay output control event with time
2000*07 Immediate freeze binary counter
200008 Immediate freeze binary counter (no response)
200009 Freeze and clear binary counter
200010 Freeze and clear binary counter (no response)
200011 Freeze binary counter at time
200012 Freeze binary counter at time (no response)
200101 Read binary counter with flag (32-bit integer)
200201 Read binary counter with flag (16-bit integer)
200501 Read binary counter (32-bit integer)
200601 Read binary counter (16-bit integer)
2101*01 Read frozen counter with flag (32-bit integer)
210201 Read frozen counter with flag (16-bit integer)
210501 Read frozen counter with flag and time (32-bit integer)
210601 Read frozen counter with flag and time (16-bit integer)
210901 Read frozen counter (32-bit integer)
211001 Read frozen counter (16-bit integer)
2201*01 Read counter event with flag (32-bit integer)
220201 Read counter event with flag (16-bit integer)
220501 Read counter event with flag and time (32-bit integer)
220601 Read counter event with flag and time (16-bit integer)
2301*01 Read frozen counter event with flag (32-bit integer)
230201 Read frozen counter event with flag (16-bit integer)
230501 Read frozen counter event with flag and time (32-bit integer)
230601 Read frozen counter event with flag and time (16-bit integer)
300007 Immediate freeze analog input
300008 Immediate freeze analog input (no response)
300009 Freeze and clear analog input
300010 Freeze and clear analog input (no response)
300011 Freeze analog input at time
300012 Freeze analog input at time (no response)
300101 Read analog input with flag (32-bit integer)
300201 Read analog input with flag (16-bit integer)
300301 Read analog input (32-bit integer)
300401 Read analog input (16-bit integer)
300501 Read analog input with flag (32-bit float)
3006*01 Read analog input with flag (64-bit float)
310101 Read frozen analog input with flag (32-bit integer)
310201 Read frozen analog input with flag (16-bit integer)
310301 Read frozen analog input with flag and time (32-bit integer)
310401 Read frozen analog input with flag and time (16-bit integer)
310501 Read frozen analog input (32-bit integer)
310601 Read frozen analog input (16-bit integer)
310701 Read frozen analog with flag (32-bit float)
3108*01 Read frozen analog with flag (64-bit float)
320101 Read analog input event with flag (32-bit integer)
320201 Read analog input event with flag (16-bit integer)
320301 Read analog input event with flag and time (32-bit integer)
320401 Read analog input event with flag and time (16-bit integer)
320501 Read analog input event with flag (32-bit float)
3206*01 Read analog input event with flag (64-bit float)
320701 Read analog input event with flag and time (32-bit float)
320801 Read analog input event with flag and time (64-bit float)
330101 Read frozen analog input event with flag (32-bit integer)
330201 Read frozen analog input event with flag (16-bit integer)
330301 Read frozen analog input event with flag and time (32-bit integer)
330401 Read frozen analog input event with flag and time (16-bit integer)
330501 Read frozen analog input event with flag (32-bit float)
3306*01 Read frozen analog input event with flag (64-bit float)
330701 Read frozen analog input event with flag and time (32-bit float)
330801 Read frozen analog input event with flag and time (64-bit float)
400101 Read analog output (32-bit integer)
400201 Read analog output (16-bit integer)
400301 Read analog output (32-bit float)
4004*01 Read analog output (64-bit float)
410105 Control analog output (32-bit integer)
410205 Control analog output (16-bit integer)
410305 Control analog output (32-bit float)
4104*05 Control analog output (64-bit float)
420101 Read analog output event (32-bit integer)
420201 Read analog output event (16-bit integer)
420301 Read analog output event with time (32-bit integer)
420401 Read analog output event with time (16-bit integer)
420501 Read analog output event (32-bit float)
4206*01 Read analog output event (64-bit float)
420701 Read analog output event with time (32-bit float)
420801 Read analog output event with time (64-bit float)
430101 Read analog output control event (32-bit integer)
430201 Read analog output control event (16-bit integer)
430301 Read analog output control event with time (32-bit integer)
430401 Read analog output control event with time (16-bit integer)
430501 Read analog output control event (32-bit float)
4306*01 Read analog output control event (64-bit float)
430701 Read analog output control event with time (32-bit float)
430801 Read analog output control event with time (64-bit float)

* Default variation