Giter Site home page Giter Site logo

openopc's Introduction

OpenOPC for Python 1.2.0
Copyright (c) 2008-2012 by Barry Barnreiter ([email protected])
Copyright (c) 2014 by Anton D. Kachalov ([email protected])

http://openopc.sourceforge.net/
https://github.com/ya-mouse/openopc

Post installation
-----------------

Please go through the following post installation steps and functional
checks to verify your installation of OpenOPC for Python is working
correctly.

1. Get a listing of the available OPC servers on your computer by
going to the command prompt and entering:

opc -q

2. Set your prefered OPC server as the default by setting the system
wide enviornment variable OPC_SERVER.  (On Windows you can do this
by going to Control Panel > System > Advanced > Environment Variables)

OPC_SERVER=Matrikon.OPC.Simulation

3. Test your Win32 COM connection to the OPC server by entering the
following at the command prompt:

opc -i

4. Test to see if the OpenOPC Gateway Service is functioning by
entering:

opc -m open -i

5. Test some of the other commands available using the OPC Command
Line Client.  To get started, try entering the opc command without
any arguments in order to see the help page:

opc

To read an item from your OPC server, just include the item name as
one of your arguments.  For example, if you're using Matrikon's
Simulation server you could do:

opc Random.Int4

To read items from a specific OPC server you have installed,
include the -s switch followed by the OPC server name.  For
example:

opc -s Matrikon.OPC.Simulation Random.Int4

If you experience any unexpected errors during these tests, please
check the FAQ on http://openopc.sourceforge.net for additional help.

If after reading through the FAQ you still require additional help,
then the author of this package would be happy to assist you via
e-mail.  Please see the project website for current contact
information.



Software Developers
-------------------

If you elected to install the OpenOPC Development library during the
installation process, then you'll need to also download and install
the following packages in order to develop your own Python programs
which use the OpenOPC library:

1. Python 3.4+
   http://www.python.org/download/

2. Python for Windows Extensions (pywin32)
   http://sourceforge.net/projects/pywin32/

3. Pyro4
   https://github.com/irmen/Pyro4

Of course, Python is necessary on all platforms.  However the other
packages may be optional depending on your configuration:

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

In order to get the most from the OpenOPC package, Windows developers
are encouraged to install both Pywin32 and Pyro.  Using Pyro to talk to
the Gateway Service provides a quick and easy method for bypassing the
DCOM security nightmares which are all too common when using OPC.


Documentation
-------------

A PDF manual for OpenOPC is included in this installation inside the
"doc" folder.   Users are encouraged to also look at the OpenOPC web
site for additional usage examples that may not be contained in the
manual.


Technical Support
-----------------

If you have any questions, bug reports, or suggestions for improvements
please feel free to contact the author at:

[email protected]

While I cannot always guarantee a quick response, I eventually respond
to all e-mails and will do my best to slove any issues which are discovered.

Thanks for using OpenOPC for Python!

openopc's People

Contributors

joseamaita avatar minix1234 avatar ya-mouse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openopc's Issues

How to read item with groups?

I have a project reading the same items every 5 seconds.
I use the "read" function to read items,the project exits after running about 3 hours .
Then I use tracemalloc to find the problem:
Sun, 17 Feb 2019 16:22:31 opcRead.py[line:53] INFO 2 memory blocks: 100.0 KiB
Sun, 17 Feb 2019 16:22:31 opcRead.py[line:55] INFO File "C:\Python36\lib\site-packages\OpenOPC.py", line 321
Sun, 17 Feb 2019 16:22:31 opcRead.py[line:55] INFO self._group_handles_tag[sub_group][n] = tag
......
Sun, 17 Feb 2019 16:22:41 opcRead.py[line:53] INFO 2 memory blocks: 120.0 KiB
Sun, 17 Feb 2019 16:22:41 opcRead.py[line:55] INFO File "C:\Python36\lib\site-packages\OpenOPC.py", line 321
Sun, 17 Feb 2019 16:22:41 opcRead.py[line:55] INFO self._group_handles_tag[sub_group][n] = tag
......
Sun, 17 Feb 2019 16:22:53 opcRead.py[line:53] INFO 2 memory blocks: 200.0 KiB
Sun, 17 Feb 2019 16:22:53 opcRead.py[line:55] INFO File "C:\Python36\lib\site-packages\OpenOPC.py", line 321
Sun, 17 Feb 2019 16:22:53 opcRead.py[line:55] INFO self._group_handles_tag[sub_group][n] = tag
......
Sun, 17 Feb 2019 19:22:09 opcRead.py[line:53] INFO 2 memory blocks: 30720.0 KiB
Sun, 17 Feb 2019 19:22:09 opcRead.py[line:55] INFO File "C:\Python36\lib\site-packages\OpenOPC.py", line 321
Sun, 17 Feb 2019 19:22:09 opcRead.py[line:55] INFO self._group_handles_tag[sub_group][n] = tag

