This widget could not be displayed.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make"tick count" work properly to count the elapsed time of each measurement in VNA 8753ES

Solved!
Go to solution

Hi guys,

 

I am doing some wireless channel measurements to investigate small scale fading in the channel. VNA is controlled by Labview 8.5.1. I would like to know how long it took in each measurement. I put initial setup outside the for loop to avoid time wasted in the unnecessary procedure, so that the sampling time between measurements could be acquired as soon as possible. However, when I increased the loop times, the elapsed time was smaller. I was thinking the elapsed time should be the total time expense in the loop divides by the loop times. Did i neglect anything? I will appreciate that if you can share your experience.

 

 

0 Kudos
Message 1 of 11
(7,867 Views)

Well, you're not really measuring the time for each set of measurements. You're measuring that, plus the time it takes to write to file, which will throw your numbers way off. Thus, you should be measuring the delta time inside the loop right after you get your data. Also, it depends on how the VNA reacts to a query for data depending on how you set up your sweep. if you've set it up for continuous sweeping, and it's in the middle of a sweep I think the VNA waits until the sweep is done, then restarts the sweep in order to give you a full sweep of data. You will need to check the manual on this. When we do our testing here we usually set up the instruments for "sweep on demand" so we don't run into this kind of situation.

 

Also, what's the purpose of the delay inside the loop?

Message 2 of 11
(7,849 Views)

Thank you Smercurio_fc.

The sweep time of VNA depends on how I set the bandwidth and numbers of points. The sweep time of VNA is 600ms now. I am trying to figure out how long it waits to implement next measurement so that the total time duration in measurements can be found. I need that to solve some small scale fading issues in my research. For example, if i run this setup 800 times, the total time duration is 800 x 600 ms = 480 sec. However, my measurement setup is controlled by Labview. Thus, the elapsed time is the processing tiime of Labview pluses sweep time of VNA. That means the total time duration is longer than 480 sec. I am still thinking how to improve my VI to reduce the processing time and to make the "Tick Count" works as I expect.

0 Kudos
Message 3 of 11
(7,833 Views)

Well, I don't know how you're expecting the Tick Count to work. It simply returns the millisecond timer value. Nothing really much to work there. As I said, you're not measuring what the VNA is doing. All you're measuring is how long it takes for you to get the data and process it and write it to file. This tell you nothing about the VNA's measurement time, and if you include the file writing the numbers may likely be all over the place. Also, the total time duration is not necessarily 800x600. As I indicated, if you have the sweep mode set to continuous, and you ask for the data while it's in the middle of a sweep, then the instrument might wait until the current sweep is done and the sweep again before the data is returned. Did you check the instrument's manual as I pointed out?

 

A more useful way to measure time is by measuring the elapsed time inside the loop, like this:

Example_VI_BD.png

This allows you to get an array output so you can see the individual times and help to spot any aberrations, or to make sure that the times are consistent. 

 

You still haven't explained what the purpose of the delay inside the loop is for. Are you accounting for this in your calculations?

Message 4 of 11
(7,820 Views)

The purpose of measuring delay time is to help me understand how accurate the measurements were. As what I mentined before, I was trying to take some measurements to observe small scale fading effect in the wireless channel. For instance, if I observe the amplitude changing at a fixed frequency point, I also want to know the relation between the variation of amplitude and time expense.

 

I checked the manual. If the sweep mode is continuous, the VNA won't take the next measurement until the current one is done. You were right. I was not measuring what the VNA was doing. I expected to know the total time in each measurement, that is processing time plus VNA sweep time. Thanks for showing me the block diagram. I tested it yesterday. I appreciate your help 🙂 

 

0 Kudos
Message 5 of 11
(7,799 Views)

In that case I would suggest setting the sweep mode to "single" and then triggering the sweep. This is the method we typically use here. The VI I use to "sweep and wait" performs the following:

  1. Temporarily increase the VISA timeout to some really large number (in this case 90 seconds). This is required for later.
  2. Query the NA to check is averaging is on.
  3. Query the NA for the number of averages.
  4. Send the OPC? command.
  5. Send the command to set the trigger mode. The trigger mode is set to "number of groups", and the number of groups count is set to 1 if averaging is off, or to the number of averages read from (3) if averaging is on.
  6. Do a VISA Read with an arbitrary byte count of 10. The VISA Read will wait until the operation is complete (due to the OPC?) command. The timeout will ensure that it will not wait forever, but it's set high enough to not generate an error prematurely. The VISA Read will return a "1" to indicate the operation (i.e., the sweep) is complete.

Attached is a screenshot of what it looks like.

 

Message 6 of 11
(7,796 Views)

Thank you for your suggestion, Smercurio_fc. I was trying to do it over the weekend but I had some problems. Would you please explain more detail how the block diagram works (because I am a beginner:))? For example, there are three property nodes in the block diagram. How do they communicate with one another? and How can I connect the output cluster (string) of the bundle VI to "error in of the select error VI" which are different format types. I know you use some VIs from your instrument drivers. Since I could not see what is inside the boxs. Wold you show me some examples? Thank you very much.

 

 

  
0 Kudos
Message 7 of 11
(7,758 Views)

