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
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.16.0
Install from git
python3 -m pip install c104@git+https://github.com/fraunhofer-fit-dien/iec104-python.git@v1.16.0
Wiki
Read more about the Classes and their Properties in our project Wiki.
Contribution
How to contribute
-
Add feature requests and report bugs using GitHub's issues
-
Create merge 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.16.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67f759045a608b3c14816d8297ae9361e80c1fd0c65bce44fa7529bb0ae3faf9 |
|
MD5 | 1b3cfe839ccefb71b2fe3f2a963b50d9 |
|
BLAKE2b-256 | 4140f3a2d57ac9807fc50398ce70b9abfd12e603e4c4276ba0682ab703ea9817 |
Hashes for c104-1.16.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdb25edf07e6c6ceafda465afe7f3c452d717a1c5788b71226eed56ddf88db41 |
|
MD5 | b934eb5de6dc29600cd3a2e32ff9009c |
|
BLAKE2b-256 | e40d4d5143c8613d91b7848aaaf00620013a4b4c7276d3210717b566886b884d |
Hashes for c104-1.16.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf17416d9998b6925368bcc40d3d61fbafa4b50ee38b3cd193a0586eae01bf9a |
|
MD5 | 6d2ec670c9e89a8aefdd7ebde8dbabbe |
|
BLAKE2b-256 | 0473fdf473fab626c46773263ce15c586155ace484294d21d2caffb682ea647f |
Hashes for c104-1.16.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12b5d352853d273958f79eaef4871caf3c56cb963aabf7024cd73d441e86b5c6 |
|
MD5 | d6f63059eff6a670361afbee9f225789 |
|
BLAKE2b-256 | 0e781b853ef2fe4b5d58aa77d88adbcd061db79fb0e417b8882aab91f51c762f |
Hashes for c104-1.16.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcde26a8f90f675ed1972cee0bd1f61f01f7ae0488ef2a9a0ca14718545f33ec |
|
MD5 | db3f67de1ca11dc808b9293d222af826 |
|
BLAKE2b-256 | 8e512f45dbad8a1e0be7053e70d85cef3b3327bbadb8da0b430b474ce5fbd629 |
Hashes for c104-1.16.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23f08e0e1ba362ef62d13355e8369f0a8cf54fcef3ad979f06af483d72952119 |
|
MD5 | f001544a7fec3ce1bac7b477a0d0eb0f |
|
BLAKE2b-256 | 4ee954406c1523b1397ff5d68a8687b3aaab720c30789b7f67e8f96e2a5dc406 |
Hashes for c104-1.16.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8671a7a3c2aeb336eee7374c4ab60ad151b3b596ed6e426fdb8b6498856726a |
|
MD5 | 05d265da7fe8e5d6365acda36317bf66 |
|
BLAKE2b-256 | a2ca7ed044be86b68a9633d428e818e334f67a3607cd57eda487d70bc5be154c |
Hashes for c104-1.16.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 009729c3a8f60882bf609ef37e99cad363caa8bd27faec3c571aeb0754dd4dae |
|
MD5 | cd6cc8cf873bfb9f61b9e75bcaf31f18 |
|
BLAKE2b-256 | 8a217cdce717c7b4eaea0afc01fe33f115363d8ca11c23543840204f35fd2283 |
Hashes for c104-1.16.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fff65b108fbdc7edadd7c2afd519e89e765a5232b573966b5177c6a06fe6b4d |
|
MD5 | e64522485daca3e367fc5626ca4e5d24 |
|
BLAKE2b-256 | 5936e01fd5befeddfe86457586caf448067f2da98db64d38b5f7937e8db72f8a |
Hashes for c104-1.16.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c2e4d5a9f883fe4c98d0fe033ce94c5f91a177d558c7ec6699a7cc0fbd9f712 |
|
MD5 | 2cf19793c819594057d30a2789a6fe9f |
|
BLAKE2b-256 | 31f4eeb08ac17ad98cb2b30cd01225ed365f15305fcc88ffdb25a83f2f8c6907 |
Hashes for c104-1.16.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6474cf06f1963eba97cc3949f8704b1391ef14fbcdfd1c9b588dc75d3e9ad14 |
|
MD5 | e3920207e6e552e25543d8b0737c4f38 |
|
BLAKE2b-256 | 22c0420efb7779b84c57e1d92c002be5c3cb90573fd48d43d4b6fed4bfe38edf |
Hashes for c104-1.16.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ea0030521a1d250895f24f783250683bde8ab5dc1d36a8d53b082d5938547b0 |
|
MD5 | 91072429914d35187f2bcb5ab597c793 |
|
BLAKE2b-256 | a0bff86ddee1cb94aa7c58a4c541450de58cda14e5eb0d51ae1f5e78bd263262 |