LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

In the attached VI I dont understand why data from the inner case structures are not being transmitted to the array.

Solved!
Go to solution

In the attached VI I don't understand why data from the inner case structures are not being transmitted to the array.

 

Thank you.

0 Kudos
Message 1 of 12
(3,210 Views)

Case.PNG

 

Watch the code in execution highlighting and use probes on the cluster coming into the while loop and what is being passed out. What I believe you will find is that only the last iteration of teh while loop has an effect since the revious iteration results are toessed on subsequent iteartions.

 

So...

 

Right-click on the tunnel bring the cluster into the while loop and select "Replace with Shift Register" and finsh that off by clicking the output tunnel of the cluster.

 

The SR will maintain the results from earlier iterations and build on that for latter iterations.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 12
(3,195 Views)

Ben,

 

I tried that with no success. Possibly I didn't understand your suggestion.

 

See attachment.

 

Thank you.

0 Kudos
Message 3 of 12
(3,186 Views)
I can't open your VI, so I'm not sure, but it looks like you're also getting bit by 'Use default if unwired'.  If that's the case you'll want to bundle each part individually within the case structure.
--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 4 of 12
(3,179 Views)
I've converted the VI to 8.6. I'm not sure exactly what you mean.
0 Kudos
Message 5 of 12
(3,167 Views)

It took me some time to figure what you are trying to do but I think I have it now.

 

The SR is still required.

 

What is happening is your "Bundle By Name" is replacing all of the fields of the cluster, not just the value coming out of the case structure. So to maintain the cluster stuff you do in earlier iterations you can either...

 

1) Put the "Index array, Bundle by name, and Replace array" inside the case structure and ONLY bundle the value you are setting in that iteration. (as you will see Tim post shortly)

 

untitled.PNG

 

OR

 

2) Move the Index array before the Case, unbundle all of the fields and feed teh case structure and run them across the case so that ALL of your output tunnels come from the coresponding input tunnel EXCEPT for the filed you are trying to set.

 

Ben

Message Edited by Ben on 05-05-2010 01:31 PM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 12
(3,155 Views)

chuck72352 wrote:
I've converted the VI to 8.6. I'm not sure exactly what you mean.

Well, I still can't run it, the typedef is missing.

 

Anyway, what I mean is that  on every iteration of the while loop you are bundling every value in the cluster.  However, only one of these values is getting real data (the data that comes from the while loop).  All of the other values are getting the default data for that type.  You can tell because of the tiny white square inside the tunnel.  

 

In addition to adding the shift register like Ben suggested consider doing this, but of course with the proper bundle in each case.

untitled.PNG

--
Tim Elsey
Certified LabVIEW Architect
Message 7 of 12
(3,151 Views)

I've detached the type defs.

 

I tried you suggestion, but I'm still doing something wrong.

See attached.

0 Kudos
Message 8 of 12
(3,134 Views)
Solution
Accepted by chuck72352

The VI still needs InfoCluster.ctl.

 

If you don't bundle anything into the cluster, you still have to pass the cluster through.  You're running into the same 'Use Default if Unwired' issue as before.  The presence of these 'bundleless cases' begs the question why you have those states since they don't do anything.

--
Tim Elsey
Certified LabVIEW Architect
Message 9 of 12
(3,127 Views)

Those little white dots on your output tunnels are there to get your attention. 

 

Case2.PNG

 

Everytime your code uses a case that is not wired thru teh default data is used.

 

Wire thru the cluster.

 

In general I avoid using the "Use default if unwired" (exception is stop button in event structure) because if this behaviour. I would rather have LV bitch at me about an un-wired tunnel than have to debug to find out I forgot about the new case i just added.

 

Hint: Execution highlighting should have helped. Smiley Wink

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 10 of 12
(3,123 Views)