SCADACore DB – SCADACore_SCCalc

Estimated reading: 6 minutes 423 views

The SCADACore DB Driver is used to generate data records based on the existing data in the SCADACore Database. Using the existing data you can aggregate the data to create a series of records or a single record based on a given timespan in the poll function parameter

SCDailyCalc

SCDailyCalc – Calculations Historical Daily records based on sensor and poll function parameters

Sensor Configuration

In the Sensor table there is an Aggregate section. this needs to be modified in the Daily sensor to tell the SCDailyCalc driver how to aggregate the data. A typical configuration would look like this:

The Register name is the name of the Sensor in the Source Data group. Prefix the Sensor name with the name of the datagroup (SourceDatagroup|Sensorname).

Aggregate options are:

  • None: No Aggregation is done. Usually used if a formula is needed.
  • Sum: Adds all the Records up for the Day and provides a single daily Record of the Sum.
  • Min: The Lowest Sensor value for the day
  • Max: The Highest Sensor Value for the Day
  • Count: The number of records in the day.
  • Accumulated: This is the Last Record – First Record. Often used to find out what how much Daily liquid is accumulated from a running total.
  • First: First record of the contract day. Often used for Tank levels to show start of day tank level.
  • Last: Last record of the contract day. Often used for tank levels to show the end day tank level.
  • Average: Averages all the daily values into a single record.

Function Parameter

[days offset, num Days, ‘starttime/endtime’|SourceDG1|SourceDG2|SourceDG3]

  1. Days Offset – The number of days to start the daily calculations
  2. Number of Days – The number of days to calculate in the Daily Records
  3. ‘startime’/’endtime’ – The timestamp of the data will either be the start date of the group of records or the end date of the group of records
  4. Source Datagroups – There can be any number of source datagroups.
    • If a source datagroup starts with ‘#’ then it will look at that DatagroupIntID and can grab data from different locations to combine them.
    • If the source datagroup does not start with ‘#’ it is considered a datagroup in that same location.

Note: In Daily reports the hour timestamp is the “Contract Hour” field in the Device.

Example 1 – Daily Record for oil and gas companies.

[0,10,’starttime’|Instant|SensorData]: Aggregate the data for the last 10 Days from the ‘Instant’ and SensorData Datagroups. Resulting in 10 date-timestamped daily records

If you had a dataset for the last 10 days that polled every 5 minutes in the ‘Instant’ Datagroup and another datagroup ‘SensorData’ polling hourly, you can combine the data into 10 Daily Data Records. The timestamp will be the FIRST record in the timestamp. Data from Oct 1st 2020 to Oct 2nd 2020 would be timestamped as Oct 1st 2020.

Note: This is the most common Daily record for Oil and Gas contract days where the timestamp is generally the day the record started.

Example 2 – Daily Record back-poll for missing data

[50,50,’starttime’|Instant]: Skip the first 50 days and aggregate the data for the next 50 days. Resulting in 50 date-stamped daily records.

If you needed to poll some missing data you can skip the more current data using the first parameter (50) then take 50 records with a “start time” datestamp for the Instant Datagroup

Note 1: This is the most common Daily record for Oil and Gas contract days where the timestamp is generally the day the record started.

Note 2: Generally you can only poll up to about 100 datapoints without significantly changing the poll timeouts. Retrieving several days of high frequency data can take a long time.

Example 3[0,10,’starttime’|#99999|#99998]: Aggregate the data for the last 10 Days from 2 different locations and combine them resulting in 10 date-timestamped daily records.

Note 1: Often used when you need to calculate differential of 2 or more locations into a daily record.

Note 2: After the aggregates have been retrieved a calculation can be done on them with the “cell formula” poll function.

Note 3: When combining Datagroups all sensor names must be unique. If you have 2 locations with identical sensor names a formula will have to be created to uniquely identify them so they can be properly identified in the sensor table.


SCIntervalCalc

SCIntervalCalc – Calculations Historical Interval records

Sensor Configuration

The Register name is the name of the Sensor in the Source Data group. Prefix the Sensor name with the name of the datagroup (SourceDatagroup|Sensorname).

In the Sensor table there is an Aggregate section. this needs to be modified in the Daily sensor to tell the SCIntervalCalc driver how to aggregate the data. A typical configuration would look like this:

Aggregate options are:

  • None: No Aggregation is done. Usually used if a formula is needed.
  • Sum: Adds all the Records up for the Day and provides a single daily Record of the Sum.
  • Min: The Lowest Sensor value for the day
  • Max: The Highest Sensor Value for the Day
  • Count: The number of records in the day.
  • Accumulated: This is the Last Record – First Record. Often used to find out what how much Daily liquid is accumulated from a running total.
  • First: First record of the contract day. Often used for Tank levels to show start of day tank level.
  • Last: Last record of the contract day. Often used for tank levels to show the end day tank level.
  • Average: Averages all the daily values into a single record.

Function Parameter

[group type, offset, num Days, ‘starttime/endtime’|SourceDG1|SourceDG2|SourceDG3]

  1. Group Type – This specifies the time interval to aggregate together. See below for Group Type numbers.
  2. Days Offset – The number of days to start the daily calculations
  3. Number of Days – The number of days to calculate in the Daily Records
  4. ‘startime’/’endtime’ – The timestamp of the data will either be the start date of the group of records or the end date of the group of records
  5. Source Datagroups – There can be any number of source datagroups.
    • If a source datagroup starts with ‘#’ then it will look at that DatagroupIntID and can grab data from different locations to combine them.
    • If the source datagroup does not start with ‘#’ it is considered a datagroup in that same location.

Group Types

0 = RealTime

1 = Minute

2 = Five Minutes

3 = 10 Minutes

4 = 1 Hour

5 = Daily

6 = 30 Minutes

Note: In Daily reports the hour timestamp is the “Contract Hour” field in the Device.

Example 1 – Hourly Record for oil and gas companies.

[4,0,10,’starttime’|Instant|SensorData]: Aggregate the data for the last 10 Days from the ‘Instant’ and SensorData Datagroups. Resulting in 10 date-timestamped daily records

If you had a dataset for the last 10 hours that polled every 5 minutes in the ‘Instant’ Datagroup and another datagroup ‘SensorData’ polling hourly, you can combine the data into 10 Hourly Data Records. The timestamp will be the FIRST record in the timestamp. Data from Oct 1st 10:00 am 2020 to Oct 2nd 11:00am 2020 would be timestamped as 10:00am

Note: This is the most common Hourly record for Oil and Gas contract days where the timestamp is generally the day the record started.

Leave a Comment

Share this Doc

SCADACore DB – SCADACore_SCCalc

Or copy link

CONTENTS