LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I make this vi run faster?

Solved!
Go to solution

Your subVI is set to read 101E3 characters from the scope.  Parsing a string that large may take some time.

 

Does the scope have a binary mode? It might be faster.

 

How long does your program take? How fast do you want it to be?  Do you know if the time-consuming part is the VISA Read or the parsing? 

 

Lynn 

0 Kudos
Message 11 of 24
(1,413 Views)
The time consuming part is not within the Channel Vi's I dont think, because when I run them separately, it is relatively quick. The time consuming part I think is when I run the entire VI, all the sub-vi's run even if they are not chosen. Nothing is output from them, but it goes through the steps. I think it is because I use the append true/false string in the beginning of the sub-vi's and just outputs an empty string if false is chosen. Is there a way I can change this so it only runs the sub-vi's that are chosen. or if you see a better way altogether to do this let me know.
0 Kudos
Message 12 of 24
(1,409 Views)

You are reading 50,000 datapoints and it looks like each is 2 bytes long. Taking nearly a second to retrieve that much data does not seem very long for GPIB communication. You can time your VI to see how long it actually takes to read that much data. You could also do the query in MAX. I don't know by how much time you want to reduce the transfer but I believe that to get a significant reduction, you would have to move to a different bus or reduce the number of samples. The fastest data transfer is going to come with a scope card that is internal to the pc.

 

 

0 Kudos
Message 13 of 24
(1,410 Views)
The time consuming part is not within the Channel Vi's I dont think, because when I run them separately, it is relatively quick. The time consuming part I think is when I run the entire VI, all the sub-vi's run even if they are not chosen. Nothing is output from them, but it goes through the steps. I think it is because I use the append true/false string in the beginning of the sub-vi's and just outputs an empty string if false is chosen. Is there a way I can change this so it only runs the sub-vi's that are chosen. or if you see a better way altogether to do this let me know.
0 Kudos
Message 14 of 24
(1,395 Views)

You've done nothing in the channel code to select or not select anything except possibly an instrument error. Why do you not have the code inside a case statement?

 

And as it's been mentioned, the for loop is quite silly. If you want four channels, you don't select to run the for loop 4 times. No loop at all is required if you do the subVIs correctly.

0 Kudos
Message 15 of 24
(1,391 Views)
The for loop is so i can keep grabbing traces off the scope over time. Like say i was grabbing live data, and i wanted to grab ten different traces of data, I would set it to run 10 times. The loop is not to grab from four channels. I would love to be able to grab all four channels from one sub-vi, but i dont know how to do that. That is why i just put four sub-vi's all pertaining to one channel and ran them with four booleans to selct what traces out of the four i want to show up.
0 Kudos
Message 16 of 24
(1,384 Views)

Well, as I said, the major problem is that your boolean does not do anything. You should have a case structure around the acquisition code and either run it or not. As it is, no matter what the state of the Boolean, you are always requesting a trace.

 

There are a couple of ways that you can create a generic subVI. One is to make the channel number an input to the subVI and use it as a variable. Don't the functions in the driver  use it that way?

0 Kudos
Message 17 of 24
(1,381 Views)
I understand that the boolean does not stop the sub-vi from running. It only prohibits a curve  from showing up on the graph. And this is exactly what im talking about. I tried to change the code on the sub-vi originally so i could read all four traces with one vi. I could not get that to work. I know what you mean with the case structure. But i need to be able to check the boxes on the front panel for the channels i want shown. Its not a problem sending in the command to read all four channels. I think its the parsing code that doesnt allow all four to show up with one of those sub-vi's shown.
0 Kudos
Message 18 of 24
(1,376 Views)
Solution
Accepted by topic author bonesaw

I took the time to modify your VI. I did this very quickly so it may not be perfect. I made your 4 subvis into one vi so all you have to do is input a boolean to tell it whether or not to check the scope for the channel and the channel name. I also modified the main vi that calls the four vis. This may not help your timing but at least it is a start.

 

Posted in LV 8.6




Joe.
"NOTHING IS EVER EASY"
Download All
0 Kudos
Message 19 of 24
(1,369 Views)
thanks alot. Now only the channels i check run. This helps on timing when i want fewer channels showing. Ok, this question has nothing to do with the high level vi in my case, but only with the sub vi. Now, looking at the code that parses the data in the sub vi, do you have any idea why I would not be able to input all four channels into request waveform part of the code read all of them through one sub-vi. For some reason when i do that it wont work.
0 Kudos
Message 20 of 24
(1,359 Views)