Skip to main content

Phasor Calculation

The pmu_dft hook provides a dft based phasor calculation. The current implementation is a proof of concept but should not be used in production since this implementation is rather resource hungry.

This version supports phasor estimation for the frequency and amplitude but not yet for the phase.

This hook removes all signals fed into it and replaces it with new signals called amplitude, frequency, phase, rocof. If add_channel_name is set to false this could result in duplicate channel names.

Implementation​

The source code of the hook is available here: https://github.com/VILLASframework/node/blob/master/lib/hooks/pmu_dft.cpp

Configuration​

sample_rate
required
integer >= 0
Default: 0

The sampling rate of the input signal.

start_frequency
required
number >= 0

The lowest frequency bin.

end_frequency
required
number >= 0

The highest frequency bin.

frequency_resolution
required
number >= 0

The frequency resolution of the DFT.

dft_rate
required
integer >= 1

The number of phasor calculations performed per second.

window_size_factor
integer
Default: 1

A factor that increases the automatically determined window size by a multiplicative factor.

window_type
string
Default: "none"
Enum: "flattop" "hamming" "hann" "none"

The window type.

padding_type
string
Default: "none"
Enum: "zero" "signal_repeat"

The padding type.

frequency_estimate_type
string
Default: "none"
Value: "quadratic"

The frequency estimation type.

pps_index
integer
Default: 0

The signal index of the PPS signal. This is only needed if data dumper is active.

angle_unit
string
Default: "rad"
Enum: "rad" "degree"

The unit of the phase angle.

add_channel_name
boolean
Default: false

Adds the name of the channel as a suffix to the signal name e.g amplitude_ch1.

timestamp_align
any
Default: "center"
Enum: "left" "center" "right"

The timestamp alignment in respect to the the window.

phase_offset
number
Default: 0

An offset added to a calculated phase.

amplitude_offset
number
Default: 0

An offset added to the calculated amplitude.

frequency_offset
number
Default: 0

An offset added to the calculated frequency.

rocof_offset
number
Default: 0

An offset added to the calculated RoCoF. This setting does not really make sense but is available for completeness reasons"

signals
Array of strings

A list of signal names to which this hook should be applied

enabled
boolean
Default: true

An optional field which can be used to disable a hook.

priority
integer
Default: 99

The priority of this hook which determines the order in which hooks are executed. Hooks with a lwoer priority are executed before ones with a higher priority.

If no priority is configured, hooks are executed in the order they are configured in the configuration file.

{
  • "sample_rate": 10000,
  • "start_frequency": 49.7,
  • "end_frequency": 50.3,
  • "frequency_resolution": 0.1,
  • "dft_rate": 1,
  • "window_size_factor": 1,
  • "window_type": "flattop",
  • "padding_type": "zero",
  • "frequency_estimate_type": "quadratic",
  • "pps_index": 0,
  • "angle_unit": "rad",
  • "add_channel_name": false,
  • "timestamp_align": "left",
  • "phase_offset": 10,
  • "amplitude_offset": 10,
  • "frequency_offset": 0.2,
  • "rocof_offset": 1,
  • "signals": [
    ],
  • "enabled": true,
  • "priority": 99
}

Example​

node/etc/examples/hooks/pmu_dft.conf
@include "hook-nodes.conf"

paths = (
{
in = "signal_node"
out = "file_node"

hooks = (
{
type = "pmu_dft"

signals = (
"sine"
)

# Sample rate of the input signal
sample_rate = 1000

# Number of phasors calculated per second
dft_rate = 10

# Lowest frequency bin
start_frequency = 49.7

# Highest frequency bin
end_frequency = 50.3

# Frequency bin resolution
frequency_resolution = 0.1

# A factor with which the window will be increased
window_size_factor = 1

# One of: flattop, hamming, hann
window_type = "hamming"

# One of: signal_repeat, zero
padding_type = "zero"

# One of: quadratic
frequency_estimate_type = "quadratic"

# Signal index of the PPS signal
pps_index = 0

# One of: rad, degree
angle_unit = "rad"
}
)
}
)