pswamp.monitoring.fft

Classes

FFTOnline

General time window application template.

Functions

calculate_fft_spectrum(y)

Calculates the frequency spectrum of the signal.

Module Contents

pswamp.monitoring.fft.calculate_fft_spectrum(y)

Calculates the frequency spectrum of the signal.

Parameters:

y – Signal to be analyzed.

Returns:

The frequency spectrum.

class pswamp.monitoring.fft.FFTOnline(kafka_kwargs, fft_window=5, time_window_store=10, kafka_topic='pmudata', status_topic='application.status', channel_selection={'measurement': 'f'}, *args, **kwargs)

Bases: pswamp.app_templates.time_window_app.TimeWindowApp

General time window application template.

New applications could be defined by inheriting from this template, and defining the “run_analysis” method. Similar to SnapshotApp, but has an internal time window storage. The length of the time window is determined by either of the arguments n_samples or window_length. If neither are specified, the size of the time window will grow indefinitely.

TODO: Remove channel_selection and channel_selection_idx from arguments.

Parameters:
  • io – Input/output object (normally connects to Kafka)

  • eval_freq – How often the evaluation of the application should be run (e.g., the part in “run_analysis”)

  • t_end – The application will stop running when this time is reached (but can be restarted)

  • t_start – The application will ask the io object (first argument) to search for t_start when initializing.

  • app_name – Name for the application.

  • input_decoder – This determines how the input is read/decoded (if no decoder is specified, a decoder for PMU data frames will be used.)

  • decoder_kwargs – Kwargs for initalizing the “input_decoder”.

  • channel_selection – Argument for specifying channel subset.

  • channel_selection_idx – Argument for specifying channel subset.

  • n_samples – Determines the window length in samples.

  • window_length – Determines the window length in seconds.

  • report_status – If enabled, status messages will be emitted.

  • io_kwargs – Any other kwargs will be forwarded to the io object.

n_samples_store
freq_range
em_freq_idx
fft_tw = []
threshold_emergency = 10
threshold_alert = 1
max_amplitude = 0
run_fft
run_analysis(t, measurements)