LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong values from multichannel task

Hi all
I have a problem. My VI has to aquire some analog signals (2 pressure sensor signals, 2 speed sensor signal and a thermocouple signal). I have created for each of them a global channel in MAX. In LV i have created a multi-channel task with all those channels. I want to display every 0.5sec the mean value of 100 samples of each signal. I have tried my VI but it doesn't work as expected. I have left in my VI only a signal treatment in order to reduce the possible sources of error: this VI is called 'wrong'. I thought that this VI would display the mean value of 100 samples of my thermocouple signal every loop but only the first mean value is correct, all the others are wrong. In my case the first mean value (that is the correct one) is 53°C while the others are more or less 33°C. I've later modified my VI in order to aquire only the thermocouple signal (the VI called 'wrong') and the mean values shown were correct!
I don't know where is the mistake... i think the two VI were equivalent...
Can someone give me some suggestions?Thaks a lot

Kind regards

p.s. is the 'mean' function correct in my VI to obtain the mean value of 100 samples (with a sampling rate of 200 S/s and a 0.5sec delay time of the loop )?

Message Edited by Maverick83 on 10-22-2006 05:19 PM

I love the smell of napalm in the morning
0 Kudos
Message 1 of 7
(3,117 Views)
Hi all
Nobody can help me? Any suggestion?

Kind regards


I love the smell of napalm in the morning
0 Kudos
Message 2 of 7
(3,096 Views)

Hi Maverick,
2 Qestions

1) Why don't you use waveforms instead of dbl arrays ?
2) Why do you use the available sample property instead of a 100 constant ?

Kind Regards

 

 

FiloP
It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong.
Richard P. Feynman
0 Kudos
Message 3 of 7
(3,084 Views)
Hi Filippo
Fortunately you have heard my SOS.
Well, it's a good question your first one... I mean, i have not a real reason to explain my choice. I have to measure pressure, crankshaft speed and tempeature, do you think i should use 1D waveforms instead of 2D double arrays in my multi-channel task? Can you even explain your choice? I'm very interested in learning this thing!
Let's have a look at your second question... mhhh... another interesting question that bring to me some suggestions. I thought it was a good idea using that node property. With a 0.5 sec wait node and a sampling rate of 200 S/s i thought i would have my 100 samples... maybe it's not true... What do you think about it? I'm really interested in your answer. Certainly your solution is more reliable. I'll use a 100  constant indeed.
You're my salvation! Thanks a lot

Best regards
I love the smell of napalm in the morning
0 Kudos
Message 4 of 7
(3,078 Views)

OK

About 2D arrays and waveforms.

Actually a waveform is an array enriched with more information, initial time t0 and sampling time dt.

I prefer waveform because you never know when you need to perform a datalogging or a FFT but at that time you need t0 and dt and having them is better than looking desperately for them in your block diagram.

About your timing choice in the While Loop..

Well generally speaking is better to use a wait until or a wait until milliseconds multiple in order to leave CPU free from the while loop. This is especially true when you are dealing with User Interface. But when you call the HW with a DaqMxRead function the function automatically sleeps until all the samples you want (100 for instance) are available, making sw timing with Wait function pointless.

What you have done is particularly risky because you trust the PC timing, that offer no more than ms precision, when you can have HW timed precision in the order of 50ns.

 

As you say you are starting with LabView can I suggest you our courses?

 

http://digital.ni.com/worldwide/italy.nsf/sb/Customer+Education?OpenDocument&node=201399_i

 

 

Best Regards

FiloP
It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong.
Richard P. Feynman
0 Kudos
Message 5 of 7
(3,068 Views)
Hi Filippo
Thanks a lot for the suggestions.
I'll seriously consider to attend NI italy courses. Meanwhile i want ask you something again... be patient...
I've tried to apply your suggestions to my VI.  I have attached the modified VI. Do you think it should work now?
I'm gonna try it on the real system as soon as i can (it's my degree thesis work).
Thaks a lot.

Best regards
I love the smell of napalm in the morning
0 Kudos
Message 6 of 7
(3,044 Views)

I'm sure you're gonna love this one  

 http://zone.ni.com/devzone/cda/tut/p/id/3024  
I suggest you to learn this design pattern called "sate machine" very well. You'd probably find it a bit complicated  now.   But tomorrow when you will need to change something in your Vi you will know that you've done the best choice. 

Talking about your vi there is a very big error in the first frame of the flat sequence. 
You are waiting the User in the while loop. 
In these cases you must use a wait function, otherwise your cpu remains trapped in the loop doing nothing !
Try to check cpu load with and without wait function you will find an amazing difference. 

About your measurement application I'm not sure you are going to measure the right temperature, you have to make some experiments and if you don't find a solution use ni.com  to search application notes and the forum to find suggestions! 

Kind Regards

FiloP
It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong.
Richard P. Feynman
0 Kudos
Message 7 of 7
(3,039 Views)