LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error using formula node

Can someone please look at the attached vi for a formula node and let me know what may be possibly missing? I keep getting an undefined variable error on line 12.

0 Kudos
Message 1 of 13
(2,289 Views)

The VI is in v23.0 and most of us are not on the latest LabVIEW version.

 

Please save for previous version from the File menu, preferably to v19.0.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 13
(2,285 Views)
  1. Missing semi-colon at end of "float TempK =1/(A+(B*In(Rt))+(C*(In(Rt))**3))"
  2. Missing semi-colon at end of "float TempC = TempK - 273.15"
  3. Those things that look like natural logarithm functions are spelled incorrectly.  Should be a lower case ell; instead you've got an upper case eye.

I wouldn't use a formula node.  Instead I would use built-in LV functions.

Message 3 of 13
(2,263 Views)

@paul_a_cardinale wrote:
  1. Missing semi-colon at end of "float TempK =1/(A+(B*In(Rt))+(C*(In(Rt))**3))"
  2. Missing semi-colon at end of "float TempC = TempK - 273.15"
  3. Those things that look like natural logarithm functions are spelled incorrectly.  Should be a lower case ell; instead you've got an upper case eye.

I wouldn't use a formula node.  Instead I would use built-in LV functions.


And this is the poster child for why you should try to avoid the formula node if at all possible.  (No such thing as syntax error if you use built-in LV functions.)  Well, there's one other reason, and that's because it is SLOWWWW.

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 4 of 13
(2,251 Views)

I was unaware that formula nodes were slow.  I always assumed they were parsed the same as any LabVIEW code.  This is good to know.

I generally use formula nodes for complicated math expressions for readability.  I find it difficult to mentally parse an elaborate collection of LabVIEW math operators into an equation, and text based equations have a more obvious correspondence with the original.

Lately I use MS Word to create an equation.  I use the Windows Snipping tool to copy an image of the equation to the clipboard and then paste the image into the VI block diagram for reference.  This really helps with documentation when I go back to look at it later.  Subexpressions can also be pasted next to outputs of blocks of operators for more detailed documentation.

0 Kudos
Message 5 of 13
(2,192 Views)

@jjohn1 wrote:

I was unaware that formula nodes were slow.  I always assumed they were parsed the same as any LabVIEW code.  This is good to know.

I generally use formula nodes for complicated math expressions for readability.  I find it difficult to mentally parse an elaborate collection of LabVIEW math operators into an equation, and text based equations have a more obvious correspondence with the original.

Lately I use MS Word to create an equation.  I use the Windows Snipping tool to copy an image of the equation to the clipboard and then paste the image into the VI block diagram for reference.  This really helps with documentation when I go back to look at it later.  Subexpressions can also be pasted next to outputs of blocks of operators for more detailed documentation.


Formula nodes are not necessarily slow and it is incorrect that complicated formulas are easier in text based code. That's a misconception!

 

A complicated formula is a 2D hierarchical collection of expressions and reducing it to sequential lines of text is much more convoluted than reducing them to a 2D LabVIEW diagram (once you have some experience!) Correctly written in LabVIEW, sub-expressions can easily be calculated in parallel, while a formula node needs to execute sequentially.

 

Our visual system is highly tuned for pattern recognition, that's why we can recognize faces from any angle or instantly tell the difference between a cat and a dog. A properly trained set of "LabVIEW eyes" can see and instantly parse graphical diagrams. Having to parse a linear sequence of monochrome characters is a giant detour!!! (even for a compiler!)

 

How many paragraphs do you need to vaguely describe what looking at a picture of the Mona Lisa can do in milliseconds? 😄

 

Message 6 of 13
(2,172 Views)

@jjohn1 wrote:

 

Lately I use MS Word to create an equation.  I use the Windows Snipping tool to copy an image of the equation to the clipboard and then paste the image into the VI block diagram for reference.  This really helps with documentation when I go back to look at it later.  Subexpressions can also be pasted next to outputs of blocks of operators for more detailed documentation.


I don't see any problem with that

0 Kudos
Message 7 of 13
(2,126 Views)

If I've transcribed it correctly, this is the code using LabVIEW built-ins.

t.png

Personally, I find this much much easier to read than your formula node.

Message 8 of 13
(2,088 Views)

@alexderjuengere wrote:

@jjohn1 wrote:

 

Lately I use MS Word to create an equation.  I use the Windows Snipping tool to copy an image of the equation to the clipboard and then paste the image into the VI block diagram for reference.  This really helps with documentation when I go back to look at it later.  Subexpressions can also be pasted next to outputs of blocks of operators for more detailed documentation.


I don't see any problem with that


Would you see a problem if the Louvre replaced the Mona Lisa with a text description of it?

0 Kudos
Message 9 of 13
(2,087 Views)

Hi Paul,

 

do you know of the polynomial evaluation?

Btw. according to Wikipedia you calculate a3*ln(Rt)^3 and not ( a3*ln(Rt) )^3…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 13
(2,072 Views)