LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering and simultaneous measurements

Solved!
Go to solution

Hi everybody 

 

I've written a Vi to to acquire data simultaneously from 7 devices. I'll be using cDAQ9178 with NI9203. The vi will acquire current values 4 to 20mA. Could you please check the attached file and let me know if I need to improve it.

 

I have some question and I should be grateful if anyone can help me to answer them.

1. How to open the binary file from write to measurement file by EXCEL?

2. Is it better to use write to spreadsheet for data logging, if yes how to include the time column??

3. I'm going to use external signal for triggering through PIF0 port, is it Ok to do that through dag assistance?? I've not tried yet but it seems straightforward?

4. Finally I have another vi for valve control that should be triggered with the measurement vi, is their any way to do that?? I was thinking about notifiers but I don't know how to use them Smiley Sad?

 

Sorry for asking to much  I really in urgent need of all of this. I should finish my data acquisition system by Tuesday Smiley Mad

 

Best Regards 

0 Kudos
Message 1 of 13
(3,299 Views)

Hello everyone 

 

Could you please help me with this problem? I would be grateful for any help you offer. 

 

Best Regards 

 

Rajab 

0 Kudos
Message 2 of 13
(3,258 Views)

1. How to open the binary file from write to measurement file by EXCEL?

If you select TDMS as the file format in the write to measurement file, you should be able to open it directly from Excel if you install the TDMS Excel Add-In. Be aware that at 1kHz data rate, you will exceed the capability of old versions of Excel to read the entire file in about 65 seconds. Newer versions can read more, but anything over a couple thousand points gets difficult to analyze. That is about my limit. Over this, I go to something else for analysis, such as LabVIEW or Mathematica.

 

2. Is it better to use write to spreadsheet for data logging, if yes how to include the time column??
The write to spreadsheet file is very inefficient for data logging and cannot be recommended. Given your data (an array of waveforms), TDMS is your best bet. The write to measurement file Express VI is the easy way to do this. I, personally, prefer the control I get from using the TDMS API directly. Note that under the hood, the output of the DAQ Assistant is an array of waveforms with individual t0s and dts. The t0s are all different due to the fact that your 9203 is a scanned device, not a simultaneously sampled device. It scans at 200kHz, so the differences are not large, but they are there. I would convert the DDT into an array of waveforms, then use the native TDMS API, but I have a lot of experience. Since you are in a hurry, the Express VI using TDMS is probably your best bet.

 

3. I'm going to use external signal for triggering through PIF0 port, is it Ok to do that through dag assistance?? I've not tried yet but it seems straightforward?
That should work fine. Given your continuous acquisition, the trigger will only start the acquisition, not gate it or trigger it at later times.

 

4. Finally I have another vi for valve control that should be triggered with the measurement vi, is their any way to do that?

We do not have enough information to answer this question. Specifically, how is the valve being triggered (boards being used, hardware interface, software interface). The ideal way would be to run it through the same cDAQ 9178 so that it can be synchronized through hardware. Software synchronization cannot be guaranteed better than about ±50ms. Read up on how to synchronize things through DAQmx and you should be good.

 

Good luck!

Message 3 of 13
(3,247 Views)

Hi 

 

Thanks a lot for your help, I really appreciated it.

 

Regarding the last two questions. Can I use another signal for trigger out through PIF1??

 

My Solenoid valve will be controlled through NI 9472(using solid relay)  I have attached the primary Vi for my overall data acquisition system.

Do you thing I'll be able to synchronizes both the measurement and valves opening??

What I need is to start the measurement and valve control at the same time by using trigger in signal

 

Best Regards 

 

Rajab 

0 Kudos
Message 4 of 13
(3,236 Views)

Since both of your control modules are in the 9178, you can synchronize them using a single trigger input and sharing timing and triggering sources. I have not done this in a long while, so am probably not the right person to tell you how to do it, but I know you can do it. If you post a detailed question on the DAQ discussion forums including your module and chassis numbers and exactly what you want to do, you will probably get a quick reply.

 

Were I to do this, I would probably try putting both the current acquisition and digital output in the same task of a DAQ assistant and see what comes out. It may not work, but it would make things simple for you if it did.

 

Good luck!

Message 5 of 13
(3,226 Views)

Thanks DFGray

 

I've posted my request in Daq discussion and haven't got a reply so far.

 

Regarding write to measurement file, I've realized that only the measurement from last iteration is saved to the file?? 

 

What is the best solution to get the dynamic  data appended to the file. 

 

Best Regards 

 

Rajab 

0 Kudos
Message 6 of 13
(3,192 Views)
Solution
Accepted by topic author Rajab84

In your example above, you have the configuration of the Write To Measurement File so it renames an existing file. This overwrites the file at each iteration. You should change this to Append to file. This is in the "If this file exists" section of the configuration dialog.

Message 7 of 13
(3,175 Views)

Thanks a lot DFGray

 

that's should solve the problem. 

 

As you know I'm trying to trigger to ViS one to acquire data(analog current) and the other vi is to control Valves using digital out put (generate signal, which can't be triggered).

 If you can see the previous attachment the default case in initialize, so even  if it can be triggered,  it won't start until the initialize case is  passed.

 

 

The first Vi will be triggered by external signal through PIF0 port. Do you thing it is possible to use notefiers (master/ slave) to synchronizes both vis??  Will they start at the same time?? 

 

Thanks in advance for your kind support 

Best Regards 

 

 

Rajab 

0 Kudos
Message 8 of 13
(3,165 Views)

I would strongly recommend you not do this in software. There will be too much jitter in the timing between the two channels. This is normally a few milliseconds, but could get to 100s of milliseconds, depending upon what else is going on. Instead, use the internal clocks of your DAQ chassis to synchronize the analog (current) input and digital (relay) output. You can find examples of this kind of programming here, here, and here. You will not be able to use the DAQ Assistant to write all your code, but you can use it to write most of your code. Set up the acquisitions in the assistant, then right click on it and select generate DAQmx code. Open the configuration VIs and copy the code to your block diagram - one line per task. Then insert the timing VIs needed to synchronize them, as shown in the above examples.

 

Good luck!

Message 9 of 13
(3,161 Views)

Thanks for your advice

 

sorry I'm still beginner in LabVIEW, just want clarify something. 

 

Actually as you can see form the attached pic. Initialize is  the first  state in my case structure, the vi was written to open 4 valves sequentially one at a time.

 

According to LabVIEW data flow, do you think using same sample clock as my analog input task will initialize the  valve's Vi??

 

 

Best Regards 

 

Rajab 

Download All
0 Kudos
Message 10 of 13
(3,154 Views)