LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

looking for a nice solution for different cases with nearly same operations

Hi everybody:

I'm looking for a nice solution for the following problem:

I'm measuring different data at the same time (with different devices). I would like to save these data all in one array (or cluster?), but I don't know exactly the way to do this. All values have corresponding time values. So for one data type it would result in a 2d array, wouldn't it? But how can I save different data types with their time values in one array? Or should I take a cluster? And how can I get only a certain type of data out of this array or cluster again? E.g. if I only need data type "3" with its time stamps for evaluation? I would really appreciate an example, I work with LV 7. Thanks!

Then - for evaluation - I only need one data type of these different data. Which one I would like to choose via the frontpanel (it changes from test to test). So, I thought of a case structure (where I can choose which data type and correspondingly which evaluation way). The evaluation steps for the different data types are quite the same, but can vary in order of execution. I could write for every case the (nearly) same evaluation steps, but this would take a lot of time, plus if I need to change one step I need to change it in every case.
Does anybody know a better way?

Thank you very much in advance,
Steffi



0 Kudos
Message 1 of 12
(3,152 Views)
Hi steffi,

to use the same code in several places you should put it in a subvi...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(3,133 Views)
We may need to get some terminology straightened out here. An array can only hold data of one type. This is by definition. Thus, you have an array of DBLs or an array of strings.  You can't have an array where the first element is a DBL (or any other numeric) and the next element is a string. You can have an array of clusters. But, each cluster's data structure has to be the same. I.e., you can define a cluster of 2 elements: timestamp and value. Then, if you create an array of this cluster you will have an array of samples.

If you are collecting data and the samples are evenly spaced then you can use a waveform datatype, as it is suited to hold this kind of data.

That said, it's not clear what you mean about having different data and different data type.  If you can provide a better explanation of what you mean by this it would help.
0 Kudos
Message 3 of 12
(3,125 Views)
To create an tool that can accept different types of data, you can create a polymorphic subVI.
 
0 Kudos
Message 4 of 12
(3,116 Views)
Hey,

thank you very much for everyone's help!
Sorry for the confusion concerning the different data types. I post a simple example which shows that I have data of the same type, but from different sources.
In this example I have four arrays, which I would like to save alltogether in one file. First column should consists of time stamps, second column of value type 1, third column of value type 2, ... How can I solve this?

And, after that, how can I display only the second coulmn (e.g.) and time stamps in a waveform chart from this file? Or how can I say in LabVIEW: "display the last 30 values of column three over the time in a waveform chart"?

I really appreciate your help!

Thank you very much.
Steffi
0 Kudos
Message 5 of 12
(3,103 Views)


steffi.kono wrote:
In this example I have four arrays, which I would like to save alltogether in one file. First column should consists of time stamps, second column of value type 1, third column of value type 2, ... How can I solve this?

Built the 4 1D arrays into a 2D array, the use write to spreadsheet file.
 


steffi.kono wrote:
And, after that, how can I display only the second coulmn (e.g.) and time stamps in a waveform chart from this file? Or how can I say in LabVIEW: "display the last 30 values of column three over the time in a waveform chart"?

There is "array subset", which allows you to get any desired subset from an array. If yoyu want entire rows or colums, use "index array".
 
To display the last 30 values in a chart, just feed the data to a chart with the history size set to 30 elements. The rest will fall into place. 🙂
0 Kudos
Message 6 of 12
(3,096 Views)
Just a suggestion: You don't need the case structures, diagram constant, and two instances of the wait primitive to select between two values in a ring.
 
You can change the datatype of the ring to U32, edit the items and uncheck sequential values, and enter 5000 and 30000 as the two choices. Now make one of them the default.
 


Message Edited by altenbach on 03-18-2008 02:02 PM
0 Kudos
Message 7 of 12
(3,086 Views)
Thanks for your suggestion. I just tried it and it works! : )
But I still have a question concerning the timing: I now can choose between 5 and 30 sec, which is good, but sometimes I need a saving frequency which is based on a calculation with local variables. Do you have a suggestion how to solve this?

E.g. I need the following choice in my ring: 60 divided by the respiartory rate (where respiratory rate is a local variable in my program which changes from test to test)

When I edit items I can't write a calculation which depends on local variables in the field for values, can I?



Thank you!
0 Kudos
Message 8 of 12
(3,066 Views)
Hmm, I still have some more questions, sorry.

I post my simplified vi, so that you can see what I already got and what my problems are:

I got an array with four columns (first column for time, second for value type 1, third for value type 2, ...) and I get an entire column out of the array with the "index array".  So, thank you so far: )
But when I display my values on a waveform chart the amplitude rises and falls inbetween two measured values. Do you know why?

And I didn't find the "history size" of the chart? Will I find it under exactly that name? Can I find it in a property node as I want to keep it flexible (e.g. last 30 sec or last 50 sec...)?

Do I have to take the "Array Subset" if I want e.g. value type 2 from sec 30 to sec 350 to be displayed? I don't know a solution as I need column #1 to define the time span and column #3 for the values, or? Maybe you can send me an example?

And how can I clear the chart in the beginning of a new run of the while loop?

Thank you very much.
0 Kudos
Message 9 of 12
(3,051 Views)
Hi steffi,

for your chart problems:

- history size can be set by right-clicking the chart (maybe hidden in the properties). You cannot change it in runtime! But you can change the x-scalew in runtime Smiley Wink
- to clear the chart you can use a property node "history data" - wire an empty array to it...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 12
(3,048 Views)