LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data table

Hello All,

 

Currently i making Lin bus sniffer.

I solved communication, so this is no the issue.

 

Problem is representation of collected data.

I getting data frames, with same ID several time per second.

data table.PNG

i need table that shows in one row one ID, and only value of data package has changing.

Like in example below... (IDs are fixed 85, 03, 3C , and the byts values are changed)

lin sniffer.PNG

 

Also if new ID appear, new line should be created...

 

VI is in attachment.

 

Thank you.

0 Kudos
Message 1 of 6
(3,328 Views)

Hi milan,

 

which LabVIEW version are you using? This sounds perfect for the LV2019 feature of maps/sets…

 

You need to create some kind of LUT (look-up table) and store only the latest message value per message ID. With older LabVIEW versions I sue variant attributes to store such LUTs, as has been described very long ago!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(3,305 Views)

Here's a simple example showing the 2019 Map datatype used to do this:

MapExample.png

 

It's worth noting that here, I haven't stored any time information, and the entries displayed in the map indicator are sorted according to however LabVIEW chooses to sort the key (you can't as far as I know control this).

 

If you wanted to store time values and sort by that, you could for example store a cluster of (time, value) in your map of (key, cluster). You'd need a specific way to display them then (perhaps in a 2D string array, or a Multicolumn Listbox, or similar). You could probably write a subVI to do this fairly easily.

 

Edit, for clarity, most of this example is not necessary if you have a real datasource. I put the top loop and queue in only so I could both "send" and "receive" data. The bottom loop is the one doing the collection, Map manipulation, and display.


GCentral
0 Kudos
Message 3 of 6
(3,265 Views)

@cbutcher wrote:

If you wanted to store time values and sort by that, you could for example store a cluster of (time, value) in your map of (key, cluster). You'd need a specific way to display them then (perhaps in a 2D string array, or a Multicolumn Listbox, or similar). You could probably write a subVI to do this fairly easily.

 


I was curious about this, so here it is below:

Really, you have to run it for the time sorting to make much difference...Really, you have to run it for the time sorting to make much difference...

Map -> Sorted 2D array by timeMap -> Sorted 2D array by time

"hex string" to hex string"hex string" to hex string

I'd guess the last one isn't great, but it works for the setup I was testing. Basically it takes a string with values that look ok in hexadecimal representation but are a bunch of weird characters or boxes in normal display style and makes them normal characters 0-F. Someone else might give a far more effective/neat implementation (I suspect it's common enough).


GCentral
0 Kudos
Message 4 of 6
(3,255 Views)

First of all, thank you for help...

 

Unfortunately I don't have 2019, so I am  unable to open yout vi.

On the other hand, according picture, I don't understand how this work... 🙂

 

if there is any easier solution, I will be greatfull.

 

Thanks

 

 

0 Kudos
Message 5 of 6
(3,237 Views)

Without LabVIEW 2019, you don't have access to the Sets and Maps datatypes (here a Map is used), described in the release announcement here.

 

As a result you could implement the same code using Variant Attributes. Elijah Kerry posted a walkthrough/guide/overview here: Using Variant Attributes for High-Performance Lookup Tables in LabVIEW.

 

The basic idea would be to replace the Map code in my example with a Variant on the Shift Register, and then use Set/Get Variant Attribute to store the values (message, or message+time) with a key (PID). You can also use the Get Variant Attributes with no key to get arrays of keys and values, allowing you to easily reuse the subVIs I showed above.

You can remove the "In Place Element" structure (yellow box) since you don't require it when using Variants, although you can also replace the "Map Get/Replace Value" nodes with "Variant Attribute Get/Replace" (which will, for a String key, as used here, be fairly similar).

 

The basic structure (not fully implemented as an example) can be seen here:

Saved to 2015 using the Code Capture Tool from LAVASaved to 2015 using the Code Capture Tool from LAVA


GCentral
0 Kudos
Message 6 of 6
(3,226 Views)