protected void Setup() { TimeSeriesDatabaseTemplate template = new TimeSeriesDatabaseTemplate(); template.Title = DatabaseTitle; template.StartTime = startTime; template.AddDataSource( "Gauge", DataSource.ConversionFunctionType.Gauge, new TimeSpan(0, 0, 1), 10, 100); template.AddDataSource( "Counter", DataSource.ConversionFunctionType.Counter, new TimeSpan(0, 0, 1), 10, 100); template.AddDataSource( "Derive", DataSource.ConversionFunctionType.Derive, new TimeSpan(0, 0, 1), 10, 100); template.AddDataSource( "Absolute", DataSource.ConversionFunctionType.Absolute, new TimeSpan(0, 0, 1), 10, 100); template.AddArchive("Average", ArchiveTemplate.ConsolidationFunctionType.Average, 50, 30, 1000); template.AddArchive("Max", ArchiveTemplate.ConsolidationFunctionType.Max, 50, 30, 1000); template.AddArchive("Min", ArchiveTemplate.ConsolidationFunctionType.Min, 50, 30, 1000); template.AddArchive("Last", ArchiveTemplate.ConsolidationFunctionType.Last, 50, 30, 1000); // Create the database on disk this.database = TimeSeriesDatabase.Create(DatabaseFilename, template); this.database.Close(); // Load the database so that we can check whether it has been // persisted properly this.freshDatabase = TimeSeriesDatabase.Read( DatabaseFilename, TimeSeriesDatabase.ConnectionMode.ReadWrite); }
protected void Setup() { TimeSeriesDatabaseTemplate template = new TimeSeriesDatabaseTemplate(); template.Title = DatabaseTitle; template.StartTime = this.startTime; template.AddDataSource( DataSourceName, DataSourceType, PollingInterval, MinThreshold, MaxThreshold ); // All readings template.AddArchive( AllArchiveName, AvgArchiveType, XFactor, AllReadingsPerDataPoint, AllNumDataPointPerArchive ); // 24hr average template.AddArchive( AvgArchiveName, AvgArchiveType, XFactor, AvgReadingsPerDataPoint, AvgNumDataPointPerArchive ); // 24hr lows template.AddArchive( MinArchiveName, MinArchiveType, XFactor, MinReadingsPerDataPoint, MinNumDataPointPerArchive ); // 24hr highs template.AddArchive( MaxArchiveName, MaxArchiveType, XFactor, MaxReadingsPerDataPoint, MaxNumDataPointPerArchive ); // Create the database to disk this.database = TimeSeriesDatabase.Create(DatabaseFilename, template); // Push the final reading - will create lots of NaN dataPoint this.database.Push(DataSourceName, new Reading(24D, new DateTime(2008, 6, 7, 23, 59, 0))); this.database.Close(); /* * Load the database so that we can check whether it has been * persisted properly */ this.freshDatabase = TimeSeriesDatabase.Read( DatabaseFilename, TimeSeriesDatabase.ConnectionMode.ReadWrite ); }
protected void Setup() { TimeSeriesDatabaseTemplate template = new TimeSeriesDatabaseTemplate(); template.Title = DatabaseTitle; template.StartTime = startTime; template.AddDataSource("Temperature", DataSource.ConversionFunctionType.Gauge, Interval, 10, 100); template.AddArchive("Average", ArchiveTemplate.ConsolidationFunctionType.Average, 50, 1, NumReadings); template.AddArchive("Max", ArchiveTemplate.ConsolidationFunctionType.Max, 50, 1, NumReadings); template.AddArchive("Min", ArchiveTemplate.ConsolidationFunctionType.Min, 50, 1, NumReadings); template.AddArchive("Last", ArchiveTemplate.ConsolidationFunctionType.Last, 50, 1, NumReadings); // Create the database on disk this.database = TimeSeriesDatabase.Create(DatabaseFilename, template); this.database.Close(); }
protected void Setup() { TimeSeriesDatabaseTemplate template = new TimeSeriesDatabaseTemplate(); template.Title = DatabaseTitle; template.StartTime = StartTime; template.AddDataSource( GaugeDataSourceName, DataSource.ConversionFunctionType.Gauge, new TimeSpan(0, 5, 0), 0D, 10000D); template.AddDataSource( AbsoluteDataSourceName, DataSource.ConversionFunctionType.Absolute, new TimeSpan(0, 5, 0), 0D, 10000D); template.AddDataSource( CounterDataSourceName, DataSource.ConversionFunctionType.Counter, new TimeSpan(0, 5, 0), 0D, 10000D); template.AddDataSource( DeriveDataSourceName, DataSource.ConversionFunctionType.Derive, new TimeSpan(0, 5, 0), 0D, 10000D); template.AddArchive("Average", ArchiveTemplate.ConsolidationFunctionType.Average, 50, 1, 10); // Create the database on disk this.database = TimeSeriesDatabase.Create(DatabaseFilename, template); Reading[] readings = { new Reading(300D, new DateTime(2005, 1, 1, 0, 5, 0)), new Reading(600D, new DateTime(2005, 1, 1, 0, 10, 0)), new Reading(900D, new DateTime(2005, 1, 1, 0, 15, 0)), new Reading(1200D, new DateTime(2005, 1, 1, 0, 20, 0)), new Reading(1500D, new DateTime(2005, 1, 1, 0, 25, 0)), new Reading(1800D, new DateTime(2005, 1, 1, 0, 30, 0)), new Reading(2100D, new DateTime(2005, 1, 1, 0, 35, 0)), new Reading(2400D, new DateTime(2005, 1, 1, 0, 40, 0)), new Reading(2700D, new DateTime(2005, 1, 1, 0, 45, 0)), new Reading(3000D, new DateTime(2005, 1, 1, 0, 50, 0)) }; this.database.Push(GaugeDataSourceName, readings); this.database.Push(AbsoluteDataSourceName, readings); this.database.Push(DeriveDataSourceName, readings); this.database.Push(CounterDataSourceName, readings); this.database.Close(); /* * Load the database so that we can check whether it has been * persisted properly */ this.freshDatabase = TimeSeriesDatabase.Read( DatabaseFilename, TimeSeriesDatabase.ConnectionMode.ReadWrite); }