Jump to content
  • 0

Logger RMS averaging with script


Andras

Question

Szia @attila!

I'm using WaveForms 3.8.18 on Windows 10.

I would like to chart the difference between the currently measured AC RMS compared to the average of the past x values. Is it possible to do with a script?
Theoretically, if I could access the past values of the C1ACRMS from script it would be possible to calculate the average and the difference from that average.
Or as another approach, can I access the current value of the "Average" column in the script?

Let's say I name this script-based signal C1ACRMSDelta. I created another one for C2, and name it C2ACRMSDelta. Will I be able to create a third one using C1ACRMSDelta, C2ACRMSDelta are they accessible from script somehow?

The other thing is that the "Maximum" column displays the minimum value, not the maximum. I think that's a small bug ;)

 

image.png.4482d5d4b4f28e040b811bf3f612e21b.png

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Szia @Andras

The Logger function is intended for simple tasks (like C1DC+C2DC/10)
You can get the logger data like this and create a plot in script.

image.png.4a742ead5eaa694e9799fc5ce544f006.png

Logger.run()
while(wait(0.1)){
    var data = Logger.Loggers.C1ACRMS.data
    var avg = 0
    data.forEach(function(v){avg += v})
    avg /= data.length
    var delta = []
    data.forEach(function(v){delta.push(v-avg)})
    plot1.Y1.data = delta
}

Note the .data returns the circular buffer, the values in it are not in first - last order.

I'm adding write support for data, so you can set custom data to be displayed in Logger, in the next software version...
Also adding get average, min, max, .data to return the values in first to last order

Edit:
Also fixing maximum display.

Thank you for the observation 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...