LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Improve the execution time of a program with loop and case structure

Hi Antho,

Your read looks correct but your write is not. I suggest you look at (Help >> Find Examples...) on DAQmx (Hardware Input and Output >> DAQmx) and File IO (Fundamentals >> File Input and Output) and look at the output examples.

 

Flash

National Instruments
Applications Engineer
0 Kudos
Message 11 of 18
(1,066 Views)

Thank you Flash!

 

 I don't understand the problem about my write. In fact my 2 outputs Control Voltage Out work well.

As regards my 2 entries DAQmx PV Voltage In and DAQmx PV Current In, the different functions come directly from an example of the help, but it doesn't work.

 

Thank you,

 

Anthony

0 Kudos
Message 12 of 18
(1,060 Views)

Hello,

 

  I have solved my problem, it was about the rate. But it still doesn't work well. I have the same problem that I had when I made the first program. There is a conflict between my entries: sometimes I have the value of one entry, sometimes the values of the other. So I fixed this problem by using the express function "Select Signals", but it doesn't work for my second version of the program.

 So I have 3 questions:

 

 -The fact to mix lower levels functions and express functions can cause conflicts?

 - How can I write an order of selection for my entries (like for the DAQ Express Assistant)?

 -Is there a mean to have a function "Select Signals" by using lower levels functions?

 

Thank you very much,

 

Anthony

 

Download All
0 Kudos
Message 13 of 18
(1,026 Views)

Hello,

 

 Please forget my precedent reply.

 

 I have replaced my DAQ Assistant with DAQmx functions. The speed during the sweeping of the range of the duty cycle is good but then there is a dead time between the end of the sweeping and the end of the program (when the maximum point is found). As the "write to measurement" function slows the program, I tried to run my program without this function but it changes nothing.

 

So I would like to know why it is so long to find the maximum point? Is there a mean to reduce this time?

And as regards the "select signals" express function, is it possible to make it by using lower levels functions?

 

Thank you,

 

Anthony

 

0 Kudos
Message 14 of 18
(994 Views)

One problem is that you are creating your analog output task on every iteration of the for loop.  You only need to create that task one time before the loop starts.

 

Try to avoid the blue datatype wire that is the result of using the express VI's.  Since you start with a 1-D array of waveforms, try to continue working with that.  Instead of using Select Signals, you can use index array to pick out the particular waveform you want from the array of waveforms.

0 Kudos
Message 15 of 18
(988 Views)

Hello Ravens fan,

 

 Thank you for your help.

But I have still a delay between the end of the loop the maximum point. I can change my express functions which build the graphs and tables but I don't think it will change the execution time to find the maximum point. 

Is there a mean to erase this delay? And there is also an error because I use a "convert from dynamic data Express". But I tried to change with functions from the array palette but it doesn't work.

 

Thank you vey much,

 

Anthony

 

0 Kudos
Message 16 of 18
(968 Views)

I don't know what you mean by "end of the loop and maximum point."

 

You have an analog output after the loop.  There is a DAQ task creation that occurs before that (maybe a while before that since it doesn't have any other data dependencies.)  That DAQ task is identical to the one you are creating before th loop.  I wouldn't create the task again, but use the same purple wire that passes through the loop up top.

 

There is a possibility that the Build Graph Express VI's are taking awhile as they create ever growing arrays.

 

It's possible the Write to Measurement file is taking a while.  File I/O operations can be slower.  You may want to use a producer/consumer architecture with queues to pass the data off to another loop to write it out to the file.

 

Your For loop has no other timing functions associated with it.  The loop is essentially software times based on how long it takes the code inside to run.  Do you have any kind of pacing you want to use for how fast to increase the voltage on the analog output?

 

Also, could you be getting errors anywhere?  You have automatic error handling turned off (not a good idea) and don't have any error wires wired up, (a worse idea.)  Wire up those error wires.  Turn on Error handling in the VI properties.  And explicitly handle your errors in the VI.  I would recommend putting an error indicator on those error wires so that you can see the errors without endless popups.

0 Kudos
Message 17 of 18
(960 Views)

Thank you Ravens Fan.

 

I am actually doing the changes that you explained. The problem still remains.

 

What I mean by "end of the loop and maximum point" is that my program sweeps the range of the duty cycle (it is the for loop) and build graphs. Then there is a dead time of 2s and then, the value of the maximum point is found and my circuit is blocked at this maximum point.

 

For my For Loop, I don't have timing function. I don't know if it can improve the execution time by adding one. The only way I have seen to improve the execution time of the loop is to limit the number of points of measure.

 

Anthony

 

 

0 Kudos
Message 18 of 18
(949 Views)