10-04-2009 01:49 AM
Hi,
I am saving the data from DAQ into an LVM file.
Now I want to send these data through a transfer function model in labview, and send them back to DAQ .
all of these in real time because this should work continously and the altered data is to be used for producing the next input data...
basically....a feed back loop in labview.. connected to a hardware set up..
The saving of data is happening in one labview .vi and the feed back in another .vi and both should work simultanoeusly.
Any ideas??
Thanks,
ruser
10-04-2009 05:21 AM
Hi,
i want to read the first set of data from lvm file process it then read the second set of data etc..
i.e
to read and then be able to process the data sets in lvm file , ..(input 1, output1,..then input 2 ,output2..etc)
I am attaching sample lvm file ..
thanks..
ruser
Channels 2 Samples 798 798 Date 9/9/2009 9/9/2009 Time 39:20.4 39:20.4 X_Dimension Time Time X0 0.00E+00 0.00E+00 Delta_X 1 1 ***End_of_Header*** X_Value upperenups1 lowerenups1 Comment 2.46214 0 2.110405 0 1.934538 0 2.46214 0 3.165608 -0.175867 4.748412 -0.527601 5.451881 -1.23107 7.738153 -2.286273 8.617489 -3.69321
10-04-2009 10:49 PM
10-05-2009 05:56 AM
Hi,
Thanks.. I tried placing queues with help from the queue basics .vi..
i put the enque operation in one vi ( and connected the data input of enqueue to my data which i wanted to transfer one by one)and the dequeue in another vi as i wanted it.
But , the dequeue doesnt seem to get the values..what do i do?
thanks..
ruser
10-05-2009 09:19 AM
Post your code with the two VI's so we can see what you are doing. Also any VI's that show how these other two are being called.
You either need to obtain a queue reference and pass it to both VI's. That or use named queues so that when you obtain the queue reference in each VI, they refer to the same queue.
10-06-2009 01:50 AM
Hi,
These are my two VIs.. In the first VI iam trying to read the lvm file data, and then enqueue it.
The second VI is trying to deque the data..
and i require the data for further processing .. so they have to be on seperate VIs.
This should also work on real time; that is for now, the LVM file is already there in my computer..
but while i employ it in the lab the measurements and these VIs should run simultanoeusly..
However i am getting an error saying NI 488 Invalid arguments or arguments to function call.
at the 'read from measurement file'.
I have also attached the lvm file as a word document( coz i cant attach .lvm file here).(3rd attachment)
Thanks..
ruser.
10-06-2009 09:16 AM
There are several problems you need to clean up first.
10-07-2009 02:34 AM
Hi,
Thanks for your reply.
Its very detailed and explained well..
I shall try to do the clearing up.. and sorting out..
However pls if u can clarify these for me..
1. Obtain the queue before the while loop, not inside the while loop. What you are doing now will cause an ever growing number of queue references to be obtained eventually crashing LabVIEW.
Ok.. i'll do this.
2. Destroy your queue reference after the loop.
Pls.. I dont understand .. how do i do it?
3. You have a control with a default of 0 wired to the queue size in the sending VI. Why? That will leave no space for the queue elements.
I was under the notion that u select the queue size from front panel as required.I'll uncheck the 'use default settings'.
4. In your receiving VI, you are dequeueing an element, but nothing is wired there. Then you Preview the queue and use the element there. But the queue will probably be empty since you just dequeued from it immediately before. Don't use the Preview Queue. Use the wire that comes out of the Dequeue Element. Actually your loops wind up freezing because of the Preview Queue. The sending VI puts an element in, the receiving VI dequeues it but never uses it. Now the queue is empty. Both the sending and receiving VI's wait at a Preview queue with the infinite timeout for the next element which will never come because the sending VI never has a chance to get around to put another element in.
I have connected the obtain queue to the dequeue and prvided the obtain queue with same name as in the sending vi for data communication.I am under the notion that the obtain que will receive values from the sending vi ..and send it to the deque..
And i thought preveiew was just for the user to view the queued element on the way to processing..!!ok.. so i shall clear the preview in both sending and receiving vis.
5. You have a mismatch of datatypes. The queue is defined to be a double scalar value. But in the sending VI, you are placing a dynamic datatype. The coercion dots show it will will get converted to a single scalar. You have a lot of unnecessary conversions going on with the preview queue, from DDT to double array, to DDT, a split or merge signal with only one input/output. All of that needs to be cleaned up.
I wanted to define the element type for the obtain queue as 0.0000 to define that the data is of similar format.. but it always returns to the o value!!.. how do i define it ?
And I have two values : input data values and output data values as u can see in the sample file i have pasted..
so if i wish to see the two data that is being sampled in every instatnt how do i do it? i did all these so that i can view the data which is being sampled..
6. Even after you fix all of this, your sending VI will only run once then throw an error for hitting the end of the file it is reading. It reads all of the file at once and ultimately just sends a single scalar. On the next iteration, it is at the end of the file. If you want to send data one element at a time from the file, you'll have to redo your file reading so that it only reads one element at a time. This might even mean redoing the File writing portion so that it can write a file that can be read one element at a time. For that matter, why are you reading from the file at all? I assume it was only to have some sample data to work with. What is the source of your data? I thought you said you were reading from a DAQ device, wanted to pass it through the VI's and send it right back out simultaneously.
The data from the DAQ is saved in the computer as a lvm file.So I am trying to give the data to the enqueue process so that it can obtain the data and enqueue it..
I cant connect it to the obtain queue as i dont see where to connect it.And i used the read from measurement file block because i dont really know of what else can i use for data to be read from lvm file..
I think all of this is really a mess now.. i'll sit on it today and send u if i discover anything new!!..:)
Thanks a lot..
regards,
ruser.
10-08-2009 10:27 AM
Hi Ruser,
I won't answer for Raven's Fan, but I can give you a some help with producer consumer architectures. Take a look at the link below:
Using Producer/Consumer Architecture for DAQmx Read and Write to File
http://decibel.ni.com/content/docs/DOC-2431
There are a few more examples if you go to ni.com/code and do a search for produceer consumer. They should give you an idea of how to correctly implement this architecture.
Nick Keel
Applications Engineering
National Instruments