DNP3 File Transfer

The File Transfer feature allows downloading files from a remote RTU and uploading files to update RTU configuration.

Typical use cases include downloading disturbance record files from the RTU or uploading configuration files to update RTU settings.

Important notes

In a distributed WinCC OA project, files are always downloaded to and uploaded from the project directory where the DNP3 driver is running.

In a redundant WinCC OA project, file transfer can be executed on either the active or passive driver.

  • To transfer files on Host 1, write to the _DriverCommon data point element of Host 1.
  • To transfer files on Host 2, write to the _DriverCommon data point element of Host 2.

Example for driver number 1:

  • Host 1: _Driver1.RPC.Request
  • Host 2: _Driver1_2.RPC.Request

Local directory configuration

The root folder for local file storage is defined by the configuration entry:

[dnp3] ftRootDir (Default: <PROJ>/data/dnp3/)

  • Outgoing files: [dnp3] ftOutSubDir (Default: empty)
  • Incoming files: [dnp3] ftInSubDir (Default: empty)

The parameters remoteFile, remoteDir and fileName are interpreted relative to the configured remote base directory ([dnp3] ftRemoteDir).

Execution via JRPC 2.0

File transfer operations are executed by writing a JRPC 2.0 request to the driver RPC request data point element.

  • Request: _Driver<n>.RPC.Request
  • Response: _Driver<n>.RPC.Response

File transfer operations

1. Put File

Uploads a file from the local directory to the remote RTU.

Example:

{
  "jsonrpc": "2.0",
  "id": "123",
  "method": "dnp3_putFile",
  "params": {
    "connDp": "_dnp3_connection",
    "localFile": "config.cfg",
    "remoteFile": "config.cfg",
    "userName": "",
    "password": "",
    "permissions": 0,
    "activateConfig": true
  }
}            

Optional parameter:

  • activateConfig = true applies the new configuration (Function Code 31).

Key parameters:

  • id: Unique request identifier.
  • connDp: Connection data point name.
  • localFile: File name in the outgoing directory.
  • remoteFile: Target file name on the RTU.
  • userName: Optional user name.
  • password: Optional password.
  • permissions: File permissions.

2. Get File

Downloads a file from the remote RTU to the local directory.

Example:

{
  "jsonrpc": "2.0",
  "id": "124",
  "method": "dnp3_getFile",
  "params": {
    "connDp": "_dnp3_connection",
    "remoteFile": "disturbance.dat",
    "userName": "",
    "password": ""
  }
}            

3. Read Directory

Retrieves file information from the remote RTU.

Example:

{
  "jsonrpc": "2.0",
  "id": "125",
  "method": "dnp3_readDirectory",
  "params": {
    "connDp": "_dnp3_connection",
    "remoteDir": "",
    "userName": "",
    "password": ""
  }
}            

4. Delete File

Deletes a file from the remote RTU.

Example:

{
  "jsonrpc": "2.0",
  "id": "126",
  "method": "dnp3_deleteFile",
  "params": {
    "connDp": "_dnp3_connection",
    "authenticationKey": 0,
    "fileName": "FRA00001.cfg",
    "userName": "",
    "password": ""
  }
}            

Error handling

Responses are returned in JRPC 2.0 format on the response data point element.

  • Success: status equals ok.
  • Failure: the response contains error details.

Possible error codes:

  • ParseError (-32700)
  • InvalidRequest (-32600)
  • MethodNotFound (-32601)
  • InvalidParams (-32602)
  • QueueOverflow (-32000)
  • InvalidResponse (-32001)
  • Timeout (-32002)