Author Topic: Connect to Red Lion OpcWorx Server Tags?  (Read 6998 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5276
    • View Profile
    • AdvancedHMI
Re: Connect to Red Lion OpcWorx Server Tags?
« Reply #15 on: November 16, 2016, 05:17:41 PM »
What makes OPC so difficult is its complexity and reliance on multiple vendors software. For example the OpcDaCom of AdvancedHMI has to work with the libraries supplied by the OPC Foundation which in turn must work with a 3rd party OPC server.

Your first message CoCreateInstanceEx is related to the Windows COM interface and as Godra mentioned this could be a DCOM issue.

I'm not sure why you did not get a program break after setting it to break on all Common Language Exceptions, unless of course the problem is outside of AdvancedHMI. The next step I would take is to put a break point at line 421, which should be this:

 If DLL Is Nothing Then CreateDLLInstance()

This is where the first contact with the driver occurs. If it hits that break point, then use F10 to step through until you get an exception.

sarclimber

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Connect to Red Lion OpcWorx Server Tags?
« Reply #16 on: November 16, 2016, 06:58:25 PM »
Thanks for the new idea on DCOM but no luck there either.  Since the application is running on a network that is not connected to the outside world I turned off Windows Firewall and opened up DCOM to everybody for everything...no change.

The opc explorer screenshot shows a "group" on the Matrikon explorer but I am using Red Lion OPCWorx and it does not show a group as shown in the OPCWorx screenshot.  As an example I am using a plc address of "Summit.AZ1" and putting that into the PLCAddress field.  I tried adding the server name into the  PLCAddress field even though it seemed redundant and it had no effect.

Just as a sanity check I verified that I can view the remote Red Lion HMI in a browser window using the Red Lions web browser feature and it works fine which further confirms my network connectivity.


Just prior to posting this I saw your reply Archie.  The program did stop at line 421 and using F10 it stopped again at line 94..

DLL.Url = New Opc.Url(m_OPCServerPath & "/" & m_OPCServer)

Since I am somewhat sure that my OPCServer address in OpcDaCom is correct this is going to send me in a new direction.  The pc I am using to develop this application is different from the one I am attempting to run it on for reasons to verbose to mention here.  I am going to have to take the pc which runs the application home and download Visual Studio and redo all your debugging suggestions while I am attempting to connect to the OPC server and remote Red Lion in real-time.  I will report back with results.

If there are any more ideas please post and in the meantime I will work on getting Visual Studio downloaded/installed.

Thanks for all the help, I would be totally lost without everybodys help.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5276
    • View Profile
    • AdvancedHMI
Re: Connect to Red Lion OpcWorx Server Tags?
« Reply #17 on: November 16, 2016, 07:46:47 PM »
When you reach this line of code with F10:

DLL.Url = New Opc.Url(m_OPCServerPath & "/" & m_OPCServer)

Before pressing F10 again, hover over m_OPCServerPath and m_OPCServer to see what their values are. This seems to be looking like it's not finding the server to connect to.

Godra

  • Hero Member
  • *****
  • Posts: 1439
    • View Profile
Re: Connect to Red Lion OpcWorx Server Tags?
« Reply #18 on: November 16, 2016, 08:18:57 PM »
Also, try using BasicLabel control for testing (it is usually the simplest yet powerful choice).

The tag name Summit.LiftRunning, as the explorer shows it, is what you should have in the PLCAddressValue field of the BasicLabel. Put it also in the PLCAddressKeypad field, which will allow you to change the value by clicking the control.

For comparison, if Matrikon.OPC.Simulation.1 server is installed as well then try testing its tags in the PLCAddressValue field of the BasicLabel (Bucket Brigade.Boolean would be an example tag and you would have to change the server name in the OpcDaCom driver).


And, for the sake of double-checking, can you read this article for verification:

https://www.softwaretoolbox.com/dcom/html/dcom_for_windows_7-_8-_-_server_2008.html

If it is Windows 10 then try finding related article somewhere on the web.
« Last Edit: November 16, 2016, 09:12:13 PM by Godra »

sarclimber

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Connect to Red Lion OpcWorx Server Tags?
« Reply #19 on: November 17, 2016, 03:37:59 PM »
Once again you guys pointed me in the right direction!  Went through the DCOM link Godra sent and verified all settings and ended making some changes.  Also discovered that OPCEnum was not showing up in Component Services.  It was not installed for some reason.  Installed and set the security policies correctly Ran the application and got a OPC error in the BasicLabel control.  That was progress.  Checked OPCEnum in Services and it was not started.  Fixed that and now BasicLabel changes colors based on tag from remote HMI.  All of that is probably basic knowledge but I had to learn it the hard way.

My brain hurts.

You guys are a wealth of knowledge...thanks!!

sarclimber

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Connect to Red Lion OpcWorx Server Tags?
« Reply #20 on: November 17, 2016, 04:05:47 PM »
Well, not sure why but not working again.  Getting "Failed OPC Read ( OPCDACom)" now.  Will go through troubleshooting steps from last posts and report back.

sarclimber

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Connect to Red Lion OpcWorx Server Tags?
« Reply #21 on: November 18, 2016, 11:07:26 AM »
More info...

When I first made the changes to DCOM and installed OPCEnum the application worked.  No changes were made and when I attempted to run program again I am getting the "Failed OPC Read (OPCDACom)" exception.  Running in debug mode throws an exception at line 482, if I am correct the reason is that in line 481 "values(0).ResultID" is {E_FAIL} when I hover over it.  The application does start and seems to run for about 2 seconds before it throws the exception.

I have rebooted computer and made sure OPCEnum service is running, network connectivity has been verified, all DCOM security settings I changed are still there.  The Matrikon OPC Explorer is still running and finds the HMI tags no problem.

For what it is worth my network is wireless and does not have blazing speed.  Is it possible that the application needs more time to read the data tags over the network?  I do not understand why it was working and now it is not.  What now?

Godra

  • Hero Member
  • *****
  • Posts: 1439
    • View Profile
Re: Connect to Red Lion OpcWorx Server Tags?
« Reply #22 on: November 18, 2016, 12:45:26 PM »
There are a few different things you can try:

1) Install MatrikonOPC Simulator and test AHMI with it (if it works continuously that would indicate that AHMI is functional, if it works for a while and then stops that could indicate some sort of intermittent communication even though it's on the same computer)
2) Download one of the previous releases of AHMI and give it a try
3) Create a new user account and try all the testing again under this account
4) Try cleaning all the temporary files from the computer (DO THESE STEPS AT OWN RISK-> close all open applications, press Logo+R and in the Run box type %temp% and then delete all temporary files that you see in this user temp folder. If you open Windows Explorer then you can browse to Windows/Temp folder and delete all files there as well. Whatever files you cannot delete just skip them). Without promoting it, the CCleaner free app might help with some removal as well.
5) If you have access to another computer then attempt tests on it

