Skip to main content

pydnp3 -- python binding for opendnp3

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

dnp3_python-0.3.0b2-cp310-cp310-manylinux1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10

dnp3_python-0.3.0b2-cp39-cp39-manylinux1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9

File details

Details for the file dnp3_python-0.3.0b2-cp310-cp310-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for dnp3_python-0.3.0b2-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8831afba9d3eb5adbb6ffc810f40e59e99775da1ec00337fdf2d8130afb6f445
MD5 41fb772057f22d3274e22c59f84948c4
BLAKE2b-256 29855045439a1be1a49722429bf9c27165ee4a9734ba5995a25f7fb2ebe8894f

See more details on using hashes here.

File details

Details for the file dnp3_python-0.3.0b2-cp39-cp39-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for dnp3_python-0.3.0b2-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8940251dadda337becc18669a231f6cdfcd75a73ac2395cfca580f727a48c28b
MD5 dfc375b4ce08156b772240f0853648f1
BLAKE2b-256 a05b91a5237f5e3b47dd0e0706e0e4e9ddc12cc3c5a4d0818abf884c49f87bba

See more details on using hashes here.

File details

Details for the file dnp3_python-0.3.0b2-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for dnp3_python-0.3.0b2-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3db8b943650e6dc0b531c17935613b3d8127f1952445801cd78e0846b608c8ca
MD5 7f396560fbb90a73ab7a786c26f2c425
BLAKE2b-256 a1ea7a04e559172e1601d02c502d771a00c5fb4a60b4e3a939f0ff8bd4f226a2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page