Defining Time Series
This page describes how to create a time series with the PowerTSM .NET API, starting with the minimum set of required properties and continuing with an advanced definition.
Minimum Definition
Section titled “Minimum Definition”At least the following properties are needed to create a time series with the .NET API:
- Name
- Cyclic
- Function
- Interval
using HAKOM.TSM.Net.Api;using HAKOM.TSM.Net.Api.Time.Intervals;using HAKOM.TSM.Net.Api.TimeSeries;
var tsm = ITsm.Create();var interval = tsm.Intervals.Create(IntervalType.Minute(), 15);var timeSeries = tsm.TimeSeries.Create( "TSM_Min_Example_TimeSeries", interval, true, FunctionType.StepLeft());
var timeSeriesStore = await repository.GetTimeSeriesStore();await timeSeriesStore.Save(timeSeries);Advanced Definition
Section titled “Advanced Definition”Dimension and compression options:
- Enable and configure historization (see Audit and Historization)
- Enable quotations and set quotation default behavior
- Enable compression
Interval transformation methods and time zone:
- Set
IntervalTransformationMethod(see Interval Transformation). Default:Average - Set
TimeZone. Default: configured time zone or UTC - Set
StartOfTime(to display the beginning of a gas year - from October to October - or to display the beginning of a gas day - from 06:00 to 06:00). Default:1970-01-01T00:00:00in the configured time zone or UTC
Storages:
- Set
Storageto configure where the time series is stored - Set
DataStorageto configure where the data of the time series is stored. Default: same location asStorage
using System;using HAKOM.TSM.Net.Api;using HAKOM.TSM.Net.Api.Compression;using HAKOM.TSM.Net.Api.Quotation;using HAKOM.TSM.Net.Api.Time.Intervals;using HAKOM.TSM.Net.Api.TimeSeries;
var tsm = ITsm.Create();var repository = await tsm.Repositories.Load("TSM_Example_Repository");var unitStore = await repository.GetUnitStore();
var interval = tsm.Intervals.Create(IntervalType.Hour(), 1);var unit = unitStore.References.Create("W");var timeZone = tsm.TimeZones.CreateFromId("W. Europe Standard Time");var startOfTime = new DateTime(2010, 10, 1, 6, 0, 0);
var timeSeries = tsm.TimeSeries.Create( name: "TSM_Example_TimeSeries", interval: interval, cyclic: true, function: FunctionType.StepRight(), unit: unit, description: "A Description which explains what this TimeSeries is", formula: null, timeZone: timeZone, intervalTransformationMethod: IntervalTransformationMethod.Sum(), startOfTime: new DateTimeOffset(startOfTime, timeZone.TimeZoneInfo.GetUtcOffset(startOfTime)), preserveDuplicatedValues: true, preserveHistoricData: true, quotation: true, quotationDefaultBehavior: QuotationBehavior.MaxExact(), compressionMode: CompressionMode.Base64BlockCompression(), storage: null, dataStorage: null);
var timeSeriesStore = await repository.GetTimeSeriesStore();await timeSeriesStore.Save(timeSeries);Was this page helpful?Thanks for your feedback!