LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you convert an excel formula so a labview formula node can execute it ?

I have an excel formula that I want to insert into a formula node in a vi. I've tried copying and pasting the formula, but I keep on getting errors and a broken arrow.

Here is the original Excel formula for cell B20:

=IF(B16="","",IF(B17="","",(((B16/(PI()*$B$8^2/4/144))/4005)^2)/(((B16/(PI()*$B$8^2/4/144))/4005)^2+B17)))

This formula calculates a TAU value, so we can optimize the immersion of fans that we test in our wind tunnel.
I think Excel executes formulas from the inside brackets to the outside, Does the labview formula node do the same?
0 Kudos
Message 1 of 4
(3,942 Views)
Here is the excel spreadsheet.

B2 BAROMETRIC PRESSURE CONSTANT 30.5
B3 TEMPERATURE CONSTANT 72
B4 FLOW COEFFICIENT CONSTANT 5240.81
B5 RHO, ROOM CONSTANT 0.0760
B6 RHO, BOX CONSTANT 0.0755

B8 FAN DIAMETER VARIABLE
B9 FAN RPM VARIABLE
B10 ORIFICE SIZE VARIABLE
B11 DELTA P VARIABLE
B12 BOX VARIABLE

B16 CFM =IF(B11="","",$B$4*B11^0.5/B5^0.5)

B17 STATIC PRESS =IF(B12="","",B12*0.075/B6)

B18 HP =IF(B13="","",B13*$B$9/840333/B5)

B19 EFFICIENCY =IF(B16="","",IF(B17="","",IF(B18="","",B16*B17/63.56/B18)))

B20 TAU =IF(B16="","",IF(B17="","",(((B16/(PI()*$B$8^2/4/144))/4005)^2)/(((B16/(PI()

*$B$8^2/4/144))/4005)^2+B17)))
0 Kudos
Message 2 of 4
(3,941 Views)
The formula node uses a different syntax from Excel. You will need to convert the formula to the formula node syntax. The help for the formula node describes the syntax.

You may also need to use other methods for detecting the equivalent of an empty cell in Excel. A LabVIEW control always has some value, the default value for the datatype if no other value has been assigned. This means that the b16="" comparison may not be very meaningful for a numeric datatype. The Comparison palette has a "not a number" function which could be used.

Sometimes it is more powerful to determine what the "other" program, in this case Excel, is doing and then develop a good dataflow model and program it into LabVIEW. For your example, the if functions could be replaced by comparison functions and case structures. The numerical formula could be implemetentd with math primitives or a formula node inside the appropriate case statement.

Lynn
Message 3 of 4
(3,926 Views)
Thanks for the info, I just went ahead and wrote the program using wiring diagrams inside of 5 cases and it works perfectly.
Message 4 of 4
(3,911 Views)