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.2.3b3-py3.10-linux-x86_64.egg (1.6 MB view details)

Uploaded Source

dnp3_python-0.2.3b3-py3.9-linux-x86_64.egg (1.6 MB view details)

Uploaded Source

dnp3_python-0.2.3b3-py3.8-linux-x86_64.egg (1.6 MB view details)

Uploaded Source

File details

Details for the file dnp3_python-0.2.3b3-py3.10-linux-x86_64.egg.

File metadata

File hashes

Hashes for dnp3_python-0.2.3b3-py3.10-linux-x86_64.egg
Algorithm Hash digest
SHA256 93141141d07f7afffd5427def3fd51c0e8970863d5366bd68d6b112502607b72
MD5 2f7014dfacf0785724a2778a7c1b1590
BLAKE2b-256 92a8ea51bfe350e4188666f1ce5bca3aea648fe9ca67b8bc9dc29ee78fe6973f

See more details on using hashes here.

File details

Details for the file dnp3_python-0.2.3b3-py3.9-linux-x86_64.egg.

File metadata

File hashes

Hashes for dnp3_python-0.2.3b3-py3.9-linux-x86_64.egg
Algorithm Hash digest
SHA256 03ef14251072bf7b8ca7f75adc6673fa9192eed00704e8e64b9b83ca6c2c93db
MD5 84615b4474cf996b3ab08b72430e0786
BLAKE2b-256 41f9759d3197cae740deafae1f1972774efb5e122246e0e60ac303a932f432fd

See more details on using hashes here.

File details

Details for the file dnp3_python-0.2.3b3-py3.8-linux-x86_64.egg.

File metadata

File hashes

Hashes for dnp3_python-0.2.3b3-py3.8-linux-x86_64.egg
Algorithm Hash digest
SHA256 9c1e25e96b6524f4716d20bb9d0b2c98f61d8386c2bfebb08d8a9f032bbe8e8e
MD5 77fc0a5c2cf9a4b1d5947104163dc4a3
BLAKE2b-256 1f50a6a3b7fb4a4dafd2cacc2e0256fabfc29eef18553ff40166694e6dfe7a65

See more details on using hashes here.

File details

Details for the file dnp3_python-0.2.3b3-cp310-cp310-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for dnp3_python-0.2.3b3-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e041c0e80815d3f14462d8af4f5b5f72e9b1c4492c01d14ce3fb383a9a689ab0
MD5 b5f91134186c9a1a5b370fecc3381663
BLAKE2b-256 5bd2a82516b15747a7a7c82e892d33b9481a86d5372c14ceb3c19d8700ba7f36

See more details on using hashes here.

File details

Details for the file dnp3_python-0.2.3b3-cp39-cp39-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for dnp3_python-0.2.3b3-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 55ac1d2089dc8865028576cd1be499c6693abd61da8ea0fdb8b98e38b7a736d7
MD5 af41fad1b8fd11603024b472e93ade54
BLAKE2b-256 401b4d71354c50c00bfc434fbff611924d8c4bbb34306d76e08a6c81634a89cd

See more details on using hashes here.

File details

Details for the file dnp3_python-0.2.3b3-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for dnp3_python-0.2.3b3-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 33c771b0a0430d34773b1c8036fa6c65b4d70a77dee1b91ef048e2949483f7ca
MD5 1e57c1c41cf411b40a02c1ef894dc224
BLAKE2b-256 96be2b83cdfc5153607ec3a79f32cabedf7002d8e78e994e20e5cd614eed6c95

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