Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Managing Time-Series Data

Infrasys systems are designed to assist with the management of systems and their associated datasets. The infrasys package utilizes Chronofy, which supports the ingestion of the most commonly used time series data structures in power systems. Infrasys supports both continuous and discontinuous time series datasets.

  • SingleTimeSeries: Used for representing continuous time series datasets. Defined by start time and time step resolution. Data length determines end time.

  • NonSequentialTimeSeries: Used for representing discontinuous time-series data. Each data point is time-stamped in this representation.

In the example below, we attach a time series profile to a load in a distribution system. We create an example load model and add it to a system.

from gdm.distribution.components import DistributionLoad
from gdm.distribution import DistributionSystem

system = DistributionSystem(auto_add_composed_components=True)
load1 = DistributionLoad.example()
system.add_component(load1)

Next, we create a time series object and attach it to the load component. The time series interface also supports unit conversion. A profile is mapped to the parameter of the component to which it is attached. In the example below, the profile is attached to the active_power parameter of the DistributionLoad component.

from datetime import datetime, timedelta
from gdm.quantities import ActivePower
from infrasys import SingleTimeSeries

load_profile_kw = SingleTimeSeries.from_array(
    data=ActivePower([1, 2, 3, 4, 5], "kilowatt"),
    variable_name="active_power",
    initial_time=datetime(2020, 1, 1),
    resolution=timedelta(minutes=30),
)

system.add_time_series(
    load_profile_kw,
    *[load1],
    profile_type="PMult",
    profile_name="load_profile_kw",
    use_actual=True,
)
SingleTimeSeriesKey(variable_name='active_power', time_series_type=<class 'infrasys.time_series_models.SingleTimeSeries'>, user_attributes={'profile_type': 'PMult', 'profile_name': 'load_profile_kw', 'use_actual': True}, length=5, initial_time=datetime.datetime(2020, 1, 1, 0, 0), resolution=datetime.timedelta(seconds=1800))

Once added, system info should show number of time series profiles added to the system.

system.info()
Loading...
Loading...
Loading...

List of time series profiles mapped to a given component can be listed using the list_time_series method.

print(system.list_time_series(load1))
[SingleTimeSeries(variable_name='active_power', normalization=None, data=<Quantity([1 2 3 4 5], 'kilowatt')>, resolution=datetime.timedelta(seconds=1800), initial_time=datetime.datetime(2020, 1, 1, 0, 0), length=5)]

When a system is serialized, time series data is exported to the <system name>_time_series folder.