Skip to content

microgrid_pb2_grpc

frequenz.api.microgrid.v1.microgrid_pb2_grpc ¤

Client and server classes corresponding to protobuf-defined services.

Classes¤

frequenz.api.microgrid.v1.microgrid_pb2_grpc.Microgrid ¤

Bases: object

The Frequenz Microgrid API

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
class Microgrid(object):
    """The Frequenz Microgrid API
    """

    @staticmethod
    def GetMicrogridMetadata(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/GetMicrogridMetadata',
            google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.GetMicrogridMetadataResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ListComponents(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/ListComponents',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListComponentsRequest.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListComponentsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ListSensors(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/ListSensors',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListSensorRequest.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListSensorsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ListConnections(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/ListConnections',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListConnectionsRequest.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListConnectionsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ReceiveComponentDataStream(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_stream(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/ReceiveComponentDataStream',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveComponentDataStreamRequest.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveComponentDataStreamResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ReceiveSensorDataStream(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_stream(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/ReceiveSensorDataStream',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveSensorDataStreamRequest.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveSensorDataStreamResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def AddComponentBounds(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/AddComponentBounds',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AddComponentBoundsRequest.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AddComponentBoundsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SetComponentPowerActive(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/SetComponentPowerActive',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerActiveRequest.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerActiveResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SetComponentPowerReactive(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/SetComponentPowerReactive',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerReactiveRequest.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerReactiveResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def StartComponent(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/StartComponent',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.StartComponentRequest.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def PutComponentInStandby(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/PutComponentInStandby',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.PutComponentInStandbyRequest.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def StopComponent(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/StopComponent',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.StopComponentRequest.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def AckComponentError(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/AckComponentError',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AckComponentErrorRequest.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

frequenz.api.microgrid.v1.microgrid_pb2_grpc.MicrogridAsyncStub ¤

The Frequenz Microgrid API

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
        * Relays:
        * closes relays

        * Precharge Modules:
        * starts the precharge process, and eventually closes the DC relays.

        If any of the above mentioned actions for a given component has already
        been performed, then this method call effectively skips that action.

        If a feature required to perform an action is missing, then that action is
        skipped.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def PutComponentInStandby(self, request, context):
        """Sets the given component into a standby state, from which it can take a
        few minutes to return to an operational state. A transition to an
        operational state can be triggered by calling the `StartComponent` RPC, or
        the `SetComponentPowerActive` RPC.

        Performs the following sequence actions for the following component
        categories:

        * Inverter: Checks if AC and DC relays are closed, then
        * sets power to 0, and
        * opens AC relays

        If any of the checks mentioned above fails, then the method call returns an
        error.

        If any of the above mentioned actions for a given component has already
        been performed, then this method call efffectively skips that action.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def StopComponent(self, request, context):
        """Stops the component completely, potentially disengaging its power
        electronics controller(s).

        Performs the following sequence actions for the following component
        categories:

        * Inverter:
        * Brings component to the cold-standby state
        * opens DC relays

        * Battery: Checks if the power output is 0, then
        * opens DC relays

        * Relays:
        * opens relays

        * Precharge Modules:
        * opens the DC relays.

        If any of the checks mentioned above fails, then the method call returns an
        error.

        If any of the above mentioned actions for a given component has already
        been performed, then this method call effectively skips that action.

        If a feature required to perform an action is missing, then that action is
        skipped.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def AckComponentError(self, request, context):
        """Acknowledges any recoverable error reported by the component, and brings it
        back to the stopped or cold-standby state.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_MicrogridServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'GetMicrogridMetadata': grpc.unary_unary_rpc_method_handler(
                    servicer.GetMicrogridMetadata,
                    request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                    response_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.GetMicrogridMetadataResponse.SerializeToString,
            ),
            'ListComponents': grpc.unary_unary_rpc_method_handler(
                    servicer.ListComponents,
                    request_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListComponentsRequest.FromString,
                    response_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListComponentsResponse.SerializeToString,
            ),
            'ListSensors': grpc.unary_unary_rpc_method_handler(
                    servicer.ListSensors,
                    request_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListSensorRequest.FromString,
                    response_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListSensorsResponse.SerializeToString,
            ),
            'ListConnections': grpc.unary_unary_rpc_method_handler(
                    servicer.ListConnections,
                    request_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListConnectionsRequest.FromString,
                    response_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListConnectionsResponse.SerializeToString,
            ),
            'ReceiveComponentDataStream': grpc.unary_stream_rpc_method_handler(
                    servicer.ReceiveComponentDataStream,
                    request_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveComponentDataStreamRequest.FromString,
                    response_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveComponentDataStreamResponse.SerializeToString,
            ),
            'ReceiveSensorDataStream': grpc.unary_stream_rpc_method_handler(
                    servicer.ReceiveSensorDataStream,
                    request_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveSensorDataStreamRequest.FromString,
                    response_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveSensorDataStreamResponse.SerializeToString,
            ),
            'AddComponentBounds': grpc.unary_unary_rpc_method_handler(
                    servicer.AddComponentBounds,
                    request_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AddComponentBoundsRequest.FromString,
                    response_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AddComponentBoundsResponse.SerializeToString,
            ),
            'SetComponentPowerActive': grpc.unary_unary_rpc_method_handler(
                    servicer.SetComponentPowerActive,
                    request_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerActiveRequest.FromString,
                    response_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerActiveResponse.SerializeToString,
            ),
            'SetComponentPowerReactive': grpc.unary_unary_rpc_method_handler(
                    servicer.SetComponentPowerReactive,
                    request_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerReactiveRequest.FromString,
                    response_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerReactiveResponse.SerializeToString,
            ),
            'StartComponent': grpc.unary_unary_rpc_method_handler(
                    servicer.StartComponent,
                    request_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.StartComponentRequest.FromString,
                    response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ),
            'PutComponentInStandby': grpc.unary_unary_rpc_method_handler(
                    servicer.PutComponentInStandby,
                    request_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.PutComponentInStandbyRequest.FromString,
                    response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ),
            'StopComponent': grpc.unary_unary_rpc_method_handler(
                    servicer.StopComponent,
                    request_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.StopComponentRequest.FromString,
                    response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ),
            'AckComponentError': grpc.unary_unary_rpc_method_handler(
                    servicer.AckComponentError,
                    request_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AckComponentErrorRequest.FromString,
                    response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'frequenz.api.microgrid.v1.Microgrid', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('frequenz.api.microgrid.v1.Microgrid', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class Microgrid(object):
    """The Frequenz Microgrid API
    """

    @staticmethod
    def GetMicrogridMetadata(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/GetMicrogridMetadata',
            google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.GetMicrogridMetadataResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ListComponents(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/ListComponents',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListComponentsRequest.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListComponentsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ListSensors(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/ListSensors',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListSensorRequest.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListSensorsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ListConnections(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/ListConnections',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListConnectionsRequest.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListConnectionsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ReceiveComponentDataStream(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_stream(
            request,
            target,
            '/frequenz.api.microgrid.v1.Microgrid/ReceiveComponentDataStream',
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveComponentDataStreamRequest.SerializeToString,
            frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveComponentDataStreamResponse.FromString,
            options,
            channel_credentials,
Attributes¤
AckComponentError: grpc.aio.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.AckComponentErrorRequest, google.protobuf.empty_pb2.Empty] instance-attribute ¤

Acknowledges any recoverable error reported by the component, and brings it back to the stopped or cold-standby state.

AddComponentBounds: grpc.aio.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.AddComponentBoundsRequest, frequenz.api.microgrid.v1.microgrid_pb2.AddComponentBoundsResponse] instance-attribute ¤

Adds inclusion bounds for a given metric of a given component. Returns the time at which the bounds will expire (as a timestamp (UTC)).

The request parameters allows users to select a duration until which the bounds will stay in effect. If no duration is provided, then the bounds will be removed after a default duration of 5 seconds.

Inclusion bounds give the range that the system will try to keep the metric within. If the metric goes outside of these bounds, the system will try to bring it back within the bounds. If the bounds for a metric are [[lower_1, upper_1], [lower_2, upper_2]], then this metric's value needs to comply with the constraints lower_1 <= value <= upper_1 OR lower_2 <= value <= upper_2.

If multiple inclusion bounds have been provided for a metric, then the overlapping bounds are merged into a single bound, and non-overlapping bounds are kept separate. E.g. if the bounds are [[0, 10], [5, 15], [20, 30]], then the resulting bounds will be [[0, 15], [20, 30]].

The following diagram illustrates how bounds are applied:

  lower_1  upper_1
<----|========|--------|========|-------->
                    lower_2  upper_2
The bounds in this example are [[lower_1, upper_1], [lower_2, upper_2]]. ---- values here are considered out of range. ==== values here are considered within range.

Note that for power metrics, regardless of the bounds, 0W is always allowed.

GetMicrogridMetadata: grpc.aio.UnaryUnaryMultiCallable[google.protobuf.empty_pb2.Empty, frequenz.api.microgrid.v1.microgrid_pb2.GetMicrogridMetadataResponse] instance-attribute ¤

Returns the microgrid metadata The metadata consists of information that describes the overall microgrid, as opposed to its electrical components or sensors, e.g., the microgrid ID, location.

ListComponents: grpc.aio.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.ListComponentsRequest, frequenz.api.microgrid.v1.microgrid_pb2.ListComponentsResponse] instance-attribute ¤

List electrical components in the local microgrid, optionally filtered by a given list of component IDs and component categories.

Electrical components are a part of a microgrid's electrical infrastructure are can be connected to each other to form an electrical circuit, which can then be represented as a graph.

If provided, the filters for component IDs and categories have an AND relationship with one another, meaning that they are applied serially, but the elements within a single filter list have an OR relationship with each other. E.g., if ids = [1, 2, 3], and categories = [ ComponentCategory::COMPONENT_CATEGORY_INVERTER, ComponentCategory::COMPONENT_CATEGORY_BATTERY], then the results will consist of elements that have the IDs 1, OR 2, OR 3, AND are of the categories ComponentCategory::COMPONENT_CATEGORY_INVERTER OR ComponentCategory::COMPONENT_CATEGORY_BATTERY.

If a filter list is empty, then that filter is not applied.

ListConnections: grpc.aio.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.ListConnectionsRequest, frequenz.api.microgrid.v1.microgrid_pb2.ListConnectionsResponse] instance-attribute ¤

Electrical components are a part of a microgrid's electrical infrastructure are can be connected to each other to form an electrical circuit, which can then be represented as a graph.

This RPC return a list of the connections between two components, denoted by (start, end). The direction of a connection is always away from the grid endpoint, i.e. aligned with the direction of positive current according to the passive sign convention: https://en.wikipedia.org/wiki/Passive_sign_convention

The request may be filtered by start/end component(s) of individual connections. If provided, the start and end filters have an AND relationship between each other, meaning that they are applied serially, but an OR relationship with other elements in the same list. For example, if start = [1, 2, 3], and end = [4, 5, 6], then the result should have all the connections where * each start component ID is either 1, 2, OR 3, AND * each end component ID is either 4, 5, OR 6.

ListSensors: grpc.aio.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.ListSensorRequest, frequenz.api.microgrid.v1.microgrid_pb2.ListSensorsResponse] instance-attribute ¤

Returns a list of sensors in the local microgrid, optionally filtered by a given list of sensor IDs and sensor categories.

Sensors measure physical metrics in the microgrid's surroundings, and are not classified as electrical components.

If provided, the filters for sensor IDs and categories have an AND relationship with one another, meaning that they are applied serially, but the elements within a single filter list have an OR relationship with each other. E.g., if ids = [1, 2, 3], and categories = [ SensorCategory::SENSOR_CATEGORY_THERMOMETER, SensorCategory::SENSOR_CATEGORY_HYGROMETER], then the results will consist of elements that have the IDs 1, OR 2, OR 3, AND are of the categories SensorCategory::SENSOR_CATEGORY_THERMOMETER OR SensorCategory::SENSOR_CATEGORY_HYGROMETER.

If a filter list is empty, then that filter is not applied.

PutComponentInStandby: grpc.aio.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.PutComponentInStandbyRequest, google.protobuf.empty_pb2.Empty] instance-attribute ¤

Sets the given component into a standby state, from which it can take a few minutes to return to an operational state. A transition to an operational state can be triggered by calling the StartComponent RPC, or the SetComponentPowerActive RPC.

Performs the following sequence actions for the following component categories:

  • Inverter: Checks if AC and DC relays are closed, then
  • sets power to 0, and
  • opens AC relays

If any of the checks mentioned above fails, then the method call returns an error.

If any of the above mentioned actions for a given component has already been performed, then this method call efffectively skips that action.

ReceiveComponentDataStream: grpc.aio.UnaryStreamMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.ReceiveComponentDataStreamRequest, frequenz.api.microgrid.v1.microgrid_pb2.ReceiveComponentDataStreamResponse] instance-attribute ¤

Returns a stream containing data from a component with a given ID.

ReceiveSensorDataStream: grpc.aio.UnaryStreamMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.ReceiveSensorDataStreamRequest, frequenz.api.microgrid.v1.microgrid_pb2.ReceiveSensorDataStreamResponse] instance-attribute ¤

Returns a stream containing data from a sensor with a given ID.

SetComponentPowerActive: grpc.aio.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.SetComponentPowerActiveRequest, frequenz.api.microgrid.v1.microgrid_pb2.SetComponentPowerActiveResponse] instance-attribute ¤

Sets the active power output of a component with a given ID, provided the component supports it. The power output is specified in watts.

The power output can be -ve or +ve, depending on whether the component is supposed to be discharging or charging, respectively.

The return value is the timestamp until which the given power command will stay in effect. After this timestamp, the component's active power will be set to 0, if the API receives no further command to change it before then. By default, this timestamp will be set to the current time plus 60 seconds.

Note that the target component may have a resolution of more than 1 W. E.g., an inverter may have a resolution of 88 W. In such cases, the magnitude of power will be floored to the nearest multiple of the resolution.

Performs the following sequence actions for the following component categories:

  • Inverter: Sends the discharge command to the inverter, making it deliver AC power.
SetComponentPowerReactive: grpc.aio.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.SetComponentPowerReactiveRequest, frequenz.api.microgrid.v1.microgrid_pb2.SetComponentPowerReactiveResponse] instance-attribute ¤

Sets the reactive power output of a component with a given ID, provided the component supports it. The power output is specified in VAr.

We follow the polarity specified in the IEEE 1459-2010 standard definitions, where - positive reactive is inductive (current is lagging the voltage) - negative reactive is capacitive (current is leading the voltage)

The return value is the timestamp until which the given power command will stay in effect. After this timestamp, the component's reactive power will be set to 0, if the API receives no further command to change it before then. By default, this timestamp will be set to the current time plus 60 seconds.

Note that the target component may have a resolution of more than 1 VAr. E.g., an inverter may have a resolution of 88 VAr. In such cases, the magnitude of power will be floored to the nearest multiple of the resolution.

StartComponent: grpc.aio.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.StartComponentRequest, google.protobuf.empty_pb2.Empty] instance-attribute ¤

Starts the component, and brings it into a state where it is immediately operational.

Performs the following sequence of actions for the following component categories:

  • Inverter:
  • closes DC relays, if the feature is available
  • closes AC relays
  • sets power output to 0

  • Battery: Checks if DC relays are open, then

  • closes DC relays

  • Relays:

  • closes relays

  • Precharge Modules:

  • starts the precharge process, and eventually closes the DC relays.

If any of the above mentioned actions for a given component has already been performed, then this method call effectively skips that action.

If a feature required to perform an action is missing, then that action is skipped.

StopComponent: grpc.aio.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.StopComponentRequest, google.protobuf.empty_pb2.Empty] instance-attribute ¤

Stops the component completely, potentially disengaging its power electronics controller(s).

Performs the following sequence actions for the following component categories:

  • Inverter:
  • Brings component to the cold-standby state
  • opens DC relays

  • Battery: Checks if the power output is 0, then

  • opens DC relays

  • Relays:

  • opens relays

  • Precharge Modules:

  • opens the DC relays.

If any of the checks mentioned above fails, then the method call returns an error.

If any of the above mentioned actions for a given component has already been performed, then this method call effectively skips that action.

If a feature required to perform an action is missing, then that action is skipped.

frequenz.api.microgrid.v1.microgrid_pb2_grpc.MicrogridServicer ¤

Bases: object

The Frequenz Microgrid API

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
class MicrogridServicer(object):
    """The Frequenz Microgrid API
    """

    def GetMicrogridMetadata(self, request, context):
        """Returns the microgrid metadata
        The metadata consists of information that describes the overall
        microgrid, as opposed to its electrical components or sensors,
        e.g., the microgrid ID, location.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ListComponents(self, request, context):
        """List electrical components in the local microgrid, optionally filtered by a
        given list of component IDs and component categories.

        Electrical components are a part of a microgrid's electrical infrastructure
        are can be connected to each other to form an electrical circuit, which can
        then be represented as a graph.

        If provided, the filters for component IDs and categories have an `AND`
        relationship with one another, meaning that they are applied serially,
        but the elements within a single filter list have an `OR` relationship with
        each other.
        E.g., if `ids` = [1, 2, 3], and `categories` = [
        `ComponentCategory::COMPONENT_CATEGORY_INVERTER`,
        `ComponentCategory::COMPONENT_CATEGORY_BATTERY`],
        then the results will consist of elements that
        have the IDs 1, OR 2, OR 3,
        AND
        are of the categories `ComponentCategory::COMPONENT_CATEGORY_INVERTER` OR
        `ComponentCategory::COMPONENT_CATEGORY_BATTERY`.

        If a filter list is empty, then that filter is not applied.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ListSensors(self, request, context):
        """Returns a list of sensors in the local microgrid, optionally filtered by a
        given list of sensor IDs and sensor categories.

        Sensors measure physical metrics in the microgrid's surroundings, and are
        not classified as electrical components.

        If provided, the filters for sensor IDs and categories have an `AND`
        relationship with one another, meaning that they are applied serially,
        but the elements within a single filter list have an `OR` relationship with
        each other.
        E.g., if `ids` = [1, 2, 3], and `categories` = [
        `SensorCategory::SENSOR_CATEGORY_THERMOMETER`,
        `SensorCategory::SENSOR_CATEGORY_HYGROMETER`],
        then the results will consist of elements that
        have the IDs 1, OR 2, OR 3,
        AND
        are of the categories `SensorCategory::SENSOR_CATEGORY_THERMOMETER` OR
        `SensorCategory::SENSOR_CATEGORY_HYGROMETER`.

        If a filter list is empty, then that filter is not applied.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ListConnections(self, request, context):
        """Electrical components are a part of a microgrid's electrical infrastructure
        are can be connected to each other to form an electrical circuit, which can
        then be represented as a graph.

        This RPC return a list of the connections between two components, denoted
        by `(start, end)`. The direction of a connection is always away from the
        grid endpoint, i.e. aligned with the direction of positive current
        according to the passive sign convention:
        https://en.wikipedia.org/wiki/Passive_sign_convention

        The request may be filtered by `start`/`end` component(s) of individual
        connections.  If provided, the `start` and `end` filters have an `AND`
        relationship between each other, meaning that they are applied serially,
        but an `OR` relationship with other elements in the same list.
        For example, if `start` = `[1, 2, 3]`, and `end` = `[4, 5, 6]`, then the
        result should have all the connections where
        * each `start` component ID is either `1`, `2`, OR `3`,
        AND
        * each `end` component ID is either `4`, `5`, OR `6`.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ReceiveComponentDataStream(self, request, context):
        """Returns a stream containing data from a component with a given ID.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ReceiveSensorDataStream(self, request, context):
        """Returns a stream containing data from a sensor with a given ID.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def AddComponentBounds(self, request, context):
        """Adds inclusion bounds for a given metric of a given component. Returns the
        time at which the bounds will expire (as a timestamp (UTC)).

        The request parameters allows users to select a duration until
        which the bounds will stay in effect. If no duration is provided, then the
        bounds will be removed after a default duration of 5 seconds.

        Inclusion bounds give the range that the system will try to keep the
        metric within. If the metric goes outside of these bounds, the system will
        try to bring it back within the bounds.
        If the bounds for a metric are [[`lower_1`, `upper_1`],
        [`lower_2`, `upper_2`]], then this metric's `value` needs to comply with
        the constraints
        `lower_1 <= value <= upper_1` OR `lower_2 <= value <= upper_2`.

        If multiple inclusion bounds have been provided for a metric, then the
        overlapping bounds are merged into a single bound, and non-overlapping
        bounds are kept separate.
        E.g. if the bounds are [[0, 10], [5, 15], [20, 30]], then the resulting
        bounds will be [[0, 15], [20, 30]].

        The following diagram illustrates how bounds are applied:
        ```
        lower_1  upper_1
        <----|========|--------|========|-------->
        lower_2  upper_2
        ```
        The bounds in this example are `[[lower_1, upper_1], [lower_2, upper_2]]`.
        ---- values here are considered out of range.
        ==== values here are considered within range.

        Note that for power metrics, regardless of the bounds, 0W is always
        allowed.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SetComponentPowerActive(self, request, context):
        """Sets the active power output of a component with a given ID, provided the
        component supports it. The power output is specified in watts.

        The power output can be -ve or +ve, depending on whether the component is
        supposed to be discharging or charging, respectively.

        The return value is the timestamp until which the given power command will
        stay in effect. After this timestamp, the component's active power will be
        set to 0, if the API receives no further command to change it before then.
        By default, this timestamp will be set to the current time plus 60 seconds.

        Note that the target component may have a resolution of more than 1 W.
        E.g., an inverter may have a resolution of 88 W.
        In such cases, the magnitude of power will be floored to the nearest
        multiple of the resolution.

        Performs the following sequence actions for the following component
        categories:

        * Inverter: Sends the discharge command to the inverter, making it deliver
        AC power.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SetComponentPowerReactive(self, request, context):
        """Sets the reactive power output of a component with a given ID, provided the
        component supports it. The power output is specified in VAr.

        We follow the polarity specified in the IEEE 1459-2010 standard
        definitions, where
        - positive reactive is inductive (current is lagging the voltage)
        - negative reactive is capacitive (current is leading the voltage)

        The return value is the timestamp until which the given power command will
        stay in effect. After this timestamp, the component's reactive power will
        be set to 0, if the API receives no further command to change it before
        then.
        By default, this timestamp will be set to the current time plus 60 seconds.

        Note that the target component may have a resolution of more than 1 VAr.
        E.g., an inverter may have a resolution of 88 VAr.
        In such cases, the magnitude of power will be floored to the nearest
        multiple of the resolution.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def StartComponent(self, request, context):
        """Starts the component, and brings it into a state where it is immediately
        operational.

        Performs the following sequence of actions for the following component
        categories:

        * Inverter:
        * closes DC relays, if the feature is available
        * closes AC relays
        * sets power output to 0

        * Battery: Checks if DC relays are open, then
        * closes DC relays

        * Relays:
        * closes relays

        * Precharge Modules:
        * starts the precharge process, and eventually closes the DC relays.

        If any of the above mentioned actions for a given component has already
        been performed, then this method call effectively skips that action.

        If a feature required to perform an action is missing, then that action is
        skipped.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def PutComponentInStandby(self, request, context):
        """Sets the given component into a standby state, from which it can take a
        few minutes to return to an operational state. A transition to an
        operational state can be triggered by calling the `StartComponent` RPC, or
        the `SetComponentPowerActive` RPC.

        Performs the following sequence actions for the following component
        categories:

        * Inverter: Checks if AC and DC relays are closed, then
        * sets power to 0, and
        * opens AC relays

        If any of the checks mentioned above fails, then the method call returns an
        error.

        If any of the above mentioned actions for a given component has already
        been performed, then this method call efffectively skips that action.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def StopComponent(self, request, context):
        """Stops the component completely, potentially disengaging its power
        electronics controller(s).

        Performs the following sequence actions for the following component
        categories:

        * Inverter:
        * Brings component to the cold-standby state
        * opens DC relays

        * Battery: Checks if the power output is 0, then
        * opens DC relays

        * Relays:
        * opens relays

        * Precharge Modules:
        * opens the DC relays.

        If any of the checks mentioned above fails, then the method call returns an
        error.

        If any of the above mentioned actions for a given component has already
        been performed, then this method call effectively skips that action.

        If a feature required to perform an action is missing, then that action is
        skipped.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def AckComponentError(self, request, context):
        """Acknowledges any recoverable error reported by the component, and brings it
        back to the stopped or cold-standby state.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')
Functions¤
AckComponentError(request, context) ¤

Acknowledges any recoverable error reported by the component, and brings it back to the stopped or cold-standby state.

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def AckComponentError(self, request, context):
    """Acknowledges any recoverable error reported by the component, and brings it
    back to the stopped or cold-standby state.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')
AddComponentBounds(request, context) ¤

Adds inclusion bounds for a given metric of a given component. Returns the time at which the bounds will expire (as a timestamp (UTC)).

The request parameters allows users to select a duration until which the bounds will stay in effect. If no duration is provided, then the bounds will be removed after a default duration of 5 seconds.

Inclusion bounds give the range that the system will try to keep the metric within. If the metric goes outside of these bounds, the system will try to bring it back within the bounds. If the bounds for a metric are [[lower_1, upper_1], [lower_2, upper_2]], then this metric's value needs to comply with the constraints lower_1 <= value <= upper_1 OR lower_2 <= value <= upper_2.

If multiple inclusion bounds have been provided for a metric, then the overlapping bounds are merged into a single bound, and non-overlapping bounds are kept separate. E.g. if the bounds are [[0, 10], [5, 15], [20, 30]], then the resulting bounds will be [[0, 15], [20, 30]].

The following diagram illustrates how bounds are applied:

lower_1  upper_1
<----|========|--------|========|-------->
lower_2  upper_2
The bounds in this example are [[lower_1, upper_1], [lower_2, upper_2]]. ---- values here are considered out of range. ==== values here are considered within range.

Note that for power metrics, regardless of the bounds, 0W is always allowed.

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def AddComponentBounds(self, request, context):
    """Adds inclusion bounds for a given metric of a given component. Returns the
    time at which the bounds will expire (as a timestamp (UTC)).

    The request parameters allows users to select a duration until
    which the bounds will stay in effect. If no duration is provided, then the
    bounds will be removed after a default duration of 5 seconds.

    Inclusion bounds give the range that the system will try to keep the
    metric within. If the metric goes outside of these bounds, the system will
    try to bring it back within the bounds.
    If the bounds for a metric are [[`lower_1`, `upper_1`],
    [`lower_2`, `upper_2`]], then this metric's `value` needs to comply with
    the constraints
    `lower_1 <= value <= upper_1` OR `lower_2 <= value <= upper_2`.

    If multiple inclusion bounds have been provided for a metric, then the
    overlapping bounds are merged into a single bound, and non-overlapping
    bounds are kept separate.
    E.g. if the bounds are [[0, 10], [5, 15], [20, 30]], then the resulting
    bounds will be [[0, 15], [20, 30]].

    The following diagram illustrates how bounds are applied:
    ```
    lower_1  upper_1
    <----|========|--------|========|-------->
    lower_2  upper_2
    ```
    The bounds in this example are `[[lower_1, upper_1], [lower_2, upper_2]]`.
    ---- values here are considered out of range.
    ==== values here are considered within range.

    Note that for power metrics, regardless of the bounds, 0W is always
    allowed.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')
GetMicrogridMetadata(request, context) ¤

Returns the microgrid metadata The metadata consists of information that describes the overall microgrid, as opposed to its electrical components or sensors, e.g., the microgrid ID, location.

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def GetMicrogridMetadata(self, request, context):
    """Returns the microgrid metadata
    The metadata consists of information that describes the overall
    microgrid, as opposed to its electrical components or sensors,
    e.g., the microgrid ID, location.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')
ListComponents(request, context) ¤

List electrical components in the local microgrid, optionally filtered by a given list of component IDs and component categories.

Electrical components are a part of a microgrid's electrical infrastructure are can be connected to each other to form an electrical circuit, which can then be represented as a graph.

If provided, the filters for component IDs and categories have an AND relationship with one another, meaning that they are applied serially, but the elements within a single filter list have an OR relationship with each other. E.g., if ids = [1, 2, 3], and categories = [ ComponentCategory::COMPONENT_CATEGORY_INVERTER, ComponentCategory::COMPONENT_CATEGORY_BATTERY], then the results will consist of elements that have the IDs 1, OR 2, OR 3, AND are of the categories ComponentCategory::COMPONENT_CATEGORY_INVERTER OR ComponentCategory::COMPONENT_CATEGORY_BATTERY.

If a filter list is empty, then that filter is not applied.

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def ListComponents(self, request, context):
    """List electrical components in the local microgrid, optionally filtered by a
    given list of component IDs and component categories.

    Electrical components are a part of a microgrid's electrical infrastructure
    are can be connected to each other to form an electrical circuit, which can
    then be represented as a graph.

    If provided, the filters for component IDs and categories have an `AND`
    relationship with one another, meaning that they are applied serially,
    but the elements within a single filter list have an `OR` relationship with
    each other.
    E.g., if `ids` = [1, 2, 3], and `categories` = [
    `ComponentCategory::COMPONENT_CATEGORY_INVERTER`,
    `ComponentCategory::COMPONENT_CATEGORY_BATTERY`],
    then the results will consist of elements that
    have the IDs 1, OR 2, OR 3,
    AND
    are of the categories `ComponentCategory::COMPONENT_CATEGORY_INVERTER` OR
    `ComponentCategory::COMPONENT_CATEGORY_BATTERY`.

    If a filter list is empty, then that filter is not applied.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')
ListConnections(request, context) ¤

Electrical components are a part of a microgrid's electrical infrastructure are can be connected to each other to form an electrical circuit, which can then be represented as a graph.

This RPC return a list of the connections between two components, denoted by (start, end). The direction of a connection is always away from the grid endpoint, i.e. aligned with the direction of positive current according to the passive sign convention: https://en.wikipedia.org/wiki/Passive_sign_convention

The request may be filtered by start/end component(s) of individual connections. If provided, the start and end filters have an AND relationship between each other, meaning that they are applied serially, but an OR relationship with other elements in the same list. For example, if start = [1, 2, 3], and end = [4, 5, 6], then the result should have all the connections where * each start component ID is either 1, 2, OR 3, AND * each end component ID is either 4, 5, OR 6.

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def ListConnections(self, request, context):
    """Electrical components are a part of a microgrid's electrical infrastructure
    are can be connected to each other to form an electrical circuit, which can
    then be represented as a graph.

    This RPC return a list of the connections between two components, denoted
    by `(start, end)`. The direction of a connection is always away from the
    grid endpoint, i.e. aligned with the direction of positive current
    according to the passive sign convention:
    https://en.wikipedia.org/wiki/Passive_sign_convention

    The request may be filtered by `start`/`end` component(s) of individual
    connections.  If provided, the `start` and `end` filters have an `AND`
    relationship between each other, meaning that they are applied serially,
    but an `OR` relationship with other elements in the same list.
    For example, if `start` = `[1, 2, 3]`, and `end` = `[4, 5, 6]`, then the
    result should have all the connections where
    * each `start` component ID is either `1`, `2`, OR `3`,
    AND
    * each `end` component ID is either `4`, `5`, OR `6`.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')
ListSensors(request, context) ¤

Returns a list of sensors in the local microgrid, optionally filtered by a given list of sensor IDs and sensor categories.

Sensors measure physical metrics in the microgrid's surroundings, and are not classified as electrical components.

If provided, the filters for sensor IDs and categories have an AND relationship with one another, meaning that they are applied serially, but the elements within a single filter list have an OR relationship with each other. E.g., if ids = [1, 2, 3], and categories = [ SensorCategory::SENSOR_CATEGORY_THERMOMETER, SensorCategory::SENSOR_CATEGORY_HYGROMETER], then the results will consist of elements that have the IDs 1, OR 2, OR 3, AND are of the categories SensorCategory::SENSOR_CATEGORY_THERMOMETER OR SensorCategory::SENSOR_CATEGORY_HYGROMETER.

If a filter list is empty, then that filter is not applied.

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def ListSensors(self, request, context):
    """Returns a list of sensors in the local microgrid, optionally filtered by a
    given list of sensor IDs and sensor categories.

    Sensors measure physical metrics in the microgrid's surroundings, and are
    not classified as electrical components.

    If provided, the filters for sensor IDs and categories have an `AND`
    relationship with one another, meaning that they are applied serially,
    but the elements within a single filter list have an `OR` relationship with
    each other.
    E.g., if `ids` = [1, 2, 3], and `categories` = [
    `SensorCategory::SENSOR_CATEGORY_THERMOMETER`,
    `SensorCategory::SENSOR_CATEGORY_HYGROMETER`],
    then the results will consist of elements that
    have the IDs 1, OR 2, OR 3,
    AND
    are of the categories `SensorCategory::SENSOR_CATEGORY_THERMOMETER` OR
    `SensorCategory::SENSOR_CATEGORY_HYGROMETER`.

    If a filter list is empty, then that filter is not applied.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')
PutComponentInStandby(request, context) ¤

Sets the given component into a standby state, from which it can take a few minutes to return to an operational state. A transition to an operational state can be triggered by calling the StartComponent RPC, or the SetComponentPowerActive RPC.

Performs the following sequence actions for the following component categories:

  • Inverter: Checks if AC and DC relays are closed, then
  • sets power to 0, and
  • opens AC relays

If any of the checks mentioned above fails, then the method call returns an error.

If any of the above mentioned actions for a given component has already been performed, then this method call efffectively skips that action.

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def PutComponentInStandby(self, request, context):
    """Sets the given component into a standby state, from which it can take a
    few minutes to return to an operational state. A transition to an
    operational state can be triggered by calling the `StartComponent` RPC, or
    the `SetComponentPowerActive` RPC.

    Performs the following sequence actions for the following component
    categories:

    * Inverter: Checks if AC and DC relays are closed, then
    * sets power to 0, and
    * opens AC relays

    If any of the checks mentioned above fails, then the method call returns an
    error.

    If any of the above mentioned actions for a given component has already
    been performed, then this method call efffectively skips that action.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')
ReceiveComponentDataStream(request, context) ¤

Returns a stream containing data from a component with a given ID.

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def ReceiveComponentDataStream(self, request, context):
    """Returns a stream containing data from a component with a given ID.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')
ReceiveSensorDataStream(request, context) ¤

Returns a stream containing data from a sensor with a given ID.

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def ReceiveSensorDataStream(self, request, context):
    """Returns a stream containing data from a sensor with a given ID.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')
SetComponentPowerActive(request, context) ¤

Sets the active power output of a component with a given ID, provided the component supports it. The power output is specified in watts.

The power output can be -ve or +ve, depending on whether the component is supposed to be discharging or charging, respectively.

The return value is the timestamp until which the given power command will stay in effect. After this timestamp, the component's active power will be set to 0, if the API receives no further command to change it before then. By default, this timestamp will be set to the current time plus 60 seconds.

Note that the target component may have a resolution of more than 1 W. E.g., an inverter may have a resolution of 88 W. In such cases, the magnitude of power will be floored to the nearest multiple of the resolution.

Performs the following sequence actions for the following component categories:

  • Inverter: Sends the discharge command to the inverter, making it deliver AC power.
Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def SetComponentPowerActive(self, request, context):
    """Sets the active power output of a component with a given ID, provided the
    component supports it. The power output is specified in watts.

    The power output can be -ve or +ve, depending on whether the component is
    supposed to be discharging or charging, respectively.

    The return value is the timestamp until which the given power command will
    stay in effect. After this timestamp, the component's active power will be
    set to 0, if the API receives no further command to change it before then.
    By default, this timestamp will be set to the current time plus 60 seconds.

    Note that the target component may have a resolution of more than 1 W.
    E.g., an inverter may have a resolution of 88 W.
    In such cases, the magnitude of power will be floored to the nearest
    multiple of the resolution.

    Performs the following sequence actions for the following component
    categories:

    * Inverter: Sends the discharge command to the inverter, making it deliver
    AC power.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')
SetComponentPowerReactive(request, context) ¤

Sets the reactive power output of a component with a given ID, provided the component supports it. The power output is specified in VAr.

We follow the polarity specified in the IEEE 1459-2010 standard definitions, where - positive reactive is inductive (current is lagging the voltage) - negative reactive is capacitive (current is leading the voltage)

The return value is the timestamp until which the given power command will stay in effect. After this timestamp, the component's reactive power will be set to 0, if the API receives no further command to change it before then. By default, this timestamp will be set to the current time plus 60 seconds.

Note that the target component may have a resolution of more than 1 VAr. E.g., an inverter may have a resolution of 88 VAr. In such cases, the magnitude of power will be floored to the nearest multiple of the resolution.

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def SetComponentPowerReactive(self, request, context):
    """Sets the reactive power output of a component with a given ID, provided the
    component supports it. The power output is specified in VAr.

    We follow the polarity specified in the IEEE 1459-2010 standard
    definitions, where
    - positive reactive is inductive (current is lagging the voltage)
    - negative reactive is capacitive (current is leading the voltage)

    The return value is the timestamp until which the given power command will
    stay in effect. After this timestamp, the component's reactive power will
    be set to 0, if the API receives no further command to change it before
    then.
    By default, this timestamp will be set to the current time plus 60 seconds.

    Note that the target component may have a resolution of more than 1 VAr.
    E.g., an inverter may have a resolution of 88 VAr.
    In such cases, the magnitude of power will be floored to the nearest
    multiple of the resolution.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')
StartComponent(request, context) ¤

Starts the component, and brings it into a state where it is immediately operational.

Performs the following sequence of actions for the following component categories:

  • Inverter:
  • closes DC relays, if the feature is available
  • closes AC relays
  • sets power output to 0

  • Battery: Checks if DC relays are open, then

  • closes DC relays

  • Relays:

  • closes relays

  • Precharge Modules:

  • starts the precharge process, and eventually closes the DC relays.

If any of the above mentioned actions for a given component has already been performed, then this method call effectively skips that action.

If a feature required to perform an action is missing, then that action is skipped.

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def StartComponent(self, request, context):
    """Starts the component, and brings it into a state where it is immediately
    operational.

    Performs the following sequence of actions for the following component
    categories:

    * Inverter:
    * closes DC relays, if the feature is available
    * closes AC relays
    * sets power output to 0

    * Battery: Checks if DC relays are open, then
    * closes DC relays

    * Relays:
    * closes relays

    * Precharge Modules:
    * starts the precharge process, and eventually closes the DC relays.

    If any of the above mentioned actions for a given component has already
    been performed, then this method call effectively skips that action.

    If a feature required to perform an action is missing, then that action is
    skipped.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')
StopComponent(request, context) ¤

Stops the component completely, potentially disengaging its power electronics controller(s).

Performs the following sequence actions for the following component categories:

  • Inverter:
  • Brings component to the cold-standby state
  • opens DC relays

  • Battery: Checks if the power output is 0, then

  • opens DC relays

  • Relays:

  • opens relays

  • Precharge Modules:

  • opens the DC relays.

If any of the checks mentioned above fails, then the method call returns an error.

If any of the above mentioned actions for a given component has already been performed, then this method call effectively skips that action.

If a feature required to perform an action is missing, then that action is skipped.

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def StopComponent(self, request, context):
    """Stops the component completely, potentially disengaging its power
    electronics controller(s).

    Performs the following sequence actions for the following component
    categories:

    * Inverter:
    * Brings component to the cold-standby state
    * opens DC relays

    * Battery: Checks if the power output is 0, then
    * opens DC relays

    * Relays:
    * opens relays

    * Precharge Modules:
    * opens the DC relays.

    If any of the checks mentioned above fails, then the method call returns an
    error.

    If any of the above mentioned actions for a given component has already
    been performed, then this method call effectively skips that action.

    If a feature required to perform an action is missing, then that action is
    skipped.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

frequenz.api.microgrid.v1.microgrid_pb2_grpc.MicrogridStub ¤

Bases: object

The Frequenz Microgrid API

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
class MicrogridStub(object):
    """The Frequenz Microgrid API
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.GetMicrogridMetadata = channel.unary_unary(
                '/frequenz.api.microgrid.v1.Microgrid/GetMicrogridMetadata',
                request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
                response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.GetMicrogridMetadataResponse.FromString,
                _registered_method=True)
        self.ListComponents = channel.unary_unary(
                '/frequenz.api.microgrid.v1.Microgrid/ListComponents',
                request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListComponentsRequest.SerializeToString,
                response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListComponentsResponse.FromString,
                _registered_method=True)
        self.ListSensors = channel.unary_unary(
                '/frequenz.api.microgrid.v1.Microgrid/ListSensors',
                request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListSensorRequest.SerializeToString,
                response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListSensorsResponse.FromString,
                _registered_method=True)
        self.ListConnections = channel.unary_unary(
                '/frequenz.api.microgrid.v1.Microgrid/ListConnections',
                request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListConnectionsRequest.SerializeToString,
                response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListConnectionsResponse.FromString,
                _registered_method=True)
        self.ReceiveComponentDataStream = channel.unary_stream(
                '/frequenz.api.microgrid.v1.Microgrid/ReceiveComponentDataStream',
                request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveComponentDataStreamRequest.SerializeToString,
                response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveComponentDataStreamResponse.FromString,
                _registered_method=True)
        self.ReceiveSensorDataStream = channel.unary_stream(
                '/frequenz.api.microgrid.v1.Microgrid/ReceiveSensorDataStream',
                request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveSensorDataStreamRequest.SerializeToString,
                response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveSensorDataStreamResponse.FromString,
                _registered_method=True)
        self.AddComponentBounds = channel.unary_unary(
                '/frequenz.api.microgrid.v1.Microgrid/AddComponentBounds',
                request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AddComponentBoundsRequest.SerializeToString,
                response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AddComponentBoundsResponse.FromString,
                _registered_method=True)
        self.SetComponentPowerActive = channel.unary_unary(
                '/frequenz.api.microgrid.v1.Microgrid/SetComponentPowerActive',
                request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerActiveRequest.SerializeToString,
                response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerActiveResponse.FromString,
                _registered_method=True)
        self.SetComponentPowerReactive = channel.unary_unary(
                '/frequenz.api.microgrid.v1.Microgrid/SetComponentPowerReactive',
                request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerReactiveRequest.SerializeToString,
                response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerReactiveResponse.FromString,
                _registered_method=True)
        self.StartComponent = channel.unary_unary(
                '/frequenz.api.microgrid.v1.Microgrid/StartComponent',
                request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.StartComponentRequest.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                _registered_method=True)
        self.PutComponentInStandby = channel.unary_unary(
                '/frequenz.api.microgrid.v1.Microgrid/PutComponentInStandby',
                request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.PutComponentInStandbyRequest.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                _registered_method=True)
        self.StopComponent = channel.unary_unary(
                '/frequenz.api.microgrid.v1.Microgrid/StopComponent',
                request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.StopComponentRequest.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                _registered_method=True)
        self.AckComponentError = channel.unary_unary(
                '/frequenz.api.microgrid.v1.Microgrid/AckComponentError',
                request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AckComponentErrorRequest.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                _registered_method=True)
Attributes¤
AckComponentError: grpc.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.AckComponentErrorRequest, google.protobuf.empty_pb2.Empty] = channel.unary_unary('/frequenz.api.microgrid.v1.Microgrid/AckComponentError', request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AckComponentErrorRequest.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, _registered_method=True) instance-attribute ¤

Acknowledges any recoverable error reported by the component, and brings it back to the stopped or cold-standby state.

AddComponentBounds: grpc.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.AddComponentBoundsRequest, frequenz.api.microgrid.v1.microgrid_pb2.AddComponentBoundsResponse] = channel.unary_unary('/frequenz.api.microgrid.v1.Microgrid/AddComponentBounds', request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AddComponentBoundsRequest.SerializeToString, response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AddComponentBoundsResponse.FromString, _registered_method=True) instance-attribute ¤

Adds inclusion bounds for a given metric of a given component. Returns the time at which the bounds will expire (as a timestamp (UTC)).

The request parameters allows users to select a duration until which the bounds will stay in effect. If no duration is provided, then the bounds will be removed after a default duration of 5 seconds.

Inclusion bounds give the range that the system will try to keep the metric within. If the metric goes outside of these bounds, the system will try to bring it back within the bounds. If the bounds for a metric are [[lower_1, upper_1], [lower_2, upper_2]], then this metric's value needs to comply with the constraints lower_1 <= value <= upper_1 OR lower_2 <= value <= upper_2.

If multiple inclusion bounds have been provided for a metric, then the overlapping bounds are merged into a single bound, and non-overlapping bounds are kept separate. E.g. if the bounds are [[0, 10], [5, 15], [20, 30]], then the resulting bounds will be [[0, 15], [20, 30]].

The following diagram illustrates how bounds are applied:

  lower_1  upper_1
<----|========|--------|========|-------->
                    lower_2  upper_2
The bounds in this example are [[lower_1, upper_1], [lower_2, upper_2]]. ---- values here are considered out of range. ==== values here are considered within range.

Note that for power metrics, regardless of the bounds, 0W is always allowed.

GetMicrogridMetadata: grpc.UnaryUnaryMultiCallable[google.protobuf.empty_pb2.Empty, frequenz.api.microgrid.v1.microgrid_pb2.GetMicrogridMetadataResponse] = channel.unary_unary('/frequenz.api.microgrid.v1.Microgrid/GetMicrogridMetadata', request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.GetMicrogridMetadataResponse.FromString, _registered_method=True) instance-attribute ¤

Returns the microgrid metadata The metadata consists of information that describes the overall microgrid, as opposed to its electrical components or sensors, e.g., the microgrid ID, location.

ListComponents: grpc.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.ListComponentsRequest, frequenz.api.microgrid.v1.microgrid_pb2.ListComponentsResponse] = channel.unary_unary('/frequenz.api.microgrid.v1.Microgrid/ListComponents', request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListComponentsRequest.SerializeToString, response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListComponentsResponse.FromString, _registered_method=True) instance-attribute ¤

List electrical components in the local microgrid, optionally filtered by a given list of component IDs and component categories.

Electrical components are a part of a microgrid's electrical infrastructure are can be connected to each other to form an electrical circuit, which can then be represented as a graph.

If provided, the filters for component IDs and categories have an AND relationship with one another, meaning that they are applied serially, but the elements within a single filter list have an OR relationship with each other. E.g., if ids = [1, 2, 3], and categories = [ ComponentCategory::COMPONENT_CATEGORY_INVERTER, ComponentCategory::COMPONENT_CATEGORY_BATTERY], then the results will consist of elements that have the IDs 1, OR 2, OR 3, AND are of the categories ComponentCategory::COMPONENT_CATEGORY_INVERTER OR ComponentCategory::COMPONENT_CATEGORY_BATTERY.

If a filter list is empty, then that filter is not applied.

ListConnections: grpc.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.ListConnectionsRequest, frequenz.api.microgrid.v1.microgrid_pb2.ListConnectionsResponse] = channel.unary_unary('/frequenz.api.microgrid.v1.Microgrid/ListConnections', request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListConnectionsRequest.SerializeToString, response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListConnectionsResponse.FromString, _registered_method=True) instance-attribute ¤

Electrical components are a part of a microgrid's electrical infrastructure are can be connected to each other to form an electrical circuit, which can then be represented as a graph.

This RPC return a list of the connections between two components, denoted by (start, end). The direction of a connection is always away from the grid endpoint, i.e. aligned with the direction of positive current according to the passive sign convention: https://en.wikipedia.org/wiki/Passive_sign_convention

The request may be filtered by start/end component(s) of individual connections. If provided, the start and end filters have an AND relationship between each other, meaning that they are applied serially, but an OR relationship with other elements in the same list. For example, if start = [1, 2, 3], and end = [4, 5, 6], then the result should have all the connections where * each start component ID is either 1, 2, OR 3, AND * each end component ID is either 4, 5, OR 6.

ListSensors: grpc.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.ListSensorRequest, frequenz.api.microgrid.v1.microgrid_pb2.ListSensorsResponse] = channel.unary_unary('/frequenz.api.microgrid.v1.Microgrid/ListSensors', request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListSensorRequest.SerializeToString, response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListSensorsResponse.FromString, _registered_method=True) instance-attribute ¤

Returns a list of sensors in the local microgrid, optionally filtered by a given list of sensor IDs and sensor categories.

Sensors measure physical metrics in the microgrid's surroundings, and are not classified as electrical components.

If provided, the filters for sensor IDs and categories have an AND relationship with one another, meaning that they are applied serially, but the elements within a single filter list have an OR relationship with each other. E.g., if ids = [1, 2, 3], and categories = [ SensorCategory::SENSOR_CATEGORY_THERMOMETER, SensorCategory::SENSOR_CATEGORY_HYGROMETER], then the results will consist of elements that have the IDs 1, OR 2, OR 3, AND are of the categories SensorCategory::SENSOR_CATEGORY_THERMOMETER OR SensorCategory::SENSOR_CATEGORY_HYGROMETER.

If a filter list is empty, then that filter is not applied.

PutComponentInStandby: grpc.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.PutComponentInStandbyRequest, google.protobuf.empty_pb2.Empty] = channel.unary_unary('/frequenz.api.microgrid.v1.Microgrid/PutComponentInStandby', request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.PutComponentInStandbyRequest.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, _registered_method=True) instance-attribute ¤

Sets the given component into a standby state, from which it can take a few minutes to return to an operational state. A transition to an operational state can be triggered by calling the StartComponent RPC, or the SetComponentPowerActive RPC.

Performs the following sequence actions for the following component categories:

  • Inverter: Checks if AC and DC relays are closed, then
  • sets power to 0, and
  • opens AC relays

If any of the checks mentioned above fails, then the method call returns an error.

If any of the above mentioned actions for a given component has already been performed, then this method call efffectively skips that action.

ReceiveComponentDataStream: grpc.UnaryStreamMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.ReceiveComponentDataStreamRequest, frequenz.api.microgrid.v1.microgrid_pb2.ReceiveComponentDataStreamResponse] = channel.unary_stream('/frequenz.api.microgrid.v1.Microgrid/ReceiveComponentDataStream', request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveComponentDataStreamRequest.SerializeToString, response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveComponentDataStreamResponse.FromString, _registered_method=True) instance-attribute ¤

Returns a stream containing data from a component with a given ID.

ReceiveSensorDataStream: grpc.UnaryStreamMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.ReceiveSensorDataStreamRequest, frequenz.api.microgrid.v1.microgrid_pb2.ReceiveSensorDataStreamResponse] = channel.unary_stream('/frequenz.api.microgrid.v1.Microgrid/ReceiveSensorDataStream', request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveSensorDataStreamRequest.SerializeToString, response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveSensorDataStreamResponse.FromString, _registered_method=True) instance-attribute ¤

