02-27-2013 07:25 AM
Hi everyone,
I have a problem that is somewhat unique and I will attempt to explain it as best as I can. I am working on a project that executes a series of tests which behave as plug-ins. These tests follow LVOOP principles in that there is a TEST PARENT CLASS that all tests inherit from and they override a Do.vi that is required for all classes inheriting from TEST. Each test has a series of steps that it executes with unique pass/fail parameters.
Certain tests perform the exact same functionality but with different parameters or step names. We have decided to call these NESTED TESTS, where there is another layer of inheritance. The "nested test" parent holds all of the code for the steps of the child classes (many steps use the same cases again with different parameters, etc). The "nested test" children all call the parent method (Do.vi) and load in the sub panel of the parent on the front panel. The unique steps are called from a parameter file and the "nested test" parent executes those steps. The main idea for these tests is since the code is usually the same but with different parameters loaded in, it makes for less code changes if one of the steps needs an update (i.e. if I found that a certain Power Supply command was incorrect, I would only have to change it in the parent and not the up to 20 children).
This all works fine, but the problem comes from a drag and drop feature we are trying to implement. In main.vi (we call it the Test Executive), the tests in a sequence are loaded in and when they run, the VI front panel is shown in a sub panel. Again, this works as well, but we are adding drag and drop functionality in case the user wants to drag back over old tests to see data or to see the front panel of a test that is about to run. This is useful as some tests in the sequence could execute in a matter of seconds while some may take up to 30 minutes. Therefore if you are in a long test and want to see what happened in previous tests, you drag the test name over from the list and drop in on the sub panel to see what the data was for that test. With the nested test idea, however, this does not work. When you load in the front panel of one of the nested tests that has finished, it is usually blank because the parent sub panel is removed once execution is complete.
I have attached a quick example I put together that basically mimics the functionality of the program (developed in LV2012). Push Start to start the sequence of tests and drag and drop from the listbox onto the sub panel. There are three tests, two are "nested tests" and I have put a few delays in the nested tests's steps to give time to play with dragging. The only solution I have thought of at this point is to take a screenshot of each test's front panel after it is finished executing and then the drag and drop would load the image, but my only hesitation there is if one of the tests has a graph, you wouldn't be able to manipulate the graph.
Sorry for the long-winded description, this wasn't so easy to describe!!
02-27-2013 08:40 AM
Your approach has several limitations. In your example, the last nested test works because it has the parent VI ref. Even if you could get around the issue that the nested test could display the front panel, it wouldn't show the data of that test, but of the last nested test that called it. So, in your example, both would show nested test 2's results. This issue also applies if you run the same test twice in your sequence, as the front panel would show the last execution.
You could try using pre-allocated clones to keep individual copies of everything, but you would have to re-architect the whole project, as you are using dynamic dispatch terminals in your UI VIs. This way, you would have dediciated copies of your UI. You could separate your UI from your parent class test and make it more a "data viewer" VI. You could do the preallocated clones option, but at that point, I would just pass the test data into it and rerun your viewer.
02-27-2013 08:59 AM
Yes, there are definitely some limitations to the design. This whole idea came up as a "nice-to-have" feature after almost all of the architecture was designed, including the nested test idea.
We did discover that having the same test multiple times in the sequence would only show the last execution, but decided that that issue was one we would live with because it would only apply to special cases that won't come up very often in our tester.
Another option may be to dig back into some VI Scripting and copy everything off of the front panel of the nested test parent to the child's front panel when finished. I do like playing with VI Scripting!
Matthew_Kelton wrote:You could separate your UI from your parent class test and make it more a "data viewer" VI.
Can you explain a little more about what you mean with the "data viewer" idea?
02-27-2013 09:31 AM
Basically, don't put the UI in the VI Do.vi (or duplicate it into another VI). You have varying levels of complication.
You could make it simply have a control input with the values and it displays them. This works well for post-run display. So, you could reload the same viewer and pass the test results into it. This may not work well for a running VI if you want results updated in realtime.
You could open the VI reference to the viewer and get references to the controls and update the controls using the value property. This gets a little clunky, but can be made to work. You could probably get away without actually having a viewer that runs, the VI will just stay idle.
The viewer can be its own independent VI running another loop and you are using queues, events, etc. to pass values into it. You can have a generic VI to send a DBL value for example, and you specify what value you are sending and the value. You have some more overhead in launching and shutting down the viewer.
In all these cases, to display an old test, you would have to have code to grab the test data and run your viewer to update it. It definitely adds more complication, but would be able to display all old tests.