Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use OPCDAAuto.dll components in C #

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

C # how to use OPCDAAuto.dll components, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

1. Introduction of ScaleOPClient.dll

ScaleOPClient.dll is developed on the basis of OPCDAAuto.dll and integrates most of the functions of OPCDAAuto.dll.

1. The component integrates the management of servers, groups and tags, including the management of parameters. But using ScaleOPClient.dll to develop your own program, some properties and functions are not external, so as not to cause program confusion to the operation of the core things.

2. The management of servers, groups and tags, as well as the management of parameters, is entirely through the configuration of the form. Reduce the workload of programmers writing code.

3. For the components needed by the environment (OpcEnum.exe,OpcRcw.Comn.dll,OpcRcw.Da.dll, etc.), ScaleOPClient.dll will automatically release resources and register, so there is no need to configure the environment. But for DCOM, you still need to manually configure it yourself.

4. After the developer has configured the client with the form of ScaleOPClient.dll, they can use AutomationHandler and ParameterHandler events to update the data.

In short, using ScaleOPClient.dll to develop the client, we only need to do two things: first: call the main empty body to configure the relevant information of the OPC client. Second: use events to inform developers to update data and transmit updated data information.

II. The use of ScaleOPClient.dll

ScaleOPClient.dll provides an external class (ScaleOPClient.Interface), which provides several functions that users need to operate, and all functional operations take this class as the center.

1. We need to create an external interface class

ScaleOPClient.Interface _ opclient=new ScaleOPClient.Interface ()

2. We need to configure the function

_ opclient.ConfigClient ()

Any OPC client is configured through this function, which calls a main form, either by the developer or manually.

3. After configuring the client information, we need to load two events that receive data updates.

_ opclient.AutomationHandler + = new ScaleOPClient.OPCAutomationHandler (Automation)

_ opclient.ParameterHandler + = new ScaleOPClient.OPCParameterInfoHandler (Parameter)

Operate in an event

Private void Automation (object sender,OPCAutomationArgs e)

{/-your code-/ /}

Private void Parameter (object sender,OPCParameterInfoArgs e)

{/-your code-/ /}

4. Select the event type. The default value is: OPCEventType.Automation

_ opclient.EventType

There are two types of this property.

1), OPCEventType.Automation: when EventType is of this type, the program will call the AutomationHandler event as the default event for OPC data update, which reads the data information of the server using OPC subscription.

2), OPCEventType.ParamaterInfo: when EventType is of this type, the program will call the ParameterHandler event as the default event for OPC data update. This event uses OPC synchronization to read the data information of the server, and the loop group reads the data in turn, and passes the server name, group name and other information.

The purpose of the EventType attribute is that you cannot respond to two events at the same time when the data is updated, which will block the channel if there are many clients.

5. Structure information of OPC client

_ inter.Servers attribute

Users can call this property, poll servers, groups, and tags, and get relevant information. This property can be used with the AutomationHandler event. Every update of data will respond to this event, polling in this event to get the tag value.

Third, picture caption

The main form of configuration information

Get a list of servers

Server Properties

Add group information

Add label

After the configuration of the main form

Multiple servers

Other functions (right-click) menu

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report