Returns a stream containing data from a sensor with a given ID.

SetComponentPowerActive: grpc.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.SetComponentPowerActiveRequest, frequenz.api.microgrid.v1.microgrid_pb2.SetComponentPowerActiveResponse] = channel.unary_unary('/frequenz.api.microgrid.v1.Microgrid/SetComponentPowerActive', request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerActiveRequest.SerializeToString, response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerActiveResponse.FromString, _registered_method=True) instance-attribute ¤

Sets the active power output of a component with a given ID, provided the component supports it. The power output is specified in watts.

The power output can be -ve or +ve, depending on whether the component is supposed to be discharging or charging, respectively.

The return value is the timestamp until which the given power command will stay in effect. After this timestamp, the component's active power will be set to 0, if the API receives no further command to change it before then. By default, this timestamp will be set to the current time plus 60 seconds.

Note that the target component may have a resolution of more than 1 W. E.g., an inverter may have a resolution of 88 W. In such cases, the magnitude of power will be floored to the nearest multiple of the resolution.

Performs the following sequence actions for the following component categories:

  • Inverter: Sends the discharge command to the inverter, making it deliver AC power.
SetComponentPowerReactive: grpc.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.SetComponentPowerReactiveRequest, frequenz.api.microgrid.v1.microgrid_pb2.SetComponentPowerReactiveResponse] = channel.unary_unary('/frequenz.api.microgrid.v1.Microgrid/SetComponentPowerReactive', request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerReactiveRequest.SerializeToString, response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerReactiveResponse.FromString, _registered_method=True) instance-attribute ¤