As you see,the memory usage get bigger and bigger.
I read the source code of file openopc.py and found it add tags to _group_handles_tag every time I read items.
Here is my question:
How to read items with group?

ProtocolError: invalid data or unsupported protocol version

I'm trying to connect to the Matrikon OPC Simulation server which is running on the same system.

my code:

import OpenOPC
OpenOPC.open_client('localhost')

The error:
ProtocolError: invalid data or unsupported protocol version

My packages:

OpenOPC-Python3x==1.2.2 ## (via pip install of https://pypi.org/project/OpenOPC-Python3x/)
Pyro4==4.74
serpent==1.27

and using python 3.7.0:

I believe this is a problem on the python side because I am able to connect and run commands using the command line client (opc.exe):
running:
opc -H localhost -h localhost -s Matrikon.OPC.Simulation -r Random.Int4
successfully yields
Random.Int4 32757 Good 12/10/18 19:24:24

Full error:
any idea why pyro4 is causing issues here?

ProtocolError                             Traceback (most recent call last)
<ipython-input-54-34e9043002f9> in <module>
----> 1 OpenOPC.open_client('localhost')

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\OpenOPC.py in open_client(host, port)
    129    import Pyro4.core
    130    server_obj = Pyro4.Proxy("PYRO:opc@{0}:{1}".format(host, port))
--> 131    return server_obj.create_client()
    132 
    133 class TimeoutError(Exception):

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\Pyro4\core.py in __getattr__(self, name)
    273             # get metadata if it's not there yet
    274             if not self._pyroMethods and not self._pyroAttrs:
--> 275                 self._pyroGetMetadata()
    276         if name in self._pyroAttrs:
    277             return self._pyroInvoke("__getattr__", (name,), None)

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\Pyro4\core.py in _pyroGetMetadata(self, objectId, known_metadata)
    613         if self._pyroConnection is None and not known_metadata:
    614             try:
--> 615                 self.__pyroCreateConnection()
    616             except errors.PyroError:
    617                 log.error("problem getting metadata: cannot connect")

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\Pyro4\core.py in __pyroCreateConnection(self, replaceUri, connected_socket)
    594                 self._pyroConnection = socketutil.SocketConnection(connected_socket, uri.object, True)
    595             else:
--> 596                 connect_and_handshake(conn)
    597             if config.METADATA:
    598                 # obtain metadata if this feature is enabled, and the metadata is not known yet

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\Pyro4\core.py in connect_and_handshake(conn)
    533                     _log_wiredata(log, "proxy connect sending", msg)
    534                 conn.send(msg.to_bytes())
