Professional OPC
Development Tools

logos

OPCLabs for dummies?

More
05 Feb 2018 19:03 #5956 by andrew.w.toole
Replied by andrew.w.toole on topic OPCLabs for dummies?
Yep there is an error for almost every tag group when I try auto tag generation in the client window.
"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?
Attachments:

Please Log in or Create an account to join the conversation.

More
05 Feb 2018 17:33 #5954 by support
Replied by support on topic OPCLabs for dummies?
Thanks.
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.

More
05 Feb 2018 16:44 #5953 by andrew.w.toole
Replied by andrew.w.toole on topic OPCLabs for dummies?
Alright, well I took your advice and of course you are correct. I set up KepServerEX V6 on my local machine. Started the Quick Client up. Made the new server connection to the remote machine. And it can browse all the tags, but all significant data about them (ie. timestamp, value, and quality), none of that can be read. It all just says Value=Unknown, Timestamp=N/A, Quality=Bad(Out of service).

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.

More
05 Feb 2018 15:38 #5951 by support
Replied by support on topic OPCLabs for dummies?
Great that you enjoyed it:-)

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
Attachments:

Please Log in or Create an account to join the conversation.

More
05 Feb 2018 14:14 #5950 by andrew.w.toole
Replied by andrew.w.toole on topic OPCLabs for dummies?
Czech Republic! Awesome! I visited Zakopane in Poland once and took a ride on one of their boat rides along the river and the river at one point crosses the border into CR briefly. What little bit I saw of CR was beautiful.

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.

More
03 Feb 2018 11:55 #5941 by support
Replied by support on topic OPCLabs for dummies?
Hmmm... this is not a common problem. "The RPC server is unavailable" is, actually, quite frequent with DCOM, and it usually indicates a problem reaching the target computer (wrong name, firewall issues, DCOM not enabled, ...). But if you are able to do the Browse, then the Read should not give this error either.

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.

More
02 Feb 2018 18:38 #5937 by andrew.w.toole
Replied by andrew.w.toole on topic OPCLabs for dummies?
Thank you...umm....support..??. I'm going to wager by that name that you are Norwegian?? Lol :P no seriously, thank you my friend.

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.

More
02 Feb 2018 17:25 #5936 by support
Replied by support on topic OPCLabs for dummies?
Hello and welcome. I do not know whether KepServerEx has as some intrinsic capability that can do the "mapping" to SQL table as you described, so I cannot comment on that approach. If it does, it might be the way, but then no OPC would really be involved, KepServerEx would act just as a protocol driver + an interface to the database, so in this case our component would not be in play.

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
The following user(s) said Thank You: andrew.w.toole

Please Log in or Create an account to join the conversation.

More
02 Feb 2018 14:20 #5934 by andrew.w.toole
Hi all. I am a senior programmer analyst and I am now working in a manufacturing company that uses a lot of PLC. Here is what I am trying to do:

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.

Moderators: support
Time to create page: 0.231 seconds

      

 Recommend this on Google