Skip to main content

Dynamic Phasor (DP) Calculation / Discrete Fourier Transform (DFT)

The dp hook calulcates the dynamic phasor of a given signal by using Discrete Fourier Transformation (DFT).

Implementation​

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

Configuration​

f0
required
number

The fundamental frequency.

dt
number
Default: 0.00005

The timestep of the input samples. Exclusive with rate setting.

rate
number

The rate of the input samples. Exclusive with dt setting.

harmonics
required
Array of integers

A list of selected harmonics which should be calculated.

inverse
boolean
Default: false

Enable the calucation of the inverse transform.

signal
string

The name of a signal 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.

{
  • "f0": 50,
  • "dt": 0.00005,
  • "rate": 0,
  • "harmonics": [
    ],
  • "inverse": false,
  • "signal": "busA.V",
  • "enabled": true,
  • "priority": 99
}

Example​

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

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

hooks = (
{
type = "dp"

signal = "sine"
f0 = 50 # In Hz
dt = 0.1 # In seconds

# Alternative to dt
# rate = 10 Hz

harmonics = [ 0, 1, 3, 5, 7 ]
inverse = false
}
)
}
)