Topic
calculate the true RMS value
Startseite ' Community ' FPScript ' calculate the true RMS value
- Dieses Thema hat 4 Antworten sowie 3 Teilnehmer und wurde zuletzt vor vor 6 Jahren, 1 Monaten von Bernhard Kantz aktualisiert.
-
AutorBeiträge
-
20.02.2013 um 15:27 Uhr #33546MAZOYER ThomasTeilnehmer
Hello,
how can I calculate the “true” RMS value of a signal whose frequency varies ?
I try with the formula of the RMS “Mean(MySignal, MEAN_SQUARE + CALC_BLOCK, xx)”, but as the frequency varies, the CALC_BLOCK “xx” varies to !My problem is with the Block-by-block calculation, where One value is calculated per interval, which interval is not constant due to frequency.
In the example join, the interval lengh is more than 1000 points at the beginning, and around 50 points at the end so I can not calculate the RMS value by block.
20.02.2013 um 15:27 Uhr #33548MAZOYER ThomasTeilnehmerHello,
how can I calculate the “true” RMS value of a signal whose frequency varies ?
I try with the formula of the RMS “Mean(MySignal, MEAN_SQUARE + CALC_BLOCK, xx)”, but as the frequency varies, the CALC_BLOCK “xx” varies to !My problem is with the Block-by-block calculation, where One value is calculated per interval, which interval is not constant due to frequency.
In the example join, the interval lengh is more than 1000 points at the beginning, and around 50 points at the end so I can not calculate the RMS value by block.
21.02.2013 um 09:13 Uhr #33547Bernhard KantzTeilnehmerThe RMS value is a mean value, for a good estimation it is sufficient to average over enough full periods of the signal.
To compute the RMS over single periods, one can use the FPScript function [i]LevelCrossings()[/i] to determine the indices of upward zero crossings as boundaries in the signal to compute one RMS value per period.[code]// indices of upward zero crossings (with 5 % hysteresis)
Dim idx = LevelCrossings(IA, 0, 0.05 * Range(IA), EVENT_POSITIVE, EVENT_INDEX)// prepare output datasets in the desired length
Dim rms_y = IA.Y[0L] # Shape(idx[1L,-1L])
Dim rms_x = IA.X[0L] # Shape(idx[1L,-1L])Dim i_begin, i_end
For Each Row i In idx[1L,-1L] Do
// extract a full period
i_begin = idx[i]
i_end = idx[i + 1L] – 1L
// use x (time) of the interval center
rms_x[i] = IA.X[(i_begin + i_end) / 2L]
rms_y[i] = Mean(IA[i_begin, i_end], MEAN_SQUARE)
EndSignal(rms_y, rms_x)
[/code]21.03.2019 um 14:31 Uhr #33549Tho MAZTeilnehmerHello,
does not work know with version 10.0.16. I have the following error :
“Wrong data structure in index operation.
When using an index with a range specification ‘[<from>,<to>]’ both arguments must be scalar values. ”
Could you please help me ?
09.04.2019 um 13:42 Uhr #33550Bernhard KantzTeilnehmerThe code seems above seems to be mangled, maybe in the transition to the new web site. The FPScript formula below should do the job.
//Recherche des index où le signal d'entrée passe à zéro (orientation positive) afin d'isoler les périodes du signal Dim PMax = Maximum(Acceleration) Dim Idx = LevelCrossings(Acceleration, 0.0, 0.05 * PMax, EVENT_POSITIVE, EVENT_INDEX) //Calcul des valeurs RMS //Code optimisé pour un calcul plus rapide //Ici on n'étend pas les variables time et rms dans la boucle for avec l'opérateur := //On définit au préalable la taille de time et rms et on les remplies dans la boucle For Dim N = NumberOfRows(idx) Dim rms = AdjustUnit(? # N-1, Acceleration) For k = 0 To N - 2 Do rms[k] = Mean(Acceleration[Idx[k], Idx[k+1]], MEAN_SQUARE) End Return Signal(rms, Acceleration.X[Idx])
-
AutorBeiträge
- Du musst angemeldet sein, um auf dieses Thema antworten zu können.