The Citect SCADA Reports system version is unknown for the data we used in testing, the Citect database version tested is 1.0.0.159.
The database structure is as follows:
TAGS table returns the tag name, TagID, and DataType ID. The TagID is used to get time stamps, values, and quality ID from the samples tables. The DataTypeID matches up the TypeName from the DataTypes table and tells us which table to retrieve data from. The quality ID is used to determine whether the value is considered "Good" or not and defined when configuring the collector.
To query data use:
USE [FRSCADAReports]
GO
DECLARE @return_value int
EXEC @return_value = [dbo].[GetInterpolatedTagSamplesByID]
@tagID = 2,
@startDateTime = '05-17-2007 00:00:00',
@endDateTime = '05-18-2007 00:00:00',
@samplePeriod = 1000000,
@interpolationMode = 1
SELECT 'Return Value' = @return_value
GO
SamplePeriod:
One Second = 10,000
One Minute = 600,000
One Hour = 36,000,000
One Day = 864,000,000
InterpolationMode:
1 means time weighted average
Data Types:
1 = Numeric = dbo.NumericSamples
2 = Digital = dbo.DigitalSamples
3 = String = dbo.StringSamples
Dates are stored as BigInt's and can be extracted using:
USE [FRSCADAReports]
GO
SELECT dbo.ToDate(633149568000000000)
Tags table: