Professional OPC
Development Tools

logos

SubscribeMultipleItems - deadband C#

More
08 Sep 2011 05:27 #482 by hedgehog

I correct "problematic" line. Now it works pefectly!
My critical code before:
short dataType = VarType.Empty;


for (int u = 0; u < Tag.Length; u++)
{
opcGroup2 = new OpcLabs.EasyOpc.DataAccess.DAItemGroupArguments(
Properties.Settings.Default.OPCmachineName,
Properties.Settings.Default.OPCserverClass,
Tag.TagID,
dataType,
Convert.ToInt32(Tag.UpdateRate), //Tag.UpdateRate = string
Tag.DeadBand); //Tag.UpdateRate = string
}







Code after correcting:
for (int u = 0; u < Tag.Length; u++)
{
opcGroup2 = new OpcLabs.EasyOpc.DataAccess.DAItemGroupArguments(
Properties.Settings.Default.OPCmachineName,
Properties.Settings.Default.OPCserverClass,
Tag.TagID,
dataType,
Convert.ToInt32(Tag.UpdateRate),
float.Parse(Tag.DeadBand), //corrected
null); //added
}






Thank You for Your quick answer!
Best regards

Please Log in or Create an account to join the conversation.

More
08 Sep 2011 05:22 #481 by support
Additional note: If you subscribe to the same item two or more times, only the lowest percent deadband will be used. Similarly, if you subscribe to the same item with different update rates, only the fastest update rate will be used. This behavior is by design.

Please Log in or Create an account to join the conversation.

More
07 Sep 2011 11:39 #476 by support
Hello, I have attempted to reproduce with recent QuickOPC.NET, and our simulation server, and it works correctly for me. I admit, however, that I have falled into a trap of using a wrong overload of SubscribeItem method - it is easy to code it so that what one thinks is the percent deadband is actually a 'state' argument. Below is the code that works for me - with the "problematic" line highlighted in yellow.


        partial class ChangeItemSubscription
        {
            public static void PercentDeadband()
            {
                using (var easyDAClient = new EasyDAClient())
                {
                    var eventHandler = new EventHandler<EasyDAItemChangedEventArgs>(easyDAClient_ItemChanged_PercentDeadband);
                    easyDAClient.ItemChanged += eventHandler;
 
                    Console.WriteLine("Subscribing with 10% deadband...");
                    int handle = easyDAClient.SubscribeItem("", "OPCLabs.KitServer.2", "Simulation.Ramp 0-100 (10 s)", 
                        VarType.Empty, 100, 10.0f, null);
 
                    Console.WriteLine("Waiting for 10 seconds...");
                    Thread.Sleep(10 * 1000);
 
                    Console.WriteLine("Changing subscription to 0% deadband...");
                    easyDAClient.ChangeItemSubscription(handle, new DAGroupParameters(100, 0.0f));
 
                    Console.WriteLine("Waiting for 10 seconds...");
                    Thread.Sleep(10 * 1000);
 
                    Console.WriteLine("Unsubscribing...");
                    easyDAClient.UnsubscribeAllItems();
 
                    Console.WriteLine("Waiting for 10 seconds...");
                    Thread.Sleep(10 * 1000);
                }
            }
 
            // Item changed event handler
            static void easyDAClient_ItemChanged_PercentDeadband(object sender, EasyDAItemChangedEventArgs e)
            {
                Console.WriteLine(e.Vtq);
            }
        }

If you do not find a solution in the above code, can you please send me relevant parts of your program so that I can look at it?
Thank you
Zbynek Zahradnik

Please Log in or Create an account to join the conversation.

More
06 Sep 2011 07:17 #475 by hedgehog
Thank you for your quick response!
Best regards

Please Log in or Create an account to join the conversation.

More
06 Sep 2011 07:12 #474 by support
OK I will set it up here and attempt to reproduce. I will let you know about the outcome when it is ready.

Please Log in or Create an account to join the conversation.

More
06 Sep 2011 06:45 #473 by hedgehog
OPC Labs Technical Support wrote:
Can you try with latest QuickOPC from our Web site?

Thank you for your advice.
I have tried it with the latest Quick OPC Classic 5.1. Unfortunaly there is still the same problem.

Please Log in or Create an account to join the conversation.

More
02 Sep 2011 13:18 #472 by support
Can you try with latest QuickOPC from our Web site?

Please Log in or Create an account to join the conversation.

More
02 Sep 2011 12:29 #471 by hedgehog
Hello,
"easyDAClient1_ItemChanged" is working normal (it return results at requestedUpdateRate).
Yes, i think the parameter "deadband" is ignored.
OPC .net client (ver. 5.1) is reading from OPC Server simulator - Graybox ( www.gray-box.net/ ).
Tags:
- numeric.sin.int16 (server data type: Short Integer)
- numeric.triangle.int16 (server data type: Short Integer)

It's possible the problem is in server data type...



Thanks & Best regards

Please Log in or Create an account to join the conversation.

More
02 Sep 2011 12:09 #470 by support
Hello,
I do not quite understand the nature of your problem. Can you please describe in more details?
Re "easyDAClient1_ItemChanged" return results at every "requestedUpdateRate". : Not sure what this means. The ItemChanged notifications should be called roughly in a rate given by the requestedUpdateRate (or slower, if there are no changes). Are you saying that this is not happening?
Re "Parameter "deadband" is not to take into.": Do you mean that it appears that this parameters is ignored? if so, can you please tell us: 1) Which OPC server are you connecting to, and 2) What type is the data item you are conecting to? (only items with "Analog" kind are subject to deadband filtering; other kinds of items DO ignore the deadband, this is per OPC specification, and 3) what is the precise version and build number of QuickOPC you are using? (there might have been builds with a bug with that effect; but the recent release should work well).
Best regards,
Zbynek Zahradnik

Please Log in or Create an account to join the conversation.

More
01 Sep 2011 09:49 #469 by hedgehog
I use this code for subscribe multiple items:
www.opclabs.com/Support/Online ...
support.softwaretoolbox.com/ap ...
"easyDAClient1_ItemChanged" return results at every "requestedUpdateRate".
Parameter "deadband" is not to take into.

Do everybodey know where is the problem?

Thanks & Best regards


Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.200 seconds

      

 Recommend this on Google