Contact an Expert

Thread: PNA-X N5242A - continuous sweep data acquisition


Permlink Replies: 10 - Pages: 1 - Last Post: Nov 5, 2014 3:35 PM Last Post By: daras Threads: [ Previous | Next ]
akalei

Posts: 54
Registered: 02/01/10
PNA-X N5242A - continuous sweep data acquisition
Posted: Jul 3, 2012 3:32 PM
Click to report abuse...   Click to reply to this thread Reply
I have a signal continuously sweeping at 25ms. I would like to read a marker after every sweep. What command can I use to know when the sweep is complete so that I may read the marker? Is it possible to get a timestamp from the PNA-X when the data is read? Thanks.
jvall

Posts: 515
Registered: 12/08/05
Re: PNA-X N5242A - continuous sweep data acquisition
Posted: Jul 11, 2012 2:22 PM   in response to: akalei in response to: akalei
Click to report abuse...   Click to reply to this thread Reply
There are at least two approaches to this.

1. Take the PNA out of continuous sweep. Then simply trigger a sweep, wait for it to complete, read the marker and repeat as necessary.

2. Leave the PNA in continuous sweep and use events (or SRQ) to detect the end of sweep. Then read the marker and wait for the next event.

The problem with approach number 2 is that 25ms is fairly short and if you cannot complete everything before the next sweep, you could miss a sweep. Depending upon your needs, this may or may not be an issue.
Hale

Posts: 2
Registered: 10/29/14
Re: PNA-X N5242A - continuous sweep data acquisition
Posted: Oct 29, 2014 8:08 AM   in response to: jvall in response to: jvall
Click to report abuse...   Click to reply to this thread Reply
Dear jvall
The approach #2 seems great, but can you please help with SCPI configuration of event registers and SRQ at the analyzer side for catching it at the controller side?
Unfortunately, for me the explanation in the manual is not that obvious and I am trying to understand it for quite some time :-( ...I just want to get that SRQ exactly when sweep (or measurement, actually, I measure S21) has finished the last point and gone to start again.
jvall

Posts: 515
Registered: 12/08/05
Re: PNA-X N5242A - continuous sweep data acquisition
Posted: Oct 30, 2014 11:31 AM   in response to: Hale in response to: Hale
Click to report abuse...   Click to reply to this thread Reply
I have to say that using the SRQ method is usually not best way to handle this. Besides, it make programming much more complicated. The SRQ method is used mostly when the computer must be processing other data while waiting for the PNA to finish acquiring data. If this is not the case, then placing the PNA in single sweep mode is the most reliable way to ensure you are getting the proper data. We highly recommend doing it this way unless there are extenuating circumstances. Let me know the specifics of what you want to do, and we can go from there.
Hale

Posts: 2
Registered: 10/29/14
Re: PNA-X N5242A - continuous sweep data acquisition
Posted: Nov 2, 2014 10:11 PM   in response to: jvall in response to: jvall
Click to report abuse...   Click to reply to this thread Reply
As far as I know, SRQ method allows 4 important things, besides parallel processing, of course, which is available using vi event-based function calls.
1) The controller is free for work with other GPIB devices. This improves performance of the supervising software as well, reducing delays and CPU load. Especially when using procedural programming.
2) The device issuing SRQ is free from STB polling spam from controller side.
3) This method allows NOT to kill parallel measurements execution option of the NA with *WAI. While *WAI and *OPC are easy to use, those are regressive approaches.
4) (which is a part of #3) This is just a very fast method for real-time data synch.

So, my question is still the same: how can I enable SRQ on sweep finish or measurement finish? The register map in the manual is quite complex, but the explanation is not very informative for people new to the architecture. Moreover, I found profanation in program samples explaining SRQ. I mean that fake program, which makes STB serial poll in the loop, instead of responding to SRQ.
jvall

Posts: 515
Registered: 12/08/05
Re: PNA-X N5242A - continuous sweep data acquisition
Posted: Nov 3, 2014 8:23 PM   in response to: Hale in response to: Hale
Click to report abuse...   Click to reply to this thread Reply
If I had a good example, I would have posted it. I will have to search around for one, however, for the next two weeks we have people from all over the world here for training and I cannot guarantee a timely response. I do agree that we do not have any good examples of this....and we really should.

Edited by: jvall on Nov 3, 2014 9:00 PM
mr_matt

Posts: 16
Registered: 04/28/14
Re: PNA-X N5242A - continuous sweep data acquisition
Posted: Nov 4, 2014 12:15 PM   in response to: jvall in response to: jvall
Click to report abuse...   Click to reply to this thread Reply
I have done what Akalei is asking about using DCOM.

I registered an callback for 'OnChannelEvent'. Once in the callback code, I filter events to only run the data-pull code if the event is ALL_SWEEPS_COMPLETED_AND_PROCESSED

I noticed a few things however:
I originally used the CHANNEL_SWEEP_COMPLETE event as my filter, but it wasn't always working correctly. That's why I switched to the other event.

I needed a minimum of 2 Channels (measurements) running, even if it was the same measurement twice. Otherwise it seemed like the data was being overwritten before I could pull it off the PNA.

Third, I had a problem with IArrayTrasfergetComplex (details can be found in other threads with my name). It boiled down to the data pointer for the wrapper function being for a single floating point variable instead of an array of floats.

I cannot post complete code, but I can help somewhat if you decide to try DCOM.
jvall

Posts: 515
Registered: 12/08/05
Re: PNA-X N5242A - continuous sweep data acquisition
Posted: Nov 4, 2014 8:10 PM   in response to: mr_matt in response to: mr_matt
Click to report abuse...   Click to reply to this thread Reply
Likewise, most everything I do is also in COM, so when these SCPI requests come around, I am usually not the best resource.
tsilchia

Posts: 231
Registered: 10/31/05
Re: PNA-X N5242A - continuous sweep data acquisition
Posted: Nov 5, 2014 10:40 AM   in response to: jvall in response to: jvall
Click to report abuse...   Click to reply to this thread Reply
The following VEE code may help - offered as the source code and two related images:

Sincerely,
tsilchia.
jvall

Posts: 515
Registered: 12/08/05
Re: PNA-X N5242A - continuous sweep data acquisition
Posted: Nov 5, 2014 10:49 AM   in response to: tsilchia in response to: tsilchia
Click to report abuse...   Click to reply to this thread Reply
Thanks for the example Tom.

If you are going to remain in continuous sweep, then you better make sure that you read whatever data you want before the next sweep starts. If you delay too long, then the data you read may be stale. One way to give yourself more time is to add a first point delay if necessary.

Also, providing us with the programming language you are using may be helpful.
daras


Posts: 918
Registered: 12/01/05
Re: PNA-X N5242A - continuous sweep data acquisition
Posted: Nov 5, 2014 3:35 PM   in response to: tsilchia in response to: tsilchia
Click to report abuse...   Click to reply to this thread Reply
Tom's example does not exactly represent the Asynchronous sweep model. the Async use case by definition requires the client application to be multi-threaded and the above example operates on a single thread. I took the liberty of modifying it a little bit.

when you set the trigger to manual and use and INIT:IMM then you are essentially doing a single sweep. in the changed example, you will notice that the channel is in continuous sweep and a separate thread monitors the spoll results and uses a couple of global variables as thread synchronization.

Point your RSS reader here for a feed of the latest messages in all forums