Description
This document explains how to use the DNP3 slave interface to report analog and binary data from the simulation to an external DNP3 master, and to receive analog and binary data from an external DNP3 master to control the simulation.
During the driver initialization, the initial values of each analog and binary outputs, defined by the user in the configuration, are used to initialize the simulated database.
This is to make sure the correct values are applied to the binary and analog outputs at the start of the simulation.
Connections are performed when the model is loaded and depending on the configuration.
It means that once the simulation is running, if a DNP3 master establishes a connection with the simulated slave IED, it can trigger a command to set a specific value on an analog output (or binary), at a specific point index.
The value of the point will then be updated inside the simulated database and this change will be also reflected at the output of the driver, on the corresponding signal of the analog (or binary) output bus in RTLAB.
The DNP3 master can also trigger a command to read the analog (or binary) value of a specific input point index and the simulated DNP3 slave IED will respond, following the DNP3 protocol, with the latest value of this point read from the simulated database.
Only the TCP protocol is supported as of now. Please refer to the Limitations section for more information.
See additional details in the Configuration and Connections sections.
Supported Features
The following is a list of the features supported by this driver:
- Read and write analog data points
- Read and write binary data points
- Unsolicited responses can be allowed
- Event mode for analog, binary, and double bit binary inputs can be configured
- Operate over TCP/IP
- Configurable network interface
- Configurable DNP3 link addresses
- Configurable scan period for analog, binary, and double bit binary inputs
- Binary output commands: control relay output block (CROB)
These features will be detailed in the next section.
Configuration
The driver is entirely configurable via the RT-LAB GUI. Users can add, delete and duplicate DNP3 slaves to connect to analogs and binaries in order to quickly obtain the desired configuration.
General Configuration
The first parameters to be configured are found below:
- Use an RT core for asynchronous computation:
- If set to true, the driver reserves a real-time CPU core for its communication system and is able to handle a bigger amount of slaves, phasors, analogs, and digitals.
- If set to false, the communication system will default to core 0.
- Verbose: If set to true, the entire configuration will be displayed during the loading of the model.
Slave Configuration
By default, the driver is configured with one slave to connect to, which contains 2 analog inputs, 2 binary inputs, 2 analog outputs, 2 binary outputs and 2 double bit binary inputs.
Each slave has multiple parameters:
- ID: Unique numeric value to identify each DNP3 slave (1-65534)
- Channel name: Unique name to be given to each DNP3 slave channel
- Protocol: Communication protocol that the DNP3 master will use to communicate with the DNP3 slave. Only 'TCP' is supported.
- TCP port: TCP port number that the DNP3 master will use to establish a connection with the DNP3 slave.
In other words, the DNP3 slave is waiting for a connection on this TCP port.
- NIC name: Network interface controller name of the target. Typically, on Linux systems, the main interface name is 'eth0'.
It is possible to get the network interface name by running the ifconfig command on the target.
If the target is equipped with more than one network interface, the user can assign different DNP3 slaves to different network controllers and control the Ethernet traffic that will have to be handled by each of them.
- IP address: the IP address that will be used to reach the DNP3 slave communication interface. If required, this parameter can be set to 'AUTO' to select the first IP address assigned to the target.
In this case, the DNP3 master will be able to reach the DNP3 slave using the main IP address assigned to the target. It can also be set to 'localhost' if the DNP3 master is running on the same target.
If multiple DNP3 slaves are simulated in the same model on the target IP address, the TCP port used for each device must be different.
On Linux systems, if an IP address that is not configured on the defined network interface is specified, the driver will attempt to create an IP alias on the network interface and attach the DNP3 slave to this alias.
In this case, the master will be able to reach the slave using the alias IP address.
This functionality is interesting to simulate different slaves in the same model and have each of them being reachable using their own IP address.
To avoid network conflicts, an error will be returned if the IP address is already used on the network.
- Slave link address: Specifies the DNP3 link-layer address of the simulated DNP3 slave IED. In a real IED network, each IED has its own DNP3 link-layer address.
- Master link address: Specifies the DNP3 link-layer address of the DNP3 master that will be allowed to establish a connection with the simulated DNP3 slave IED.
- Link status period: Specifies how often to send link status requests, if no DNP3 frames have been received on this session. In the DNP3 IP networking spec, this is called the keep-alive interval.
- Validate source address: Specifies whether or not to validate source link address in received frames. DNP3 frames contain both a source link-address field and a destination link-address field.
If set to 0, the DNP3 slave does not validate the source link address, and frames whose destination link address matches a configured slave session will be accepted.
Setting this to 1 requires both source and destination link addresses to match a local slave session before the frame is accepted.
- Enable self-address: Specifies whether or not to enable self-address functionality on this slave device as specified by DNP Technical Bulletin 2003-003 Self-Address Reservation.
The slave will respond to address 0xfffc as though it received a request for its configured address. It will respond with its own address so the master can automatically discover the slave address.
- Allow multiple fragment response: Specifies whether the application is allowed to send multi-fragment responses.
- Confirm multiple fragments: Specifies whether application layer confirmations will be requested for non-final fragments of a multi-fragment response.
Application layer confirmations are always requested for responses that contain events.
- Send qualifier 7 for active config response: Parsing Table says send qualifier 5b for activate config response. For backward compatibility with old implementations send qualifier 7 instead.
- Set need time in response: Specifies whether this slave will set the Need Time IIN bit in response to this session at startup and after the clock valid period has elapsed.
If this bit is set the master will respond with a time synchronization request. Typically this parameter should be true for one session for each slave device.
Set this parameter to 0 if the report by exception is not supported or there is no reason this device needs to be synchronized from the master.
- Application confirm timeout (ms): Application confirms timeout specifies how long the DNP3 slave will wait for an application layer confirmation from the master.
This in combination with unsolRetryDelay or unsolOfflineRetryDelay will determine how frequently an unsolicited response will be resent.
The unit is in milliseconds.
- Delete oldest event: If set to 1, the event with the earliest timeStamp will be deleted when a new event is added to an event queue that is full.
- Select timeout (ms): Specifies the maximum amount of time that a select will remain valid before the corresponding operation is received.
If an operation request is received after this period has elapsed since the previous selection will not be valid and the operation request will fail.
The unit is in milliseconds.
- Warm restart delay (ms): Specifies the time a master must wait after receiving a response to a warm restart request.
This value is encoded in a time delay fine object in the response which limits it to 65535 ms. The unit is in milliseconds. - Cold restart delay (ms): Specifies the time a master must wait after receiving a response to a cold restart request.
This value is encoded in a time delay fine object in the response which limits it to 65535 ms. The unit is in milliseconds.
Allow unsolicited responses: Specifies whether or not unsolicited responses are allowed.
Only Class 1, 2, and 3 input data can allow unsolicited responses.
Send unsolicited responses when online: Specifies whether or not unsolicited responses is enabled sent when the session comes online.
Refer to official DNP3 documentation for more details about the variations of the objects.
- Unsolicited class mask: Specifies which class of point is reported by default when sendUnsolWhenOnline is set to true.
- Default variation for type 30 objects: Specifies the DNP3 default variation for type 30 objects (*).
- Default variation for type 32 objects: Specifies the DNP3 default variation for type 32 objects (*).
- Default variation for type 40 objects: Specifies the DNP3 default variation for type 40 objects (*).
- Default variation for type 42 objects: Specifies the DNP3 default variation for type 42 objects (*).
- Event mode for analog inputs: Specifies the event mode for analog inputs. Must be MOST_RECENT to have the most recent events being reported or 'SOE' for having sequences of events being reported.
- Event mode for binary inputs*: Specifies the event mode for binary inputs. Must be MOST_RECENT to have the most recent events being reported or 'SOE' for having sequences of events being reported.
- Maximum number of analog inputs*: Specifies the number of analog input events that can be registered between two consecutive polling operations.
This value will scale the analog input event buffer size.
To avoid buffer overflow, it should be large enough to handle all the analog input events registered between two analog inputs read request from the master.
- Maximum number of binary inputs: Specifies the number of binary input events that can be registered between two consecutive polling operations.
This value will scale the binary input event buffer size.
To avoid buffer overflow, it should be large enough to handle all the analog input events registered between two binary inputs read request from the master. - Analog inputs scan period (ms): Specifies analog inputs scan period (in millisecond).
This is the rate at which the DNP3 slave library will scan the database to detect events on analog input points.
It is recommended to configure this rate about 10 times the variation speed of the fastest analog input. - Binary inputs scan period (ms)*: Specifies binary inputs scan period (in millisecond).
This is the rate at which the DNP3 slave library will scan the database to detect events on binary input points.
It is recommended to configure this rate about 10 times the variation speed of the fastest binary input.
*Note: The configuration will also be applied on the double bit binary inputs (for event mode, the maximum number of inputs, and scan period only).
DNP3 has provisions for representing data in different formats.
Static values can be represented by variation numbers as follows:
- A 32-bit integer value with flag
- A 16-bit integer value with flag
- A 32-bit integer value
- A 16-bit integer value
- A 32-bit floating-point value with flag
- A 64-bit floating-point value with flag
The flag referred to is a single octet with bit fields indicating whether the source is online, the data source restarted, communications are lost with a downstream source, the data is forced and the value is over the range.
Event data can be represented by variation numbers as follows:
- A 32-bit integer value with flag
- A 16-bit integer value with flag
- A 32-bit integer value with flag and event time
- A 16-bit integer value with flag and event time
- A 32-bit floating-point value with flag
- A 64-bit floating-point value with flag
- A 32-bit floating-point value with flag and event time
- A 64-bit floating-point value with flag and event time
The flag has the same bit fields as for the static variations
By default, the driver is configured with one slave, that contains 2 analog inputs, 2 binary inputs, 2 double-bit binary inputs, 2 analog outputs, and 2 binary outputs.
Analog, Binary, and Double Bit Binary Inputs Configuration
A slave contains a list for each of the input data types (analog, binary and double bit binary). These lists are to be configured depending on the desired point class of each point.
If the DNP3 master sends a command to enable 'unsolicited responses' for the analog, binary, and/or double-bit binary inputs, changes on these inputs will be periodically reported to the DNP3 master.
Each data has the following parameter(s):
- Point class: The point class can be 0, 1, 2, or 3.
- Deadband (Analog type only): The analog input data will be reported to the master if the value exceeds the latest value in the event queue plus or minus the value set as deadband.
Analog and Binary Outputs Configuration
A slave contains a list for each of the output data types (analog and binary). These lists are to be configured depending on the desired point class and the default value of each point.
Each data has the following parameters:
- Point class: The point class can be 0, 1, 2 or 3.
- Default value: The initial value that will be sent to the model until a DNP3 master connects and updates it with a new value.
- Operate as trip/close pair (Binary type only): A checkbox that enables or disables the use of the point as a trip/close pair.
When checked, the binary output will have 2 connection points, one for 'trip' and one for 'close'. The default value dictates how the 'trip or 'close' gets activated:- default value OFF = 'trip' or 'close' output will be active for the duration of the 'on time' parameter of the command
- default value ON = 'trip' or 'close' output will be active for the duration of the 'off time' parameter of the command
The DNP3 master can enable unsolicited responses for a specific class of points (class 1, 2, and 3).
Connections
Once the driver has been configured as desired, the user will have to connect points in the model to points in the driver by using the designated RT-LAB GUI. This connection panel will show all the driver's and model's connectable points, once the model has been compiled. It is also possible to make connections on LabVIEW panels.
The driver's connectable points depend on the number of analog and digital inputs and outputs that the slave has.
The following lists the driver connectable points for an input (analog, binary or double bit binary) and an output (analog or binary).
The example model provided with RT-LAB is already packaged with connections between the driver and the model. It can be used to understand how the connections between the model and the driver should be done.
Analog / Binary / Double Bit Binary Inputs
Connectable Name | Description | Direction |
---|---|---|
Analog input X or Binary input X or Double bit binary input X | Data value | To model |
(X being the number of the point in its related configuration list) |
Analog / Binary Outputs
Analog
Connectable Name | Description | Direction |
---|---|---|
Analog output X | Data value | From model |
(X being the number of the point in its related configuration list) |
Binary
If the Operate as trip/close pair parameter is off:
Connectable Name | Description | Direction |
---|---|---|
Binary output X | Data value | From model |
(X being the number of the point in its related configuration list) |
Otherwise, if the Operate as trip/close pair parameter is on:
Connectable Name | Description | Direction |
---|---|---|
Binary output X trip | Data value for the 'trip' output | From model |
Binary output X close | Data value for the 'close' output | |
(X being the number of the point in its related configuration list) |
Limitations
The current version of the driver has the following limitations:
- Only the DNP3 slave endpoint is supported.
- The indexes of the data points correspond to the order of their definition in the driver configuration, with the first signal starting at index 0.
- RS-232/RS-422/RS-485 and UDP communication links are not supported (TCP/IP only).
- The supported data types are analog inputs, analog outputs, binary inputs, binary outputs, and double bit binary inputs.
- Double bit binary input can have a value of 0, 1, 2, and 3, which are the only value that will be reflected on the DNP3 master.
- CROB command parameters 'clear' and 'queue' are not supported.