Sets the reactive power output of a component with a given ID, provided the component supports it. The power output is specified in VAr.

We follow the polarity specified in the IEEE 1459-2010 standard definitions, where - positive reactive is inductive (current is lagging the voltage) - negative reactive is capacitive (current is leading the voltage)

The return value is the timestamp until which the given power command will stay in effect. After this timestamp, the component's reactive power will be set to 0, if the API receives no further command to change it before then. By default, this timestamp will be set to the current time plus 60 seconds.

Note that the target component may have a resolution of more than 1 VAr. E.g., an inverter may have a resolution of 88 VAr. In such cases, the magnitude of power will be floored to the nearest multiple of the resolution.

StartComponent: grpc.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.StartComponentRequest, google.protobuf.empty_pb2.Empty] = channel.unary_unary('/frequenz.api.microgrid.v1.Microgrid/StartComponent', request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.StartComponentRequest.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, _registered_method=True) instance-attribute ¤

Starts the component, and brings it into a state where it is immediately operational.

Performs the following sequence of actions for the following component categories:

  • Inverter:
  • closes DC relays, if the feature is available
  • closes AC relays
  • sets power output to 0

  • Battery: Checks if DC relays are open, then

  • closes DC relays

  • Relays:

  • closes relays

  • Precharge Modules:

  • starts the precharge process, and eventually closes the DC relays.

