OpcNetApi.dll|Classic OPC: DA, A&E, HDA, XML-DA, etc.|Forum|OPC Foundation - Opcnetapi.com.dll free download
Looking for:
Opcnetapi.com.dll free downloadFile Download & Fix For All Windows OS. Opcnetapi.com.dll free download
DLL that wraps Interop. This article will first describe the myOPC. DLL wrapper and then give real world examples of how to use it in a client. NET program. At the time I was using VB. NET for my PC application development. Searching for a. I'm not going into the basics of OPC as this has been done by several people with my favorite here. To communicate with a device e. PLC through a channel e. NET 3. The last one seems to be a standard the OPC Foundation would prefer never existed.
I found VB. With this example and my knowledge of object oriented programming I created a wrapper that extracted out the ugly details of using the Interop. The first procedure examined is the function StartOPC. After creating an instance of the myOPC. The returned Boolean indicates success True or failure False at starting this opcnetapi.com.dll free download. The below is the complete code for this function that I present for clarity. This увидеть больше be followed with detail explanations of sections of this function to describe the more important concepts in this function.
Please note that the function starts out by checking that pivotal properties and fields have been set by the object user. The connection will not attempt to start if any of these are empty and will return a false. Once this посмотреть больше is created a connection is made opcnetapi.com.dll free download the actual OPC server.
These values were discovered using the discovery example opcnetapi.com.dll free download on the Kepwareweb site. The second parameter is called Node opcnetapi.com.dll free download is an object.
It is not clear to me what this is used for and because the opcnetapi.com.dll free download worked without it I just used what the Kepware example used i. The OPC group is next to be created and defined. The group houses the OPC items and define some of their behavior. The first step is to make groups default to be active. Next the dead band is set via the property DeadBand. The dead band is an integer that is kept to a value of 0 to 99 via the DeadBand property.
The dead band is only valid for an asynch group. If set to zero then any change in the group items will cause an asynch read of the changed item. I found that this string is useful in troubleshooting. The update rate is next to be defined with the property UpdateRate.
This property is an integer opcnetapi.com.dll free download represents the update rate of the group in milliseconds. When I have multiple connections to the same device I set each update rates at a different prime number. Also keep in opcnetapi.com.dll free download it is possible for some OPC servers to optionally over ride this rate. When AsynchMode is set to False the values of the items in the group can only be discovered through a manual client OPC read.
Inversely when set to Opcnetapi.com.dll free download a method will be raised every time the value changes based on DeadBand and UpdateRate. Synchronous and Asynchronous modes will be described more later in this article.
The last group thing modified is the DefaultIsActive set to False forcing the items to be added in a non active state. Items should not be made active until they are confirmed working with no faults. This process uses the NumItems property to set opcnetapi.com.dll free download the For loop. Make sure the number of itemID's added matches the NumItems.
From the below code it can be seen that the string for ItemID is formatted significantly differently for each OPC server type. This array gives the address in the device of the items being tracked, I call them tags. The format of these tags can also be confusing. Fortunately Opcnetapi.com.dll free download has done a great job of documenting them.
Notice opcnetapi.com.dll free download certain properties pertain to the OPC server type chosen. Once the ItemID array has been defined then all of opcnetapi.com.dll free download items set up by the client is added at once. This method calls to the connected group to add items and has five parameters. The forth and fifth parameters are set by the OPC server call not the client. The last parameter is used to inform of any errors that occurred. Now that the items have been added to the group the items without errors are made active.
I opcnetapi.com.dll free download this bit of code could use some refactoring. After making the items active all of the items in the group are read.
I have since wondered if I should have added this functionality. The problem arrives in asynchronous mode in free download the asynch method is called when the StartOPC function is ran.
Depending on your application this can be a problem. The final адрес страницы I want to mention here is about the SilentMode Boolean property. Looking at the full code above it can be seen that all of this logic is wrapped in a try.
This message box is used to inform the client that an error occurred when opcnetapi.com.dll free download SilentMode is set to False. If the client sets the OPC group to be asynchronous the below method will fire every time one or more items changes within the dead band. This method receives the number of items effected and their corresponding client handles from the OPC server.
Through the use of this information this method will update the item fields that changed related to the OPC item value, quality, and time stamp. Once the changed items have been updated the method OPCdataChanged is called. This method is meant for the client to over-ride it so it can be informed of a change of data. I will show this in подробнее на этой странице example but this DLL can be used in two main ways.
If used in synchronous mode then myOPC. DLL is instantiated directly. Otherwise a class should be created that inherits from myOPC. In this way this new class can over-ride the OPCdataChanged method and use it as required. If the client sets the OPC group to be Synchronous the below Boolean function can opcnetapi.com.dll free download used to manually read individual items.
If all goes well a True will be returned and the corresponding field value will be updated i. Notice that because OPCItemValues are objects a cast will be required before the client can effectively use them. The first thing this function does is verify that the value of ItemClientHandle is legitimate.
After looking up the server item handle this code performs a SynchRead on the specified item. If the synchronous read returns no errors then the specified OPC item value, quality, and time stamp will be updated. Note that a nearly identical function also opcnetapi.com.dll free download that uses очень-очень download game dragon ball z budokai tenkaichi 3 pc подборка.Первая item name as the parameter instead of /1179.txt item handle.
Alternatively we can read all items within the group at once with the below Boolean function. It requires no parameters and returns a True if all goes well. The logic is nearly the same to the above except that it loops through all the item handles and reads them. If an opcnetapi.com.dll free download needs to be changed by your client program than OPCwrite is the Boolean function opcnetapi.com.dll free download you.
Again if all goes well this function will return a True. The function accepts two parameters the first representing the new value and the second the handle of the item. Once the handle is verified the function writes the items new value. If any errors occur along the line a False is returned.
Be a good steward and close the OPC connection with the below opcnetapi.com.dll free download. This method closes in the same way it opens but in reverse order. Two main zip files are provided.
The first is visual studio solution that compiles the myOPC. If you wish to improve or add to this object then you will need this zip file. If your just opcnetapi.com.dll free download to use the DLL file for your client needs opcnetapi.com.dll free download the second zip file is all that is required.
Inside this zip file you will find several files. The files myOPC. The file Interop. On every machine your /34845.txt program uses myOPC. If you don't do this and you will forget the assembly myOPC. The below example opcnetapi.com.dll free download a simple windows form that creates a synchronous and asynchronous OPC connection when the form loads.
❿
Comments
Post a Comment