43327members
217741posts

How to call the ClearSCADA built in Time Average function?

Highlighted
Ensign
Ensign

How to call the ClearSCADA built in Time Average function?

Is it possible to call the ClearSCADA Time Average function from a .NET application using the client library? Any example code will be much appreciated.

 

Thanks a lot.

Tags (1)
3 REPLIES 3
Highlighted
Commander

Re: How to call the ClearSCADA built in Time Average function?

Yes, it's possible.

 

From the .NET API you can InvokeMethods, you just need to know the name of the Method that you want to call, and what aggregate it is on, and what arguments to provide to it.

Pretty much all of these can be found in the DB Schema.

So I would start there.

 

If you're on your local GeoSCADA Expert server you can probably just go here:

https://localhost/schema/CHistoryBase

 

And that should show you the methods available.  You can see 'ProcessedValue' which will return 'a single processed historic value', which sounds like what a Time Average would be.

Then if you look at the argument for it, it wants:

  • StartTime (Time)... should be easy
  • EndTime (Time)... should be easy
  • Aggregate (Long)... you probably need to find out what number is associated with the aggregate you want.. I forget where this was found, I think it's in the help somewhere, or tprojects
  • Reason (String).. to filter the values if needed

It will return a variant representing the processed value.


Lead Control Systems Engineer for Alliance Automation (VIC).
All opinions are my own and do not represent the opinions or policies of my employer, or of my cat..
Tags (1)
Highlighted
Sisko

Re: How to call the ClearSCADA built in Time Average function?

Here's some sample code to do that - comments do some of the explaining:

                // Retrieve the last day's data 
                DateTime startTime = DateTime.UtcNow.Subtract(TimeSpan.FromDays(1));
                DateTime endTime = DateTime.UtcNow;

                // Retrieve an average of the last day's values - Processed Data
                // Historic Aggregate code 3 = average of values. Search help for "Animations for Historic Data" for codes.
                object[] pParams = new object[4] { startTime, endTime, 3, "" };
                object value = (object)myPoint.InvokeMethod("Historic.ProcessedValue", pParams);
                Console.WriteLine("Processed Average Value: " + value.ToString());
Tags (1)
Highlighted
Ensign
Ensign

Re: How to call the ClearSCADA built in Time Average function?

Time Average = 30

StdDev = 5

 

Thanks a lot for your help!

Tags (1)