Andras

Members
  • Content Count

    15
  • Joined

  • Last visited

Everything posted by Andras

  1. Szia @attila, Would you consider adding support for raw PCM or RIFF WAVE as export file formats? Both supports 32-bit floating point datapoints too if you preferred them.
  2. Oh, I see, thank you @attila for the explanation! I learned something new again!
  3. Hi, I use the Spectrum Analyzer's FFT for a variety of tasks and I really like the high resolution capabilities of Analog Discovery 2. If I set the BINs of the FFT something big like 4.097k or 8.193k the problem is that I can't set my display to have as many columns on the chart to show them all. If I understand it correctly the FFT with the setting of 8193 BINs will divide the range (from Start to Stop) into 8193 small segments and the FFT will generate 8193 datapoints. These datapoints will be displayed on the chart. If you have a monitor resolution like me, you have 1920 pixels horizontally from which approximately 1700 will be used as the active region of the chart. This means that we got (8193/1700=)4.8 datapoints for every column on the chart. I suppose WaveForms displays the average of those datapoints, but that means that we are unable to see any extremely high or low values because they got averaged out. My request would be to have an improved display of those datapoints on the chart. Design-wise it could be done in different ways, for example Grafana has a chart where you can see min, max and mean values instantly by using a solid line for mean and semi-transparent filling for min and max values: Would you consider improving the chart this way? Regards, Andras
  4. Ah, never mind, I have just realized that the dB average counter on the bottom of the chart shows that is get reset. In this case it's more like a feature request: could you keep the average function's buffer if the user changes a non-critical parameter of the measurement like the vertical scale? Do I understand it correctly that changing the top and bottom settings of the spectrum analyzer doesn't change the measurement parameters if the range remains the same?
  5. Hi, I'm using WaveForms 3.8.22's Spectrum Analyzer with Analog Discovery 2. When I run the analyzer I use FFT with 129 BINs in the 1 Hz to 100 Hz range on both channels. The magnitude settings of the Spectrum Analyzer are the follows: Vrms, top: 10 mV, bottom: 0 V, reference: 1V, range: 5V. I selected the exponential dB Average on both channels. If I run the spectrum analyzer and while it's running I change the top value from 10 mV to let's say 20 mV it instantly changes the chart correctly, but after a new measurement completes the chart changes drastically which is not the expected behavior, I think. Here is a screenshot of my workspace (just before the change): And another one just after the change from 10 mV to 20 mV: As you can see the chart changes significantly while the source signal remained somewhat the same. Interestingly when I tried to reproduce the problem by connecting the signal generator with the scope while generating a steady sine signal, the problem didn't show. It did show though when I set the signal generator to sweep mode. It also work fine if I change the type of the trace from the exponential dB average to sample. Is there a reason why this could happen? Does the averaging algorithm's buffer get reset when we change any of the parameters of the spectrum analyzer? Thank you, Andras
  6. Szia @attila, Thanks again for the excellent script, it works nearly perfectly. I noticed that when I run the script you recommended for the exponential average of difference and I keep the source Trace1 and Trace2 visible the Spectrum Analyzer, they both are shown as if they had a "Sample" type, and it make no difference if I choose any other type for them. Is this the intended behavior?
  7. Hi @attila I'm playing around with the new Spectrum1.Trace3.setMagnitude(d); command and I'd need some help. I used your script and made some changes to it to generate the 3rd trace signal in the Spectrum Analyzer: plot1.X.Units.text = "Hz" plot1.X.data = Spectrum1.Trace1.frequency plot1.Y1.Units.text = "dB" plot1.Y1.AutoScale.checked = false; plot1.Y1.Range.value = 40; plot1.Y1.Offset.value = 100; //while (true) { var t1 = Spectrum1.Trace1.magnitude var t2 = Spectrum1.Trace2.magnitude var c = t1.length var d = [] for(var i = 0; i < c; i++){ d.push(t1[i]-t2[i]-100) } plot1.Y1.data = d Spectrum1.Trace3.setMagnitude(d); // Spectrum1.wait(); } I have 3 traces in the Spectrum Analyzer: Trace1 (C1, Exponential dB Average, 10) Trace2 (C2, Exponential dB Average, 100) Trace3 (Hold, Sample) The first strange thing is that when I run the Spectrum Analyzer and then I click on the Play sign next the the "Script" label at the tab's top, the script runs, but both averaging functions reset for Trace1 and Trace2. Is that the intended behavior? Also, I would like to make the script above a continuously running one (that's why I used the "do (while)" and ".wait()" methods), but I wasn't successful. Could you help me out with this? The third thing I wonder: will it be possible to run an averaging function on Trace3 (like the Exponential dB Average) if it's values are set by the Spectrum1.Trace3.setMagnitude() method? Thanks!
  8. @attila, that's fantastic, thank you, I really appreciate your quick work!
  9. 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
  10. Szia @Attila! I'm trying to make the Network Analyzer and the Waveform Generator work at the same time, because I would need to generate a sine wave at a frequency and then check if that frequency is detectable by the Network Analyzer. When I start my test by first running the Waveform Generator and then I start the Network Analyzer, the Generator stops automatically. Is it intentional, is there a reason why they can't run at the same time? I use WaveForms version 3.8.15 beta. Btw, thank you for showing me the min and max functions, I didn't know they exists. I have just found them listed in the 5.6. section of the help (Help/Browse menu) and you also mention the following: "The specific objects and variables available in each of these can be found under the Insert menu Locals group." Could you help me get to the Insert/Locals menu item, I can't seem to find it anywhere Thanks!
  11. Hi, I'm working on a WaveForms script which would be able to generate chart with the frequency profile of a liquid. For this, I need to use a Wavegen and a Scope: first I need to set the generator to a certain frequency and then I'd like to check the power of that signal on the scope. Between the probes of the generator and the scope there will be the liquid I would like to test. I created a basic script to step from 1 Hz to 150 Hz, check that signal with the scope, repeat this loop 5 times, and calculate the min, max and average values at each frequency. Although the script works, I have a few questions: * I couldn't find any documentation about the Scope.Channelx.fftmagnitude and fftfrequency arrays. Where should I look for them? Are there any other properties related to the FFT configuration? * Is there a way to set the number of BINs and samples of the scope's FFT? * Can I somehow use the Goertzel algorithm instead of FFT? (The Görtzel algorithm is designed to tell us the power of a signal at one predefined frequency. https://en.wikipedia.org/wiki/Goertzel_algorithm) I would need this to get the power for the exact Hz value I define, and not the closest one I have from the FFT like I do it now. * Is there a way to change the color/style of the charts? Here is the script itself, but bear in mind that it is just the very first version const hzmax = 150; // the maximum frequency to measure const csamples = 5; // the number of samples to measure for each frequency const cdatapoints = 150; // chart X-axis resolution (currently: 1 datapoint / 1 Hz) var datapoints = new Array(4); // datapoint array datapoints[0] = new Array(cdatapoints); // max datapoints[1] = new Array(cdatapoints); // avg datapoints[2] = new Array(cdatapoints); // min datapoints[3] = new Array(cdatapoints * csamples); // raw data // clear the raw data array for(var j = 0; j < cdatapoints * csamples; j++) { datapoints[3][j] = 0; } // generate the freqeuncies to measure var frequencies = new Array(cdatapoints); for(var j = 0; j < cdatapoints; j++) { frequencies[j] = j+1; } { // configure plot plot1.X.Units.text = "Hz"; plot1.X.Offset.value = -hzmax/2 plot1.X.Range.value = hzmax; plot1.Y1.AutoScale.checked = false; plot1.Y2.AutoScale.checked = false; plot1.Y3.AutoScale.checked = false; plot1.Y4.AutoScale.checked = false; const vmax = 1.00; const vmin = 0.98; var offset = -(vmin + (vmax - vmin)/2); var range = (vmax - vmin); plot1.Y1.Offset.value = offset; plot1.Y2.Offset.value = offset; plot1.Y3.Offset.value = offset; plot1.Y4.Offset.value = offset; plot1.Y1.Range.value = range; plot1.Y2.Range.value = range; plot1.Y3.Range.value = range; plot1.Y4.Range.value = range; } { // configure wavegen Wavegen1.Channel1.Mode.text = "Simple"; Wavegen1.Channel1.Simple.Type.text = "Sine"; } { // configure scope Scope1.BufferSize.value = 1; Scope1.Buffer.value = 1; Scope1.Time.Mode.text = "Shift"; Scope1.Channel1.checked = true; Scope1.Channel2.checked = false; } Wavegen1.run(); for (var n=0; n<csamples; n++) { Scope1.Time.Samples.value = 1024; for (var i=0; i<hzmax; i++) { // change the frequency to the next one var frequency = frequencies[i]; Wavegen1.Channel1.Simple.Frequency.text = frequency; Scope1.Time.Rate.value = frequency * 256; print("Frequency: ",frequency," Hz | Running @ ",Scope1.Time.Rate.value," Hz | ", Scope1.Time.Samples.value," samples"); // take a single sample Scope1.single(); Scope1.wait(); // check out the FFT values var rgmag = Scope1.Channel1.fftmagnitude; var rghz = Scope1.Channel1.fftfrequency; var c = rgmag.length; var minHzDistance = frequency; // check all the FFT values, and get the one closest to our inspected frequency for(var j = 0; j < c; j++) { var hz = rghz[j] var hzDistance = frequency - hz; if (hzDistance < 0) { hzDistance = -hzDistance; } if (hzDistance <= minHzDistance) { minHzDistance = hzDistance; datapoints[3][i*csamples + n] = rgmag[j]; } } // calculate the min, max, avg values var rgmin = 1000.0; var rgavg = 0.0; var rgmax = 0.0; var validsamples = 0; for(var j = 0; j < csamples; j++) { currentsample = datapoints[3][i*csamples + j]; if (currentsample != 0) { if (currentsample < rgmin) { rgmin = currentsample; } if (currentsample > rgmax) { rgmax = currentsample; } rgavg += currentsample; validsamples++; } } rgavg /= validsamples; print("Min:",rgmin," V | Avg:",rgavg," V | Max:",rgmax," V | error: +/-",minHzDistance," Hz"); print(); // save the calculated data into their arrays datapoints[0][i] = rgmax; datapoints[1][i] = rgavg; datapoints[2][i] = rgmin; // check if the error if too high if (minHzDistance > 0.5) { Scope1.Time.Samples.value *= 2; i--; } // plot the most recent values on the chart plot1.Y1.data = datapoints[0]; // max plot1.Y2.data = datapoints[1]; // avg plot1.Y3.data = datapoints[2]; // min } }
  12. Szia Attila! Perfect, thanks a lot for the quick and wonderful reply!
  13. Hi, I'm an absolute beginner with WaveForms, I've just started to play around with it last week. I think it's brilliant, there are only a few questions I'd like to ask. 1, When I use the Spectrum's FFT or CZT and I set the stop frequency to something low (like 200 Hz) and the sample to something high (like 8.192k) the response rate of the chart will get very slow (it takes 20 seconds to refresh). My guess is that Analog Discovery 2 has to fill its buffer fully before sending it for the FFT/CZT and since the sample rate is 400 Hz only it takes a lot of time. If I understand it correctly I would need a big buffer if I wanted to measure the very low frequency regions (at least 400 samples for 1 Hz, 800 samples for 0.5 Hz, etc.) so I would prefer to not lower the sample count. On the other hand a higher refresh rate would be nice. Could you add the option to use a FIFO buffer for FFT/CZT, where a small number of samples of the recently captured values would be frequently added to the buffer that is used for the FFT/CZT, so the FFT/CZT would be always highly responsive independently from the buffer size/score rate? 2, I'm trying to visually show the changes of a signal using the Spectrum with 3 different exponential dB average traces on the same channel with 5, 100 and 1000 weights. It looks alright, but since I can't set the opacity level of the different trances they overlap each other. As a small feature request, could you add opacity option to the color setting dialog? 3, Do I understand it correctly that if I wanted to measure the cumulative power of a certain frequency region (like the theta, alpha, beta, gamma brainwaves) I need to write a script to do the math and plot the values? Is it possible to create a continuously updating chart which shows the different measurements over time this way? Thank you, Andras