Your OPC Client Toolkit Should Keep Connectivity Simple, Right?

7 min read

May 9, 2024 2:00:00 PM

Sometimes we are approached by users and integrators with very specific business demands, and an off-the-shelf OPC client solution isn't always the answer to their problems. As they explore the fully customizable development toolkits on the market, they are often concerned that their OPC expertise is inadequate for writing their own OPC client application. How should states and client objects be handled? When would an OPC group need to be created and have items added? What about timeouts, keep-alive intervals and more? Isn't PubSub (as in OPC UA PubSub) a deli sandwich from a popular grocery store called Publix in the US region we live in? Look – we hear you – and its problems like this that Software Toolbox has been solving since 1996. Let's start by saying this up front – you do NOT need to be an OPC expert or understand the internal complexities of OPC connectivity. Our OPC client development toolkit handles all of that and so much more for you. Let's learn more. 

OPC Data Client is an interoperability tested and lab certified OPC client development toolkit, and with its detailed documentation and bundled project examples, it stands out as a beacon of efficiency and accessibility. This toolkit significantly lowers the complexity for developers when getting involved with OPC client development projects. However, under the hood of its seemingly simple exterior lies the intricate complexities of managing OPC DA and OPC UA connections that the user is abstracted from, making it easy for you to maintain and troubleshoot your custom client applications.

Simplify Connection Graphic

In a past blog, we've looked at an overview of the Benefits of Using an OPC Client Development Toolkit, but today, we delve into the intricacies of OPC Data Client and how it adeptly navigates these complexities on your behalf. This added benefit frees you from the burden of grappling with the technical intricacies of maintaining OPC connections, enabling you to focus solely on extracting the essential information from your OPC server.

The Stateless Philosophy

In software development, in simple terms, the concept of state refers to remembering where you were in an exchange between different systems, applications, or areas in your code. In a stateful connection, the parties remember who they are talking to, save off where they were, and any security context information.  If you have a lot to exchange but in bursts or periodically and not continuously, not having to reconnect and establish state again improves efficiency. A stateful connection provides that efficiency.  By contrast, a stateless connection remembers nothing. One application requests information, the other provides it. One application says to write some information, the other does it. Each time there is a new transaction, it's like the parties never met before. Quick, but if the reintroduction of the parties takes time, going stateless can be less efficient. To compare to networking, TCP connections are stateful, and UDP connections are not. When using webservices, such as RESTful connections, they are stateless. So how does this apply to OPC and the OPC Data Client? 

By nature, OPC connections are stateful— this allows for optimized communications after the client and server establish the parameters that both will use for requests and responses. Additionally, the use of stateful communications benefits security. With certain parameters only being defined in the initial client-server handshake instead of on every call, they become obscured from malicious parties during regular traffic. For more details on this from an OPC UA lens, our blog post Exploring OPC UA - Key Concepts of a Layered Security Model is a great resource.

OPC Data Client hides most of OPC’s stateful nature by instead providing what you as a developer will experience as a connection-less, or stateless, interface for OPC tasks, while preserving the benefits of the actual stateful OPC connection. The transformation from a stateful to stateless model is one of the biggest advantages gained by using the OPC Data Client.

Because the connection state must be handled by the OPC client, this would typically add substantial work to be properly handled in a custom client application. However, managing connection states with OPC Data Client does not require multiple method calls to achieve the desired state first. Most common tasks can be accomplished by just instantiating an object and making a single method call.

OPC Data Client OPC DA Example Code

You also won’t need to worry about reconstructing the state after a communications failure. OPC Data Client makes connection management a breeze by decoupling the underlying mechanism of server connections from client objects. The toolkit will silently reconstruct the OPC state in the background even if a new client object is now in use. These advantages bring tremendous reductions in the amount of code that must be written.

Click here for more information on OPC Data Client Failure Recovery.

Not having to worry about the state of any particular client-server session means that you can focus on the important parts of developing your application: getting the data you need.

Subscription Persistence and Other Internal Optimizations

Another aspect of the stateless philosophy is how OPC Data Client manages subscriptions. The toolkit has specific methods for subscribing to multiple tags at once, which allows them to handle exceptions with nuance. OPC exceptions are passed back in event notifications and callbacks, which means that you can specify different behavior for different problems. One bad quality tag won't keep you from getting the rest of your data.

Like with the connection state, the toolkit will automatically and continuously attempt to reestablish a subscription. You dictate the conditions for unsubscribing only without managing the in-between communication breaks.

Furthermore, OPC Data Client performs many internal optimizations, and uses the knowledge of proper approaches and procedures to effectively handle the communication with OPC servers. Here are some examples:

  • OPC operations are performed on multiple elements at once wherever possible.
  • Items with similar update rates and percentage deadbands are placed in common OPC groups.
  • OPC items are temporarily retained in OPC groups for a certain amount of time to allow for efficient reestablishment if necessary.
  • Item data is held in memory and if fresh enough, the value is read from memory to avoid an unnecessary OPC Read request to the server.
  • Scan rate floors are enforced to prevent overloading systems by scanning too fast for data.
  • Asynchronous calls are preferred over synchronous calls, which prevents blocking threads that can cause user experience/interface issues such as screen update pauses on slow/non-responsive connections.
  • Multiple uses of the same OPC server or items within a user application are merged into a single OPC request to the server.
  • In OPC UA, a slower keep-alive interval is used when a debugger is attached to allow the developer time to examine the program without causing sessions to be disconnected due to inactivity while the execution is suspended.

Connection Customizability

OPC Data Client contains a plethora of properties for defining any aspect of an OPC connection. By default, the OPC UA and OPC DA components each have a set of parameters shared by their client objects that have default values, which facilitate an easy minimal implementation. However, there may be some unique cases where separate connections to one server make sense. For these situations, the toolkit has the option to set client objects as isolated, with separate isolated connection parameters for that object, so you can make your client application as nuanced as you like.

For example, the table below summarizes the default timeout parameters using in OPC UA Client-Server communication:

OPC Data Client Default OPC UA Session Parameters

Here is some documentation on:

Conclusion

In summary, the OPC Data Client contains many internal optimizations and handles many operations under the hood, making it an easy to learn product that requires less code, all while still offering advanced functionality like OPC UA PubSub and UA Complex Data. These reasons and so much more are how OPC Data Client continually keeps you ahead of the curve when it comes to developing your own custom OPC client application to fit your unique business demands. It removes the need to understand the complex inner workings of OPC and is a toolkit that ultimately keeps it simple for its users, as it should.

We have many OPC Data Client specific resources here on our blog, as well as in our knowledge base, and our support team is happy to discuss your project requirements by phone at 1-704-849-2773 during our business hours (Monday-Friday, 8AM-5PM Eastern Time) or via email at support@softwaretoolbox.com.

Don’t forget to subscribe to our blog for more interesting technical content and solutions, and if you’re ready to get started with OPC Data Client, you can download the free trial here.

OPC Data Client Download Trial

 

Nicole Knox
Written by Nicole Knox

Software Toolbox Technical Blog

We're engineers like you, so this blog focuses on "How to" appnotes, videos, tech team tips, product update announcements, user case studies, and other technical updates.  Subscribe to updates below. Your feedback and questions on posts are always welcomed - just use the area at the bottom of any post.

Subscribe to our Blog

Recent Posts

Posts by Topic

See all