02-09-2016 03:18 AM
Hi,
I have a query on LabVIEW, i'm using few Analog Input(AI) and Analog Output(AO) cards, presently i'm recording the AI data in a .csv file with sampling rates (say 100HZ to 2KHz), and now i want to record the AO data too to be logged for those particular Timestamps of AI’s (As Shown in the Figure) in the csv file. The AO’s applied are On Demand DC signals.
Can someone please reply to solve this issue.
Thanks,
Siva
Solved! Go to Solution.
02-09-2016 03:52 AM
Does it have to be in the same unique csv file? Maybe a TDMS file would help you, it is quite handy when you have multiple tasks that run at different rates and that have to log data in the same file.
Do you have the same rate for acquisition (AIs) and generation (AOs)?
In your code, is the AO task anywhere near the AI task?
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
02-09-2016 04:21 AM
you need just recall your .csv file(read file) back as array then use insert into array to insert new data and again save it in new .csv file
02-09-2016 04:28 AM
02-09-2016 06:07 AM - edited 02-09-2016 06:07 AM
As reported by Titou, saving data in TDMS seems to be the bet solution. Using TDMS you can save data with different sampling rate, add data of new channel at any time and in ease.
You can also view the TDMS file using Excel (a plugin is required for this).
02-09-2016 06:11 AM
Both the AO and AI data should be in the same csv file.
No the Rate of Acquisition (AIs) and genration (AOs) are different. (The AIs are continuosly acquired and recorded and the AO values are generated discretely, and whenever a AO value is generated, it is to be recorded with the AI values in the csv file)
And the AO tasks and AI tasks are seperately coded in different VIs so they are not nearby.
Hope these will answer your questions, please let me know if any other information is required.
Thanks,
Siva
02-09-2016 06:19 AM
Hi Hatef,
Thanks for the Reply.
The scenario is that I'm acquiring AI data continuosly and AOs discretely so if i recall the csv and try to add AO data then the timestamps will be incorrect. I want to continuosly acquire AIs and whenever there is a AO data generated it has to be recorded with the AI data at that timestamp in the .csv file.
Is there any solution for this?
Thanks,
Siva
02-09-2016 06:21 AM
Yes, the description is quite clear now.
I have 2 suggestions :
- a. you can compromise on the file format, use a TDMS file with 2 groups (AIs eand AOs) have both you task log into it, have an "export to CSV" option, to do that you'd have to load both groups from the TDMS and match, base on the timse stamp, the AI lines on which to add the AO changes.
- b. transfert each discreate change of AO to the log function in the AI code in order to add the few columns you have to only when there is an AO change. Tansfert technique can be queues.
Hope this helps
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
02-09-2016 06:48 AM
1) Just take whatever the current value of the AOs are when you write to the file (e.g. using a no-wait notifier / FGV / local / global variable) and write them into the file - you'll get repeated data in your file but that probably isn't a problem.
2) Wire the AOs back to your AI - that way you can sample the actual AO value as an input and log it along with your other AI signals.
As others have said, TDMS does allow you to write data at different rates (e.g. your dt-sampled AI and periodic AO update events) but it's a completely different file format so it may not be suitable in this case.
02-09-2016 07:15 AM
Hi TiTou,
As you explained in option b - I think this will serve my purpose, i'm trying to do this way and check.
Thanks for the solution.
Regards,
Siva