LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array of clusters

Hello,
Can somebody explain me, what my program is wrong?....
I have DAQ system with 4 channels. Signal of each channel has three components (which are of different types).
I want to create array of clusters. Cluster - is a set of channel components. Array - has 4 clusters (because of 4 channels).
The idea - I want to look at channel component by choosing the number of channel as an element of array, not to have all these components simultaneously at front panel.
At block diagram I created 4 clusters, then I create one array, using them.
At front panel I create cluster, consisting of 3 elements, then I create array and interted the cluster into array field. With it, I think, I created the array of clusters.
 
But LabVIEW shows me error -
"These cannot be wired together because their data types (numeric, string, array, cluster, etc.) do not match.
The type of the source is 1-D array of cluster of 3 elements.
The type of the sink is 1-D array of cluster of 3 elements."
 
LabVIEW 8.0, DAQ 6052E,  if it is important.
Thank you, in advance
Anna

Message Edited by mikhaylova_anna on 06-11-2007 08:25 AM

Message Edited by mikhaylova_anna on 06-11-2007 08:27 AM

0 Kudos
Message 1 of 10
(3,074 Views)
Anna, I took a look at your code. I'd suggest spending a little time with the Getting Started tutorial. You'll find that most of your questions are answered in there. Anyway, the easiest way to do what you want is to right-click the output of the build array terminal where you've wired your 4 clusters, and select Create>Indicator. This will automatically generate the array of clusters terminal for the front panel. I'm guessing that the element of the cluster you made on the front panel are not in the same order as those on the block diagram. If you want to check this, you can right-click on the edge of the cluster (not the array) and select Reorder Controls in Cluster.

Also, I noticed that the three elements that you are putting into the cluster are t0, dt, and Y. This just happens to be the contents of a Waveform datatype (which is actually where they are coming from). You don't need to break out the elements, bundle them up, and create an array of clusters. Just put the 4 waveforms into the Build Array Terminal, and create a Waveform Array Indicater using the same technique I described above.

Good luck!
Chris
Message 2 of 10
(3,055 Views)

Thank you, Chris,

Really, I am a beginner in LabVIEW, but I am getting better ....

You are right, I mistaked with order of components.

What about not to break out the elements... 1) I need to use these values in other places, too, because I have some misunderstanding with how the synchronization works and ADconvertion works. 2) I found, that without this breaking, I save very strange data into files. But such breaking makes saved data correct.

Thank you again.

Anna

0 Kudos
Message 3 of 10
(3,043 Views)

One more question, if it is possible,

If not to break out the components and bundle them up directly to array, is there way to get the size of Y component directly also (e.g., now I use "Array size" block, applied to separated Y component) - because I need to have cluster of 4 componrnts - 3 standard and 1-size of Y.

Thank you in advance.

Anna

0 Kudos
Message 4 of 10
(3,020 Views)

I'm not sure what you mean, I think you'll have to get the size directly from the array. 

But my advice would be to read up on creating a Type Def. Control.  You can create a cluster the way you want it and call the control.  Then use Bundle/Unbundle By Name instead of regular bundling.  You will find it is much easier to keep track of the contents of your clusters.  The other benefit is if you want to add or change something about the bundle, you only have to change the type def. and all the wires to and from it will change appropriately.  You don't have to necessarily change all your bundle operations.

-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 5 of 10
(3,017 Views)
Yes, before I created a cluster for each channel. It works well.
But I was advised to bundle the components directly. And it sounds pretty good and I've managed to do it and it looks wery well. But, except 3 standard component, I need to have size of Y component as a 4th component of cluster. If the bundle the Y component and use "Array size" - it destroy all advantages of bundling directly. That's why I ask, may be there is the way to get it from standard procedure.
 
My real program now is more sophisticating, as I've shown before (I wanted only to show the idea for simplicity). I am afraid, that direct bundling is not capable to make it more readable.

Message Edited by mikhaylova_anna on 06-11-2007 02:10 PM

0 Kudos
Message 6 of 10
(3,010 Views)
Anna,
 
One serious problem in your code are race conditions and misuse of local variables.
 
For example:
 
There is never a need to write a control to a local variable of itself. Nothing will change.
 

Your local variables here (See image below) will get read exactly once way before the loop finishes (or even before the loop starts). You might easily get a stale value for e.g. dt_0. Also the controls can easily be operated during execution of the loop, scrambling all data. All your controls belong before the loop so they remain consistent during the loop. The right way would be to eliminate these locals and wire the values from within the loop. LabVIEW execution order is determined by dataflow and not "left to right". This part of the code does not depend on any wires so it can execute right away when the program starts.
 
 

 
Loop terminations connected to a stop button should be set to "stop if true". Makes no sense otherwise. There is also no real good reason for your sequence structure. Once you get rid of the local variables, dataflow uniquely determines execution order anyway. 😉

Message Edited by altenbach on 06-11-2007 12:19 PM

Download All
0 Kudos
Message 7 of 10
(3,011 Views)
Thank you for detailed answer. But, unfortunately, I have a lot of gaps in knowledge, and don't understand it fully.
 
May be, I use local variables wrongly, but the ideas to have "Frequency" and "Amplitude" local variable is only to avoid long wiring. Their values are necessary only to write down into the info file (it is a file about experimental conditions).
 
It doesn't matter that I use a loop - it executes only one time. That's why I never use "Stop" button
 
Also, I don't understand what you mean on the 1st picture - why to put the question mark on the trigger block.
 
And one more question in this case - on the 1st picture it is possible to see, that amplitude and frequency (to generate output signal) are set. But really, I have got output signal of different frequency (empirically, I found that it is equal to (frequency*Input rate)/1000). Why?
 
Sorry for a such amount of questions.
Thank you in advance.
Anna
0 Kudos
Message 8 of 10
(2,996 Views)


@mikhaylova_anna wrote:
May be, I use local variables wrongly, but the ideas to have "Frequency" and "Amplitude" local variable is only to avoid long wiring. Their values are necessary only to write down into the info file (it is a file about experimental conditions).

A local variable points to a control or indicator. If you read from a local variable, you are getting the current value from the terminal. There is no need to write to a local variable first in order to read from the local variable later. For example you have the terminal of "output rate" wired to a local varaible of itself. This simply writes its own value back to the control and nothing has changes except you wasted computer resources.


@mikhaylova_anna wrote:
It doesn't matter that I use a loop - it executes only one time. That's why I never use "Stop" button

Why don't you delete the loop then? It serves no purpose. 😉


@mikhaylova_anna wrote:
Also, I don't understand what you mean on the 1st picture - why to put the question mark on the trigger block.

This is just because I don't have DAQmx installed and thus I am missing these subVIs. Just ingore it.


@mikhaylova_anna wrote:
And one more question in this case - on the 1st picture it is possible to see, that amplitude and frequency (to generate output signal) are set. But really, I have got output signal of different frequency (empirically, I found that it is equal to (frequency*Input rate)/1000). Why?

You should wire your sampling information to the function generator. Right now you don't have it wired so it defaults to 1000. CHeck the online help.



 

0 Kudos
Message 9 of 10
(2,981 Views)

Thank you a lot, really,

About local variables - I've understood now.

About a loop - it sounds strange, but I don't want to touch anything, if it is not a source of errors (and this loop - is not). But I'll try.

About frequency parameter - it is not a default. Really, if to change it value twice bigger, the sampling rate is decreased twice, and visa verse. It looks like the sampling rate parameter is something like frequency, and frequency is something like a sampling rate. I am already crazy about it.

Anna

0 Kudos
Message 10 of 10
(2,971 Views)