How to use the protobuf.pb_util.build_payload function in protobuf

To help you get started, we’ve selected a few protobuf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openpowerquality / opq / mauka / plugins / makai_event_plugin.py View on Github external
start_timestamp,
                                                     end_timestamp)

    try:
        rms_windowed_voltage = protobuf.pb_util.build_payload(name,
                                                              event_id,
                                                              box_id,
                                                              protobuf.mauka_pb2.VOLTAGE_RMS_WINDOWED,
                                                              vrms_waveform(waveform_calibrated,
                                                                            int(constants.SAMPLES_PER_CYCLE)),
                                                              start_timestamp,
                                                              end_timestamp)
        makai_event_plugin.debug("Got rms windowed voltage")
    except Exception as exception:
        makai_event_plugin.logger.error("Error getting VOLTAGE_RMS_WINDOWED: %s", str(exception))
        rms_windowed_voltage = protobuf.pb_util.build_payload(name,
                                                              event_id,
                                                              box_id,
                                                              protobuf.mauka_pb2.VOLTAGE_RMS_WINDOWED,
                                                              [],
                                                              start_timestamp,
                                                              end_timestamp)

    try:
        frequency_windowed = protobuf.pb_util.build_payload(name,
                                                            event_id,
                                                            box_id,
                                                            protobuf.mauka_pb2.FREQUENCY_WINDOWED,
                                                            analysis.frequency_per_cycle(waveform_calibrated),
                                                            start_timestamp,
                                                            end_timestamp)
        makai_event_plugin.debug("Got windowed frequency")
github openpowerquality / opq / mauka / plugins / makai_event_plugin.py View on Github external
[],
                                                     start_timestamp,
                                                     end_timestamp)

    try:
        raw_voltage = protobuf.pb_util.build_payload(name,
                                                     event_id,
                                                     box_id,
                                                     protobuf.mauka_pb2.VOLTAGE_RAW,
                                                     waveform_calibrated,
                                                     start_timestamp,
                                                     end_timestamp)
        makai_event_plugin.debug("Got raw voltage")
    except Exception as exception:
        makai_event_plugin.logger.error("Error getting VOLTAGE_RAW: %s", str(exception))
        raw_voltage = protobuf.pb_util.build_payload(name,
                                                     event_id,
                                                     box_id,
                                                     protobuf.mauka_pb2.VOLTAGE_RAW,
                                                     [],
                                                     start_timestamp,
                                                     end_timestamp)

    try:
        rms_windowed_voltage = protobuf.pb_util.build_payload(name,
                                                              event_id,
                                                              box_id,
                                                              protobuf.mauka_pb2.VOLTAGE_RMS_WINDOWED,
                                                              vrms_waveform(waveform_calibrated,
                                                                            int(constants.SAMPLES_PER_CYCLE)),
                                                              start_timestamp,
                                                              end_timestamp)
github openpowerquality / opq / mauka / plugins / makai_event_plugin.py View on Github external
protobuf.mauka_pb2.VOLTAGE_RMS_WINDOWED,
                                                              [],
                                                              start_timestamp,
                                                              end_timestamp)

    try:
        frequency_windowed = protobuf.pb_util.build_payload(name,
                                                            event_id,
                                                            box_id,
                                                            protobuf.mauka_pb2.FREQUENCY_WINDOWED,
                                                            analysis.frequency_per_cycle(waveform_calibrated),
                                                            start_timestamp,
                                                            end_timestamp)
        makai_event_plugin.debug("Got windowed frequency")
    except Exception as exception:
        frequency_windowed = protobuf.pb_util.build_payload(name,
                                                            event_id,
                                                            box_id,
                                                            protobuf.mauka_pb2.FREQUENCY_WINDOWED,
                                                            [],
                                                            start_timestamp,
                                                            end_timestamp)
        makai_event_plugin.logger.error("Error getting FREQUENCY_WINDOWED: %s", str(exception))

    return adc_samples, raw_voltage, rms_windowed_voltage, frequency_windowed
