Home ! Без рубрики Usage COPC32 on Visual Basic.NET

Usage COPC32 on Visual Basic.NET

0
0

This tutorial will certainly guide you how to utilize COPC32 on Aesthetic Basic.NET. You have to install COPC32 on your system before create SCADA with Visual.NET as well as COPC32 ActiveX control. As well as we intend that you have OPC Web server on your regional system already.

We will produce the basic type to read and write to OPC web server on neighborhood systems. However you would certainly, like to connect to remote OPC web server. Please configure DCOM on both web server as well as client side by describe tutorial of KEPWare at http://www.kepware.com/Support_Center/Viewlets/XP_sp2_viewlet_swf.html

The form we will certainly create is displayed in Number 1.

Number 1

When customer insert numerical value in textbox and click switch ‘& lsquo; Compose ‘, COPC32 will certainly write to OPC tag and reveal its value on ‘& lsquo

  1. ; Label1 ‘. Open Visual Studio.NET and crate new project with VB.NET

Number 2

Kind the name of this project as “& ldquo; TestCOPC32VBNET &

rdquo;. 2. Add COPC32 ActiveX control into tool kit by pick food selection Tools > > Add/Remove Toolbox Items & hellip;

Figure 3

After that pick COPC32 displayed in Number 4.

Number 4

After that click “& ldquo;

OK & rdquo; 3.More Here bitCOPC32 Download At our site Crate a button, a textbox and tag on form like shown in Number 1

. 4. Select in tool kit and drag on the form.

5. Right click COPC32 control on the type and also pick ActiveX residential properties.

Number 5

Set update price to 100 msec. And pick OPC Server name to desired OPC Web server. You need to get in IP address or equipment name in ‘& lsquo; nodname ‘ textbox if you wish to connect to remote OPC server over the network.

Figure 6

6. Select OPC Tag you want to connect to.

Figure 7

Click OK.

This OPC Tag could be Readable as well as Writable. You can check on your OPC Web server like displayed in Number 8.

Number 8 OPC Tag residential or commercial properties.

Figure 9 Configure OPC tag index number = 0

And click OK to exit home web pages.

Note: You can set up connected OPC tags by import OPC tag listing from CSV documents which export from OPC Web server. Please refer to

http://www.scadathai.com/COPC/COPCEng/tutorials.htm

And also see “& ldquo; How to pack OPC tags from CSV data”&

rdquo;. 7. Dual click on the type to go into to Form_Load occasion code view.

8. Produce the code to attach to OPC web server as well as obtain value of OPC tag index 0 to show on Label1.

Personal Below Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase. Load

Axcopc1.cnnec()

Label1.Text = Convert.ToString(Axcopc1.GetVl( 0 ))

End Below

Note: If you have configure other OPC tag such as OPC tag index number = 1. You can obtain its worth using ‘& lsquo

; GetVl( “1)’”. 9. Select & ldquo; Closing & rdquo;

event name from

dropdown. Number 10 And also create the code like adhering to

Personal Below Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Takes care of MyBase. Closing

Application.DoEvents()

Axcopc1.discnn()

End Below

Keep in mind: We utilize “& ldquo; Application.DoEvents()” & rdquo; to waiting other task to complete prior to separate from OPC Web server.

10. Back to develop sight. Dual click COPC32 control on the kind to get in to “& ldquo; datChange & rdquo; occasion code sight. Then create the code to display OPC tag worth on Label1 when the vale of OPC tag we are attached has altered.

Exclusive Below Axcopc1_datChange(ByVal sender As Object, ByVal e As System.EventArgs) Deals with Axcopc1.datChange

Label1.Text = Convert.ToString(Axcopc1.GetVl( 0 ))

End Below

11. Back to develop style view. Dual click on button ‘& lsquo; Create ‘. After that produce code to compose vale to OPC tag which has index number = 0.

Personal Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Takes care of Button1.Click

Axcopc1.opcWrt(0, Convert.ToDouble(TextBox1.Text))

End Below

12. Examination program by click F5. Insert the number into textbox as well as click ‘& lsquo; Write ‘. You might see the vale shown in tag amounts to your get in number.

Figure 11

The complete relevant code is received Figure 12.

Admin Уважаемые посетители, если у Вас возникли какие-либо вопросы, Вы можете их задать в комментариях. Мы обязательно Вам ответим в течении суток.

Напишите свой комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *