Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
danilNil opened this issue Aug 11, 2023 · 11 comments

Comments

@danilNil
Copy link

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 Starting zzzOpenOPCService error ya-mouse/openopc#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!
@jamesbraza
Copy link
Contributor

jamesbraza commented Aug 11, 2023

Note I am using this fork of openopc, not openopc2, mainly because I couldn't get openopc2 multithreading to work.

I found installing Matrikon OPC Explorer onto the client machine installs some special sauce that was required for me to get openopc to work.

Are you able to use Matrikon OPC Explorer (client machine) to read from Matrikon OPC Simulation Server (server machine)? I would say test that connectivity works first.

@renzop
Copy link
Collaborator

renzop commented Aug 14, 2023

Hi,

Please don't mix openopc from yamouse with this project... they are not the same codebase and not compatible.

  1. Why do you compile the executables, instead of downloading them from this repo? (same location as cli)
  2. Can you try what happens, when you set the environment variable

OPC_CLASS=Graybox.OPC.DAWrapper

@danilNil
Copy link
Author

danilNil commented Aug 14, 2023

Hey @renzop! Appreciate the assistance! Now 64 bit version functions with both Windows server and MacOS 🔥

@renzop
Copy link
Collaborator

renzop commented Aug 14, 2023

changed readme according to this.

@renzop
Copy link
Collaborator

renzop commented Oct 30, 2023

@danilNil what did do to get everything 64bit working... ?

@danilNil
Copy link
Author

Hi @renzop ! You can see steps above to get connected to OPC DA. I've just changed OPC_CLASS=Graybox.OPC.DAWrapper. But in order to get tags values you need to fix a bug in openopc2 library. Let me ping another developer from our team... @s-tatus found some bugs in openopc2 and fixed them.

@danilNil
Copy link
Author

@s-tatus could you create PR to openopc2 with your fixes?

@renzop
Copy link
Collaborator

renzop commented Oct 31, 2023

@danilNil @s-tatus that PR would be great. Even if its not as cleas as you like... I will do the rest

@renzop renzop reopened this Oct 31, 2023
@renzop
Copy link
Collaborator

renzop commented Oct 31, 2023

When running the tests in a 64bit environment i get

Process finished with exit code -1073741819 (0xC0000005)

@renzop
Copy link
Collaborator

renzop commented Nov 16, 2023

@danilNil, @s-tatus Any chance to create that pull request? Or just the snippet of the changes.

@renzop
Copy link
Collaborator

renzop commented Feb 27, 2024

@danilNil, @s-tatus Any chance to create that pull request? Or just the snippet of the changes. That would be really great and good for your Karma :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants