Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Capturing .csv files from a R&S Spectrum Analyzer

Solved!
Go to solution

Hi,

 

I am working on a project in WPF C# to save the trace of a spectrum analyzer to a .csv file on a PC for post processing.  When I call the SaveTrace() method nothing seems to happen.

 

using NationalInstruments.Visa;

namespace dcre {
    public partial class MainWindow : Window {
        private MessageBasedSession mbSession;
        ResourceManager rm = new ResourceManager();
        string resString = "TCPIP::169.254.173.194::INSTR";
        mBsession = (MessageBasedSession)rm.Open(resString);

        private void SaveTrace(){
            mBsession.RawIO.Write(@"MMEM:STOR:TRAC 1,'Trace.csv'");
            mBsession.RawIO.Write(@"MMEM:DATA? 'Trace.csv'");
        }
    }
}
0 Kudos
Message 1 of 13
(9,470 Views)

What make and model is your spectrum analyzer?

Are you using a driver for the instrument?

Please confirm you are using Ethernet bus to connect to the instrument.

0 Kudos
Message 2 of 13
(9,433 Views)

I am using an R&S FSL and an ethernet connection and am able to change various settings like frequency range and attenuation, but can't save the trace.  The only drivers I've installed are the NI-VISA 17.0.

0 Kudos
Message 3 of 13
(9,429 Views)

Your spectrum analyzer would need to be on the same subnet as your PC.

 

Which directory on your PC?  Do you expect the instrument to read your mind?

0 Kudos
Message 4 of 13
(9,421 Views)

Operating Manual: R&S FSL3, FSL6, FSL18 Spectrum Analyzers
https://www.testworld.com/wp-content/uploads/user-manual-rohde-and-schwarz-fsl3-fsl6-fsl18-spectrum-...

 

From page 897, it does sound like your file name needs to include path and drive name.

0 Kudos
Message 5 of 13
(9,413 Views)

I've changed the SCPI line and am now able to see the file saved on the instrument.  However I am still not sure how I can copy this file to my PC.

 

mbSession.RawIO.Write(@"MMEM:STOR:TRAC 1,'C:\Temp\Atrace.csv'");  // Works

mbSession.RawIO.Write(@"MMEM:DATA? 'C:\Temp\Atrace.csv','C:\Users\j\Documents'"); //Doesn't work
mbSession.RawIO.Write(@"MMEM:COPY 'C:\Temp\Atrace.csv','C:\Users\j\Documents''"); //Doesn't work
0 Kudos
Message 6 of 13
(9,408 Views)

SCPI "MMEM"  commands are for storing data on the instrument, not your PC.  See page 884 of manual..

 

"The MMEMory (mass memory) subsystem provides commands which allow for access to the storage media of the instrument and for storing and loading various instrument settings"

 

So the commands you are using are just pushing the file around on the analyzer hard drive, nothing transfered over the bus to PC.  Perhaps MMEM:network commands, though the documentation there is terrible!.  

 

I think you can use "TRACE?" queries to get the data from each trace in your measurement as a list/block of data.  See page 990.  But not sure about setup files or such.

0 Kudos
Message 7 of 13
(9,399 Views)

Actually MMEM:DATA? should do it but you need to read the file in chunks.  There are examples here..

 

https://www.rohde-schwarz.com/driver-pages/remote-control/drivers-remote-control_110753.html

 

The SCPI LabVIEW example has file to pc which is what you want.

 

Craig

0 Kudos
Message 8 of 13
(9,397 Views)

I tried to take a look at that Labview file, but I do not have a license.  Is there anyway to view them without LabView?

0 Kudos
Message 9 of 13
(9,387 Views)

You can install LabVIEW in trial mode.

0 Kudos
Message 10 of 13
(9,385 Views)