--> 535                 msg = message.Message.recv(conn, [message.MSG_CONNECTOK, message.MSG_CONNECTFAIL], hmac_key=self._pyroHmacKey)
    536                 if config.LOGWIRE:
    537                     _log_wiredata(log, "proxy connect response received", msg)

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\Pyro4\message.py in recv(cls, connection, requiredMsgTypes, hmac_key)
    166         Validates a HMAC chunk if present.
    167         """
--> 168         msg = cls.from_header(connection.recv(cls.header_size))
    169         msg.hmac_key = hmac_key
    170         if 0 < config.MAX_MESSAGE_SIZE < (msg.data_size + msg.annotations_size):

c:\users\keerthan\appdata\local\programs\python\python37\lib\site-packages\Pyro4\message.py in from_header(cls, headerData)
    150         tag, ver, msg_type, flags, seq, data_size, serializer_id, anns_size, _, checksum = struct.unpack(cls.header_format, headerData)
    151         if tag != b"PYRO" or ver != constants.PROTOCOL_VERSION:
--> 152             raise errors.ProtocolError("invalid data or unsupported protocol version")
    153         if checksum != (msg_type + ver + data_size + anns_size + flags + serializer_id + seq + cls.checksum_magic) & 0xffff:
    154             raise errors.ProtocolError("header checksum mismatch")

ProtocolError: invalid data or unsupported protocol version`

Intermittent read error occurs. Help solve the problem

Intermittent read error occurs. Help solve the problem

2023-01-18 00:00:35,292 ERROR Connect: -2146959355
Traceback (most recent call last):
File "C:\Users\Freelancer\PycharmProjects\OPC_DATA\venv\lib\site-packages\OpenOPC.py", line 223, in connect
self._opc.Connect(s, opc_host)
File "C:\Users\FREELA~1\AppData\Local\Temp\gen_py\3.8\341A7851-5DEA-4022-B0D6-F9954AF9273Dx0x1x0.py", line 233, in Connect
return self.oleobj.InvokeTypes(1610743826, LCID, 1, (24, 0), ((8, 1), (12, 17)),ProgID
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2146959355), None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Freelancer\PycharmProjects\OPC_DATA\WRdbSchedule.py", line 68, in RdAndWrOPCtoDB
maplai.rdtagfor_db()
File "C:\Users\Freelancer\PycharmProjects\OPC_DATA\WRdbSchedule.py", line 36, in rdtagfor_db
opc.connect('Freelance2000OPCServer.51')
File "C:\Users\Freelancer\PycharmProjects\OPC_DATA\venv\lib\site-packages\OpenOPC.py", line 227, in connect
raise OPCError(error_msg)
OpenOPC.OPCError: Connect: -2146959355

I made a script to write data to a database. Reading and writing occurs once every 5 seconds. Unfortunately, this script does not work stably for 1 or 5 days, then such an error occurs. Help find a solution

OpenOPC.open_client: ConnectionRefusedError + remote machine running OpenOPC Gateway Service

I have the following set up:

  • On remote machine (10.4.8.71): both MatrikonOPC Simulation Server and the OpenOPC Gateway Service running
  • On local machine: run the below snippet
  • On both machines: Windows OS, Windows Firewall disabled, ran regsvr32 /s \path\to\openopc\lib\gbda_aut.dll
import OpenOPC

opc = OpenOPC.open_client(host="10.4.8.71")

The last line throws the following Pyro4.errors.CommunicationError:

Traceback (most recent call last):
  File "C:\path\to\venv\lib\site-packages\Pyro4\core.py", line 511, in connect_and_handshake
    sock = socketutil.createSocket(connect=connect_location,
  File "C:\path\to\venv\lib\site-packages\Pyro4\socketutil.py", line 307, in createSocket
    sock.connect(connect)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  ...
  File "C:\path\to\scripts\opc.py", line 25, in matrikon_simulation_main
    opc = OpenOPC.open_client("10.4.8.71")
  File "C:\path\to\venv\lib\site-packages\OpenOPC.py", line 131, in open_client
    return server_obj.create_client()
  File "C:\path\to\venv\lib\site-packages\Pyro4\core.py", line 275, in __getattr__
    self._pyroGetMetadata()
  File "C:\path\to\venv\lib\site-packages\Pyro4\core.py", line 615, in _pyroGetMetadata
    self.__pyroCreateConnection()
  File "C:\path\to\venv\lib\site-packages\Pyro4\core.py", line 596, in __pyroCreateConnection
    connect_and_handshake(conn)
  File "C:\path\to\venv\lib\site-packages\Pyro4\core.py", line 549, in connect_and_handshake
    raise ce
Pyro4.errors.CommunicationError: cannot connect to ('10.4.8.71', 7766): [WinError 10061] No connection could be made because the target machine actively refused it

I am not sure if:

  • I am missing a software entity in the communication pipeline
  • If multi-machine systems doesn't work with OpenOPC
  • If I have an incorrect OS configuration on one or both machines

What can I do to fix this?

OpenOPC.client() fails with "OPCError: Dispatch: Invalid class string"

Please correct my misunderstanding if I am wrong. The README.TXT leads me to believe that this version of OpenOPC is an updated version of the package that was originally described at http://openopc.sourceforge.net/. As such, I think that I should expect the "minimal working program" code to work. Here is an interpreter session with traceback showing that I am failing right from the start:

Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenOPC
>>> OpenOPC.__version__
'1.2.0'
>>> opc = OpenOPC.client()
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py",
line 89, in _GetGoodDispatch
    IDispatch = pythoncom.connect(IDispatch)
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\OpenOPC.py", line 167, in __init__
    self._opc = win32com.client.gencache.EnsureDispatch(c, 0)
  File "C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\gencache.py",
 line 527, in EnsureDispatch
    disp = win32com.client.Dispatch(prog_id)
  File "C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\__init__.py",
 line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py",
line 114, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py",
line 91, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\lib\site-packages\OpenOPC.py", line 173, in __init__
    raise OPCError(error_msg)
OpenOPC.OPCError: Dispatch: Invalid class string

I'm failing just by attempting to create a client with no arguments. I installed this package from PyPI using pip. Both win32 and pyro4 were installed when I installed OpenOPC.

Advice and suggestions are greatly appreciated, thanks!

Error occured when start openopcservice, which was complied to EXE by pyinstaller

I used CMD to run "python zzzopenopcservice.py install" and then start the service, it works well on NON-DCOM mode.
When I complied it to EXE by pyinstaller. it can be installed as service well, but can not be started. I check from the log, it said" The instance's SvcRun90 method failed." "Pyro4.errors.SerializeErro:serializert"json' is unknown or not available."

If anybody successfully compiled it to EXE by Pyinstaller and solve the problems, thanks a lot in advance.

Bug: opc.connect() and opc.servers() not working with host besides localhost

I have the OpenOPC Gateway Service running locally. I have validated client-server connectivity for localhost using MatrikonOPC Simulation Server. 🥳

Now, I am trying to connect across the network to an OPC DA server on another host (10.4.8.71). I have the following script to make that happen:

import OpenOPC



opc = OpenOPC.open_client("localhost")  # Succeedsopc.connect(opc_server="Matrikon.OPC.Simulation", opc_host="10.4.8.71")  # Fails


When run, it throws the following Pyro4.errors.SerializeError:

Traceback (most recent call last):
  File "C:\path\to\venv\lib\site-packages\Pyro4\core.py", line 185, in __call__
    return self.__send(self.__name, args, kwargs)
  File "C:\path\to\venv\lib\site-packages\Pyro4\core.py", line 467, in _pyroInvoke
    data = serializer.deserializeData(msg.data, compressed=msg.flags & message.FLAGS_COMPRESSED)
  File "C:\path\to\venv\lib\site-packages\Pyro4\util.py", line 171, in deserializeData
    return self.loads(data)
  File "C:\path\to\venv\lib\site-packages\Pyro4\util.py", line 614, in loads
    return self.recreate_classes(serpent.loads(data))
  File "C:\path\to\venv\lib\site-packages\Pyro4\util.py", line 416, in recreate_classes
    return self.dict_to_class(literal)
  File "C:\path\to\venv\lib\site-packages\Pyro4\util.py", line 633, in dict_to_class
    return super(SerpentSerializer, cls).dict_to_class(data)
  File "C:\path\to\venv\lib\site-packages\Pyro4\util.py", line 395, in dict_to_class
    raise errors.SerializeError("unsupported serialized class: " + classname)
Pyro4.errors.SerializeError: unsupported serialized class: OpenOPC.OPCError

Furthermore, trying to run:

import OpenOPC



opc = OpenOPC.open_client("localhost")  # Succeedsopc.servers(opc_host="10.4.8.71")  # Fails


I get the same stack trace. An aside is it would be good to add support for Pyro4 serialization of OpenOPC.OPCError.

Now debugging inside the OpenOPC.OPCError to see the real Exception:

>>> print("".join(data["attributes"]["_pyroTraceback"]))
Traceback (most recent call last):
  File "OpenOPC.py", line 1117, in servers
  File "C:\path\to\AppData\Local\Temp\tmph013js_3\gen_py\F8582D24-88FB-11D0-B850-00C0F0104305x0x1x0.py", line 239, in GetOPCServers
    return self._ApplyTypes_(1610743825, 1, (12, 0), ((12, 17),), 'GetOPCServers', None,Node
  File "win32com\client\__init__.py", line 572, in _ApplyTypes_
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "Pyro4\core.py", line 1424, in handleRequest
  File "OpenOPC.py", line 1123, in servers
OpenOPC.OPCError: servers: -2147467259

Here's some related issues/posts:

What might I be doing wrong?

Alternately, I believe OpenOPC may have some bug such that it doesn't work if the OPC host is not localhost.


Machine Set Up

I have Windows Firewall turned off on both machines, and the OPC Gateway Service running on the local machine (and not on the remote machine 10.4.8.71). Also, I have run regsvr32 /s \path\to\openopc\lib\gbda_aut.dll on both machines.

I am using Python 3.10.9-win32 from pyenv-win

NameError: name 'pythoncom' is not defined

PlatForm : Windows 7 X64 , Python version : 3.7
when I use :
import OpenOPC
opc = OpenOPC.client()
Pycharm raise an error "NameError: name 'pythoncom' is not defined".

Starting zzzOpenOPCService error

Hello, I am trying to start zzzOpenOPCService by running OpenOPCService.py but I am still getting error "The service did not respond to the start or control request in a timely fashion". I am using Python 3.6.5 32-bit on Windows 10. Thank you for any advices

'Matrikon.OPC.Automation' - Dispatch: Class not registered

I am trying to complete the steps in https://openopc.sourceforge.net/'s minimal working program example, and have begun by using src/opc.py to scan for OPC servers:

> python -m src.opc -q
Failed to initialize an OPC Automation Class from the search list 'Matrikon.OPC.Automation' - Dispatch: Class not registered

Any ideas on how to fix this?

I am using Python 3.10.8 on Windows 10 with the below pip packages:

Pyro4==4.82
pywin32==305

Question: is the OPC client thread safe?

import OpenOPC

opc: OpenOPC.client = OpenOPC.open_client("localhost")

Is the client thread safe for reads/writes? Or should I protect my client with a threading.Lock?

opc.read() line killing and restating the kernel

I got stuck up with small issue while using openOPC.
I have installed python 3.8.3 on windows 10 64 bit system.
Installed OpenOPC-Python3x through pip install.
Running Matrikon OPC simulation server and OPC explorer for data simulation.

While running the following code, I'm able to connect with Matrikon OPC server, but when I try to read/write the data, kernel is restarting and I'm not able to get any data.

import OpenOPC
opc = OpenOPC.client()
print(opc.servers())
opc.connect('Matrikon.OPC.Simulation.1')
print(opc['Random.Real8'])
opc.close()

Kindly help me to get out of this issue.
I also tried with different IDEs (Jupyter, Spyder, IDLE), but same result.

Uncoming changes on DCOM can affect OPC communication

Are you aware of this future Windows Update?

On June 8, 2021, Microsoft released a security update that changed how the Windows
operating system enforces DCOM security. This Windows update was made in response
to a recently discovered vulnerability, detailed in CVE 2021 26414. As a result of this
change, OPC communications relying on DCOM may stop working when the Windows
changes start to be enforced in 2022.

[Update 5 KSM2022 001 - Experion OPC Classic Clients Microsoft Windows DCOM Security Update 2022 Changes.pdf]

(https://github.com/ya-mouse/openopc/files/8451545/Update.5.KSM2022.001.-.Experion.OPC.Classic.Clients.Microsoft.Windows.DCOM.Security.Update.2022.Changes.pdf)

Got two errors during connection for 32 and 64 bit installation: OPCError: Class not registered and ConnectionRefusedError

Hi there!

I want to use this library for connecting to OPC DA from linux machine. However I can not even get local connection to OPC DA server working. Please help me to figure out where my mistake is.

Environment

Windows Server 2016 Standart 64 bit
Python 3.10.11 - 64 bit in windows shell and Python 3.11.4 32 bit under miniconda3

Steps to reproduce

32 bits installation

  1. install OPC Core Components Redistributable (x86) 3.00.107
  2. Restart windows server
  3. Compiled 32 bit zzzOpenOPCService by using instruction from this comment #5 (comment) and put it to Program Files (x86)
  4. Install and start service OpenOPCService
  5. Copy 32 bit version of gbda_aut.dll to SysWoW64
  6. Move to SysWoW64 folder and run %SystemRoot%\SysWoW64\regsvr32 gbda_aut.dll
  7. Install MatriconOPCSimulator and run it
  8. Setup env variables
    1. OPC_CLASS=OPC.Automation
    2. OPC_CLIENT=OpenOPC
    3. OPC_GATE_HOST={server-ip} (tried with localhost as well)
    4. OPC_GATE_PORT=7766
    5. OPC_HOST=localhost
    6. OPC_MODE=dcom
    7. OPC_SERVER=Matrikon.OPC.Simulation
  9. Create inbound outbound rule for port 7766 (tried with turned off firewall as well)
  10. Download and install openopc2 via pip under 32 bit version of Python in miniconda3
  11. Run python -m openopc2 list-servers in miniconda shell and got
    1. [11:11:49] ERROR Could not connect to OPC server: cannot connect to ({server-ip}, 7766): [WinError 10061] cli.py:344 No connection could be made because the target machine actively refused it

64 bit installation

  1. install OPC Core Components Redistributable (x64) 3.00.107
  2. Restart windows server
  3. Delete previous installed OpenOPCService and uninstall gbda_aut.dll
  4. Download OpenOPCService from https://github.com/iterativ/openopc2/releases/tag/0.1.11 and put it to Program Files
  5. Install and start service OpenOPCService
  6. Copy 64 bit version of gbda_aut.dll to System32
  7. Got to System32 and run regsvr32 gbda_aut.dll
  8. Setup env variables
    1. OPC_CLASS=OPC.Automation
    2. OPC_CLIENT=OpenOPC
    3. OPC_GATE_HOST={server-ip}
    4. OPC_GATE_PORT=7766
    5. OPC_HOST=localhost
    6. OPC_MODE=dcom
    7. OPC_SERVER=Matrikon.OPC.Simulation
  9. Create inbound outbound rule for port 7766 (tried with turned off firewall as well)
  10. Download OpenOPCCli from https://github.com/iterativ/openopc2/releases/tag/0.1.11 and put it to Program Files
  11. Run openopcCLI server-info
  12. Got
    1. OPCError: (OPCError(...), 'Dispatch: (-2147221164, 'Class not registered', None, None) opc_class:"OPC.Automation"') [13832] Failed to execute script 'cli' due to unhandled exception!

Identifying OPC servers: do I need opc.exe? Where is it?

Hi there,

I've been reading OPC documentation for a few days. I hope that I'm familiar enough with OPC to ask the right questions.

I have a Python application to which I want to add OPC client capabilities, so I'm trying to use OpenOPC. In order for a client to connect, it has to have an OPC server name.

I have an OPC Server running in Rockwell RSLinx Classic. The RSLinx Classic package includes an OPC Test Client. The Client program produces a list of OPC Servers to which I can connect (there are a few extra servers on my machine from National Instruments, I'm not sure how they got there). I choose a server and connect.

Now I want to write my own client. How can I get the OPC Server list in OpenOPC? According to the README.TXT, I'm supposed to:

  1. Get a listing of the available OPC servers on your computer by
    going to the command prompt and entering:

opc -q

  1. Set your prefered OPC server as the default by setting the system
    wide enviornment variable OPC_SERVER. (On Windows you can do this
    by going to Control Panel > System > Advanced > Environment Variables)

I have looked high and low in this software package, and on my computer, for a program called opc.exe. I cannot find it.

I have discovered that I have an executable service program called OpcEnum.exe. It's not on the system path, but it's apparently accessible as a Windows system service. My Services tab shows that it is running. Presumably Rockwell obtains OPC server names from this service. If you run OpcEnum.exe at the command line, it returns no information to the console.

Any help you can provide in understanding how to identify available OPC servers would be greatly appreciated. Thanks!

Error with line 7 in OpenOPC.py

Error:

Failed to import [...] due to exception: Non-ASCII character '\xc3' in file /lambda/OpenOPC.py on line 7, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details (OpenOPC.py, line 7)

the é is causing this error - removing the accent over the 'e' should resolve the issue.
Unless there is another work around?

Timestamp

Hi,
OpenOPC "read" results with timestamp which does not match with local time. How to set local timezone in OpenOPC?

Question: how to install OpenOPC Gateway Service on non-Windows OS

From https://openopc.sourceforge.net/api.html:

In Open mode a connection is made to the OpenOPC Gateway Service running on the specified node. This mode is available to both Windows and non-Windows clients.

I am trying to build and start the OpenOPC Gateway Service on macOS Monterey version 12.6 using pyinstaller as suggested here. I can actually successfully build the service, but when I go to run it:

> pyinstaller --onefile  --hidden-import=json --hidden-import=win32timezone ./src/OpenOPCService.py
68 INFO: PyInstaller: 5.7.0
68 INFO: Python: 3.10.9
81 INFO: Platform: macOS-12.6-arm64-arm-64bit
...
12129 INFO: Building EXE from EXE-00.toc completed successfully.
> ./dist/OpenOPCService debug
Traceback (most recent call last):
  File "OpenOPCService.py", line 13, in <module>
ModuleNotFoundError: No module named 'win32serviceutil'
[21202] Failed to execute script 'OpenOPCService' due to unhandled exception!

My question is, given the gateway service depends upon Windows packages like win32serviceutil, how can one install the OpenOPC Gateway Service on OS's besides Windows?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.