|
SynchroPMU
C implementation of the Phasor Measurement Unit Estimator based on the Iterative Interpolated DFT Synchrophasor Estimation Algorithm
|
Function and type stubs for PMU estimator. More...
#include <math.h>#include <complex.h>

Go to the source code of this file.
Macros | |
| #define | M_PI_p M_PI |
| Mathematical constant PI (can be overridden) | |
| #define | float_p float |
| Floating-point type stub (default: float) | |
| #define | complex_p _Complex |
| Complex number type stub (default: _Complex) | |
| #define | uint_p unsigned int |
| Unsigned integer type stub (default: unsigned int) | |
| #define | bool_p _Bool |
| Boolean type stub (default: _Bool) | |
| #define | pmue_fft_r(in_ptr, out_ptr, out_len, n_bins) dft_r(in_ptr, out_ptr, out_len, n_bins) |
| FFT for real input stub. | |
| #define | pmue_cabs(x) cabs(x) |
| Complex absolute value (magnitude) stub. | |
| #define | pmue_fabs(x) fabs(x) |
| Floating-point absolute value stub. | |
| #define | pmue_carg(x) carg(x) |
| Complex argument (phase angle) stub. | |
| #define | pmue_cos(x) cos(x) |
| Cosine function stub. | |
| #define | pmue_sin(x) sin(x) |
| Sine function stub. | |
| #define | pmue_cexp(x) cexp(x) |
| Complex exponential function stub. | |
Function and type stubs for PMU estimator.
This header file provides a flexible stubbing mechanism for arithmetic functions and data types used in the PMU estimator. It allows users to replace standard library implementations with custom versions or external library functions.
The stubbing system enables:
To use a custom implementation, define the macro before including this header:
Or define your function and use it directly:
| #define bool_p _Bool |
Boolean type stub (default: _Bool)
| #define complex_p _Complex |
Complex number type stub (default: _Complex)
| #define float_p float |
Floating-point type stub (default: float)
| #define M_PI_p M_PI |
Mathematical constant PI (can be overridden)
| #define pmue_cabs | ( | x | ) | cabs(x) |
| #define pmue_carg | ( | x | ) | carg(x) |
| #define pmue_cexp | ( | x | ) | cexp(x) |
| #define pmue_cos | ( | x | ) | cos(x) |
| #define pmue_fabs | ( | x | ) | fabs(x) |
| #define pmue_fft_r | ( | in_ptr, | |
| out_ptr, | |||
| out_len, | |||
| n_bins ) dft_r(in_ptr, out_ptr, out_len, n_bins) |
FFT for real input stub.
| in_ptr | Input array pointer (real values) |
| out_ptr | Output array pointer (complex values) |
| out_len | Output array length |
| n_bins | Number of frequency bins |
Example custom implementation:
| #define pmue_sin | ( | x | ) | sin(x) |
| #define uint_p unsigned int |
Unsigned integer type stub (default: unsigned int)