Professional OPC
Development Tools

logos

Set Property Value [specify update rate]

More
07 May 2014 08:19 #1934 by Jan
Thank you. I'm sure that is what I'm looking for.
I will try it...

Thanks !!!

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

More
07 May 2014 06:13 #1932 by support
OPC Data Access does not allow the client to directly set values of OPC properties - they are all "read only".

What you are probably looking for is to influence how often you get notifications from the server about changes in the item's value or status. This is of course possible. With the EasyDAClient component, you specify the UpdateRate when calling SubscribeItem or SubscribeMultipleItems.

For example, the argument "1000" in the call to SubscribeItem below, indicates that you want an update rate of 1000 milliseconds (1 second).

// This example shows how subscribe to changes of multiple items and display the value of the item with each change,
// using a callback method specified using lambda expression.
 
using System.Diagnostics;
using OpcLabs.EasyOpc.DataAccess;
using System;
using System.Threading;
 
namespace DocExamples
{
    namespace _EasyDAClient
    {
        class SubscribeItem
        {
            public static void CallbackLambda()
            {
                // Instantiate the client object
                var easyDAClient = new EasyDAClient();
 
                Console.WriteLine("Subscribing...");
                // The callback is a lambda expression the displays the value
                easyDAClient.SubscribeItem("", "OPCLabs.KitServer.2", "Simulation.Random", 1000,
                    (sender, eventArgs) =>
                        {
                            Debug.Assert(eventArgs != null);
 
                            if (eventArgs.Exception != null)
                                Console.WriteLine(eventArgs.Exception.ToString());
                            else
                            {
                                Debug.Assert(eventArgs.Vtq != null);
                                Console.WriteLine(eventArgs.Vtq.ToString());
                            }
                        });
 
                Console.WriteLine("Processing item changed events for 10 seconds...");
                Thread.Sleep(10 * 1000);
 
                Console.WriteLine("Unsubscribing...");
                easyDAClient.UnsubscribeAllItems();
 
                Console.WriteLine("Waiting for 2 seconds...");
                Thread.Sleep(2 * 1000);
            }
        }
    }
}
 

The value of the "scan rate" property than *may* be changed by the server, but it's kind of server specific, and you are probably not interested in it then anyway.

Best regards

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

More
06 May 2014 20:21 #1930 by Jan
Hi. I'm a total newbie.

I have used the EasyDaClient.GetPropertyValue method to get the scanrate of an item.
How do I change the scanrate? Is that possible from the client?

Thanks in advance...

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

Moderators: support
Time to create page: 0.165 seconds

      

 Recommend this on Google