Skip to content

Commit

Permalink
Python wrapper: update the Readme file
Browse files Browse the repository at this point in the history
Signed-off-by: Mikael Bourhis <[email protected]>
  • Loading branch information
mbourhis committed Oct 26, 2023
1 parent 0f0d22a commit 3462320
Showing 1 changed file with 39 additions and 7 deletions.
46 changes: 39 additions & 7 deletions pyiec61850/tutorial.md → pyiec61850/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Building
Before building you should install swig and python.
To build python bindings you have to turn on the BUILD\_PYTHON\_BINDINGS flag in CMake from cmake-gui or in command line:
# Python wrapper for libIEC61850

## Building
Before building you should install SWIG and Python
(see the '[Setup development environment on Linux](#setup-environment-on-linux-ubuntu)' section for help).

To build the Python bindings you have to turn on the BUILD\_PYTHON\_BINDINGS flag in CMake from cmake-gui or in command line:
```sh
$ mkdir build && cd build
$ cmake -DBUILD_PYTHON_BINDINGS=ON ..
Expand All @@ -11,21 +15,23 @@ Then compile the library and install it:
$ make
$ sudo make install
```
CMake and swig will automatically detect your python version and install the python library in python library directories.
(Eventually, update your ld cache with: `sudo ldconfig`)

CMake and SWIG will automatically detect your Python version and install the Python library in Python library directories.

For running the integrated tests:
```sh
$ make test
```

pyiec61850 library is to be imported calling
pyiec61850 library is to be imported calling:
```python
import pyiec61850 as iec61850
```

# Client tutorial
## Client tutorial

The python bindings works similarly to the basic C library. However there are some differences:
The Python bindings works similarly to the basic C library. However there are some differences:

* a specific function is to be called to cast variables from one type to another
* arguments passed by pointer are to be removed from arguments and append to the return list
Expand Down Expand Up @@ -61,3 +67,29 @@ Reading and writing operations can be performed using this syntax:
err = iec61850.IedConnection_writeFloatValue(con,
"simpleIOGenericIO/GGIO1.AnIn1.mag.f", iec61850.IEC61850_FC_MX, 10.0)
```

## Appendix

## Setup development environment on Linux Ubuntu

_[Tested on Ubuntu 20.04 LTS, Ubuntu 22.04 LTS, Ubuntu 23.10]_

Here the minimum required packages for compiling libiec61850 and the Python
wrapper (without TLS, SQlite, ...):

```sh
$ sudo apt-get update
$ sudo apt-get install g++ cmake swig git python3 python3-all-dev
```

## Setup development environment on Linux Alpine

_[Tested on Alpine 3.18]_

Here the minimum required packages for compiling libiec61850 and the Python
wrapper (without TLS, SQlite, ...):

```sh
$ apk update
$ apk add git g++ swig make cmake python3 python3-dev linux-headers
```

0 comments on commit 3462320

Please sign in to comment.