01-22-2024 06:39 PM
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.
01-22-2024 06:51 PM
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.
01-22-2024 07:13 PM
I wouldn't use a formula node. Instead I would use built-in LV functions.
01-22-2024 07:34 PM
@paul_a_cardinale wrote:
- Missing semi-colon at end of "float TempK =1/(A+(B*In(Rt))+(C*(In(Rt))**3))"
- Missing semi-colon at end of "float TempC = TempK - 273.15"
- 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.
01-23-2024 10:10 AM
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.
01-23-2024 10:55 AM - edited 01-23-2024 10:58 AM
@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? 😄
01-23-2024 02:05 PM
@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
01-23-2024 11:13 PM
If I've transcribed it correctly, this is the code using LabVIEW built-ins.
Personally, I find this much much easier to read than your formula node.
01-23-2024 11:15 PM
@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?
01-24-2024 12:42 AM - edited 01-24-2024 12:45 AM
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…