LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data acquisition from Agilent 34980 ploting and saving in excel file

Another info, the 3 applications controlling Agilent devices or Ni 9148 are exactely working the same way. For the need of the production, i did three Main Vis with exactely the same functionnalities in order to have three Exe. You must also know that when i say there are different test possibly running at the same time it's mean for example that we may have differents bodys or equipement tested in the same or different test room. And the production team want to have one GUI per test bench.

0 Kudos
Message 11 of 19
(1,960 Views)

I would recommend to look at some LabVIEW tutorials about design patterns. Like the Core 3 online training. As I see you have a kind of state machine here, it is a good start. However how you built up this code is really not good. You have an Event structure, and beside a brutally huge while loop. You could have a look at some design patterns, like an advanced producer/consumer. Or the Queued Message Handler (have a look also the "Continuous Acquisition and Logging (DAQmx)" project example too)

 

I would try to proceed in the following way:

  1. Start to recreate your whole project from zero.
  2. First create a clear project documentation, and a flow chart on a paper which describes the required states (HW init, acquisition, stop, etc...)
  3. You should separate the DAQ, User interaction (events) and data processing/logging in your code:
    1. you have an Event loop where you can capture the user interactions with the GUI (user commands are received)
    2. DAQ Producer loop, where you ONLY read the data out from your HW devices, and send these data with PROPER timing/time stamps to the Consumer loop via a QUEUE
    3. Consumer loop: here you get your HW data "Dequeued" from the Data Queue. Here you can process/convert/scale your raw data, and save it to data file

You should be familiar with such design pattern, google for the above terms, you will find many tutorials. You will need to understand and use Queues, Events and also User Events (also useful to broadcast errors from the DAQ & Consumer loops to the GUI Event structure loop).

0 Kudos
Message 12 of 19
(1,952 Views)

Thank you very much for your advice but i don't see the link with my problem of the delay appearing at a certain moment of acqusition...

0 Kudos
Message 13 of 19
(1,938 Views)

I am not sure if there is a link. But your code is not designed properly, it means also very difficult to debug. If you have a clean compact code, it is very fast usually to pinpoint problems/bugs!

 

Other than cleaning up/rewriting your recent code, you could try to dig into the part, where you get the data from your HW. Since I cannot examine your code due to the size and other problems, I cannot really help at this stage, sorry. You could also make a small test VI, a "mock-up", to test a single Agilent device, but in the same way as you do it in your big code. If you do not see the bug at this level, it can mean that your big code causes some kind of delays. If this mini code (which should be very small and simple) does show the same time delay/sync bug, the source of your problem is probably the HW.

 

I can imagine, since you have everything in a huge while loop (DAQ and data process/logging not separated as it should be), maybe one iteration of the big while loop takes longer than the acquisition time of the HW. In this way you lose data, and your DAQ & logging will be out of sync...?

0 Kudos
Message 14 of 19
(1,930 Views)

Smiley LOL All the Vis are project structured as you can see in the picture and i have several tens subvis. I have already made this with queues/dequeues model, producer/consumer modell but i had other problem of synchronisation. The time is given by the HW with a synchronisation with the time of computer at the "init/config" state. I just have 10 s to do everything and got the next values. I agree with you I need to make it more clear but i don't think that it's the cause of the delay unless you give me the reason.

0 Kudos
Message 15 of 19
(1,928 Views)

And are you sure your while loop can do "everything in 10 seconds"? As I see, in your huge while loop, there is a "Wait (ms)" function. This is what you really want? This will just add the specified mseconds waiting to the actual total process time of your while loop.

 

If you use the "Wait Until Next ms Multiple" function in your while loop (with a value of 10 000 mseconds), you get the following behaviour:

lets assume, your DAQ tasks, data processing and file logging in ONE iteration requires 8 seconds (and this WILL vary, since file logging is buffered, up to your OS when it phyisically moves data to disk). In this case, the "Wait Until Next ms Multiple" will make the while loop to wait ANOTHER 2 seconds. So your total iteration time will be 10 seconds. BUT! this only works if the while loop process time stays below 10 seconds!

 

Also as you see, to have a single monster while loop with all the functionality inside, is not really good: for example, if you need to abort/stop acquisiton, you need to wait up to 10 seconds after the user clicks on the "stop" button...

 

Can you check what is the iteration time of this while loop? Also, how do you get time stamp info into your file? You produce it in the while loop, or you do not save absolute time stamps into the file? This is how you can check exec. time of a while loop for example:

 

Example_VI_BD_timing.png

 

 

Message 16 of 19
(1,913 Views)

Thank you. My while loop does everything in 10 seconds. I m sure because when i open my file, the interval between two scan equate to the time period of scanning at the side of HW (10 s). The reason i let the "Wait Until Next ms Multiple" in the while loop is that this Vi also works with NI 9148 expansion chassis with NI 9217 module, and datas scanning is not automatic with these Ni futures. So, I need to control the intervall of acquisition in this cas. In the cas of Agilent device, i send the command of time period to the device and it works alone, scanning every 10 s. I will tryp to rebuilt the project and make the use of "Wait Until Next ms Multiple" conditional...Thanks again!

0 Kudos
Message 17 of 19
(1,905 Views)

    I want to get temputer via 34980A, can you share me one sample program for me.

0 Kudos
Message 18 of 19
(1,306 Views)

Hi,

 

You will find interesting tools here:

https://www.ni.com/downloads/instrument-drivers/f/

 

Just search for 34980 in the browser.

 

regards

0 Kudos
Message 19 of 19
(1,302 Views)