If any of the above mentioned actions for a given component has already been performed, then this method call effectively skips that action.

If a feature required to perform an action is missing, then that action is skipped.

StopComponent: grpc.UnaryUnaryMultiCallable[frequenz.api.microgrid.v1.microgrid_pb2.StopComponentRequest, google.protobuf.empty_pb2.Empty] = channel.unary_unary('/frequenz.api.microgrid.v1.Microgrid/StopComponent', request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.StopComponentRequest.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, _registered_method=True) instance-attribute ¤

Stops the component completely, potentially disengaging its power electronics controller(s).

Performs the following sequence actions for the following component categories:

  • Inverter:
  • Brings component to the cold-standby state
  • opens DC relays

  • Battery: Checks if the power output is 0, then

  • opens DC relays

  • Relays:

  • opens relays

  • Precharge Modules:

  • opens the DC relays.

If any of the checks mentioned above fails, then the method call returns an error.

If any of the above mentioned actions for a given component has already been performed, then this method call effectively skips that action.

If a feature required to perform an action is missing, then that action is skipped.

Functions¤
__init__(channel) ¤

Constructor.

PARAMETER DESCRIPTION
channel

A grpc.Channel.

TYPE: Union[Channel, Channel]

Source code in frequenz/api/microgrid/v1/microgrid_pb2_grpc.py
def __init__(self, channel):
    """Constructor.

    Args:
        channel: A grpc.Channel.
    """
    self.GetMicrogridMetadata = channel.unary_unary(
            '/frequenz.api.microgrid.v1.Microgrid/GetMicrogridMetadata',
            request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.GetMicrogridMetadataResponse.FromString,
            _registered_method=True)
    self.ListComponents = channel.unary_unary(
            '/frequenz.api.microgrid.v1.Microgrid/ListComponents',
            request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListComponentsRequest.SerializeToString,
            response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListComponentsResponse.FromString,
            _registered_method=True)
    self.ListSensors = channel.unary_unary(
            '/frequenz.api.microgrid.v1.Microgrid/ListSensors',
            request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListSensorRequest.SerializeToString,
            response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListSensorsResponse.FromString,
            _registered_method=True)
    self.ListConnections = channel.unary_unary(
            '/frequenz.api.microgrid.v1.Microgrid/ListConnections',
            request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListConnectionsRequest.SerializeToString,
            response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ListConnectionsResponse.FromString,
            _registered_method=True)
    self.ReceiveComponentDataStream = channel.unary_stream(
            '/frequenz.api.microgrid.v1.Microgrid/ReceiveComponentDataStream',
            request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveComponentDataStreamRequest.SerializeToString,
            response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveComponentDataStreamResponse.FromString,
            _registered_method=True)
    self.ReceiveSensorDataStream = channel.unary_stream(
            '/frequenz.api.microgrid.v1.Microgrid/ReceiveSensorDataStream',
            request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveSensorDataStreamRequest.SerializeToString,
            response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.ReceiveSensorDataStreamResponse.FromString,
            _registered_method=True)
    self.AddComponentBounds = channel.unary_unary(
            '/frequenz.api.microgrid.v1.Microgrid/AddComponentBounds',
            request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AddComponentBoundsRequest.SerializeToString,
            response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AddComponentBoundsResponse.FromString,
            _registered_method=True)
    self.SetComponentPowerActive = channel.unary_unary(
            '/frequenz.api.microgrid.v1.Microgrid/SetComponentPowerActive',
            request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerActiveRequest.SerializeToString,
            response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerActiveResponse.FromString,
            _registered_method=True)
    self.SetComponentPowerReactive = channel.unary_unary(
            '/frequenz.api.microgrid.v1.Microgrid/SetComponentPowerReactive',
            request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerReactiveRequest.SerializeToString,
            response_deserializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.SetComponentPowerReactiveResponse.FromString,
            _registered_method=True)
    self.StartComponent = channel.unary_unary(
            '/frequenz.api.microgrid.v1.Microgrid/StartComponent',
            request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.StartComponentRequest.SerializeToString,
            response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            _registered_method=True)
    self.PutComponentInStandby = channel.unary_unary(
            '/frequenz.api.microgrid.v1.Microgrid/PutComponentInStandby',
            request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.PutComponentInStandbyRequest.SerializeToString,
            response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            _registered_method=True)
    self.StopComponent = channel.unary_unary(
            '/frequenz.api.microgrid.v1.Microgrid/StopComponent',
            request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.StopComponentRequest.SerializeToString,
            response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            _registered_method=True)
    self.AckComponentError = channel.unary_unary(
            '/frequenz.api.microgrid.v1.Microgrid/AckComponentError',
            request_serializer=frequenz_dot_api_dot_microgrid_dot_v1_dot_microgrid__pb2.AckComponentErrorRequest.SerializeToString,
            response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            _registered_method=True)