LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Variant from a queued cluster

I have a problem (Again)

I'm trying to start on a producer-consumer approach to a new program and I've already hit a stumbling block.

I'm trying to try an operator overloading approach to queued messaging by comparing the type descriptor of variants sent via a queue.

This works mostly, but there's an odd example in this file which doesn't work.  The slits and tower data are updated, but for some reason the type descriptor of the DBL being sent is different when taken from the queue.  I've compared the values BEFORE the queue, and they seem to be the same.  Coming out of the queue, however, they are no longer the same.

I'm going crazy here, what's going on?

In the example posted here, set the "Enum2" to choose a portion of the cluster on the right (parameters) to be refreshed.  Pressing "set" triggers an event which then sends the data via queue to the consumer loop.  Two of the three types work, why doesn't the third?

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 1 of 16
(3,489 Views)
OOps, my bad,

Forgot to attach the file.  See, I really AM going grazy.......
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 2 of 16
(3,478 Views)
Shane,

Your custom controls were not included.

Lynn
Message 3 of 16
(3,477 Views)
Aw man, it's really not my day.

Here's everything. LV 6.1.

Sorry.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 4 of 16
(3,488 Views)

Shane

Just tried it on LV8 and it seems to work as expected.

David

Message 5 of 16
(3,474 Views)
I have it working now too,

I re-constructed the data to get the "wavelength" value from a cluster linked to the typedef, and it works.  Getting the value from a DBL constant (using the Create constant command on a wire coming from the typedeffed cluster) fails.  Wierd.  The only difference I can see is that one is coming from a typedeffed control, the other isn't-  But even still, some such controls (tower and slits) work even outside the typedeffed control.  Maybe it was just a corrupted VI or something silly like that.

Glad to hear the version which doesn't work in LV 6.1 works in later versions.

I think I should go back to bed now and call it quits for today, it's not been very successful.

Thanks for the help anyhow.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 6 of 16
(3,472 Views)
The type descriptors (TD) are indeed different. The second word in the arrays are 0x400A in one case and 0x600A in the other case. It is specified in the TD documentation that the high byte of this word contains private data and should be ignored for TD comparison. One bit (weight 0x40) of this private data indicates that the data is named. The other bit set (0x20) seems to indicate that the variant value was converted from a digram constant.

Message Edité par Jean-Pierre Drolet le 02-14-2006 10:39 AM



LabVIEW, C'est LabVIEW

Message 7 of 16
(3,477 Views)
Doesn't work under 7.1, and it's as Jean-Pierre said. The type descriptor is different if the value comes from a constant on the block diagram as opposed to a front panel control. Perhaps you may want to change your code so that you expand your available events so that instead of lumping the three sets into "Mono-set" you have a separate event for each so you don't have to use the while loop to check each type descriptor to find out which one is being set.
0 Kudos
Message 8 of 16
(3,466 Views)
Wow JPD,

That's great, and it proves that I'm not going crazy (yet).

Well now I can at least set about making a VI to do a proper compare (As the documentation describes).

I'm still learning about Variants, the possibilities seem almost endless..... 🙂

Smercurio,  the different data types are all lumped together in one event case purely for testing.  I still want to maintain a single command which accepts different data tyoes though as I believe this will make the interface to the executing code far simpler.  Just bundle what you want to update and send it, without having to worrs about updating a cluster which may or may not be visible.  I beleive this may be called "encapsulation" but as I have no formal programming training, I might be totally wrong.

JPD, maybe you can help me out on something else.  I kind of remember reading somewhere (Given my state of mind recently, it's best to ask) that the name of the control is included in the Variant typedef, so even similar datatypes with different names will allow distinction code-side in my example, is this true?

Thanks again,

Here, take some stars :

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 9 of 16
(3,463 Views)
Technically not quite encapsulation, as encaspulation has to do with classes, and not datatypes.

As for your other comment, I think you're thinking of the case when you convert a cluster to a variant. In that case the names of the cluster elements are included. However, this is not the case when you convert a simple data type like a DBL.
0 Kudos
Message 10 of 16
(3,445 Views)