Skip to content
Documentation

Enabling Historization

Historization records the state of time series data over time. When enabled, every write operation creates a new historical layer, which allows reading data as it existed at any previous point in time. This page describes how to enable historization and how to write and read historical data with the PowerTSM .NET API.

The historization can be enabled by the PreserveHistoricData property in ITimeSeries. When creating a new time series the historization is disabled by default but can be enabled with the parameter preserveHistoricData.

var tsm = ITsm.Create();
var repository = await tsm.Repositories.Load("TSM_Example_Repository");
var unitStore = await repository.GetUnitStore();
var timeSeries = tsm.TimeSeries.Create(
"Historization" + Guid.NewGuid().ToString(),
tsm.Intervals.Create(IntervalType.Hour()),
true,
FunctionType.StepRight(),
unitStore.References.Create("kWh"),
preserveHistoricData: true
);
var timeSeriesStore = await repository.GetTimeSeriesStore();
await timeSeriesStore.Save(timeSeries);

In case historization is enabled for a time series, any data write process will automatically result in new historical datasets.

When creating new ITimeSeriesDataReadingOptions the parameter historicDate can be used to specify which historic version (given by the historic date) to which condition (exact or not exact) should be read. If the HistoricDate property is null or no ITimeSeriesDataReadingOptions are provided for the Read method, by default the current date with exact is false will be used for reading data.

var readingOptions = timeSeriesDataStore.ReadingOptions.Create(
new DateTimeOffset(2023, 01, 05, 00, 00, 00, new TimeSpan(1, 0, 0)),
new DateTimeOffset(2023, 01, 05, 08, 00, 00, new TimeSpan(1, 0, 0)),
historicDate: DateTimeOffsetAtOrBefore.Create(dateTimeAfterFirstWrite, false)
);
await foreach (var point in await timeSeriesDataStore.Read<double>(readingOptions))
{
Console.WriteLine($"{point.Time}: {point.Value}");
}
© 2026 Volue.Version v0.6.38017 November 2026