AnsweredAssumed Answered

Getting data off of an N9020B via SCPI

Question asked by crouleau on Nov 28, 2017
Latest reply on Nov 29, 2017 by crouleau

I've been having trouble figuring out how to get data off of the spectrum analyzer in its various measurement modes. I'm doing all my communication via SCPI over Ethernet. I can connect to the instrument just fine, and I'm currently just loading .state files in order to recall a state for a measurement.


However, for saving data, I'm struggling to figure out what the "architecture" or "theory of operation" is. There seem to be multiple ways to get measurement data off of the SpecAn, and they do different things based on what measurement mode you're in. However, the documentation doesn't seem to describe what to expect. Or if it does, it's very hard to figure out where the data is. I'm using this:

Keysight N9040B Online Documentation 


Currently I'm only using the Spectrum Analyzer mode, and I'm doing "Swept" measurements as well as "Channel Power" measurements. I've figured out how to get some of the data I need, but not all.


I also can't figure out how to save a screenshot over SCPI - do I need to save a local screenshot and then copy it over to a computer using WinSCP or something?


These are the queries I've tried so far and the progress I've made. In all cases I switched into either "Swept" or "Channel Power" mode and then acquired a measurement using "INIT". 

  • "TRAC? TRACE1"
    • Swept:
      • This returns an ASCII list of numbers that seem to line up to the Y scale of the spectrum analyzer (ranges from -50dB to -80dB or so).
      • However, I can't figure out how to get the time series data here
    • Channel power:
      • This just returns -1000 repeated a whole bunch of times, for no apparent reason:
        • "-1.000000000E+03,-1.000000000E+03,-1.000000000E+03,-1.000000000E+03,-1.000000000E+03"
  • ":FETCh:CHP1?"
    • Now I need to know that I'm in 'Channel Power' mode. I can figure this out with "CONF?" so I suppose that's fine
    • However, I only get two numbers in return, which seem to match up with 'Total Channel Power' and 'Total Power Spectral Density'. I can't figure out how to get the trace data, and I can't figure out where in the documentation it tells me what return format I should expect on fetch
  • ":FETCh:SAN1?"
    • This actually seems to work, although it doesn't help with channel power. It returns a list of comma separated values that alternate between frequency and power. So now I actually have all the data that was on the screen.
    • However, once again I have to experimentally determine that the data format is [frequency, power, frequency, power] (etc)
      • How do I know that this won't change depending on the settings of the instrument?
  • :FETCh:CHP2?
    • Randomly, this gets a whole bunch of channel power data
    • However, it doesn't get time series info
    • I tried ":FETCh:CHP0?" and ":FETCh:CHP3?" and they both errored out


The documentation on "Fetch" is quite small and relies on this:

"See each measurement for details of what types of scalar results or trace data results are available." 

I went to the Channel Power Measurement, and found a drop-down for "Remote Command Results for Channel Power."  This has some loose info and explains why I got what I did with those two fetch commands. However, there doesn't appear to be any way to get the x-axis data or marker data? I just need to calculate those separately? How was I supposed to know to look here for this info? I found it only by randomly poking around in the channel power measurement section.


Ultimately, I'm finding the documentation quite confusing and feeling like I'm just randomly trying different things and then trying to match the response to what I can see on the screen. I think I just need a pointer to better documentation, or an explanation of how this documentation is meant to be used. For example, should I be using "Fetch" or "Trace" to download data?


I also have no idea how to download a spectrum analyzer image over SCPI. With the MSO-X 4000 series scopes you can do this, but perhaps it's not possible with the spectrum analyzers?