Skip to content

Add resampler to MovingWindow #269

@matthias-wende-frequenz

Description

What's needed?

In some cases we want to store data in a MovingWindow with a smaller sample rate as provided by the LogicalMeter.

Proposed solution

We add a sample_period parameter as well as a resample_period parameter to the list of parameters.

Example:

moving_window = MovingWindow(
    size = timedelta(days = 7),
    sample_period = timedelta(seconds = 1),
    resample_period = timedelta(minutes = 1),
    resampled_data_recv = logic_meter.grid_power(),
)

Furthermore I propose we change the size to be passed as timedelta. From the timedelta and the sample period we can simply calculate the number of samples and thus the size of the underlying ring buffer.

Use cases

For certain use case the resolution of data can be rather small, e.g. having one sample per minute (in the electricity industry many applications are still using one sample per 15 minutes).

A second resampling stage helps to reduce the amount of data to be stored in memory and speeds up further computation.

Alternatives and workarounds

As an alternative we could change the ResamplingActor to accept arbitrary sample typed channels, which can be directly plugged into the MovingWindow resampled_data_recv parameter.

We consider adding this second level resample step directly to the MovingWindow, instead of using a composable approach, to be user friendly as well as fast to implement and perform better. Also a user doesn't have to inst
Further more this approach will still work in the Future when the ResamplingActor accepts arbitrary Sample typed input channels.

Additional context

No response

Metadata

Metadata

Labels

part:data-pipelineAffects the data pipelinepriority:URGENTAddress this immediately or the sky will falltype:enhancementNew feature or enhancement visitble to users

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions