openopc2


Nameopenopc2 JSON
Version 0.1.18 PyPI version JSON
download
home_pagehttps://github.com/iterativ/openopc2
SummaryOPC library with a Windows gateway enabling non-Windows clients to access OPC-DA calls.
upload_time2024-09-13 20:38:54
maintainerNone
docs_urlNone
authorLorenz Padberg
requires_python<3.13,>=3.8
licenseGPL-2.0-or-later
keywords opc openopc opc-da opc classic
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
<img src="https://github.com/iterativ/openopc2/raw/develop/doc/assets/open-opc.png" alt="LinuxSetup" width="700"/>
</p>

[![PyPI version](https://badge.fury.io/py/openopc2.svg)](https://badge.fury.io/py/openopc2)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/openopc2)

**OpenOPC 2**  is a Python Library for OPC DA. It is Open source and free for everyone. It allows you to use
[OPC Classic](https://opcfoundation.org/about/opc-technologies/opc-classic/) (OPC Data Access) in
modern Python environments. OPC Classic is a pure Windows technology by design, but this library includes a Gateway Server
that lets you use OPC Classic on any architecture (Linux, MacOS, Windows, Docker). So this Library creates a gateway
between 2022 and the late 90ties. Like cruising into the sunset with Marty McFly in a Tesla.

OpenOPC 2 is based on the OpenOPC Library that was initially created by Barry Barnleitner and hosted on Source Forge, but
It was completely refactorerd and migrated to Python 3.8+

# πŸ”₯ Features

- An OpenOPC Gateway Service (a Windows service providing remote access
  to the OpenOPC library, which is useful to avoid DCOM issues).
- Command Line Interface (CLI)
- Enables you to use OPC Classic with any Platform
- CLI and Gateway are independent Executables that do not require Python
- A system check module (allows you to check the health of your system)
- A free OPC automation wrapper (required DLL file).
- General documentation with updated procedures (this file).

# 🐍 OpenOPC vs OpenOPC 2

Open OPC 2 is based on OpenOPC and should be seen as a successor. If you already have an application that is based on
OpenOPC, you can migrate with a minimal effort. Our main motivation to build this new version was to improve the developer
experience and create a base for other developers that is easier to maintain, test and work with...

- Simpler installation
- Mostly the same api (but we take the freedom to not be compatible)
- No memory leak in the OpenOpcService πŸŽ‰
- Python 3.8+ (tested with 3.10)
- Typings
- Pyro5, increased security
- We added tests 😎
- Refactoring for increased readablity
- Nicer CLI
- Pipy Package

# πŸš€ Getting started

## Windows local installation

The quickest way to start is the cli application. Start your OPC server and use the openopc2.exe cli application for test (no python
installation required).

Now you know that your OPC server is talking to OpenOPC 2. Then lets get started with python. If you use OpenOPC 2 with
Python in windows directly you are **limited to a 32bit Python** installation. This is because the dlls of OPC are 32bit.
If you prefer working with a 64bit Python version you can simply use the With OpenOPC Gateway.

<img src="https://github.com/iterativ/openopc2/raw/develop/doc/assets/WindowsSetup.png" alt="WindowsSetup" width="400"/>

You must install the gbda_aut.dll (in /lib) which is the GrayboxOpcDa wrapper.

http://gray-box.net/daawrapper.php?lang=en

```console
python -m openopc2 list-servers
```

## Multi platform installation

One of the main benefits of OpenOPC 2 is the OpenOPC gateway. This enables you to use any modern platform for
developing your application. Start the OpenOPC service in the Windows environment where the OPC server is running.
The Service starts a server (Pyro5) that lets you use the OpenOPC2 OpcDaClient on another machine. Due to the magic of
Pyro (Python Remote Objects) the developer experience and usage of the Library remains the same as if you work in the
local Windows setup.

([Download the executables here](https://github.com/iterativ/openopc2/releases/latest))


<img src="https://github.com/iterativ/openopc2/raw/develop/doc/assets/LinuxSetup.png" alt="LinuxSetup" width="700"/>

On the Windows Machine open the console as administrator.

```shell
openopcservice install
openopcservice start
```

On your Linux machine

```shell
pip install openopc2
```

python

```python
from openopc2.da_client import OpcDaClient
```

# βš™οΈ Configuration

The configuration of the OpenOpc 2 library and the OpenOpcGateway is done via environment variables.

```
OPC_CLASS=Graybox.OPC.DAWrapper
OPC_CLIENT=OpenOPC
OPC_GATE_HOST=192.168.1.96    # IMPORTANT: Replace with your IP address
OPC_GATE_PORT=7766
OPC_HOST=localhost
OPC_MODE=dcom
OPC_SERVER=Matrikon.OPC.Simulation
```

- If they are not set, open a command prompt window (`cmd`) and type:

```
C:\>set ENV_VAR=VALUE
C:\>set OPC_GATE_HOST=172.16.4.22    # this is an example
```

- Alternately, Windows OS system or user environment variables work.
  Note that user environment variables take precedent over system environment
  variables.

- Make sure the firewall is allowed to keep the port 7766 open. If in
  doubt, and you're doing a quick test, just turn off your firewall
  completely.

- For easy testing, make sure an OPC server is installed in your Windows
  box (i.e. Matrikon OPC Simulation Server).

- The work environment for testing these changes was a remote MacOs with Window10 64bit host and the Matrikon simulation
  server.

- Register the OPC automation wrapper ( `gbda_aut.dll` ) by typing this
  in the command line:

```shell
C:\openopc2\lib>regsvr32 gbda_aut.dll
```

- If, for any reason, you want to uninstall this file and remove it from
  your system registry later, type this in the command line:

```shell
C:\openopc2\lib>regsvr32 gbda_aut.dll -u
```

# CLI

The CLI (Command Line Interface) lets you use OpenOPC2 in the shell and offers you a quick way to explore your opc server
and the OpenOPC DA client without the need of writing Python code.

The documentation of the CLI can be found [here](CLI.md)

<p>
<img src="https://github.com/iterativ/openopc2/raw/develop/doc/assets/cli_server-info.png" alt="WindowsSetup" width="400"/>
</p>

<p>
<img src="https://github.com/iterativ/openopc2/raw/develop/doc/assets/cli_read.png" alt="WindowsSetup" width="400"/>
</p>

<p>
<img src="https://github.com/iterativ/openopc2/raw/develop/doc/assets/cli_write.png" alt="WindowsSetup" width="400"/>
</p>

<p>
<img src="https://github.com/iterativ/openopc2/raw/develop/doc/assets/cli_properties.png" alt="WindowsSetup" width="400"/>
</p>

# OpenOPC Gateway

This task can be completed from one of two ways (make sure to have it
installed first):

- By clicking the `Start` link on the "OpenOPC Gateway Service" from the
  "Services" window (Start -> Control Panel -> System and Security ->
  Administrative Tools).
- By running the `net start SERVICE` command like this:

```shell
C:\openopc2\bin> zzzOpenOPCService
```

- If you have problems starting the service, you can also try to start
  this in "debug" mode:

```shell
C:\openopc2\src>python OpenOPCService.py debug
```

```shell
C:\openopc2\>net stop zzzOpenOPCService
```

### Configure the way the OpenOPC Gateway Service starts

If you are going to use this service frequently, it would be better to
configure it to start in "automatic" mode. To do this:

- Select the "OpenOPC Gateway Service" from the "Services" window
  (Start -> Control Panel -> System and Security -> Administrative Tools).
- Right-click and choose "Properties".
- Change the startup mode to "Automatic". Click "Apply" and "OK"
  buttons.
- Start the service (if not already started).

## πŸ™ Credits

OpenOPC 2 is based on the OpenOPC python library that was originally created by Barry Barnleitner and its many Forks on
Github. Without the great work of all the contributors, this would not be possible. Contribution is open for everyone.

The authors of the package are (among others):

| Years     |     | Name              | User                          |
| --------- | --- | ----------------- | ----------------------------- |
| 2008-2012 | πŸ‡ΊπŸ‡Έ  | Barry Barnreiter  | barry_b@users.sourceforge.net |
| 2014      | πŸ‡·πŸ‡Ί  | Anton D. Kachalov | https://github.com/ya-mouse   |
| 2017      | πŸ‡»πŸ‡ͺ  | JosΓ© A. Maita     | https://github.com/joseamaita |
| 2022      | πŸ‡¨πŸ‡­  | Lorenz Padberg    | https://github.com/renzop     |
| 2022      | πŸ‡¨πŸ‡­  | Elia Bieri        | https://github.com/eliabieri  |

## πŸ“œ License

This software is licensed under the terms of the GNU GPL v2 license plus
a special linking exception for portions of the package. This license is
available in the `LICENSE.txt` file.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/iterativ/openopc2",
    "name": "openopc2",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.8",
    "maintainer_email": null,
    "keywords": "opc, openopc, opc-da, opc classic",
    "author": "Lorenz Padberg",
    "author_email": "lorenz.padberg@iterativ.ch",
    "download_url": "https://files.pythonhosted.org/packages/b9/0a/745f87bfba82628978f8795eac1e961357c95931e31fc15d5e603f838355/openopc2-0.1.18.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n<img src=\"https://github.com/iterativ/openopc2/raw/develop/doc/assets/open-opc.png\" alt=\"LinuxSetup\" width=\"700\"/>\n</p>\n\n[![PyPI version](https://badge.fury.io/py/openopc2.svg)](https://badge.fury.io/py/openopc2)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/openopc2)\n\n**OpenOPC 2**  is a Python Library for OPC DA. It is Open source and free for everyone. It allows you to use\n[OPC Classic](https://opcfoundation.org/about/opc-technologies/opc-classic/) (OPC Data Access) in\nmodern Python environments. OPC Classic is a pure Windows technology by design, but this library includes a Gateway Server\nthat lets you use OPC Classic on any architecture (Linux, MacOS, Windows, Docker). So this Library creates a gateway\nbetween 2022 and the late 90ties. Like cruising into the sunset with Marty McFly in a Tesla.\n\nOpenOPC 2 is based on the OpenOPC Library that was initially created by Barry Barnleitner and hosted on Source Forge, but\nIt was completely refactorerd and migrated to Python 3.8+\n\n# \ud83d\udd25 Features\n\n- An OpenOPC Gateway Service (a Windows service providing remote access\n  to the OpenOPC library, which is useful to avoid DCOM issues).\n- Command Line Interface (CLI)\n- Enables you to use OPC Classic with any Platform\n- CLI and Gateway are independent Executables that do not require Python\n- A system check module (allows you to check the health of your system)\n- A free OPC automation wrapper (required DLL file).\n- General documentation with updated procedures (this file).\n\n# \ud83d\udc0d OpenOPC vs OpenOPC 2\n\nOpen OPC 2 is based on OpenOPC and should be seen as a successor. If you already have an application that is based on\nOpenOPC, you can migrate with a minimal effort. Our main motivation to build this new version was to improve the developer\nexperience and create a base for other developers that is easier to maintain, test and work with...\n\n- Simpler installation\n- Mostly the same api (but we take the freedom to not be compatible)\n- No memory leak in the OpenOpcService \ud83c\udf89\n- Python 3.8+ (tested with 3.10)\n- Typings\n- Pyro5, increased security\n- We added tests \ud83d\ude0e\n- Refactoring for increased readablity\n- Nicer CLI\n- Pipy Package\n\n# \ud83d\ude80 Getting started\n\n## Windows local installation\n\nThe quickest way to start is the cli application. Start your OPC server and use the openopc2.exe cli application for test (no python\ninstallation required).\n\nNow you know that your OPC server is talking to OpenOPC 2. Then lets get started with python. If you use OpenOPC 2 with\nPython in windows directly you are **limited to a 32bit Python** installation. This is because the dlls of OPC are 32bit.\nIf you prefer working with a 64bit Python version you can simply use the With OpenOPC Gateway.\n\n<img src=\"https://github.com/iterativ/openopc2/raw/develop/doc/assets/WindowsSetup.png\" alt=\"WindowsSetup\" width=\"400\"/>\n\nYou must install the gbda_aut.dll (in /lib) which is the GrayboxOpcDa wrapper.\n\nhttp://gray-box.net/daawrapper.php?lang=en\n\n```console\npython -m openopc2 list-servers\n```\n\n## Multi platform installation\n\nOne of the main benefits of OpenOPC 2 is the OpenOPC gateway. This enables you to use any modern platform for\ndeveloping your application. Start the OpenOPC service in the Windows environment where the OPC server is running.\nThe Service starts a server (Pyro5) that lets you use the OpenOPC2 OpcDaClient on another machine. Due to the magic of\nPyro (Python Remote Objects) the developer experience and usage of the Library remains the same as if you work in the\nlocal Windows setup.\n\n([Download the executables here](https://github.com/iterativ/openopc2/releases/latest))\n\n\n<img src=\"https://github.com/iterativ/openopc2/raw/develop/doc/assets/LinuxSetup.png\" alt=\"LinuxSetup\" width=\"700\"/>\n\nOn the Windows Machine open the console as administrator.\n\n```shell\nopenopcservice install\nopenopcservice start\n```\n\nOn your Linux machine\n\n```shell\npip install openopc2\n```\n\npython\n\n```python\nfrom openopc2.da_client import OpcDaClient\n```\n\n# \u2699\ufe0f Configuration\n\nThe configuration of the OpenOpc 2 library and the OpenOpcGateway is done via environment variables.\n\n```\nOPC_CLASS=Graybox.OPC.DAWrapper\nOPC_CLIENT=OpenOPC\nOPC_GATE_HOST=192.168.1.96    # IMPORTANT: Replace with your IP address\nOPC_GATE_PORT=7766\nOPC_HOST=localhost\nOPC_MODE=dcom\nOPC_SERVER=Matrikon.OPC.Simulation\n```\n\n- If they are not set, open a command prompt window (`cmd`) and type:\n\n```\nC:\\>set ENV_VAR=VALUE\nC:\\>set OPC_GATE_HOST=172.16.4.22    # this is an example\n```\n\n- Alternately, Windows OS system or user environment variables work.\n  Note that user environment variables take precedent over system environment\n  variables.\n\n- Make sure the firewall is allowed to keep the port 7766 open. If in\n  doubt, and you're doing a quick test, just turn off your firewall\n  completely.\n\n- For easy testing, make sure an OPC server is installed in your Windows\n  box (i.e. Matrikon OPC Simulation Server).\n\n- The work environment for testing these changes was a remote MacOs with Window10 64bit host and the Matrikon simulation\n  server.\n\n- Register the OPC automation wrapper ( `gbda_aut.dll` ) by typing this\n  in the command line:\n\n```shell\nC:\\openopc2\\lib>regsvr32 gbda_aut.dll\n```\n\n- If, for any reason, you want to uninstall this file and remove it from\n  your system registry later, type this in the command line:\n\n```shell\nC:\\openopc2\\lib>regsvr32 gbda_aut.dll -u\n```\n\n# CLI\n\nThe CLI (Command Line Interface) lets you use OpenOPC2 in the shell and offers you a quick way to explore your opc server\nand the OpenOPC DA client without the need of writing Python code.\n\nThe documentation of the CLI can be found [here](CLI.md)\n\n<p>\n<img src=\"https://github.com/iterativ/openopc2/raw/develop/doc/assets/cli_server-info.png\" alt=\"WindowsSetup\" width=\"400\"/>\n</p>\n\n<p>\n<img src=\"https://github.com/iterativ/openopc2/raw/develop/doc/assets/cli_read.png\" alt=\"WindowsSetup\" width=\"400\"/>\n</p>\n\n<p>\n<img src=\"https://github.com/iterativ/openopc2/raw/develop/doc/assets/cli_write.png\" alt=\"WindowsSetup\" width=\"400\"/>\n</p>\n\n<p>\n<img src=\"https://github.com/iterativ/openopc2/raw/develop/doc/assets/cli_properties.png\" alt=\"WindowsSetup\" width=\"400\"/>\n</p>\n\n# OpenOPC Gateway\n\nThis task can be completed from one of two ways (make sure to have it\ninstalled first):\n\n- By clicking the `Start` link on the \"OpenOPC Gateway Service\" from the\n  \"Services\" window (Start -> Control Panel -> System and Security ->\n  Administrative Tools).\n- By running the `net start SERVICE` command like this:\n\n```shell\nC:\\openopc2\\bin> zzzOpenOPCService\n```\n\n- If you have problems starting the service, you can also try to start\n  this in \"debug\" mode:\n\n```shell\nC:\\openopc2\\src>python OpenOPCService.py debug\n```\n\n```shell\nC:\\openopc2\\>net stop zzzOpenOPCService\n```\n\n### Configure the way the OpenOPC Gateway Service starts\n\nIf you are going to use this service frequently, it would be better to\nconfigure it to start in \"automatic\" mode. To do this:\n\n- Select the \"OpenOPC Gateway Service\" from the \"Services\" window\n  (Start -> Control Panel -> System and Security -> Administrative Tools).\n- Right-click and choose \"Properties\".\n- Change the startup mode to \"Automatic\". Click \"Apply\" and \"OK\"\n  buttons.\n- Start the service (if not already started).\n\n## \ud83d\ude4f Credits\n\nOpenOPC 2 is based on the OpenOPC python library that was originally created by Barry Barnleitner and its many Forks on\nGithub. Without the great work of all the contributors, this would not be possible. Contribution is open for everyone.\n\nThe authors of the package are (among others):\n\n| Years     |     | Name              | User                          |\n| --------- | --- | ----------------- | ----------------------------- |\n| 2008-2012 | \ud83c\uddfa\ud83c\uddf8  | Barry Barnreiter  | barry_b@users.sourceforge.net |\n| 2014      | \ud83c\uddf7\ud83c\uddfa  | Anton D. Kachalov | https://github.com/ya-mouse   |\n| 2017      | \ud83c\uddfb\ud83c\uddea  | Jos\u00e9 A. Maita     | https://github.com/joseamaita |\n| 2022      | \ud83c\udde8\ud83c\udded  | Lorenz Padberg    | https://github.com/renzop     |\n| 2022      | \ud83c\udde8\ud83c\udded  | Elia Bieri        | https://github.com/eliabieri  |\n\n## \ud83d\udcdc License\n\nThis software is licensed under the terms of the GNU GPL v2 license plus\na special linking exception for portions of the package. This license is\navailable in the `LICENSE.txt` file.\n",
    "bugtrack_url": null,
    "license": "GPL-2.0-or-later",
    "summary": "OPC library with a Windows gateway enabling non-Windows clients to access OPC-DA calls.",
    "version": "0.1.18",
    "project_urls": {
        "Homepage": "https://github.com/iterativ/openopc2",
        "Repository": "https://github.com/iterativ/openopc2"
    },
    "split_keywords": [
        "opc",
        " openopc",
        " opc-da",
        " opc classic"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9f416d1b2769256c3d7618be27c12dc7ed4708728b2cb88790238d9926f08b44",
                "md5": "e1f1f154504cc5b39d650b8509fcd5ae",
                "sha256": "342fd9983ce72eec3a3f94ec538f2b9b5cb10d2888de574f3d9fce0d02e3a228"
            },
            "downloads": -1,
            "filename": "openopc2-0.1.18-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e1f1f154504cc5b39d650b8509fcd5ae",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.8",
            "size": 34523,
            "upload_time": "2024-09-13T20:38:52",
            "upload_time_iso_8601": "2024-09-13T20:38:52.343114Z",
            "url": "https://files.pythonhosted.org/packages/9f/41/6d1b2769256c3d7618be27c12dc7ed4708728b2cb88790238d9926f08b44/openopc2-0.1.18-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b90a745f87bfba82628978f8795eac1e961357c95931e31fc15d5e603f838355",
                "md5": "a6cb7675baf885af45d6a8afae76d124",
                "sha256": "585d83032f1a6243f6a02fd012ab3b7d2bcc6b99dd06d021fb3c557b6f3cdaba"
            },
            "downloads": -1,
            "filename": "openopc2-0.1.18.tar.gz",
            "has_sig": false,
            "md5_digest": "a6cb7675baf885af45d6a8afae76d124",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.8",
            "size": 32695,
            "upload_time": "2024-09-13T20:38:54",
            "upload_time_iso_8601": "2024-09-13T20:38:54.684763Z",
            "url": "https://files.pythonhosted.org/packages/b9/0a/745f87bfba82628978f8795eac1e961357c95931e31fc15d5e603f838355/openopc2-0.1.18.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-13 20:38:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "iterativ",
    "github_project": "openopc2",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "openopc2"
}
        
Elapsed time: 0.54790s