LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

processing raw data in different ways depending on some condition


@TGL wrote:

How do I ensure these two inputs are in sync?



Show us your latest program.

0 Kudos
Message 11 of 21
(895 Views)

I understand there may be a few problems with this as it stands but the primary issue is syncing the data line into the Case structure with the Data string into the selector of the data Case selector....

0 Kudos
Message 12 of 21
(891 Views)

spreadsheet looks like this...

0 Kudos
Message 13 of 21
(890 Views)

What is the typical number of the string lenght? If you only look at the remainder, things will be very ambiguous. You seem to to quotient&remainder twice, once explicit, once using two case structures.

 

(There rest of the code is sitll horribly convoluted. Also make sure you initialize the shift registers)

0 Kudos
Message 14 of 21
(885 Views)

Does the Production data array contain 32 bits at a time and how many bits are contained in a packet of UDP data? The case structure will only run once per loop, but it will wait for a data type to arrive at the selector input before running, so it should work correctly for the first 32 bits of of the input data.

 

Do you have any control over the system transmitting the data?

 

Joel G
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 15 of 21
(883 Views)

Altenbach: At
the moment the typical string length is 56. However, for the purpose of
developing this code I am only sending/receiving 4 measured parameters of
different data types. When the code has the desired functionality there will be
around 500 measured parameters contained in the data (each data packet will
consist of a 32 byte header and then about 2000 bytes of data). The
quotient&remainder is to increment the index each time 4bytes of data are
received - one shift reg increments the index, the other resets the index count
(this number will be alot greater than 4 in the future). Can you suggest a
better way to do this other than using quotient&remainder and 2 shift
registers?

Joel G: The
production data contains all the data except the header. In this case where
there are only 4 measured parameters being sent it only contains 16 bytes (each
parameter is represented in 32 bits). Essentially I need the case structure to
run N number of times within the loop, where N is the number of measured
parameters being sent (or the number of parameters on the referenced
spreadhseet). And I do not have control over the system sending data - would it
help if i did?

 

0 Kudos
Message 16 of 21
(868 Views)

Great, thanks for the extra info, I was wondering if you were controlling the data being sent because it might have been possible to send some additional information regarding the data type, making it easier to interpret the data in the receiver, but it doesn't matter. I think I have it working as you would like, rather than using the remainder etc. to calculate the case, you can simply use an auto indexing for loop to select the right case, the production data can then also be converted into an array of 32 bit numbers, and be auto indexed also. This should also be scalable for when you include more data.

 

Have a look and let me know if that solves the problems.

 

Joel G
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 17 of 21
(863 Views)

Many thanks for this. But what does the loop do? When i run the VI the Data Type does not change, the row index is not being incremented? And it appears the float and the DInt have been swapped...

0 Kudos
Message 18 of 21
(857 Views)

The row index doesn't need to change because the entire column is output as a 1-D array of strings (your data types). This is then auto indexed by the for loop. The for loop iterates for each element in the Production data array (4 elements) and each time takes the next element from the data type array (REAL, BYTE, INT, DINT) and updates the value in the corresponding case. The data type indicator will change, if you turn execution highlighting on, you should be able to see it happening on the front panel. Not sure about the swapping of the FLOAT and DINT because this doesn't seem to happen on the example I've made, could you just swap the order in the excel file to sort this out?

Joel G
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 19 of 21
(854 Views)

Thanks, I got it working. Just had to reverse the order of the array. However, when I increase the frequency of the data transfered from 1 Hz to 10 Hz significant errors seem to creep into the time samples. The program should output a new time value everytime a sampe is received but it does not start updating the time until approx 20 seconds after I run the program. Any idea why this would happen? Is this a limitation of Labview?

0 Kudos
Message 20 of 21
(838 Views)