10-25-2017 04:26 PM
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'");
}
}
}
Solved! Go to Solution.
10-26-2017 08:39 AM - edited 10-26-2017 08:39 AM
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.
10-26-2017 09:20 AM - edited 10-26-2017 09:22 AM
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.
10-26-2017 07:00 PM - edited 10-26-2017 07:01 PM
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?
10-27-2017 09:47 AM
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.
10-27-2017 12:48 PM
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
10-29-2017 06:31 AM
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.
10-29-2017 06:48 AM
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
10-31-2017 03:38 PM
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?
10-31-2017 03:40 PM
You can install LabVIEW in trial mode.