Spontaneous Time Series
What Is a Spontaneous Time Series
Spontaneous, also known as asynchronous or acyclic time series, are time series with variable time intervals between two values on the time axis.
Spontaneous Vs. Cyclic Time Series
The following comparison shows the differences between a spontaneous time series and cyclic time series:
Spontaneous Time Series | Cyclic Time Series | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Time axis | The time axis is variable, the time span between two values can be freely chosen - with varying interval lengths. | The time axis follows a fixed raster, the time span between two values has always the same length. | |||||||||||||||||||||||||||||||||||||||||||||||
Value validity range | A value is always valid up to the next value on the time axis. The last value on the time axis is valid until infinity (UniversalTime.Max). Example: spontaneous power time series
| There is a fixed equidistant raster of time stamps on the time axis with. Each value is valid until the end of the interval assigned to the time series. Example: cyclical power time series,
Note the values above replicate the spontaneous time series in the example on the left. (The last value would have to be updated for a long period of time). | |||||||||||||||||||||||||||||||||||||||||||||||
Raster | As all HAKOM time series, spontaneous time series can be read and output to any raster. | As all HAKOM time series, cyclic time series can be read and output to any raster. | |||||||||||||||||||||||||||||||||||||||||||||||
Storage space and compressibility | Spontaneous time series require less storage space than cyclic time series for the same time period (if not all potential time stamp has its own value), but due to their asynchronous nature, they cannot be compressed into time blocks of equal length. See also Time Series Compression. | Cyclic time series require more storage space compared to spontaneous time series, but in order to reduce size, they can be compressed. See also Time Series Compression. |
When Use Spontaneous Time Series?
Depending on the business context, data volume, performance requirements and the interval between two value changes the following bullet points might help you to decide what time series type to use:
Use Spontaneous Time Series
- Constant, never changing values (e.g. to model fixed volume deals and flexible deals using the same solution)
- Values must keep their acyclic intervals upon saving and reading
- Any given value must be valid until the next value change on the time line (without repeating values)
- Number of occurring values, value changes is small enough, that a compressed cyclic time series will not provide a major performance improvement.
Use Cyclic Time Series
- Values are frequently changing
- Amount of values per compression block is higher than 75% of a given block, so that using compressed cyclic time series would result in higher performance (see Time Series Compression)
Time Series Data with and Without Interval
Spontaneous time series support as well fixed intervals (where spontaneous values are valid until at the end of a given interval, e.g. valid in a given hour) - let's call them cyclic-like spontaneous time series - as well an interval less state (where spontaneous values are valid until the next value change on the timeline, whenever it occurs) - let's call them real spontaneous time series.
The following WebTSM Services API request examples will illustrate the differences between a fixed interval and no interval.
Time series definitions
We will use two time series, one with interval "No" (real spontaneous time series) and one with interval "Hour" (cyclic-like spontaneous time series):
Name | Type | Interval.Value | Interval.Multiplier | Unit |
---|---|---|---|---|
Spontaneous_Real | Spontaneous | No | 1 | kWh |
Spontaneous_Cyclic | Spontaneous | Hour | 1 | kWh |
WebTSM Services API example - time series definition
POST {{baseUrl}}\repositories\ZAMS\timeseriescollections\definition
[
{
"ID": -1,
"Name": "Spontaneous_Real",
"Type": 3,
"Interval": {
"Value": 0,
"Multiplier": 1
},
"Unit": "kWh"
},
{
"ID": -1,
"Name": "Spontaneous_Cyclic",
"Type": 3,
"Interval": {
"Value": 3,
"Multiplier": 1
},
"Unit": "kWh"
}
]
Spontaneous Data
Let's take a first look at how HAKOM TSM handles real spontaneous data (without interval) under following circumstances:
- Saving on real spontaneous time series
- Saving on cyclic-like spontaneous time series (interval "Hour")
- Reading from a real spontaneous time series
- Reading from cyclic-like spontaneous time series (interval "Hour")
Writing Data
To demonstrate spontaneous data, the following data has a gap of one day between the values:
Timestamp | Value |
---|---|
2019-12-31T23:00:00Z | 22,8 |
2020-01-01T23:00:00Z | 23,9 |
Note
In WebTSM Services API - using the default, so called "selfcontained" data format, you can specify unit and interval of the data, so that the system can interpret and convert data to the target time series interval and unit.
To set the data to spontaneous without interval, we will use Interval "No" which is represented by the Value "0":
"Interval":{
"Value": 0,
"Multiplier": 1
}
WebTSM Services API example - write spontaneous data
POST {{baseUrl}}/repositories/ZAMS/timeseriescollections/data
[
{
"Name": "Spontaneous_Real",
"Data":
{
"Interval": {
"Value": 0,
"Multiplier": 1
},
"Unit": "kWh",
"Data": [
{
"From": "2019-12-31T23:00:00Z",
"Value": 22.8,
"Flag": 9
},
{
"From": "2020-01-01T23:00:00Z",
"Value": 23.6,
"Flag": 9
}
]
}
},
{
"Name": "Spontaneous_Cyclic",
"Data":
{
"Interval": {
"Value": 0,
"Multiplier": 1
},
"Unit": "kWh",
"Data": [
{
"From": "2019-12-31T23:00:00Z",
"Value": 22.8,
"Flag": 9
},
{
"From": "2020-01-01T23:00:00Z",
"Value": 23.6,
"Flag": 9
}
]
}
}
]
API response
The above shown data write requests will result in the API responding that spontaneous data without interval cannot be stored on a time series with a fixed interval. This is because the system tries to convert the received data to the interval of the target time series. For data without interval this would lead to a division by infinity, because the last submitted data point is valid until infinity.
Time series | Spontaneous_Real | Spontaneous_Cyclic |
---|---|---|
Request Status | 201 | 400 |
Explanation | Successfully saved | Cannot save data without interval on a time series with interval. |
WebTSM Services API response - write spontaneous data
[
{
"ID": 13131,
"Name": "Spontaneous_Real",
"Status": 201,
"Message": "Time series data successfully saved.",
"Details": null
},
{
"ID": null,
"Name": "Spontaneous_Cyclic",
"Status": 400,
"Message": "Requested data items exceed configured 'GetDataInTargetInterval'. Try partitioning your time period into multiple requests or choose a larger interval.",
"Details": null
}
]
Reading Data
To illustrate the results of the previous write process, we run a read request against both time series with the following results.
Timestamp | Spontaneous_Real | Spontaneous_Cyclic |
---|---|---|
2019-12-31T23:00:00Z | 22,8 | 0 |
2020-01-01T23:00:00Z | 23,9 | (timestamp does not exist on this sponaneous time series) |
Note
When requesting time series data (e.g. using /repositories/:repository/timeseries/:id|name/data
) besides specifying the time period (using from and to parameter) you may also specify the interval and interval multiplier for the output raster.
If you do not specify any interval, each time series data will be output in the original interval specified on the respective time series definition. See also Intervals and raster.
WebTSM Services API example - read spontaneous data
GET {{baseUrl}}/repositories/ZAMS/timeseriescollections/data?name=Spontaneous_NoInterval&name=Spontaneous_Interval_1h&from=2019-12-31T23:00:00Z&to=2020-01-02T23:00:00Z
[
{
"ID": 13131,
"Name": "Spontaneous_Real",
"Status": 200,
"Message": null,
"Details": null,
"Data": {
"Interval": {
"Value": 0,
"Multiplier": 1
},
"Unit": "KWh",
"Data": [
{
"From": "2019-12-31T23:00:00Z",
"Value": 22.8,
"Flag": 9
},
{
"From": "2020-01-01T23:00:00Z",
"Value": 23.6,
"Flag": 9
}
]
}
},
{
"ID": 13130,
"Name": "Spontaneous_Cyclic",
"Status": 200,
"Message": null,
"Details": null,
"Data": {
"Interval": {
"Value": 0,
"Multiplier": 1
},
"Unit": "KWh",
"Data": [
{
"From": "2019-12-31T23:00:00Z",
"Value": 0.0,
"Flag": 19
}
]
}
}
]
Cyclic Data
Let's also take look at how HAKOM TSM handles cyclic data (with interval) under following circumstances:
- Saving on real spontaneous time series
- Saving on cyclic-like spontaneous time series (interval "Hour")
- Reading from a real spontaneous time series
- Reading from cyclic-like spontaneous time series (interval "Hour")
Writing Data
To demonstrate cyclic data, we will use the same data as above:
Timestamp | Value |
---|---|
2019-12-31T23:00:00Z | 22,8 |
2020-01-01T23:00:00Z | 23,9 |
In this example we will not keep each value valid until the next day's value (as it was the case with the spontaneous data). For better visibility we will close both values with a 0 value on the next available time stamp on the raster:
Timestamp | Value |
---|---|
2019-12-31T23:00:00Z | 22,8 |
2020-01-01T00:00:00Z | 0 |
2020-01-01T01:00:00Z | 0 |
... | 0 |
2020-01-01T23:00:00Z | 23,9 |
2020-01-02T00:00:00Z | 0 |
Note
To tell the API that the data is in an hourly granularity, we will set interval header to "Hour" (which is represented by the integer 3) in our self contained data format:
"Interval":{
"Value": 3,
"Multiplier": 1
}
WebTSM Services API example - write cyclic data
POST {{baseUrl}}/repositories/ZAMS/timeseriescollections/data
[
{
"Name": "Spontaneous_Real",
"Data":
{
"Interval": {
"Value": 3,
"Multiplier": 1
},
"Unit": "kWh",
"Data": [
{
"From": "2019-12-31T23:00:00Z",
"Value": 22.8,
"Flag": 9
},
{
"From": "2020-01-01T23:00:00Z",
"Value": 23.6,
"Flag": 9
}
]
}
},
{
"Name": "Spontaneous_Cyclic",
"Data":
{
"Interval": {
"Value": 3,
"Multiplier": 1
},
"Unit": "kWh",
"Data": [
{
"From": "2019-12-31T23:00:00Z",
"Value": 22.8,
"Flag": 9
},
{
"From": "2020-01-01T23:00:00Z",
"Value": 23.6,
"Flag": 9
}
]
}
}
]
API response
The above shown data write requests will result in the API responding that on both time series (real spontaneous and cyclic-like spontaneous) data with a fixed interval could be successfully saved.
Time series | Spontaneous_Real | Spontaneous_Cyclic |
---|---|---|
Request Status | 201 | 201 |
Explanation | Successfully saved | Successfully saved |
WebTSM Services API response - write cyclic data
[
{
"ID": 13132,
"Name": "Spontaneous_Real",
"Status": 201,
"Message": "Time series data successfully saved.",
"Details": null
},
{
"ID": 13133,
"Name": "Spontaneous_Cyclic",
"Status": 201,
"Message": "Time series data successfully saved.",
"Details": null
}
]
Reading Data
To illustrate the results of the previous write process, we run a read request against both time series with the following results.
Timestamp | Spontaneous_Real | Spontaneous_Cyclic |
---|---|---|
2019-12-31T23:00:00Z | 22,8 | 22,8 |
2020-01-01T00:00:00Z | 0 | 0 |
2020-01-01T23:00:00Z | 23,9 | 23,9 |
2020-01-02T00:00:00Z | 0 | 0 |
WebTSM Services API example - read cyclic data
{{baseUrl}}/repositories/ZAMS/timeseriescollections/data?name=Spontaneous_NoInterval&name=Spontaneous_Interval_1h&from=2019-12-31T23:00:00Z&to=2020-01-02T23:00:00Z
[
{
"ID": 13132,
"Name": "Spontaneous_Real",
"Status": 200,
"Message": null,
"Details": null,
"Data": {
"Interval": {
"Value": 0,
"Multiplier": 1
},
"Unit": "KWh",
"Data": [
{
"From": "2019-12-31T23:00:00Z",
"Value": 22.8,
"Flag": 9
},
{
"From": "2020-01-01T00:00:00Z",
"Value": 0.0,
"Flag": 19
},
{
"From": "2020-01-01T23:00:00Z",
"Value": 23.6,
"Flag": 9
},
{
"From": "2020-01-02T00:00:00Z",
"Value": 0.0,
"Flag": 19
}
]
}
},
{
"ID": 13133,
"Name": "Spontaneous_Cyclic",
"Status": 200,
"Message": null,
"Details": null,
"Data": {
"Interval": {
"Value": 0,
"Multiplier": 1
},
"Unit": "KWh",
"Data": [
{
"From": "2019-12-31T23:00:00Z",
"Value": 22.8,
"Flag": 9
},
{
"From": "2020-01-01T00:00:00Z",
"Value": 0.0,
"Flag": 19
},
{
"From": "2020-01-01T23:00:00Z",
"Value": 23.6,
"Flag": 9
},
{
"From": "2020-01-02T00:00:00Z",
"Value": 0.0,
"Flag": 19
}
]
}
}
]
Spontaneous and Cyclic Cases Compared
In summary, the following side-by-side comparison shows the difference between data without and with interval:
Spontaneous (No Interval) | Cyclic (with Interval) | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The respective value is valid until the next change
| The respective value is valid until the end of the underlying interval
|
We recommend the following video under Video Tutorials:
- Types of Time Series