diff --git a/doc/openapi/components/schemas/config/hooks/_round.yaml b/doc/openapi/components/schemas/config/hooks/_round.yaml new file mode 100644 index 000000000..08a4c4631 --- /dev/null +++ b/doc/openapi/components/schemas/config/hooks/_round.yaml @@ -0,0 +1,3 @@ +allOf: +- $ref: common.yaml +- $ref: round.yaml diff --git a/doc/openapi/components/schemas/config/hooks/pmu_dft.yaml b/doc/openapi/components/schemas/config/hooks/pmu_dft.yaml index d4dbfd274..d9a195674 100644 --- a/doc/openapi/components/schemas/config/hooks/pmu_dft.yaml +++ b/doc/openapi/components/schemas/config/hooks/pmu_dft.yaml @@ -5,42 +5,98 @@ allOf: - $ref: common.yaml - $ref: multi.yaml - type: object + required: + - sample_rate + - start_freqency + - end_freqency + - frequency_resolution + - dft_rate properties: sample_rate: type: integer + default: 0 + example: 10000 + description: The precision to which the singal should be rounded start_freqency: type: number + example: 49.7 + description: "The first frequency bin" end_freqency: type: number + example: 50.3 + description: "The last frequency bin" frequency_resolution: type: number + example: 0.1 + description: "The frequency resolution of the dft" dft_rate: type: integer + example: 1 + description: "Phasor calculations per second. Cannot be lower then 1 phasor/second" window_size_factor: type: integer + default: 1 + description: "A factor that increases the automatically calculated window by this amount" window_type: type: string enum: - flattop - hamming - hann + default: none + description: "The type of windowing" padding_type: type: string enum: - zero - signal_repeat + default: none + description: "The padding type" frequency_estimate_type: type: string enum: - quadratic - sync: - type: boolean + default: none + description: "The estimation type" pps_index: type: integer + description: "The index of the PPS singal. This is only needed if dumper is used" + default: 0 angle_unit: type: string enum: - rad - degree + default: rad + description: "The representation of the angle" add_channel_name: type: boolean + default: false + description: "Adds the name of the channel to the phasor property name e.g amplitude_ch1" + timestamp_align: + enum: + - left + - center + - right + default: center + description: "The timestamp in the window that is used for timestamping the phasor" + phase_offset: + type: number + default: 0.0 + example: 10.0 + description: "The offset for a calculated phase" + amplitude_offset: + type: number + default: 0.0 + example: 0.2 + description: "The offset for a calculated amplitude" + frequency_offset: + type: number + default: 0.0 + exmaple: 0.2 + description: "The offset for a calculated frequency" + rocof_offset: + type: number + default: 0.0 + example: 0.0 + description: "The offset for a calculated rocof. This setting does not really make sense but is available for completeness reasons" diff --git a/doc/openapi/components/schemas/config/hooks/pps_ts.yaml b/doc/openapi/components/schemas/config/hooks/pps_ts.yaml index b46b4858d..39f354dc4 100644 --- a/doc/openapi/components/schemas/config/hooks/pps_ts.yaml +++ b/doc/openapi/components/schemas/config/hooks/pps_ts.yaml @@ -14,11 +14,14 @@ allOf: - simple - horizon default: simple + description: "The sync mode. It is not recommended to use horizon since it is not fully tested" threshold: type: number default: 1.5 + description: "The level of the pps signal to trigger on." expected_smp_rate: type: integer + description: "The expected sampling rate. Only important for a faster initialization" horizon_estimation: type: integer default: 10 diff --git a/lib/hooks/pmu_dft.cpp b/lib/hooks/pmu_dft.cpp index 3cd136dd9..c85ff78fa 100644 --- a/lib/hooks/pmu_dft.cpp +++ b/lib/hooks/pmu_dft.cpp @@ -107,7 +107,6 @@ protected: unsigned windowSize; unsigned windowMultiplier; /**< Multiplyer for the window to achieve frequency resolution */ unsigned freqCount; /**< Number of requency bins that are calculated */ - bool sync; bool channelNameEnable; /**< Rename the output values with channel name or only descriptive name */ uint64_t smpMemPos; @@ -166,7 +165,6 @@ public: windowSize(0), windowMultiplier(0), freqCount(0), - sync(0), channelNameEnable(1), smpMemPos(0), lastSequence(0), @@ -293,7 +291,7 @@ public: Hook::parse(json); - ret = json_unpack_ex(json, &err, 0, "{ s?: i, s?: F, s?: F, s?: F, s?: i, s?: i, s?: s, s?: s, s?: s, s?: b, s?: i, s?: s, s?: b, s?: s, s?: F, s?: F, s?: F, s?: F}", + ret = json_unpack_ex(json, &err, 0, "{ s?: i, s?: F, s?: F, s?: F, s?: i, s?: i, s?: s, s?: s, s?: s, s?: i, s?: s, s?: b, s?: s, s?: F, s?: F, s?: F, s?: F}", "sample_rate", &sampleRate, "start_freqency", &startFrequency, "end_freqency", &endFreqency, @@ -303,11 +301,10 @@ public: "window_type", &windowTypeC, "padding_type", &paddingTypeC, "frequency_estimate_type", &freqEstimateTypeC, - "sync", &sync, "pps_index", &ppsIndex, "angle_unit", &angleUnitC, "add_channel_name", &channelNameEnable, - "timestamp", &timeAlignC, + "timestamp_align", &timeAlignC, "phase_offset", &phaseOffset, "amplitude_offset", &litudeOffset, "frequency_offset", &frequencyOffset, @@ -317,7 +314,7 @@ public: throw ConfigError(json, err, "node-config-hook-dft"); windowSize = sampleRate * windowSizeFactor / (double) rate; - logger->info("Set windows size to {} samples which fits {} / rate {}s", windowSize, windowSizeFactor, 1.0 / rate); + logger->info("Set windows size to {} samples which fits {} times the rate {}s", windowSize, windowSizeFactor, 1.0 / rate); if (!windowTypeC) logger->info("No Window type given, assume no windowing"); @@ -399,13 +396,11 @@ public: smpMemPos++; bool run = false; - if (sync) { - double smpNsec = smp->ts.origin.tv_sec * 1e9 + smp->ts.origin.tv_nsec; + double smpNsec = smp->ts.origin.tv_sec * 1e9 + smp->ts.origin.tv_nsec; - if (smpNsec > nextCalc) { - run = true; - nextCalc = (smp->ts.origin.tv_sec + (((calcCount % rate) + 1) / (double) rate)) * 1e9; - } + if (smpNsec > nextCalc) { + run = true; + nextCalc = (smp->ts.origin.tv_sec + (((calcCount % rate) + 1) / (double) rate)) * 1e9; } if (run) {