Skip to content

metric_sample_pb2

frequenz.api.common.v1.metrics.metric_sample_pb2 ¤

Generated protocol buffer code.

Attributes¤

frequenz.api.common.v1.metrics.metric_sample_pb2.METRIC_AC_APPARENT_ENERGY: Metric.ValueType module-attribute ¤

AC energy metrics

frequenz.api.common.v1.metrics.metric_sample_pb2.METRIC_AC_APPARENT_POWER: Metric.ValueType module-attribute ¤

AC power metrics

frequenz.api.common.v1.metrics.metric_sample_pb2.METRIC_AC_FREQUENCY: Metric.ValueType module-attribute ¤

General AC electricity metrics

frequenz.api.common.v1.metrics.metric_sample_pb2.METRIC_AC_POWER_FACTOR: Metric.ValueType module-attribute ¤

AC Power factor

frequenz.api.common.v1.metrics.metric_sample_pb2.METRIC_AC_THD_CURRENT: Metric.ValueType module-attribute ¤

AC harmonics

frequenz.api.common.v1.metrics.metric_sample_pb2.METRIC_BATTERY_CAPACITY: Metric.ValueType module-attribute ¤

General BMS metrics.

frequenz.api.common.v1.metrics.metric_sample_pb2.METRIC_DC_VOLTAGE: Metric.ValueType module-attribute ¤

DC electricity metrics

frequenz.api.common.v1.metrics.metric_sample_pb2.METRIC_EV_CHARGER_TEMPERATURE: Metric.ValueType module-attribute ¤

EV charging station metrics.

frequenz.api.common.v1.metrics.metric_sample_pb2.METRIC_INVERTER_TEMPERATURE: Metric.ValueType module-attribute ¤

General inverter metrics.

frequenz.api.common.v1.metrics.metric_sample_pb2.METRIC_SENSOR_WIND_SPEED: Metric.ValueType module-attribute ¤

General sensor metrics

frequenz.api.common.v1.metrics.metric_sample_pb2.METRIC_UNSPECIFIED: Metric.ValueType module-attribute ¤

Default value.

Classes¤

frequenz.api.common.v1.metrics.metric_sample_pb2.AggregatedMetricSample ¤

Bases: Message

Encapsulates derived statistical summaries of a single metric.

The message allows for the reporting of statistical summaries — minimum, maximum, and average values - as well as the complete list of individual samples if available.

This message represents derived metrics and contains fields for statistical summaries—minimum, maximum, and average values. Individual measurements are are optional, accommodating scenarios where only subsets of this information are available.

Attributes¤
avg_value: builtins.float instance-attribute ¤

The derived average value of the metric.

max_value: builtins.float instance-attribute ¤

The maximum measured value of the metric.

min_value: builtins.float instance-attribute ¤

The minimum measured value of the metric.

raw_values: google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.float] property ¤

Optional array of all the raw individual values.

frequenz.api.common.v1.metrics.metric_sample_pb2.Metric ¤

Bases: _Metric

List of supported metrics.

frequenz.api.common.v1.metrics.metric_sample_pb2.MetricSample ¤

Bases: Message

Representation of a sampled metric along with its value.

Note

This represents a single sample of a specific metric, the value of which is either measured or derived at a particular time. The real-time system-defined bounds are optional and may not always be present or set.

Note

Relationship Between Bounds and Metric Samples¤

Suppose a metric sample for active power has a lower-bound of -10,000 W, and an upper-bound of 10,000 W. For the system to accept a charge command, clients need to request current values within the bounds.

Attributes¤
bounds: google.protobuf.internal.containers.RepeatedCompositeFieldContainer[frequenz.api.common.v1.metrics.bounds_pb2.Bounds] property ¤

List of bounds that apply to the metric sample.

These bounds adapt in real-time to reflect the operating conditions at the time of aggregation or derivation.

Multiple Bounds¤

In the case of certain components like batteries, multiple bounds might exist. These multiple bounds collectively extend the range of allowable values, effectively forming a union of all given bounds. In such cases, the value of the metric must be within at least one of the bounds. In accordance with the passive sign convention, bounds that limit discharge would have negative numbers, while those limiting charge, such as for the State of Power (SoP) metric, would be positive. Hence bounds can have positive and negative values depending on the metric they represent.

Example¤

The diagram below illustrates the relationship between the bounds.

     bound[0].lower                         bound[1].upper
<-------|============|------------------|============|--------->
               bound[0].upper      bound[1].lower
---- values here are disallowed and will be rejected ==== values here are allowed and will be accepted

metric: global___Metric.ValueType instance-attribute ¤

The metric that was sampled.

sample: global___MetricSampleVariant property ¤

The value of the sampled metric.

sampled_at: google.protobuf.timestamp_pb2.Timestamp property ¤

The UTC timestamp of when the metric was sampled.

source: builtins.str instance-attribute ¤

An optional string that can be used to identify the source of the metric.

This is expected to be populated when the same Metric variant can be obtained from multiple sensors in the component. Knowing the source of the metric can help in certain control and monitoring applications.

E.g., a hybrid inverter can have a DC string for a battery and another DC string for a PV array. The source names could resemble, say, dc_battery_0 and `dc_pv_0. A metric like DC voltage can be obtained from both sources. For an application to determine the SoC of the battery using the battery voltage, the source of the voltage metric is important.

In cases where the component has just one source for a metric, then this field is not expected to be present, because the source is implicit.

frequenz.api.common.v1.metrics.metric_sample_pb2.MetricSampleVariant ¤

Bases: Message

MetricSampleVariant serves as a union type that can encapsulate either a SimpleMetricSample or an AggregatedMetricSample.

This message is designed to offer flexibility in capturing different granularities of metric samples—either a simple single-point measurement or an aggregated set of measurements for a metric.

A MetricSampleVariant can hold either a SimpleMetricSample or an AggregatedMetricSample, but not both simultaneously. Setting one will nullify the other.

frequenz.api.common.v1.metrics.metric_sample_pb2.SimpleMetricSample ¤

Bases: Message

Represents a single sample of a specific metric, the value of which is either measured or derived at a particular time.

Attributes¤
value: builtins.float instance-attribute ¤

The value of the metric, which could be either measured or derived.