The block diagram I showed you was just for reference. You would not be able to copy it directly because it used VIs that I wrote. For example, the "Select Error" that you're referring to is one of them. There is no "Select Error" VI in LabVIEW. The individual blocks with light-blue headers are wrapper VIs around driver VIs. The driver VIs you can get from NI. I trim down the standard drivers VIs to perform those specific actions since most of the driver VIs you get from NI are written to perform several operations at once, whether you want to or not. I split the functions out into individual VIs so I set that specifci parameter that I want to set, and not 12 others. I had provided the step-by-step operations so you could implement the code yourself.

 

I don't really understand your question about how the VISA property nodes "communicate with each other". They're not communicating with each other. They're simply setting the VISA timeout as I had outlined in my step-by-step actions. The error clusters are being used to force execution order.  The one that's on the right-hand side executes after the VISA Read, but it uses the VISA resource name rather than the error cluster because you do not want that property node to not execute if there's an error. You want to make sure the timeout is reset and not left at 90 seconds. As far as how the code implements the steps I had outlined, see attached image. Note that I left out step 7 in my previous post, which was to reset the timeout. Also attached is a VI that's just the raw VISA functions. Note that this assumes the network analyzer has been set up for single sweep (i.e., not continuous sweep).

Download All
Message 8 of 11
(7,745 Views)

Thank you, Smercurio_fc. I tested and modified the the VI file you attached. The VNA would only take one sweep when the average was off. It acted as single sweep mode. When the average was on , the number of groups is set to take the certain number of sweeps and then averages them. I would like to put each sweep into a buffer without averaging them and dump them to a file later. I want to get a bunch of raw data measurements instead of a single averaged one. Is that possible? I also found that when I set the average factor=30(average on) the number of groups was equal to 3. It means that the "Decimal String to Number" VI only captured the first digit from the left side. Is that an mistake? or, did I misunderstand the VI you wrote?

 

In the block diagram, there are three property nodes. the first one gives a timeout value 100sec to complete whole processes, the second one is a 90 sec timeout in charge of the sweep part, and the third one resets the timeout value for the first property node when the previous commands are done. Is this correct? If so, can I use the third property node as a reference to run this code in a loop? What exactly does that VISA timeout node do? I tried playing around with it, but it seemed to have no effect on the output.

 

0 Kudos
Message 9 of 11
(7,723 Views)
Solution
Accepted by topic author yveshsu

yveshsu wrote:

Thank you, Smercurio_fc. I tested and modified the the VI file you attached. The VNA would only take one sweep when the average was off. It acted as single sweep mode. When the average was on , the number of groups is set to take the certain number of sweeps and then averages them. I would like to put each sweep into a buffer without averaging them and dump them to a file later. I want to get a bunch of raw data measurements instead of a single averaged one. Is that possible?


As far as I know, that's the way the network analyzer works. If you want to do that then you need to turn off averaging, and sweep N times, getting the data each time.

 


I also found that when I set the average factor=30(average on) the number of groups was equal to 3. It means that the "Decimal String to Number" VI only captured the first digit from the left side. Is that an mistake? or, did I misunderstand the VI you wrote?

Code error. You need to replace the Decimal String to Number function there with a Fract/Exp String to Number function since the network analyzer returns the value in engineering notation (i.e., 30 gets returned as 3.00000E+01). 

 


In the block diagram, there are three property nodes. the first one gives a timeout value 100sec to complete whole processes, the second one is a 90 sec timeout in charge of the sweep part, and the third one resets the timeout value for the first property node when the previous commands are done. Is this correct?  ...  What exactly does that VISA timeout node do? I tried playing around with it, but it seemed to have no effect on the output.


The VISA Timeout property controls how long an operation like VISA Read will wait before it generates an error if it has not received the specified number of bytes or has seen an <End of input> condition to indicate there is no more data to read. If there's a communication problem you don't want to get stuck inside the VISA Read waiting forever. Hence, a timeout value.

 

I don't understand why the initial timeout return 100 secs for you. I think the default is 20-25 seconds. Are you explicitly setting the timeout somewhere else in your code? Normally you don't want the timeout to be a really large number. Otherwise, you'll be sitting there waiting a really long time if there's a communication error. The reason why it's being changed in this case is because you don't want the VISA Read to time out on long sweeps (this is based on the presumption of the normal value for the VISA timeout). The OPC? command tells the network analyzer to return the result of the next command it receives, which in this case is the sweep. The VISA Read will sit there waiting until the network analyzer returns a result, and this won't happen until the sweep is done. If the timeout is short, and less than the sweep time, then you will get a bogus communication error. Thus, it's set to an arbitrarily large number for the duration of the sweep, and then changed back to what it was prior to sweeping. 

 


If so, can I use the third property node as a reference to run this code in a loop? 

I don't understand your question here. Setting that property has nothing to do with loop control and I don't see how you would use it for that purpose.

Message 10 of 11
(7,715 Views)