Below I explain my problem, and a solution. So my questions are how do I best implement this solution, is this solution really a bad idea, and is there a better solution?
Scenario: Four independent variables, say frequency, amplitude, phase, and bias. Each one sets a piece of test equipment. I want to sweep all of these independent variables over a range and measure the response of a DUT to all combinations of settings in the four dimensional volume defined by the ranges of the four independent variables.
Standard Solution: Four nested loops, one loop for each variable. I don't really like this solution because the complexity of the problem is embedded in the code. It is difficult to troubleshoot and not easily adapted to other numbers of independent variables.
A more object oriented approach: Each combination of the independent variables is an object. These objects can be combined into a list object. Conceivably I could create a list of all combinations of the independent variables, then go through the list writing the values to my test instruments. The list could be really big, not a good thing, and there would be lots of redundant writes to my instruments (this could be dealt with if it mattered). But it does remove the complexity from the program to the class constructor.
My preferred solution: Generate the independent data objects one by one. Have a function that creates one independent variable vector. Use this four times, once each for frequency, amplitude, phase, and bias. Feed these to a vi that indexes thought the four arrays and sequentially returns the points in the four dimensional independent variable space (each vector is an axis of this space)(this then is the class constructor). Write these values to the instruments. (use logic to avoid redundant writes if necessary). This moves the complexity to the vi that generates the independent variable vectors, and to the vi that indexes thought the independent variable space. And these are very reusable, and can be easily extended to any number of variables. If this solution is reasonable is it already coded somewhere? If not coded are there functions in Labview that already implement some of this, such as a function that will generated the sweep vectors, or that will generate all of the multidimensional indices?
Thanks
David Grucza, CLD