03-21-2012 12:19 PM
Hi.
I have inhereted rather a large code base consisting of lots of "Stacked Sequence Structure" architecture. This architecture make is impossible to pass error clusters through so I am attempting to come up with a method to replace this architecture without something better. The current users of the code are acoustomed to the way it looks, so I am basically constrained to turning the sequence structure into a case structure and putting it inside a for loop.
I have attempted creating a shift register for each outputted variable, and assigning them all a "Use Default if Unwired" meaning I can simply transform my sequence structure into a case structure and all I have to do is add a default step will all of the variables wired straight though. Unfortunalty when I do this, my exis results seem to be only the last result and not any of the others.
Can anyone tell me why this is? The application does not seem to be functioning as I would expect it to. I know one way to avoid this would be to have rails for each variable running through the middle of each step, but this makes the code even more unmessy and is not a adiquate solution...
I have attached my half baked solution vi, and the problem vi.
Help would be greatly appreciated!
03-21-2012 12:45 PM
You get only the last value because the default value when unwired is an empty string.
I would suggest using a single exit tunnel and either placing a concantanate string in each case or building an array.
03-21-2012 12:51 PM
My feeling is that you don't really understand how shift registers work. Shift registers are written to with every iteration of the loop. When the loop terminates, the most recent value in the shift register is output. In the code you show, the final case you execute is case 2 -- where you write two empty strings and the string constant "Two" to the output shift registers. Hence, that is what the shift registers will contain when your loop terminates.
If you don't want to overwrite a previous value that's been written to a shift register, you need to run wires through the case structure, connecting the input shift register to the output shift register. Why is this "not an adequate solution"?
How did you think shift registers worked?
03-21-2012 03:45 PM
A more refined vi. Do not re-use code in a case statement.
03-22-2012 03:27 AM
can you save that last one for LV 2010 please someone?
03-22-2012 09:38 AM
Here it is, please find attached.