- Thank you received: 0
Online Forums
Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.
Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.
Do not use the Contact page for technical issues.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- Reading, Writing, Subscriptions, Property Access
- MultipleItemChanged
MultipleItemChanged
Thak you for all answers!!
Best regards
Please Log in or Create an account to join the conversation.
DAVtqResult does not contain ItemID, but it is the same ItemID as passed into the method in the element of an array with the same index as the result. That should normally be sufficient, as you can refer back to the input array, and take the ItemID from the corresponding element there. Some people do not like it that way, and want additional information (such as ItemID) "go through", appear in the results. If you require this, you can use the ReadMultipleItems overload that takes an input array of DAItemArguments objects, and each DAItemArguments has a State property which is an Object and you put there any data you like - e.g. an ItemID, or even a reference back to the same DAItemArguments object. The State is then available in each DAVtqResult after ReadMultipleItems method returns.
Please Log in or Create an account to join the conversation.
Thanks a lot for explanation!!
I have last question. Is there some function which read all items on every x time period (like ReadMultipleItems support.softwaretoolbox.com/ap...)?
How can I get TagID in results from DAVtqResults?
Regards
Please Log in or Create an account to join the conversation.
Could it be the reason that many items actually do not change their values? (With some simplification, ) OPC Servers are required to send notifications only if the value or the quality have changed.
Please Log in or Create an account to join the conversation.
Now I have another problem. In MultipleItemsChanged event (or in ItemsChanged event) I'm saving items into SQL database (with loop).
In DAItemGroupArguments I have 130 tags with update rates 5000ms for all tags.
I see there is only around 30 or 40 new inseted tag values in SQL database every 5s. I think there is tags saved within 1 second.
Is there some settings for DAClient which has dependence on my problem?
Do you suggest some another solution-function (not SubscribeMultipleItems)?
I use EasyOPC.NET 5.1 client (Windows form aplication).
Please Log in or Create an account to join the conversation.
<span style="font-family: "Calibri","sans-serif"; color: #1f497d; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-themecolor: dark2">
<span style="font-family: "Calibri","sans-serif"; color: #1f497d; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-themecolor: dark2">For most usages, it is easier and fine to just use the ItemChanged event. You can freely use it even if you subscribe using SubscribeMultipleItems.
<span style="font-family: "Calibri","sans-serif"; color: #1f497d; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-themecolor: dark2">Every item change gets notified using BOTH ItemChanged and MultipleItemsChanged events. So you really just need to pick one which is better, but never use both together. If there are multiple changes arriving "together" from the OPC Server, it is slightly more efficient to hook to MultipleItemsChanged, because there is just one notification, and not say 100 notifications. Inside that handler, you then need to loop through the ArgsArray provided, and then process each object in the same way as you would do in ItemChanged event handler.
<span style="font-family: "Calibri","sans-serif"; color: #1f497d; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-themecolor: dark2">However, the performance difference is quite small in QuickOPC.NET (the event exists mainly for symmetry with QuickOPC-COM, where the EAsyDAClient object usually runs in a separate process, and method calls and event notifications are much costlier).
<span style="font-family: "Calibri","sans-serif"; color: #1f497d; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-themecolor: dark2">An example for MultipleItemsChanged is in the Reference documentation for that event. It looks like this:
<span style="font-family: "Calibri","sans-serif"; color: #1f497d; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-themecolor: dark2">
// This example shows how to process multiple item changes in one callback.
using OpcLabs.EasyOpc.DataAccess;
using System;
using System.Threading;
namespace DocExamples
{
namespace _EasyDAClient
{
class MultipleItemsChanged
{
public static void Main()
{
using (var easyDAClient = new EasyDAClient())
{
easyDAClient.MultipleItemsChanged += easyDAClient_MultipleItemsChanged;
easyDAClient.SubscribeMultipleItems(
new[] {
new DAItemGroupArguments("", "OPCLabs.KitServer.2", "Simulation.Random", 1000, null),
new DAItemGroupArguments("", "OPCLabs.KitServer.2", "Trends.Ramp (1 min)", 1000, null),
new DAItemGroupArguments("", "OPCLabs.KitServer.2", "Trends.Sine (1 min)", 1000, null),
new DAItemGroupArguments("", "OPCLabs.KitServer.2", "Simulation.Register_I4", 1000, null)
});
Console.WriteLine("Processing multiple item changed events for 1 minute...");
Thread.Sleep(60 * 1000);
}
}
// Multiple items changed event handler
static void easyDAClient_MultipleItemsChanged(object sender, EasyDAMultipleItemsChangedEventArgs es)
{
Console.WriteLine();
EasyDAItemChangedEventArgs[] a = es.ArgsArray;
foreach (EasyDAItemChangedEventArgs e in a)
Console.WriteLine("{0}: {1}", e.ItemDescriptor.ItemId, e.Vtq);
}
}
}
Best regards
Please Log in or Create an account to join the conversation.
I want to know what is difference between ItemChanged event and MultipleItemsChanged event for easyDAClient.
Now I'm using easyDAClient_Item changed. In base I call function easyDAClient.SubscribeMultipleItems(DAItemGroupArgumets...) in Windows Form Application.
Is there some example for MultipleItemsChanged event (I didn't found any example on internet for now)?
How does it work?
How can I get results (for ItemChanged event I get results for one tag in e.Vtq..., e.ItemDescriptor... )?
Thanks & Best regards
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- Reading, Writing, Subscriptions, Property Access
- MultipleItemChanged