- Posts: 9
- Thank you received: 0
Online Forums
Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.
Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.
Do not use the Contact page for technical issues.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- Connections, Reconnections, COM/DCOM
- OPCLabs for dummies?
OPCLabs for dummies?
- andrew.w.toole
- Topic Author
- Offline
- Premium Member
"Failed to connect to 2.0 data access interface for group ......on server ..... Falling back to 1.0 interface"
I'm including screen shots so you can see the log.
Now that I think of it, if I remote into the other machine and I right click on the Kepware icon in the system tray and then click "Stop Runtime", it hangs for a couple seconds an then control returns but the runtime does not stop. However, if I try the same on my machine on my local KepServer installation, I can start and stop the runtime no problem. Could this be a permissions issue? I don't see how since I still have full access enabled for the "Everyone" alias, but it sure seems like something is blocking certain commands on that remote machine.
What do you make of all this?
Please Log in or Create an account to join the conversation.
Do you get some error/warning messages in the log view in the bottom half of the window?
Please Log in or Create an account to join the conversation.
- andrew.w.toole
- Topic Author
- Offline
- Premium Member
- Posts: 9
- Thank you received: 0
So obviously it's a setting on the remote machine, though I have no clue what it could be. I even went so far as to give full access to "Everyone" and still, nothing.
Right now I have recreated the KepServer on my local machine and running the code against the local server works a treat as it should. Read commands return the value(s) as expected. I don't know what else to do except to continue with a rule that the OPC server must be installed alongside the application on the same machine. At least until I can get an actual admin to have a look at it.
What are your thoughts Zbynek?
Please Log in or Create an account to join the conversation.
At this point, what really matters (to myself at least) is to determine whether the issue is somehow with our software only, or would happen with *any* OPC client, if installed on the same machine. Knowing this would allow to steer the investigation further.
I have checked the stuff that comes KepServer, and it looks like that their "OPC Quick Client" is capable of remote connections as well. See the following picture, that's what it offer after clicking "New Server":
So what I suggest is that you install KepServer (or, if it allows, just this part of it) to the computer where you now run your project with out QuickOPC library. Then, run their "OPC Quick Client", do "New Server", and enter the same computer name and ProgID as you are using from your C# project.
Then, I would expect that the connection will work, and that you will be able to browse. The big question is, will you be able to Read as well? If yes, the problem is limited to QuickOPC. If not, the problem is elsewhere - e.g. in the configuration of computers.
Best regards
Please Log in or Create an account to join the conversation.
- andrew.w.toole
- Topic Author
- Offline
- Premium Member
- Posts: 9
- Thank you received: 0
However, back on topic...lol
The only reason I added the line EasyDAClient.SharedInstance.InstanceParameters.Mode.AllowAsynchronousMethod = false;
is because I had seen another post on here where a user had difficulty with doing a ready operation, and it was recommended to him that he add that line of code to compensate for problems with DCOM configurations allowing callbacks. So I figured maybe that was contributing at least to my issue.
I'm kind of scratching my head on this one too. I just don't understand how there can be no problem for browsing, but it suddenly can't even call a command on read???
I've also seen many posts on here warning about the complexity involved in properly configuring DCOM settings to work seamlessly in handling OPC calls from remote client apps. And I am by no means a systems administrator, so I can only go so far with things like COM/DCOM.
Further, I've seen lots of posts stating that, whenever possible, put the client app and the OPC server on the same machine to eliminate the horrors of remote connections. I don't want to put out a product that puts this limitation on a user, but it might be a good idea for the time being until I get more comfortable with this OPC stuff.
Also, I even found a doc on the KepWare site that goes over how to configure the DCOM settings on the machine to allow for functionality via remote connections. And still, no go. And I'm not sure if there is a way to use the KepWare quick client remotely.
What do you think Zbynek?
Please Log in or Create an account to join the conversation.
May I ask why you have the "AllowAsynchronousMethod = false;" line? It's not wrong - in fact, it's quite clever, because normally the async method would be preferred for Reads, but it requires a callback from the server to the client, and that it is difficult to configure DCOM/security properly for it to succeed. But you must have had some reason - were you getting a different behavior without it?
Since I do not know the cause, I would suggest to try to a different OPC client to do the same thing (from the same client machine), in order to determine whether the issue has something to do with QuickOPC and/or your program, or whether it is a more general problem. I am not sure whether the OPC client app distributed with KepWare can work remotely - but if it can, that would be first candidate to try. If it cannot, let me know and I will recommend something else.
Zbynek
P.S. ^ from Czech Republic
Please Log in or Create an account to join the conversation.
- andrew.w.toole
- Topic Author
- Offline
- Premium Member
- Posts: 9
- Thank you received: 0
Yes, KepServerEx does have a capability to map PLC tags to SQL table columns. It's interesting, but not a viable option anymore for this project. The customers will want to keep track of all boards that are running on their sorting machine conveyor belt and will also want to keep record that the PLC is indeed sending the boards to the correct sorting bin as detailed in the user's submitted sort parameters. This would require way too much data read/write back and forth to make a sql "middleware" useful. Especially since the read/writes will be going as fast as a conveyor belt moves (ie probably every x hundredth of a second). At the time I didn't realize there were libraries in existence to communicate directly with the PLC via OPC server. Now that I've found you guys, this is the route I'm taking for sure.
As for the code I tried, I didn't take note of the exception message, but now I am getting the following:
-{"An OPC operation failure with error code -2147023174 (0x800706BA) occurred, originating from 'OpcLabs.EasyOpcRaw.DataAccess.RawEasyDAClient'. The inner exception contains details about the problem. -InnerException {"The RPC server is unavailable. "} System.Exception {System.Runtime.InteropServices.COMException}
Further, yes, the KepServer is on a remote machine named ENGWIN10C2QUAD. Now my current code, as I'm playing around with it right now to see how it works, looks like this:
var client = new EasyUAClient();
EasyDAClient.SharedInstance.InstanceParameters.Mode.AllowAsynchronousMethod = false;
var a = EasyDAClient.SharedInstance.BrowseLeaves(
"ENGWIN10C2QUAD", "Kepware.KEPServerEX.V6", "PLCTest.RileyPLC.Global.LugChain_x.LugChain_098");
var b = EasyDAClient.SharedInstance.BrowseBranches(
"ENGWIN10C2QUAD", "Kepware.KEPServerEX.V6", "PLCTest.RileyPLC.Global.LugChain_x.LugChain_098");
var c = EasyDAClient.SharedInstance.ReadItemValue(
"ENGWIN10C2QUAD", "Kepware.KEPServerEX.V6", "PLCTest.RileyPLC.Global.LugChain_x.LugChain_098.LugID");
the "BrowseLeaves" and "BrowseBranches" code works fine. But when it does the ReadItemValue call I get that error. LugID should have some numeric value (ie. 11324)
What would you suggest here?
Thanks.
Please Log in or Create an account to join the conversation.
So, for us at least, the solution where you integrate the OPC client into your own app is the "standard" way of doing this. And you are on the right track.
What' more, I cannot even spot a problem in your code. Obviously, I cannot verify some things in it - for example, the 3rd parameter to ReadItemValue is the ItemId of the tag you want to read - it "looks" that it might be correct, but I cannot tell for sure without knowing the server configuration.
What happens when you run it? Do you get an exception? If so, what's its text, and InnerException?
Also, the 1st parameter to ReadItemValue is the name of the computer where the OPC server is located. Is it, in your case, on the same computer as the client (your app), or on a remote computer? If it is on the same computer, I recommend to replace the computer name simply by an empty string.
If it is on a remote computer (and you therefore have to specify its name), the common cause of errors is then the DCOM/security configuration. That is, not a programming problem per se, but rather a system setup issue. That is a subject about which whole books can be written, so I'd rather not start on it until we know that it indeed *is* the problem. For that, we need the exception details as well, as explained above.
Best regards
Please Log in or Create an account to join the conversation.
- andrew.w.toole
- Topic Author
- Offline
- Premium Member
- Posts: 9
- Thank you received: 0
We are in the sawmill/lumber industry machine manufacturing industry. One machine we build is a log sorter. Now I have been brought in to design a web application (I am using ASP.NET with c# webapi framework).....don't know if that matters....anyways. So I am trying to design an application that will allow the user to put together parameters by which they can sort the boards that are running along the line on this sorter. The idea is that, the user goes to a screen and connects to the app and sets his parameters for how he wants to sort the logs. When he is don't, the sorting params are then written to tags on the PLC and the machine then runs and uses this data to sort the logs in different bins based on the parameter values.
Now I am totally new to the idea of actually reading and writing back and forth with a PLC. We have the trial version of KepWare's KepServrEX V6 and I have set up a channel. Also, I have a test PLC device currently running with a tag structure similar to what will be used in production, and I have added it as a device to the channel and have auto generated its tag structure in the KepServer Configuration tool. I can run the Quick Client tool that comes with the KepServer and I can see the values for the PLC machine in it.
Initially I was going to have the KepServer map the PLC tags to a SQL Express table and then have the application connect to the same table and they would transfer data that way. But the further I get into this, the less that makes sense. So I am thinking I would rather just have the application connect directly to the OPC Server and read/write values to the PLC through that connection.
Now, as I said, I have never done this before. Last night downloaded the OPCLabs packages from NuGet and have them added to my project. Now, how do I connect to the server?
I tried following an example I found but no luck. This is what I tried:
var client = new EasyUAClient();
EasyDAClient.SharedInstance.InstanceParameters.Mode.AllowAsynchronousMethod = false;
var a=EasyDAClient.SharedInstance.ReadItemValue(
"ENGWIN10C2QUAD", "Kepware.KEPServerEX.V6", "PLCTest.RileyPLC.Global").ToString();
Thank you for any help you can provide. I greatly appreciate it. I totally need an OPC Client for Dummies book.
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- Connections, Reconnections, COM/DCOM
- OPCLabs for dummies?