Skip to main content

iec104-python

Project description

iec104-python

Table of contents

  1. Introduction
  2. Licensing
  3. System requirements
  4. Installation
  5. Wiki
  6. Contribution

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.

» Source code

» Documentation

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.

» Source code

» Documentation

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++.

» Source code

» Documentation

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.

» Source code

» Documentation

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

  1. Add feature requests and report bugs using GitHub's issues

  2. Create merge requests

How to build for multiple python versions (linux with docker)

  1. Build wheels via docker
    /bin/bash ./bin/linux-build.sh
    

How to build (linux)

  1. Install dependencies

    sudo apt-get install build-essential python3-pip python3-dev python3-dbg
    python3 -m pip install --upgrade pip
    
  2. Build wheel

    python3 -m pip wheel .
    

How to analyze performance (linux)

  1. Install dependencies

    sudo apt-get install google-perftools valgrind
    sudo pip3 install yep
    
  2. Copy pprof binary

    cd /usr/bin
    sudo wget https://raw.githubusercontent.com/gperftools/gperftools/master/src/pprof
    sudo chmod +x pprof
    
  3. Execute profiler script

    ./bin/profiler.sh
    

How to build (windows)

  1. Install dependencies

  2. Build wheel

    python3 -m pip wheel .
    

Generate documentation

  1. Build c104 module

  2. Install dependencies

    • python3 -m pip install --upgrade sphinx breathe sphinx-autodoc-typehints
    • doxygen
    • graphviz
  3. Build doxygen xml

    doxygen Doxyfile
    
  4. Build sphinx html

    python3 bin/build-docs.py
    

Change log

Track all changes in our CHANGELOG documentation.

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

c104-1.16.1-cp311-cp311-win_amd64.whl (397.6 kB view details)

Uploaded CPython 3.11 Windows x86-64

c104-1.16.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (541.1 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

c104-1.16.1-cp310-cp310-win_amd64.whl (397.4 kB view details)

Uploaded CPython 3.10 Windows x86-64

c104-1.16.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (540.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

c104-1.16.1-cp39-cp39-win_amd64.whl (389.2 kB view details)

Uploaded CPython 3.9 Windows x86-64

c104-1.16.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (539.9 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

c104-1.16.1-cp38-cp38-win_amd64.whl (397.2 kB view details)

Uploaded CPython 3.8 Windows x86-64

c104-1.16.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (566.5 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

c104-1.16.1-cp37-cp37m-win_amd64.whl (397.2 kB view details)

Uploaded CPython 3.7m Windows x86-64

c104-1.16.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (580.7 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

c104-1.16.1-cp36-cp36m-win_amd64.whl (397.2 kB view details)

Uploaded CPython 3.6m Windows x86-64

c104-1.16.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (580.6 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

File details

Details for the file c104-1.16.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: c104-1.16.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 397.6 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for c104-1.16.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 67f759045a608b3c14816d8297ae9361e80c1fd0c65bce44fa7529bb0ae3faf9
MD5 1b3cfe839ccefb71b2fe3f2a963b50d9
BLAKE2b-256 4140f3a2d57ac9807fc50398ce70b9abfd12e603e4c4276ba0682ab703ea9817

See more details on using hashes here.

File details

Details for the file c104-1.16.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file c104-1.16.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: c104-1.16.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 397.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for c104-1.16.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cf17416d9998b6925368bcc40d3d61fbafa4b50ee38b3cd193a0586eae01bf9a
MD5 6d2ec670c9e89a8aefdd7ebde8dbabbe
BLAKE2b-256 0473fdf473fab626c46773263ce15c586155ace484294d21d2caffb682ea647f

See more details on using hashes here.

File details

Details for the file c104-1.16.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file c104-1.16.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: c104-1.16.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 389.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for c104-1.16.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 fcde26a8f90f675ed1972cee0bd1f61f01f7ae0488ef2a9a0ca14718545f33ec
MD5 db3f67de1ca11dc808b9293d222af826
BLAKE2b-256 8e512f45dbad8a1e0be7053e70d85cef3b3327bbadb8da0b430b474ce5fbd629

See more details on using hashes here.

File details

Details for the file c104-1.16.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file c104-1.16.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: c104-1.16.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 397.2 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for c104-1.16.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e8671a7a3c2aeb336eee7374c4ab60ad151b3b596ed6e426fdb8b6498856726a
MD5 05d265da7fe8e5d6365acda36317bf66
BLAKE2b-256 a2ca7ed044be86b68a9633d428e818e334f67a3607cd57eda487d70bc5be154c

See more details on using hashes here.

File details

Details for the file c104-1.16.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file c104-1.16.1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: c104-1.16.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 397.2 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for c104-1.16.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 8fff65b108fbdc7edadd7c2afd519e89e765a5232b573966b5177c6a06fe6b4d
MD5 e64522485daca3e367fc5626ca4e5d24
BLAKE2b-256 5936e01fd5befeddfe86457586caf448067f2da98db64d38b5f7937e8db72f8a

See more details on using hashes here.

File details

Details for the file c104-1.16.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file c104-1.16.1-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: c104-1.16.1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 397.2 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for c104-1.16.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 c6474cf06f1963eba97cc3949f8704b1391ef14fbcdfd1c9b588dc75d3e9ad14
MD5 e3920207e6e552e25543d8b0737c4f38
BLAKE2b-256 22c0420efb7779b84c57e1d92c002be5c3cb90573fd48d43d4b6fed4bfe38edf

See more details on using hashes here.

File details

Details for the file c104-1.16.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

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

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