LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a Table in one Case Structure, Clear it in Another

Attached is a VI I've been struggling with a bit (It's version 8.5; if you need an older one, let me know). 
 
To give you an idea of what I'm shooting for, I guess explaining the application might help.  The VI attached is simply a "proof of concept" VI, which I am just playing with so that I can do most of my programming in one simple shot with the full-scale equipment.  This will eventually be a data acquisition program for a subsonic wind tunnel.
 
So, the generic idea is that we'd like to be continuously reading data (which will eventually be set-up to be viewed in real-time).  When the model being tested is at an appropriate angle of attack or yaw angle or whatever, we want to be able to grab the data points for that condition.  Then, we would like to be able to adjust the model again (let's say I'm sweeping angles of attack) and grab data points for each of those angles.  The way I currently have it set up is to take each point and simultaneously write it to an exported tab-delimited measurement file and the on-screen table (for the convenience of the user, I want this viewable).  One reason for this is to allow me to have my written data points from whatever tests have been completed, on the off chance something goes wrong and I lose the data I've already taken.  This means I prefer the methodology I have set up to one where I could just write my table, then export it and clear it all in one shot.
 
Once a set of tests is complete (let's say a tare condition without the model in), I'd like to be able to be able to clear the table and start a new write file for the a set of tests with a clean configuration model in the tunnel.  So far, I have accomplished this much.  Unfortunately, once I grab a point from the next set of tests, the data from the previous set of tests appears on my table again, with the new data point appended to the bottom of the table.
 
I have looked at a lot of threads on here and have not found one that gave a response that I got any success with.  It is possible there is a simpler solution if the structure of my code is adjusted a bit, though I'm not sure.  From what I have tested, though, it seems that I can't easily use the "Reset" node on the "Build Table" express VI.
Any assitance would be greatly appreciated.  If any additional information would help you understand what I'm talking about, feel free to ask.
 
[Since I'm sure it'll be of interest to someone, the reason for wanting to seperate tests this way relates to the operation of the tunnel.  Varying the configuration of the model (such as changing a flap configuration, trip strip, etc) requires reducing the speed before opening the tunnel and making the adjustment.  When bringing the tunnel back up to speed, no guarantee can be made that the speed would match the previous condition (indeed, any number of things can change), so keeping the tests distinct helps to prevent over-simplifying data reduction.  Some aspects (like angle of attack or yaw angle) could be adjusted while the tunnel runs, without needing to have that extra bit of protection against over-simplification.  The limitation is not wholly necessary, but is preferred in the interests of limiting the number of independent variables; different measurement files can be specified by the changed variable.]


Message Edited by Scallion on 02-15-2008 02:13 PM
0 Kudos
Message 1 of 9
(5,985 Views)
The reason why the data returns is that you are using the express VI "Build Table" to actually create a table.  While you press the  new button and that creates an empty array to feed to the table, that is only temporary.  The Build Table VI is maintaining the data that builds the table and appends new data to it.
 
The Build Table VI has a reset input.  You will need to wire a true to that as well when your button is pressed.
0 Kudos
Message 2 of 9
(5,965 Views)

How can I wire that to work within another case structure?  When the "New" button is pressed, the "Grab" button is still in its "false" case.  Is there a way to tunnel to that "build table" somehow?

I once tried making a second "Build Table" that fed to a local variable for the table so I could use the reset functionality, but that didn't reset the memory in the original "Build Table".

0 Kudos
Message 3 of 9
(5,956 Views)

You just need to think a bit more flexible. Here's one possibility. 🙂

Since the built table express VI has an "enable" input, it does not need to be in any case structure.

I would also strongly suggest to create the header diagram constant only once and not in multiple places. Else if you ever want to change it, you need to change it in multiple places and you create a mess if you forget one instance.



Message Edited by altenbach on 02-16-2008 09:16 AM
Message 4 of 9
(5,946 Views)


altenbach wrote:

You just need to think a bit more flexible. Here's one possibility. 🙂

Since the built table express VI has an "enable" input, it does not need to be in any case structure.

I would also strongly suggest to create the header diagram constant only once and not in multiple places. Else if you ever want to change it, you need to change it in multiple places and you create a mess if you forget one instance.



Message Edited by altenbach on 02-16-2008 09:16 AM

 That's perfect!  It was exactly what I was looking for.  Thank you for pointing out the "Enable" input.  I swear, I looked at it a hundred times and never put it all together.
 
Thanks for the help from both of you.
 
This will probably sound silly, but I can't find how to rate the messages.  Nothing is jumping out at me, so I'll keep looking.  I'm not trying to neglect you guys.


Message Edited by Scallion on 02-16-2008 03:06 PM
0 Kudos
Message 5 of 9
(5,933 Views)


Scallion wrote:

This will probably sound silly, but I can't find how to rate the messages.  Nothing is jumping out at me, so I'll keep looking.  I'm not trying to neglect you guys.


You have to have posted at least 50 messages in order to be able to rate messages.  So keep posting.  I threw 5 stars to Altenbach, on your behalf.
Message 6 of 9
(5,918 Views)

Hello,

 

I am having a similar issue with my code as well.  Very similar data acquisition type as described above as well, except it is tweaked for in flight testing.  I am using a state machine in order to execute my code.  In one case, the user can execute an option to take a measurement of data and then a table is created (eventually I will write the code that will save the data).  However, if the user has a bad run and wants to delete the data in the tables, I would like to have a clear button that the user can press.  I understand why I can not clear the table as you have already described.  I tried to place the build table outside of the case structure, but then I received an error that the other cases were not complete.  I am unsure of where to proceed from here and I was hoping to make clearing the tables a separate case, but I do not know how to wire the clear button to the reset table from a separate case structure.

 

I am using LabVIEW 9, and I have attached my code as well 

 

I would appreciate anyones help!

 

-Ellen

0 Kudos
Message 7 of 9
(4,538 Views)

Ellen,

 

1. It is often better to start a new thread than to reply to an old one.  Sometimes the people who answered the old thread may not be participating any longer or they may not pay attention to threads that they thought were finished.  If you start a new thread and have a problem similar to an old one, refer to that old thread or, better, include a link to it.

 

2. Shift registers are your friend.  Pass the data through all the cases via a shift register.  In the Take Data case you can build the table. In the clear table case wire an empty array to the table.  Put the indicator outside all the cases but inside the loop.

 

3. If you use an enum (enumerated type control) for the state and make it a type def you get two huge advantages in state machines. First the item text appears in the case selesctor label, making the states self-documenting.  Second when you make changes such as adding a state the typedef will change all instances (like constants inside the cases) to reflect the changes.

 

The version I am attaching only changed one of the tables.  I put a Diagram Disable structure around the MathScript node since I do not have that.

 

Lynn

0 Kudos
Message 8 of 9
(4,508 Views)

Lynn,

 

Thank you for the advice, I will be sure to use it in future posts.

 

Also, you helped me figure out how to clear my tables.  I did have to add an additional shift register so that I could not only clear the table, but reset the table.  Thanks again for your help.

 

Ellen

0 Kudos
Message 9 of 9
(4,471 Views)