LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculations with long equations

Solved!
Go to solution
Highlighted

Hello Everyone,

I am getting data from several sensors and I want to do calculations with them via Labview. The equations are long. Whats the procedure or method to do this?

Regards,
Alexis Koulidis

0 Kudos
Message 1 of 17
(588 Views)
Highlighted

Just implement the equations using LabVIEW code. Length is irrelevant.

 

If you tell us a little more about the problem, maybe we can give more specific advice. What does the formula do? How many inputs does it have?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 2 of 17
(569 Views)
Highlighted

Hello,

Thank you very much for your reply. I am getting data from 4 sensors, and I want calculate an other parameter that combines the sensors data with some constants.

Initially I was thinking to do with several Numeric and to each part of the addition, subtract or division separate, but I want to do all the calculations in once..If it is possible

 

I am giving an example of the formula: X,Y,Z and C are my input data from the sensors and 120,12,50 and 30 are constants

A = (120*pi*X)/(12*Y) + (Z*50)/(C+30)

0 Kudos
Message 3 of 17
(558 Views)
Highlighted

Personally, I find the Formula Node easier to read equations from (and therefore implement).  Others, like Altenbach, will go with the "pure" LabVIEW code (wire up all of the functions).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 4 of 17
(550 Views)
Highlighted
Solution
Accepted by topic author Alexis_Koul

@crossrulz wrote:

Personally, I find the Formula Node easier to read equations from (and therefore implement).  Others, like Altenbach, will go with the "pure" LabVIEW code (wire up all of the functions).


Excellent.  A solution for everyone's tastes.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 5 of 17
(536 Views)
Highlighted
Solution
Accepted by topic author Alexis_Koul

Your solution looks excellent. One last question if I may. In your VI you put the X,Y,Z and C that you can put the values. In my case, I will just connect my data output correct with the numeric?

-Alexis

0 Kudos
Message 6 of 17
(442 Views)
Highlighted
Solution
Accepted by topic author Alexis_Koul

Though, a quick test show the formula node is noticably slower, so depending on your requirements it might be needed to use the nodes.

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 17
(423 Views)
Highlighted

@Yamaeda wrote:

Though, a quick test show the formula node is noticably slower, so depending on your requirements it might be needed to use the nodes.


I'd like to see your benchmark and results.  I know the formula node will eliminate parallelism, but I have trouble believing it will be "noticeable" on a small equation like this.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 8 of 17
(415 Views)
Highlighted

@Alexis_Koul wrote:

Your solution looks excellent. One last question if I may. In your VI you put the X,Y,Z and C that you can put the values. In my case, I will just connect my data output correct with the numeric?


I would turn what I showed you into a VI on its own with the controls and indicator connected on the Connector Pane.  This small block is then easily testable and reusable.  Your main VI will then just call this equation VI, wiring up the values to the right inputs.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 9 of 17
(414 Views)
Highlighted
Solution
Accepted by topic author Alexis_Koul

FormulaNode.png

10M loops yields ~700 vs ~100ms (formula node in other case). So no, it's not noticable in a single run. But as i said, if the requirements are such that'll run many times in a tight loop, a factor of 8 is noticable. 🙂

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
Message 10 of 17
(409 Views)