joseamaita / openopc120

OpenOPC for Python 1.2.0 (works with Python 3.7+ and Pyro4 4.80+)
Other
26 stars 20 forks source link

OpenOPC for Python 1.2.0

Project Description

OpenOPC for Python is a free, open source and easy to use OPC (OLE for Process Control) library designed to be used with the popular Python programming language. The project also includes a Windows gateway service that enable non-Windows clients to also access OPC-DA calls.

The files within this repository allow us to work with recent versions of Python (v3.7+) and Pyro4 (v4.80+).

If you are interested in the original version from Barry Barnreiter, you can go here. However, if you want to try a different fork that also works with Python 3.4+ (if you make some minor changes to the Python source code that affects Pyro4), go to the GitHub version of Anton D. Kachalov by clicking here.

Contents

This repository offers the following files:

Prerequisites and Considerations

Follow these steps to prepare your work environment:

pip install Pyro4 

or

pip install Pyro4==4.80
OPC_CLASS=Matrikon.OPC.Automation;Graybox.OPC.DAWrapper;HSCOPC.Automation;RSI.OPCAutomation;OPC.Automation
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=Hci.TPNServer;HwHsc.OPCServer;opc.deltav.1;AIM.OPC.1;Yokogawa.ExaopcDAEXQ.1;OSI.DA.1;OPC.PHDServerDA.1;Aspen.Infoplus21_DA.1;National Instruments.OPCLabVIEW;RSLinx OPC Server;KEPware.KEPServerEx.V4;Matrikon.OPC.Simulation;Prosys.OPC.Simulation
C:\>set ENV_VAR=VALUE
C:\>set OPC_GATE_HOST=172.16.4.22    # this is an example
1. Win32 platform, using the OpenOPC Gateway Service

Pywin32:  optional
Pyro4:    required

2. Win32 platform, talking to OPC Servers directly using COM/DCOM

Pywin32:  required
Pyro4:    optional

3. Non-Windows platform (use of Gateway Service is mandatory)

Pywin32:  not applicable
Pyro4:    required

Installation

Getting Started

Begin to work with this project by doing this:

C:\OpenOPC37\lib>regsvr32 gbda_aut.dll
C:\OpenOPC37\lib>regsvr32 gbda_aut.dll -u

Install the OpenOPC Gateway Service

This goal can be achieved by running the "OpenOPCService.py" script with the Python interpreter and the "install" argument (remember to do it as administrator):

C:\OpenOPC37\src>python OpenOPCService.py install
Installing service zzzOpenOPCService
Service installed

Usage

Start the OpenOPC Gateway Service

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

C:\OpenOPC37\bin>net start zzzOpenOPCService
C:\OpenOPC37\src>python OpenOPCService.py debug

Stop the OpenOPC Gateway Service

This task can be completed from one of two ways:

C:\OpenOPC37\bin>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:

Implement the OpenOPC library module

Go here for the basic implementation of the library. But, if you want updated procedures using Python 3.4+, see the wiki pages.

Documentation

A PDF manual for OpenOPC is included in this repository inside the doc folder, written by the original author. Users are encouraged to also look at the OpenOPC web site for additional usage examples that may not be contained in the manual.

Credits

The authors of this package are:

Copyright (c) 2008-2012 by Barry Barnreiter (barry_b@users.sourceforge.net)
Copyright (c) 2014 by Anton D. Kachalov (mouse@yandex.ru)
Copyright (c) 2017 by José A. Maita (jose.a.maita@gmail.com)

Contact

If you need technical assistance to implement this in a larger project, go to the main site here or here for more detailed information.

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.