11-01-2006 07:50 AM
11-02-2006 08:57 AM
Hi aviatrix,
Where is the lookup table in DIAdem? Is it an invisible variable that you repeatedly reference, or is it a series of Channels in the Data Portal, or do you have the choice as to how to architect the lookup table? The programming approach for these two cases is very different.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
11-02-2006 11:58 AM
Sorry I wasn't more specific. I've copied the entire table below; I can reference in any manner that would make sense; its entries are constants. First I'd like to check the value of a Diadem variable, 'efficiency', to see if it's between 0.2 and 0.7 (the first row of the table). If it is outside that range, then the new variable 'bypass' should be set to zero. Then I'd like to check the Diadem variable "utility" to be within 5 and 50 inclusive (the first column of the table). If it is outside the range, then again bypass should equal zero. If efficiency and utility are both within range, then I'd like to linearly interpolate between the values of the table (based on efficiency and utility) to calculate bypass.
0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | |
5 | 1.5 | 2 | 3 | 3.5 | 4.5 | 6 |
8 | 1.8 | 2.9 | 4.2 | 5 | 10.9 | 15.3 |
10 | 2 | 3.5 | 5 | 7 | 14 | 21.5 |
30 | 4 | 8 | 17 | 31 | 40 | 80 |
50 | 5.5 | 16 | 17 | 31 | 40 | 80 |
11-03-2006 11:06 AM
Hi aviatrix,
I went ahead and built an example for you of how DIAdem can tackle a lookup table. Note than in the example it loads the raw lookup table values into the first Group, creates a high-definition lookup table in the second Group, then executes 3 individual requests to lookup interpolated values for arbitrary [X,Y] pairs. The function "GetInterpValue()" that I created returns a VBScript Null if the X or Y value is out of range.
In a real application, you would want to create the high-definition lookup table Group one time, then leave it for as long as you will need to reference it. You do NOT need to recreate the high-definition lookup table Group multiple times for multiple lookup requests.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
11-08-2006 08:33 AM