- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-05 09:17 PM . Last Modified: 2023-05-03 12:13 AM
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.
- Labels:
-
SCADA
- Tags:
- english
Link copied. Please paste this link to share this article on your social media post.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-06 10:55 PM
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:
- english
Link copied. Please paste this link to share this article on your social media post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-07 02:19 AM
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:
- english
Link copied. Please paste this link to share this article on your social media post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-06 10:55 PM
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:
- english
Link copied. Please paste this link to share this article on your social media post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-07 02:19 AM
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:
- english
Link copied. Please paste this link to share this article on your social media post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.

