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.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee44458c28f8a1388e8c3dda793fef8095d46ddfb58a973a6174667c32698e15 |
|
MD5 | 6dd8de8ea20c3fe09892a7cf0a995bfc |
|
BLAKE2b-256 | ebc635a3b4f98418bf530d1fce3790b8010dca58b359e7b9ecf26f57bc71a7fd |
Hashes for c104-1.17.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2d1e1ace0d021efded1d2a483300cdc56f11303295ffb82035b64610a5a7721 |
|
MD5 | 84007c502467ce97bdc524d752802738 |
|
BLAKE2b-256 | 2bbb724e20b6f8eb73ee7f96f76bf0d080f5d87afee7e57b2afa98cadeb41c42 |
Hashes for c104-1.17.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9733a746b6691036b28ec1955a9dace6cb76ec93b46582ef896d4273f2c282a9 |
|
MD5 | 28331b5b84a91a71ba6f7f9b367b57f0 |
|
BLAKE2b-256 | 8f5ad6f28e1e3e6d14f1bb0610c6b97419e2006f6d0f2499a73f17943357e44a |
Hashes for c104-1.17.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d1b9c877e1cb8855bb608750ff7353c7ee689b03a30a99ea063458546482e93 |
|
MD5 | f8923dd2c588e82a2a0333dece93160c |
|
BLAKE2b-256 | 35f98805fdf14723bad6c2163426cfb129c35e5ae563c9005d118f82979ce174 |
Hashes for c104-1.17.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3e70b7aed0e06232b9fc74754038a2b6f9035f3013ce12da5a93c7609cda5ab |
|
MD5 | 27f7670bc273e09789cc0d6c7eccab04 |
|
BLAKE2b-256 | c54f2f9e2e805c420ea21ccfd588a23a28a3403817caf3588b485c75901fc172 |
Hashes for c104-1.17.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 555e4ac97916a6941da60d3c2da02be9060c449a0d5bed129bfecc822efc39fc |
|
MD5 | 0a9af02cfa47813b5c5fc8efac5f4464 |
|
BLAKE2b-256 | 7d7ce5da51b0af4a862a445042cafad3794811336e15684fcb00c1afafa79f54 |
Hashes for c104-1.17.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac2d2b6f97c17198597e599b5099a03f564182363826c68dac3b84ead86e7d9a |
|
MD5 | e2561d9f9b07689fe823158b45c38985 |
|
BLAKE2b-256 | 9d059f486770c23dfc0f022c37dfbb5123f5e842efced546f2e28a0acd17cce4 |
Hashes for c104-1.17.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6937be71d3d773ae14df459225d99da623cf3961c6e03a684be443f06f639c1 |
|
MD5 | 42e80ef1923716b64195bd947cf39379 |
|
BLAKE2b-256 | 1a4f60c9e6e0b169a1245e6e9ac7399dc63b39037da191390f173d9bbeca2cd2 |
Hashes for c104-1.17.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47e98578a66d488400884bdfb9f92128dfaba23c519453cbccc44183be63bd74 |
|
MD5 | 6dfa2154250877fc9aeb6f26d272c849 |
|
BLAKE2b-256 | a443b3b78faa6ac2dae89aff937214a75c39ec105f807f16009ba1cc74577f86 |
Hashes for c104-1.17.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17397cfc0d5d1d153deef1340b79d836e88a5c82346dcfbfefad8a8459d53620 |
|
MD5 | 1b8605ca2c808a945bc1de491abce41f |
|
BLAKE2b-256 | b3a965e280052f282431c574788aa9d83055b01be0a86e7dcaefe7f300656d31 |
Hashes for c104-1.17.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a461701d6fbf1e8702ac0e026d1b5fbc3227ab730a4c374cbcbaf591be6241ba |
|
MD5 | 9a91f73d3e80adcb8ce0ab1c2ce0ac76 |
|
BLAKE2b-256 | 332cff877c19772fae634bcb418d1e351e681b1998b763489eb631677f3b4d04 |
Hashes for c104-1.17.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 551b14fa0a8c7d448edcbdc80bbeba106b305c16642db3567abac2f1d38d7519 |
|
MD5 | e879d604cdf167d115ebda3c38be60de |
|
BLAKE2b-256 | a68025b08fc6f2fa4b6ebd42bb86825761440d81800cd60df246b8d5becb0da7 |