In this OPC client development model, you write code that calls methods on QuickOPC objects. You prepare and pass in the arguments necessary, and get back the results that you can process further.
This is the traditional model, “natural” to many software developers. Its advantage is that you have high level of control over what is happening, and you can structure the code the way you like it. The disadvantage is that you may end up writing more code than it’s necessary, compared to other models.
How Does The Code Look Like?
There is nothing too surprising here. Generally, your code will do the following steps:
- Create or obtain a "client" object (an object which contain methods that perform the OPC operations).
- Prepare arguments for the method call.
- Call a method on a client object, performing the OPC operation you need.
- Process results from the method call.
We have paid great attention to design the API for easy use by the developer. As a result, with QuickOPC you can write short and readable code, for example:
// Read item value and display it in a message box
"", "OPCLabs.KitServer.2", "Demo.Single").ToString());
How Do I Create And Destroy OPC Connections?
While the underlying OPC mechanisms are intrinsically connection-based, the QuickOPC API gives you a totally connection-less "feeling" of OPC. The connections are managed internally by the component. You just call the methods to perform the operations you need. QuickOPC takes care of creating and destroying the connections, detecting connection problems, and automatic reconnections.
This is valid even with subscriptions: When you subscribe to something, you declare an intent to be subscribed; the subscription remains valid until you explicitly unsubscribe, and it "survives" any connection problems in between. Even if the subscription cannot be made at the moment, the call succeeds, just giving you a notification of the problem over the usual channel. If the connection is established later, the data will start flowing.
The connection-less nature of the QuickOPC API is a great advantage over other toolkits or libraries that work on much lower level, and force you to write the connection management and housekeeping code.
What OPC Operations Can I Perform?
For All OPC Specifications
- Discover (browse) OPC servers (applications) on the computer and on the network.
- Browse the address space of the OPC server.
- Display ready-made browsing dialogs with rich user interface.
For OPC Data Access and OPC Unified Architecture
- Read one or more values/items/node attributes.
- Write one or more values/items/node attributes.
- Subscribe to changes of a value/item/node attribute, and possibly later change the parameters of the subscription, or unsubscribe.
For OPC Data Access Specifically
- Browse access path for an item.
- Browse OPC properties of an item.
- Get value of one or more OPC properties of an item.
For OPC Unified Architecture Specifically
- Call a method or multiple methods.
For OPC Alarms&Events
- Get state of an event condition.
- Acknowledge an active condition.
- Query for event categories and event conditions.
- Subscribe to events, and possibly later change the parameters of the subscription, or unsubscribe.
- Refresh the event subscription.
From Developers To Developers
QuickOPC provides wide range of developer productivity features: Intellisense, ReSharper annotations, serialization support, and many more.
Useful links: Documentation / Knowledge Base
Footnote & required disclosure: QuickOPC (including its Options) is a software development kit (SDK) for development of OPC clients. Installing QuickOPC or its Options does not change system settings.