# iec104-python
__Table of contents__
1. [Introduction](#introduction)
2. [Licensing](#licensing)
3. [System requirements](#system-requirements)
4. [Installation](#installation)
5. [Wiki](#wiki)
6. [Contribution](#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**
```python
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**
```python
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](https://github.com/Fraunhofer-FIT-DIEN/iec104-python/tree/main/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](https://github.com/Fraunhofer-FIT-DIEN/iec104-python/blob/main/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](https://www.gnu.org/licenses/gpl-3.0.en.html).
The library is used for 60870-5-104 protocol based communication.
[» Source code](https://github.com/mz-automation/lib60870)
[» Documentation](https://support.mz-automation.de/doc/lib60870/latest/index.html)
#### mbedtls
This project is build on top of mbedtls from the Mbed TLS Contributors, which is licensed under [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0).
The library is used to add transport layer security to the 60870-5-104 protocol based communication.
[» Source code](https://github.com/Mbed-TLS/mbedtls)
[» Documentation](https://www.trustedfirmware.org/projects/mbed-tls/)
#### pybind11
This project is build on top of pybind11 from Wenzel Jakob, which is licensed under a [BSD-style license](https://github.com/pybind/pybind11/blob/master/LICENSE).
The library is used to wrap c++ code into a python module and allow seamless operability between python and c++.
[» Source code](https://github.com/pybind/pybind11)
[» Documentation](https://pybind11.readthedocs.io/en/stable/)
#### catch2
This project is build on top of catch2 from the Catch2 Authors, which is licensed under [BSL-1.0](https://www.boost.org/users/license.html).
The library is used as testing framework for test-automation.
[» Source code](https://github.com/catchorg/Catch2)
[» Documentation](https://github.com/catchorg/Catch2/blob/devel/docs/Readme.md)
## 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.13
## Installation
Please adjust the version number to the latest version or use a specific version according to your needs.
### Install from pypi.org
```bash
python3 -m pip install c104
```
### Install from git with tag
```bash
python3 -m pip install c104@git+https://github.com/fraunhofer-fit-dien/iec104-python.git
```
## Documentation
Read more about the **Classes** and their **Properties** in our [read the docs documentation](https://iec104-python.readthedocs.io/python/index.html).
## Contribution
### How to contribute
1. Add feature requests and report bugs using GitHub's issues
1. Create pull requests
### How to build for multiple python versions (linux with docker)
1. Build wheels via docker
```bash
/bin/bash ./bin/linux-build.sh
```
### How to build (linux)
1. Install dependencies
```bash
sudo apt-get install build-essential python3-pip python3-dev python3-dbg
python3 -m pip install --upgrade pip
```
1. Build wheel
```bash
python3 -m pip wheel .
```
### How to analyze performance (linux)
1. Install dependencies
```bash
sudo apt-get install google-perftools valgrind
sudo pip3 install yep
```
1. Copy pprof binary
```bash
cd /usr/bin
sudo wget https://raw.githubusercontent.com/gperftools/gperftools/master/src/pprof
sudo chmod +x pprof
```
1. Execute profiler script
```bash
./bin/profiler.sh
```
### How to build (windows)
1. Install dependencies
- [Python 3](https://www.python.org/downloads/windows/)
- [Buildtools für Visual Studio 201*x*](https://visualstudio.microsoft.com/de/downloads/) (Scroll down » All Downloads » Tools for Visual Studio 201*x*)
1. Build wheel
```bash
python3 -m pip wheel .
```
### Generate documentation
1. Build c104 module
1. Install dependencies
- `python3 -m pip install --upgrade sphinx breathe sphinx-autodoc-typehints`
- doxygen
- graphviz
1. Build doxygen xml
```bash
doxygen Doxyfile
```
1. Build sphinx html
```bash
python3 bin/build-docs.py
```
## Change log
Track all changes in our [CHANGELOG](https://github.com/Fraunhofer-FIT-DIEN/iec104-python/blob/main/CHANGELOG.md) documentation.
Raw data
{
"_id": null,
"home_page": "https://github.com/fraunhofer-fit-dien/iec104-python",
"name": "c104",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "Python bindings,scada,rtu,remote-terminal-unit,mtu,master-terminal-unit,energy-management,60870-5-104,iec60870-5-104,iec60870-5,60870",
"author": "Martin Unkel, Fraunhofer FIT",
"author_email": "martin.unkel@fit.fraunhofer.de",
"download_url": "https://files.pythonhosted.org/packages/26/ed/1f9447694e894e8aa5298f0fbfaae00b807b8b9f048017a893b5d388ab48/c104-1.17.1.post7.tar.gz",
"platform": null,
"description": "# iec104-python\r\n\r\n__Table of contents__\r\n1. [Introduction](#introduction)\r\n2. [Licensing](#licensing)\r\n3. [System requirements](#system-requirements)\r\n4. [Installation](#installation)\r\n5. [Wiki](#wiki)\r\n6. [Contribution](#contribution)\r\n\r\n\r\n---\r\n\r\n## Introduction\r\n\r\nThis software provides an object-oriented high-level python module to simulate scada systems and remote terminal units communicating via 60870-5-104 protocol.\r\n\r\nThe python module c104 combines the use of lib60870-C with state structures and python callback handlers.\r\n\r\n**Example remote terminal unit**\r\n\r\n```python\r\nimport c104\r\n\r\n# server and station preparation\r\nserver = c104.Server(ip=\"0.0.0.0\", port=2404)\r\n\r\n# add local station and points\r\nstation = server.add_station(common_address=47)\r\nmeasurement_point = station.add_point(io_address=11, type=c104.Type.M_ME_NC_1, report_ms=1000)\r\ncommand_point = station.add_point(io_address=12, type=c104.Type.C_RC_TA_1)\r\n\r\nserver.start()\r\n```\r\n\r\n**Example scada unit**\r\n\r\n```python\r\nimport c104\r\n\r\nclient = c104.Client(tick_rate_ms=1000, command_timeout_ms=5000)\r\n\r\n# add RTU with station and points\r\nconnection = client.add_connection(ip=\"127.0.0.1\", port=2404, init=c104.Init.INTERROGATION)\r\nstation = connection.add_station(common_address=47)\r\nmeasurement_point = station.add_point(io_address=11, type=c104.Type.M_ME_NC_1, report_ms=1000)\r\ncommand_point = station.add_point(io_address=12, type=c104.Type.C_RC_TA_1)\r\n\r\nclient.start()\r\n```\r\n\r\nSee [examples](https://github.com/Fraunhofer-FIT-DIEN/iec104-python/tree/main/examples) folder for more detailed examples.\r\n\r\n## Licensing\r\n\r\nThis software is licensed under the GPLv3 (https://www.gnu.org/licenses/gpl-3.0.en.html).\r\n\r\nSee [LICENSE](https://github.com/Fraunhofer-FIT-DIEN/iec104-python/blob/main/LICENSE) file for the complete license text.\r\n\r\n### Dependencies\r\n\r\n#### lib60870-C\r\n\r\nThis project is build on top of lib60870-C v2 from MZ Automation GmbH, which is licensed under [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html).\r\n\r\nThe library is used for 60870-5-104 protocol based communication.\r\n\r\n[» Source code](https://github.com/mz-automation/lib60870)\r\n\r\n[» Documentation](https://support.mz-automation.de/doc/lib60870/latest/index.html)\r\n\r\n#### mbedtls\r\n\r\nThis project is build on top of mbedtls from the Mbed TLS Contributors, which is licensed under [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0).\r\n\r\nThe library is used to add transport layer security to the 60870-5-104 protocol based communication.\r\n\r\n[» Source code](https://github.com/Mbed-TLS/mbedtls)\r\n\r\n[» Documentation](https://www.trustedfirmware.org/projects/mbed-tls/)\r\n\r\n#### pybind11\r\n\r\nThis project is build on top of pybind11 from Wenzel Jakob, which is licensed under a [BSD-style license](https://github.com/pybind/pybind11/blob/master/LICENSE).\r\n\r\nThe library is used to wrap c++ code into a python module and allow seamless operability between python and c++.\r\n\r\n[» Source code](https://github.com/pybind/pybind11)\r\n\r\n[» Documentation](https://pybind11.readthedocs.io/en/stable/)\r\n\r\n#### catch2\r\n\r\nThis project is build on top of catch2 from the Catch2 Authors, which is licensed under [BSL-1.0](https://www.boost.org/users/license.html).\r\n\r\nThe library is used as testing framework for test-automation.\r\n\r\n[» Source code](https://github.com/catchorg/Catch2)\r\n\r\n[» Documentation](https://github.com/catchorg/Catch2/blob/devel/docs/Readme.md)\r\n\r\n\r\n## System requirements\r\n\r\n### Operating systems\r\n\r\n* Debian/Ubuntu (x64): YES >= 20.04\r\n* Raspbian (arm32v7): YES\r\n* Windows (x64): YES\r\n* Raspbian (aarch64): Not yet tested\r\n\r\n### Python versions\r\n* python >= 3.6, < 3.13\r\n\r\n## Installation\r\nPlease adjust the version number to the latest version or use a specific version according to your needs.\r\n\r\n### Install from pypi.org\r\n```bash\r\npython3 -m pip install c104\r\n```\r\n\r\n### Install from git with tag\r\n```bash\r\npython3 -m pip install c104@git+https://github.com/fraunhofer-fit-dien/iec104-python.git\r\n```\r\n\r\n## Documentation\r\n\r\nRead more about the **Classes** and their **Properties** in our [read the docs documentation](https://iec104-python.readthedocs.io/python/index.html).\r\n\r\n## Contribution\r\n\r\n### How to contribute\r\n\r\n1. Add feature requests and report bugs using GitHub's issues\r\n\r\n1. Create pull requests\r\n\r\n### How to build for multiple python versions (linux with docker)\r\n\r\n1. Build wheels via docker\r\n ```bash\r\n /bin/bash ./bin/linux-build.sh\r\n ```\r\n\r\n### How to build (linux)\r\n\r\n1. Install dependencies\r\n ```bash\r\n sudo apt-get install build-essential python3-pip python3-dev python3-dbg\r\n python3 -m pip install --upgrade pip\r\n ```\r\n\r\n1. Build wheel\r\n ```bash\r\n python3 -m pip wheel .\r\n ```\r\n\r\n### How to analyze performance (linux)\r\n\r\n1. Install dependencies\r\n ```bash\r\n sudo apt-get install google-perftools valgrind\r\n sudo pip3 install yep\r\n ```\r\n\r\n1. Copy pprof binary\r\n ```bash\r\n cd /usr/bin\r\n sudo wget https://raw.githubusercontent.com/gperftools/gperftools/master/src/pprof\r\n sudo chmod +x pprof\r\n ```\r\n\r\n1. Execute profiler script\r\n ```bash\r\n ./bin/profiler.sh\r\n ```\r\n\r\n### How to build (windows)\r\n\r\n1. Install dependencies\r\n - [Python 3](https://www.python.org/downloads/windows/)\r\n - [Buildtools f\u00fcr Visual Studio 201*x*](https://visualstudio.microsoft.com/de/downloads/) (Scroll down » All Downloads » Tools for Visual Studio 201*x*)\r\n\r\n1. Build wheel\r\n ```bash\r\n python3 -m pip wheel .\r\n ```\r\n\r\n### Generate documentation\r\n\r\n1. Build c104 module\r\n\r\n1. Install dependencies\r\n - `python3 -m pip install --upgrade sphinx breathe sphinx-autodoc-typehints`\r\n - doxygen\r\n - graphviz\r\n\r\n1. Build doxygen xml\r\n ```bash\r\n doxygen Doxyfile\r\n ```\r\n\r\n1. Build sphinx html\r\n ```bash\r\n python3 bin/build-docs.py\r\n ```\r\n\r\n## Change log\r\n\r\nTrack all changes in our [CHANGELOG](https://github.com/Fraunhofer-FIT-DIEN/iec104-python/blob/main/CHANGELOG.md) documentation.\r\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "A Python module to simulate SCADA and RTU communication over protocol 60870-5-104 to research ICT behavior in power grids.",
"version": "1.17.1.post7",
"project_urls": {
"Bug Tracker": "https://github.com/Fraunhofer-FIT-DIEN/iec104-python/issues",
"Changelog": "https://github.com/Fraunhofer-FIT-DIEN/iec104-python/blob/main/CHANGELOG.md",
"Documentation": "https://iec104-python.readthedocs.io/python/index.html",
"Homepage": "https://github.com/fraunhofer-fit-dien/iec104-python",
"Source Code": "https://github.com/Fraunhofer-FIT-DIEN/iec104-python"
},
"split_keywords": [
"python bindings",
"scada",
"rtu",
"remote-terminal-unit",
"mtu",
"master-terminal-unit",
"energy-management",
"60870-5-104",
"iec60870-5-104",
"iec60870-5",
"60870"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "26ed1f9447694e894e8aa5298f0fbfaae00b807b8b9f048017a893b5d388ab48",
"md5": "bac9eae029fa1c1c7c3b8745590f6a05",
"sha256": "0e16b56078f3f2220680535fea3d72687c9bd716f9d323d2dc660a0e85f6f6b3"
},
"downloads": -1,
"filename": "c104-1.17.1.post7.tar.gz",
"has_sig": false,
"md5_digest": "bac9eae029fa1c1c7c3b8745590f6a05",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 6713328,
"upload_time": "2024-02-08T11:44:17",
"upload_time_iso_8601": "2024-02-08T11:44:17.524446Z",
"url": "https://files.pythonhosted.org/packages/26/ed/1f9447694e894e8aa5298f0fbfaae00b807b8b9f048017a893b5d388ab48/c104-1.17.1.post7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-08 11:44:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fraunhofer-fit-dien",
"github_project": "iec104-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "c104"
}