Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

dnp3-python

About the DNP3 Protocol

Distributed Network Protocol (DNP or DNP3) has achieved a large-scale acceptance since its introduction in 1993. This protocol is an immediately deployable solution for monitoring remote sites because it was developed for communication of critical infrastructure status, allowing for reliable remote control.

GE-Harris Canada (formerly Westronic, Inc.) is generally credited with the seminal work on the protocol. This protocol is, however, currently implemented by an extensive range of manufacturers in a variety of industrial applications, such as electric utilities.

DNP3 is composed of three layers of the OSI seven-layer functions model. These layers are application layer, data link layer, and transport layer. Also, DNP3 can be transmitted over a serial bus connection or over a TCP/IP network.

Main DNP3 Capabilities

As an intelligent and robust SCADA protocol, DNP3 gives you many capabilities. Some of them are:

  • DNP3 can request and respond with multiple data types in single messages
  • Response without request (unsolicited messages)
  • It allows multiple masters and peer-to-peer operations
  • It supports time synchronization and a standard time format
  • It includes only changed data in response messages

For more details about the DNP3 protocol, the DNP3-Primer.md article is a good start.

About the dnp3-python Package

Python bindings for the opendnp3 library, an open source implementation of the DNP3 protocol stack written in C++14.

Note: This is a redesign of pydnp3 and work in progress.

Supported Platforms: Linux (Tested with Ubuntu 20.04, 22.04)

Install

Support Python >= 3.8, using pip

pip install dnp3-python

Validate Installation

After installing the package, run the following command to validate the installation.

dnp3demo

Expected output

ms(1666217818743) INFO    manager - Starting thread (0)
channel state change: OPENING
ms(1666217818744) INFO    tcpclient - Connecting to: 127.0.0.1
ms(1666217818744) WARN    tcpclient - Error Connecting: Connection refused
2022-10-19 17:16:58,744 dnp3demo.data_retrieval_demo    DEBUG   Initialization complete. Master Station in command loop.
ms(1666217818746) INFO    manager - Starting thread (0)
ms(1666217818746) INFO    server - Listening on: 127.0.0.1:20000
2022-10-19 17:16:58,746 dnp3demo.data_retrieval_demo    DEBUG   Initialization complete. OutStation in command loop.
ms(1666217819745) INFO    tcpclient - Connecting to: 127.0.0.1
ms(1666217819745) INFO    tcpclient - Connected to: 127.0.0.1
channel state change: OPEN
ms(1666217819745) INFO    server - Accepted connection from: 127.0.0.1

...

===important log: case6 get_db_by_group_variation ==== 2 2022-10-19 17:17:01.157129 {GroupVariation.Group30Var6: {0: 5.588852790313346, 1: 17.7138169198775, 2: 22.456219616993142, 3: 0.0, 4: 0.0, 5: 0.0, 6: 0.0, 7: 0.0, 8: 0.0, 9: 0.0}}
===important log: case6b get_db_by_group_variation ==== 2 2022-10-19 17:17:01.157407 {GroupVariation.Group1Var2: {0: True, 1: True, 2: True, 3: False, 4: False, 5: False, 6: False, 7: False, 8: False, 9: False}}
===important log: case6c get_db_by_group_variation ==== 2 2022-10-19 17:17:01.157559 {GroupVariation.Group30Var1: {0: 5, 1: 17, 2: 22, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0}}
===important log: case7 get_db_by_group_variation_index ==== 2 2022-10-19 17:17:01.157661 {GroupVariation.Group30Var6: {0: 5.588852790313346}}
===important log: case7b get_db_by_group_variation_index ==== 2 2022-10-19 17:17:01.157878 17.7138169198775
===important log: case7c get_db_by_group_variation_index ==== 2 2022-10-19 17:17:01.157974 0.0

NOTE: Use dnp3demo -h to see demo options

$ dnp3demo -h
usage: dnp3demo [-h] {master,outstation,demo} ...

Dnp3 use case demo

optional arguments:
  -h, --help            show this help message and exit

dnp3demo Sub-command:
  {master,outstation,demo}
    master              run a configurable master interactive program
    outstation          run a configurable outstation interactive program
    demo                run dnp3 demo with default master and outstation

For more details about the dnp3demo module, please refer to dnp3demo-module.md.

For Developers

pydnp3 is a thin wrapper around opendnp3 classes. Documentation for the opendnp3 classes is available at automatak.

Dependencies

To build the library from source, you must have:

This repository includes two repositories as submodules (under deps/):

Please find more info Notes_on_packaging.md about packaging process, for example, building from the C++ source code, packaging native Python code with C++ binding code, etc.

Metadata

Release files for dnp3-python 0.3.0b2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for dnp3-python 0.3.0b2
File Interpreter ABI Platform
dnp3_python-0.3.0b2-cp310-cp310-manylinux1_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.5+ x86-64 Details
dnp3_python-0.3.0b2-cp39-cp39-manylinux1_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.5+ x86-64 Details
dnp3_python-0.3.0b2-cp38-cp38-manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details

Total release size: 4.9 MB

Release files / dnp3_python-0.3.0b2-cp310-cp310-manylinux1_x86_64.whl

Download URL dnp3_python-0.3.0b2-cp310-cp310-manylinux1_x86_64.whl
Size 1.6 MB
Tags CPython 3.10 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
8831afba9d3eb5adbb6ffc810f40e59e99775da1ec00337fdf2d8130afb6f445
BLAKE2b-256 checksum
How to use checksums
29855045439a1be1a49722429bf9c27165ee4a9734ba5995a25f7fb2ebe8894f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / dnp3_python-0.3.0b2-cp39-cp39-manylinux1_x86_64.whl

Download URL dnp3_python-0.3.0b2-cp39-cp39-manylinux1_x86_64.whl
Size 1.6 MB
Tags CPython 3.9 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
8940251dadda337becc18669a231f6cdfcd75a73ac2395cfca580f727a48c28b
BLAKE2b-256 checksum
How to use checksums
a05b91a5237f5e3b47dd0e0706e0e4e9ddc12cc3c5a4d0818abf884c49f87bba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / dnp3_python-0.3.0b2-cp38-cp38-manylinux1_x86_64.whl

Download URL dnp3_python-0.3.0b2-cp38-cp38-manylinux1_x86_64.whl
Size 1.6 MB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
3db8b943650e6dc0b531c17935613b3d8127f1952445801cd78e0846b608c8ca
BLAKE2b-256 checksum
How to use checksums
a1ea7a04e559172e1601d02c502d771a00c5fb4a60b4e3a939f0ff8bd4f226a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.3.0b2 This release

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page