Whatever steps you can do might just help you in troubleshooting this issue.

sarclimber

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Connect to Red Lion OpcWorx Server Tags?
« Reply #23 on: November 18, 2016, 06:03:22 PM »
No luck with temp files.  Having trouble locating an older version of AHMI to download, can you point me in the right direction?

Thanks.

Godra

  • Hero Member
  • *****
  • Posts: 1439
    • View Profile
Re: Connect to Red Lion OpcWorx Server Tags?
« Reply #24 on: November 18, 2016, 08:39:40 PM »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5276
    • View Profile
    • AdvancedHMI
Re: Connect to Red Lion OpcWorx Server Tags?
« Reply #25 on: November 19, 2016, 02:29:48 PM »
Not sure if this would make any difference, but here is something to try:

- Edit OpcdaCom.vb
- Go to about line 425 and look for this code:

SubscriptionState.UpdateRate = 5

- Change the 5 to a 500

sarclimber

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Connect to Red Lion OpcWorx Server Tags?
« Reply #26 on: November 21, 2016, 07:26:23 PM »
Everything seems to be working now.  Older versions of AHMI had same problem.  Installed Matrikon OPCSimulator and it worked good pointing to a problem outside of AHMI.  I noticed awhile back that OPCWorx did not show up as a service when I was changing DCOM settings.  Red Lion tech support stated that OPCWorx does not run as a service but rather as an application.  This got me to thinking the problem had to be an access issue.  While digging through the security settings for various programs looking for clues I found a setting for "ALL APPLICATION PACKAGES".  I added this to the group/user name security settings for OPCWorx and Visual Studio and and gave it full access and the "Failed OPC Read (OPCDACom)" error is fixed.

Thank you Archie and Godra for your continued support!  Now I will see what else I can break! 

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5276
    • View Profile
    • AdvancedHMI
Re: Connect to Red Lion OpcWorx Server Tags?
« Reply #27 on: November 21, 2016, 07:42:56 PM »
Glad to hear you got it working. Every time I see OPC mentioned, it makes me cringe because I know more chance than not it can be a long drawn out process to troubleshoot. So it's good to hear you figured it out without too much pain.