github openpowerquality / opq / mauka / plugins / makai_event_plugin.py View on Github external
waveform_calibrated,
                                                     start_timestamp,
                                                     end_timestamp)
        makai_event_plugin.debug("Got raw voltage")
    except Exception as exception:
        makai_event_plugin.logger.error("Error getting VOLTAGE_RAW: %s", str(exception))
        raw_voltage = protobuf.pb_util.build_payload(name,
                                                     event_id,
                                                     box_id,
                                                     protobuf.mauka_pb2.VOLTAGE_RAW,
                                                     [],
                                                     start_timestamp,
                                                     end_timestamp)

    try:
        rms_windowed_voltage = protobuf.pb_util.build_payload(name,
                                                              event_id,
                                                              box_id,
                                                              protobuf.mauka_pb2.VOLTAGE_RMS_WINDOWED,
                                                              vrms_waveform(waveform_calibrated,
                                                                            int(constants.SAMPLES_PER_CYCLE)),
                                                              start_timestamp,
                                                              end_timestamp)
        makai_event_plugin.debug("Got rms windowed voltage")
    except Exception as exception:
        makai_event_plugin.logger.error("Error getting VOLTAGE_RMS_WINDOWED: %s", str(exception))
        rms_windowed_voltage = protobuf.pb_util.build_payload(name,
                                                              event_id,
                                                              box_id,
                                                              protobuf.mauka_pb2.VOLTAGE_RMS_WINDOWED,
                                                              [],
                                                              start_timestamp,
github openpowerquality / opq / mauka / plugins / makai_event_plugin.py View on Github external
waveform,
                                                     start_timestamp,
                                                     end_timestamp)
        makai_event_plugin.debug("Got ADC samples")
    except Exception as exception:
        makai_event_plugin.logger.error("Error getting ADC_SAMPLES %s", str(exception))
        adc_samples = protobuf.pb_util.build_payload(name,
                                                     event_id,
                                                     box_id,
                                                     protobuf.mauka_pb2.ADC_SAMPLES,
                                                     [],
                                                     start_timestamp,
                                                     end_timestamp)

    try:
        raw_voltage = protobuf.pb_util.build_payload(name,
                                                     event_id,
                                                     box_id,
                                                     protobuf.mauka_pb2.VOLTAGE_RAW,
                                                     waveform_calibrated,
                                                     start_timestamp,
                                                     end_timestamp)
        makai_event_plugin.debug("Got raw voltage")
    except Exception as exception:
        makai_event_plugin.logger.error("Error getting VOLTAGE_RAW: %s", str(exception))
        raw_voltage = protobuf.pb_util.build_payload(name,
                                                     event_id,
                                                     box_id,
                                                     protobuf.mauka_pb2.VOLTAGE_RAW,
                                                     [],
                                                     start_timestamp,
                                                     end_timestamp)
github openpowerquality / opq / mauka / plugins / makai_event_plugin.py View on Github external
int(constants.SAMPLES_PER_CYCLE)),
                                                              start_timestamp,
                                                              end_timestamp)
        makai_event_plugin.debug("Got rms windowed voltage")
    except Exception as exception:
        makai_event_plugin.logger.error("Error getting VOLTAGE_RMS_WINDOWED: %s", str(exception))
        rms_windowed_voltage = protobuf.pb_util.build_payload(name,
                                                              event_id,
                                                              box_id,
                                                              protobuf.mauka_pb2.VOLTAGE_RMS_WINDOWED,
                                                              [],
                                                              start_timestamp,
                                                              end_timestamp)

    try:
        frequency_windowed = protobuf.pb_util.build_payload(name,
                                                            event_id,
                                                            box_id,
                                                            protobuf.mauka_pb2.FREQUENCY_WINDOWED,
                                                            analysis.frequency_per_cycle(waveform_calibrated),
                                                            start_timestamp,
                                                            end_timestamp)
        makai_event_plugin.debug("Got windowed frequency")
    except Exception as exception:
        frequency_windowed = protobuf.pb_util.build_payload(name,
                                                            event_id,
                                                            box_id,
                                                            protobuf.mauka_pb2.FREQUENCY_WINDOWED,
                                                            [],
                                                            start_timestamp,
                                                            end_timestamp)
        makai_event_plugin.logger.error("Error getting FREQUENCY_WINDOWED: %s", str(exception))
github openpowerquality / opq / mauka / plugins / makai_event_plugin.py View on Github external
end_timestamp = box_event["event_end_timestamp_ms"]

    makai_event_plugin.debug("Extracted timestamps %d-%d" % (start_timestamp, end_timestamp))

    try:
        adc_samples = protobuf.pb_util.build_payload(name,
                                                     event_id,
                                                     box_id,
                                                     protobuf.mauka_pb2.ADC_SAMPLES,
                                                     waveform,
                                                     start_timestamp,
                                                     end_timestamp)
        makai_event_plugin.debug("Got ADC samples")
    except Exception as exception:
        makai_event_plugin.logger.error("Error getting ADC_SAMPLES %s", str(exception))
        adc_samples = protobuf.pb_util.build_payload(name,
                                                     event_id,
                                                     box_id,
                                                     protobuf.mauka_pb2.ADC_SAMPLES,
                                                     [],
                                                     start_timestamp,
                                                     end_timestamp)

    try:
        raw_voltage = protobuf.pb_util.build_payload(name,
                                                     event_id,
                                                     box_id,
                                                     protobuf.mauka_pb2.VOLTAGE_RAW,
                                                     waveform_calibrated,
                                                     start_timestamp,
                                                     end_timestamp)
        makai_event_plugin.debug("Got raw voltage")