10-28-2009 09:10 AM
Hi guys
I am new on labview and i am strugling to right a bit of code.
I am using formula node and i keep getting the error as above on the title moreover it displays: Error on line 5 is marked by a '#' character: " for {# H = 00.00.00 to H = 06.00".
I am attaching my file so that if you can give me a hand you could have a brief look.
Thank you
Solved! Go to Solution.
10-28-2009 09:18 AM - edited 10-28-2009 09:21 AM
Hi inaslab,
what kind of datatype do you expect for your variable H? You input an integer and try to calculate with numbers like "6.00.00" ( a notation I never have seen before)...
I think you should also define any variables in the formula node (like T, V, To, U). And I would prefer real LabView code using a case structure...
10-28-2009 09:44 AM
Allow me to channel my inner-Ben for a moment: I am reluctant to help somebody in the use of a formula node. I use them myself for testing purposes only. My first suggestion is to dump it and go for real LV code. We will all thank you for it.
If you insist on the formula node route, begin by reading the context help, particularly the section on syntax. Curly braces should be parentheses, and the for-loop construction is different than what you show. You are passing integers and checking for what appear to be time values.
If I fixed the error you are now showing, there are at least two-dozen more that will follow. We may both be enthusiasts by the time it is all sorted out.
10-28-2009 09:56 AM
Thanks guys
As a matter of a fact this code is just for testing. Indeed one of the problems was that I stupidily thought H would be in the format HH.MM.SS. In fact it is just a integer numeber.
I have also sorted out the dozens of other possible error it was potentially about to show after solving the first issue.
For future reference, there is an attached solution for this matter.
Thanks
10-28-2009 10:07 AM - edited 10-28-2009 10:08 AM
Hi inaslab,
why do you give an input H when the first command is overwriting the input anyway? ("for (H=0;...")
Are those "for H+18" (and similar) really wanted or just typos?
10-28-2009 01:17 PM
Perhaps it would help if you said what you were trying to accomplish.
As far as I can see you formula node has a lot of redundancy in it, and to me doesn't really make any sense.
You have a number of loops, with the first four all executing. Inside each loop the calculation is loop-invariant, so it will just do the calculation within, and set the loop variable to it's end state. You don't pass the loop variable outside of the node so....
if (T< 23)
{
V=a;
}
else
{ V=0;
}
would have the same effect as your node.
The last loop would not execute as it's termination condition is already met. (After the previous loop, H will be equal to 25) If the last loop's "H+0" were to be changed to "H=0" that loop would then execute and would do the U=b contained within.
Rod.
10-29-2009 05:18 AM
Guys,
the previous file attached isn't the right one.
See the following attachment.
All I wanted is to test a numeber of different conditions... to get use to formula node editing on labview...and the following attached file does help a bit.
thanks
10-29-2009 05:26 AM - edited 10-29-2009 05:29 AM
Hi inaslab,
still your formula node doesn't make sense: You still overwrite the value for H in the first FOR statement...
What you want is either an IF-THEN-ELSE or a SWITCH/CASE construct like "IF (H>=0 AND H<6) THEN...". Right-click the formula node, select help, select formula node syntax !
And I'm even more convinced a standard LV case structure will be much more reasonable here: just wire H to the selector input...