LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Concatenation of clusters

Dear Experts,

 

I am experimenting with different ways of passing data using clusters. From the attached vi, Cluster 1 and Cluster 3 are for inputs and whereas Cluster 2 and Cluster 4 are used for displaying outputs.

 

I have successfully concatenated two clusters and passing it to the data in of UDP Write. Kindly assist me how both the values of these respective clusters can be read and received from data out of UDP Read. Thank you in advance.

0 Kudos
Message 1 of 5
(3,401 Views)

I suspect it may be quite difficult to do that in the way you'd like - you'd have to parse the string yourself and the parsing might change with LabVIEW changes (probably not, but still...)

 

A better method might be to bundle 1+3 together and create a typedef for the combined cluster of clusters, then flatten that. This way, you only send one object and can unflatten it into the joint typedef, then unbundle to get 2+4.

 

Here's an example without the typedef defined. I'd suggest using a typedef to simplify updating it in future.

UDP_Cluster_Concatenation_BD.png


GCentral
Message 2 of 5
(3,393 Views)

Personally, I am a fan of using the Flatten Into String and the Unflatten From String functions.  They have some benefits over the Type Cast, the most important (to me anyways) being the ability to set the Endianness (ie byte order).  But for this case, the more important part is the the Unflatten From String has an extra output for "Remaining String".  So you can chain these functions together.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 5
(3,347 Views)

@crossrulz wrote:

Personally, I am a fan of using the Flatten Into String and the Unflatten From String functions. 


Somehow I did not scroll enough to see your post, so I composed&tested basically an identical solution before noticing yours. 😮 Probably would need to handle unflatten errors, because there is no way to guarantee what's received. Probably needs also other tweaks.

0 Kudos
Message 4 of 5
(3,277 Views)

@altenbach wrote:
Probably would need to handle unflatten errors, because there is no way to guarantee what's received. Probably needs also other tweaks.

If on a dedicated, low traffic network, not much of an issue.  If on a larger or high traffic network, I would add in some error checking like a CRC or Reed-Solomon.  We would then catch that issue before we even try to interpret the data.  But, yes, we should do some checking in case the wrong thing was actually sent.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 5
(3,136 Views)