iec104-python
Project description
iec104-python
Table of contents
Introduction
This software provides an object-oriented high-level python module to simulate scada systems and remote terminal units communicating via 60870-5-104 protocol.
The python module c104 combines the use of lib60870-C with state structures and python callback handlers.
Example remote terminal unit
import c104
# server and station preparation
server = c104.Server(ip="0.0.0.0", port=2404)
# add local station and points
station = server.add_station(common_address=47)
measurement_point = station.add_point(io_address=11, type=c104.Type.M_ME_NC_1, report_ms=1000)
command_point = station.add_point(io_address=12, type=c104.Type.C_RC_TA_1)
server.start()
Example scada unit
import c104
client = c104.Client(tick_rate_ms=1000, command_timeout_ms=5000)
# add RTU with station and points
connection = client.add_connection(ip="127.0.0.1", port=2404, init=c104.Init.INTERROGATION)
station = connection.add_station(common_address=47)
measurement_point = station.add_point(io_address=11, type=c104.Type.M_ME_NC_1, report_ms=1000)
command_point = station.add_point(io_address=12, type=c104.Type.C_RC_TA_1)
client.start()
See examples folder for more detailed examples.
Licensing
This software is licensed under the GPLv3 (https://www.gnu.org/licenses/gpl-3.0.en.html).
See LICENSE file for the complete license text.
Dependencies
lib60870-C
This project is build on top of lib60870-C v2 from MZ Automation GmbH, which is licensed under GPLv3.
The library is used for 60870-5-104 protocol based communication.
mbedtls
This project is build on top of mbedtls from the Mbed TLS Contributors, which is licensed under Apache-2.0.
The library is used to add transport layer security to the 60870-5-104 protocol based communication.
pybind11
This project is build on top of pybind11 from Wenzel Jakob, which is licensed under a BSD-style license.
The library is used to wrap c++ code into a python module and allow seamless operability between python and c++.
catch2
This project is build on top of catch2 from the Catch2 Authors, which is licensed under BSL-1.0.
The library is used as testing framework for test-automation.
System requirements
Operating systems
- Debian/Ubuntu (x64): YES >= 20.04
- Raspbian (arm32v7): YES
- Windows (x64): YES
- Raspbian (aarch64): Not yet tested
Python versions
- python >= 3.6, < 3.11
Installation
Please adjust the version number to the latest version or use a specific version according to your needs.
Install from pypi.org
python3 -m pip install c104~=1.17.0
Install from git with tag
python3 -m pip install c104@git+https://github.com/fraunhofer-fit-dien/iec104-python.git@v1.17.0
Documentation
Read more about the Classes and their Properties in our read the docs documentation.
Contribution
How to contribute
-
Add feature requests and report bugs using GitHub's issues
-
Create pull requests
How to build for multiple python versions (linux with docker)
- Build wheels via docker
/bin/bash ./bin/linux-build.sh
How to build (linux)
-
Install dependencies
sudo apt-get install build-essential python3-pip python3-dev python3-dbg python3 -m pip install --upgrade pip
-
Build wheel
python3 -m pip wheel .
How to analyze performance (linux)
-
Install dependencies
sudo apt-get install google-perftools valgrind sudo pip3 install yep
-
Copy pprof binary
cd /usr/bin sudo wget https://raw.githubusercontent.com/gperftools/gperftools/master/src/pprof sudo chmod +x pprof
-
Execute profiler script
./bin/profiler.sh
How to build (windows)
-
Install dependencies
- Python 3
- Buildtools für Visual Studio 201x (Scroll down » All Downloads » Tools for Visual Studio 201x)
-
Build wheel
python3 -m pip wheel .
Generate documentation
-
Build c104 module
-
Install dependencies
python3 -m pip install --upgrade sphinx breathe sphinx-autodoc-typehints
- doxygen
- graphviz
-
Build doxygen xml
doxygen Doxyfile
-
Build sphinx html
python3 bin/build-docs.py
Change log
Track all changes in our CHANGELOG documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for c104-1.17.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee74a15f7590046db892bcdb58cb885e3b9644dc42bf2f488cd9ed735b5a8f0c |
|
MD5 | de1b7630f648f0d38bcb15df601cb243 |
|
BLAKE2b-256 | ca36bc6750176a5c8e18fe280df30ab038c5a0ad836eb40b9d3de619f3bda38a |
Hashes for c104-1.17.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 782f90b123acdb139112da89a62ebabbbe0129808921a60fb08a9a85ef0ea4c8 |
|
MD5 | 1dfc65fc6879a7678d778fb8e3dd7662 |
|
BLAKE2b-256 | 652082d1f79e6c1cf475e2d37f623df7dba7c4fab30fda05e4d4b8c86dfb225b |
Hashes for c104-1.17.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c9ba6bd036fc24ed23bcee1466185f925bca65b965d297e824feed181b06ba1 |
|
MD5 | bf7e0e29903f96e57fa755ccfff32f67 |
|
BLAKE2b-256 | 3a0b3820b07052e8c2f23b9d576bcbbebb082174751a22d8a3719020f90bc6c1 |
Hashes for c104-1.17.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e22ed535af3e03317f5a38d92880915390e77dd056e15b8473c0d91bbf5fa7e |
|
MD5 | 63594adc991d5b0f7c8b1b2c949c498e |
|
BLAKE2b-256 | eb1725264a30e179106314022df8f069d5e2f77f95575e047950b085911c4bde |
Hashes for c104-1.17.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e9d35526c9d3b5bed479c4c6c55568fd12d8aabb46dbc7e7f2dfa97af91a79d |
|
MD5 | 36497d05c97869ee9f244bb7c178c76e |
|
BLAKE2b-256 | 0214054970f86c80f8317c29b6ddda355fe07dead129e2ae4fbf50757565967e |
Hashes for c104-1.17.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06b2c6fdde92a821c684ba8aee7ced479c557308e52ac552d14a523c8f89f1d0 |
|
MD5 | a010f24e68978f9489280f5fd1543a4a |
|
BLAKE2b-256 | f89fa7d909a2cf454980a73f9daf5c8d8d0553b913e18c1987950af9c19e61da |
Hashes for c104-1.17.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a0dd0f17bb6d7b3944b64cb28b48726dcc0140e48333fca7dfb8f933cf6ac75 |
|
MD5 | 786058e4ab2648b139a1b7bf5421211f |
|
BLAKE2b-256 | 165b1f61ed4598b6cdd4f13e458dbd58474f9701f575245f77682ebd937834a5 |
Hashes for c104-1.17.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1098f6124ccc942e02b0fec3d938562d87e8616499e969273007e8fc9080fcc9 |
|
MD5 | 033fff9cae092320835264b79de6d8f0 |
|
BLAKE2b-256 | 3f23aeb6ffce3202a578e499fc8293474daba8730fda5d4789ac78c9f9fdf251 |
Hashes for c104-1.17.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8763f34a3fc387385014a8730a15b7e7a9045627e3c82fc67909b11a01b083eb |
|
MD5 | 2a8f203fd8f0c6d243bfa3bd3f4046da |
|
BLAKE2b-256 | cddea796d987377af10528d06cf5089863ecb3c1961a78f434bccfe37b701d3a |
Hashes for c104-1.17.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 770142408a7655362ad4859367a0d1dc5651953de4b82f874c35bda2a050edf4 |
|
MD5 | b4a8be7dbe621883cf13f9abd6339bb9 |
|
BLAKE2b-256 | fcaa3882b578bdaeb9a2edf94ec0bc458bf815f997161cf4e48d323aa9ab6c66 |
Hashes for c104-1.17.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c312feadf9ecab4490bd193dbb6bb10bd1f9b8dc7e39284d8b2b5e1dcccb7101 |
|
MD5 | 065a815ee6da9ccb418b6db1daff779f |
|
BLAKE2b-256 | dee1308a01278a494b2b2b26d1f0d71db6e4dbb448cb41012113dfc5247f8439 |
Hashes for c104-1.17.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e26345000dbcec422377d05009eeebb6052027b1bc940381e10d1c93eec4114 |
|
MD5 | b3561a0a879699bf3bb353b6f3400759 |
|
BLAKE2b-256 | 42726b986eaa921aaf8c738f4c2f0ac4a27ceead411f57d369cfec8720c2c6a1 |