LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic formula

Hi,

 

        I have a string for calculating force in a Daq operation, For ex: the string would like   " AI0+0.0254*AI1". I have to create a calculation dynamically for this Daq operation. how to do it?

0 Kudos
Message 1 of 9
(3,389 Views)

You could try using the Forumla Node

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 9
(3,376 Views)

are you trying to say your formula is not constant and it may vary?

 

If only inputs are varying then using formula node is ok, but if the operators are going to vary then you will have to write a smart decoder which will identify formula and process as per "BODMAS" rule.

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
0 Kudos
Message 3 of 9
(3,367 Views)

Hi,

 

     yep, the equation varies according to the user definition, sometimes it might be AI0+AI1+AI2*0,005 some thign like this. So , how to do it. If anz exampels pls do post. 

0 Kudos
Message 4 of 9
(3,363 Views)

I do not have example handy, the only thing I can suggest right now is, write a decoder which will follow BODMAS rule.

 

search for variables and operators associated with them and then process.

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
0 Kudos
Message 5 of 9
(3,358 Views)

Other than Decoder, Is there anz other method solving this problem.

0 Kudos
Message 6 of 9
(3,345 Views)

Try inserting the variables (AI0,AI1...) in one column of a CSV file and in other column insert formula required.

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
0 Kudos
Message 7 of 9
(3,341 Views)

 

I've had success using LabPython.  Here's an example I wrote a long time ago.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 8 of 9
(3,315 Views)

I've never used the LabPython but heard good things.  Also for simple equestions you can use the formula evaluator VIs.  They ship with LabVIEW, but it takes some reading into the documentation to know the format and what functions are supported.  It is under Scripts and Formulas palette under Mathematics.

Message 9 of 9
(3,306 Views)