From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Expression evaluation

Hi

I need an expression evaluator which can resolve an expression at run time.

Can not use formula nodes as they can't be dynamically configured at run time.

 

What I need is sonmething like the exprerssion editor and evaluator in TestStand.

 

I.e. the user applies the equation : var1/var2 + (1/var4)*0.1254 - var5.

 

The variables and their values are known at the time of the evaluation.

 

Has anyone implemented this in LabVIEW

 

Kind regards Kahr

 

 

 

Regards Kahr
Certified LabVIEW Architect
CIM A/S
0 Kudos
Message 1 of 22
(4,035 Views)

You could use lab python.  I posted this example a few years 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 2 of 22
(4,029 Views)

Here's where I ended up after asking a question on LAVA.

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 3 of 22
(4,025 Views)

test python.png

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 4 of 22
(4,014 Views)

I'm curious to know if this is useful for your application.  I've seen this use-case suggested in the past and I'm interested to see your solution.

 

This solution requires you to install Python and the Lab Python tools, but it adds great flexibility in handling your dynamic formula input.

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 5 of 22
(3,987 Views)

Or this, which more closely answers your original description.

 

test python.png

 

I'm having fun.  Anybody?  Anybody?  Bueller?  Kahr?  Anybody?

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 6 of 22
(3,958 Views)
Haven't found a good solution yet. Need a LabVIEW implemented solution. Not interested in python or other external application.
Regards Kahr
Certified LabVIEW Architect
CIM A/S
0 Kudos
Message 7 of 22
(3,946 Views)
I just noticed the dll jcarmody. Is python server running in the background ?
Regards Kahr
Certified LabVIEW Architect
CIM A/S
0 Kudos
Message 8 of 22
(3,944 Views)

kablam!

 

Parse Formula String.vi and the Eval Parsel Formula String.vi are your friends!

0 Kudos
Message 9 of 22
(3,936 Views)

Will the Parse Formula String.vi work for you?  The formula is entered as a string. Most of the fucntions available for the Formula node can be used.  The Formula VIs are in Mathematics >> Scripts & Formulas.

 

Lynn

0 Kudos
Message 10 of 22
(3,931 Views)