LV 6i: Serious Formula Node problem!

I have found a "serious" problem converting VI from LV 5.1.1 to 6i:
I have same "big" equations for density calculation with upper 65 coefficients
and 3 o more inputs variables.
Everything goes well and fast in 5.1.1, when I open this VI in LV 6i there
is automatically conversion
of exponential symbol (from "^" to "**") with non apparent problem,
but the result of equation is WRONG, very, very incorrect (from 0 in 5.1.1
to same negative milliard...).
I tried with more different equations and the results are similar...
For the last: when I re-convert my VI in version 5 and run it in LV 5.1.1
everything re-work PERFECTLY! Strange.
Have I found a "terrible" BUG?
Someone have found the same problem?
Do you have some ide
a?
I will wait some news from you.:-)
Thanks for reading this LONG news.
Bye, bye.
Alfio.

"Alfio" wrote:
>>I have found a "serious" problem converting VI from LV 5.1.1 to 6iI have
same "big" equations for density calculation with upper 65 coefficients>and
3 o more inputs variables.>Everything goes well and fast in 5.1.1, when I
open this VI in LV 6i there>is automatically conversion>of exponential symbol
(from "^" to "**") with non apparent problem,>but the result of equation
is WRONG, very, very incorrect (from 0 in 5.1.1>to same negative milliard...).>I
tried with more different equations and the results are similar...>For the
last: when I re-convert my VI in version 5 and run it in LV 5.1.1>everything
re-work PERFECTLY! Strange.>Have I found a "terrible" BUG?>Someone have found
the same problem?>Do you have some idea?
>I will wait some news from you.:-)>Thanks
for reading this LONG news. >Bye, bye.>Alfio.
Hi Alfio
Some times ago I had a simmilar problem but with labview 4.x. My equation
in the
formula node was (and still is) very large too but the problem was related
with the
x^2 terms. When these terms were changed with x*x the vi worked fine. Very
strange.....Also, this problem did not appear with small equations. Try a
smaller equation and see what happens. And more: with LV 5.1 (I am using
this version)
there is no problem.
Good luck.
Ricardo.

Similar Messages

  • Formula node problem

    Basically I initialize an array and then run a formula node  which fills  up an array based on the cells that are written in the first frame of the sequance to that  array. My problem is that it appears that the formula node does not actually write anything to my array table. I ran multiple simulations but was not able to explain this problem. Please see the sequance structure at the bottom of my code.
    Attachments:
    Spektr.vi ‏47 KB

    Your Timeout case may be empty, but since you're wiring a constant of 10 to the Event Structure's "Event Timeout" the Event Structure will trigger every 10 msec even if there's nothing to do. If you left the "Event Timout" unwired the event structure will trigger only when there's an actual event.
    There are numerous examples that ship with LabVIEW. Open the Example Finder (Help -> Find Examples), and then in the tree menu select "Fundamentals -> Arrays and Clusters". You should start with the example "Building Tables", as this is what you really want to do. Basically, all you're doing is adding some columns to a pre-existing array. Your implementation of the formula is not correct to begin with since you only get one value out, and I'm guessing you want to generate those additional "Harmonic" columns. The best/easiest way to do this is with an autoindexed loop. Here is one way to do this:
    Also, in regards to your statement
    also if I use  the flat sequence instead of the
    stacked one will that write the Value after each frame instead of
    writing only after the end of the whole sequence structure?
    The answer is no, if you keep the tunnel and property nodes in the same way. The type of sequence frame doesn't matter. It's when the data is available.
    Message Edited by smercurio_fc on 05-27-2008 03:29 PM
    Attachments:
    Example_VI.png ‏15 KB

  • Graph equation formula node problems

    I am using LV6.0. I am having some problems regarding the formula in the formula node. I hope someone can help. The vi is attached
    Attachments:
    graph equation.vi ‏15 KB

    Yes, that's right. Waveform graphs and charts always show data in this way. If you want to use your x-values as x-axis and the y-values as y-axis, you have to use the xy-graph.
    Attached is a screenshot of the vi.
    Hope this helps.
    Thomas
    Message Edited by becktho on 10-04-2005 12:32 PM
    Using LV8.0
    Don't be afraid to rate a good answer...
    Attachments:
    xygraph.JPG ‏175 KB

  • Serious bug in LabView 8.5 Formula Node

    Hello,
    Thought I would warn my fellow LabView programmers about a serious error in the Formula Node:
    The problem may be encountered by anyone running a non-us LabView installation:
    I am located in Norway, and over here we use the comma (,) as the separator in floating point numbers: So, the use 3.14 is written like 3,14.
    The problem is that the Formula Node accepts both formats, but only the US Notation is interpreted correctly !
    Example:
    float64 x1, x2;
    x1 = 3.14;    // Interpreted Correctly !
    x2 = 3,14;     // Interpreted as 3: One might say this leads to problems.......
    Message Edited by geirove on 06-13-2008 06:23 AM
    Geir Ove

    geirove wrote:
    JoeLabView wrote:
    Hi Geir,
    It is not a bug.  ............
     The node does not recognize localized decimal separators."
    Of course it is a Bug:  **Any** code that **any** compiler does not recognize, should be flagged with an error message ! I have written my share of compilers myself, and they all flag down code that is not accepted as an error.
    Failing to do so may cause serious, expensive and very hard to trace errors.
    Sorry, but I would expect that the NI team in their 20. year of LabView development is capable of better than this.
    Sorry to disappoint you! It's not a bug since that statement is absolutely valid albeit useless in that context.
    The Formula Node since LabVIEW 7 supports C syntax except some advanced features such as pointers. In C the comma in expressions is the sequence operator meaning it separates expressions that will be executed from left to right and the last one will actually be the result of the entire sequence expression. This is often used for the initilizer expression inside the for statement, to initilize several variables to a start value.
    And the NI team really is a lot better than you think. The online help may be a bit short about the reasons why the comma is not supported as decimal point but there have been many people thinking about this before it was made like that. It was either C syntax support without localized decimal point or some homegrown syntax with localized decimal point and they went for the first.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Formula node parenthesis problems

    Hi Y'all,
       I'm going cross-eyed trying to figure out what is wrong with the equation that I'm trying to use in a formula node. I've attached both the VI (version LabVIEW 2009) and the error msg. Unfortunately there are a couple more of these, but maybe if I get the problem with this one pointed out to me ...
    Thanks!
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion
    Solved!
    Go to Solution.
    Attachments:
    Calculate Discharge coeff.vi ‏7 KB

    Ha ha ha, thank goodness for Mac's. When I went back and replaced all the "-" with "-" it fixed the problem. The problem was that I had copied/pasted from a pdf document, and what was displayed in the formula node wasn't what it was seeing! So much for WYSIWYG!
    What a PAIN! It didn't say "What the heck is this weird character", told me that I alternately was missing a right hand parenthesis, or a semi-colon.
    Thanks,
    Message Edited by LV_Pro on 10-21-2009 12:39 PM
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Problems with bit shift left in Formula Node

    Hi,
    Sorry but my English is not good.
    I'm trying to execute a bit shift left in the Formula Node, but the shift left is not working as I expected.
    uInt32 parametro[5];
    float32 valorAmostra;
    int16 indiceAmostra;
    uInt8 indiceResposta;
    int16 controle;
    int32 valor;
    int8 i;
    for(i=0; i<5; i++)
    parametro[i]=param[i];
    valor = parametro[5]<<16 | parametro[4]<<8 | parametro[3];
    controle = parametro[1]<<8 | parametro[0];
    indiceAmostra = (controle & 0x3FF);
    indiceResposta = (controle >> 10);
    valorAmostra = valor & 0x7FFFFF;
    valorAmostra = valorAmostra*(2.4/8388607);
    if((valor & 0x800000) == 0x800000)
    valorAmostra = valorAmostra*(-1);
    the input param array is of the type uInt8, as I saw in other topics that does not shift with uInt8,
    I copy the values of param array to parametro which is of type  uInt32, but still did not work.
    Testing the input param with the following values:
    param[] = {10,14,10,0,16}
    the valorAmostra returned is 0,00117188 when he should be 0,300003.
    Can someone help me please?
    Solved!
    Go to Solution.

    Portuguese:
    Olá,
    Existe um bug no LabVIEW para esta operação. Este bug deverá ser corrigido em versões futuras. Uma solução para esta situação é utilizar um int32 ao invés de um ulnt32.
    Qualquer dúvida por favor entre em contato.
    Obrigado.
    English:
    I investigated the problem you are having, and it turns out that it is a bug that has already been reported and documented. The work around for it is to use int32 rather than uInt32.
    Thanks.
    Luciano Borges
    R&D Engineer
    Pirelli Brazil

  • Array index problem in formula node

    dear friend
    I'm trying to use formula node to solve a problem because I make this program using c at the begining.
    It runs perfectly in turbo c, but somehow it doesn't work in the formula node.
    I try to debug my source code, and I find that the formula node seems can't read the true value in
    the array.
    Here is the code in the formula node.
    int32 i,j,k;
    for ( i = 0 ; i < sopa; i++ )
     j = 1;
     ep[i][0] = pa[i];
     ep[i][1] = np[ep[i][0]][0];
     while ( ep[i][j-1] != exit )
      for ( k = 0 ; k < sonp ; k++ )
        if ( np[ep[i][j-1]][k] != -1 && (pc[ep[i][j-1]][ep[i][j]] + pc[ep[i][j]][exit] >= pc[ep[i][j-1]][np[ep[i][j-1]][k]] + pc[np[ep[i][j-1]][k]][exit] ) && (pc[ep[i][j-1]][np[ep[i][j-1]][k]] == org[ep[i][j-1]][np[ep[i][j-1]][k]] ))
          ep[i][j] = np[ep[i][j-1]][k];
      j++;
    This is the part that I think the problem might be.
    if ( np[ep[i][j-1]][k] != -1 && (pc[ep[i][j-1]][ep[i][j]] + pc[ep[i][j]][exit] >= pc[ep[i][j-1]][np[ep[i][j-1]][k]] + pc[np[ep[i][j-1]][k]][exit] ) && (pc[ep[i][j-1]][np[ep[i][j-1]][k]] == org[ep[i][j-1]][np[ep[i][j-1]][k]] ))
     ep[i][j] = np[ep[i][j-1]][k];
    I state that "np[ep[i][j-1]][k] != -1" but I do get the value -1 in the array "ep".
    Could someone tell me why I get -1 in the array?
    I hope I can finally do it all by labview not using formula node,but array like "pc[ep[i][j-1]][np[ep[i][j-1]][k]] "
    seems very hard to wire in labview. Could someone give me some good advices of doing this?
    Thanks for your help

    altenbach 已寫:
    normanshi wrote:
     ep[i][0] = pa[i];                                          (A)
     ep[i][1] = np[ep[i][0]][0];                            (B)
    ...    if ( np[ep[i][j-1]][k] != -1 && ... )          (C)
          ep[i][j] = np[ep[i][j-1]][k];                       (D)
    I state that "np[ep[i][j-1]][k] != -1" but I do get the value -1 in the array "ep".
    Could someone tell me why I get -1 in the array?
    I hope I can finally do it all by labview not using formula node,but array like "pc[ep[i][j-1]][np[ep[i][j-1]][k]] "
    seems very hard to wire in labview. Could someone give me some good advices of doing this?
    There are many possible scenarios to get a -1 in the ep output. For example if the -1 gets already written in step (A) or (B) at a certain index, and that index does not get overwritten in step (D). You are indexing all over the place! Is there some bounds checking on the array contents? What are typical inputs and array sizes?
    I'm sure about that the -1 doesn't get already written in step (A) or (B) because ep[i][0] and ep[i][1] is fine. What really makes me confuse is that sometimes ep array has the value like this.
    That means it does overwritten some value in step (D). The -1 should never be written into it because I have already state that np[ep[i][j-1]][k] != -1. Somehow I still get -1,and this is really strange! I'm indexing all over the place becuase I can't figure out a better way to achieve my requirement.
    I think I should briefly tell you what I'm trying to do. In this program,I input some values which means the distance from one point to another. Then I use floyd's all pairs shortest-path algorithm to find all the shortest distance. Finally I want to find out the "shortest path". I mean like from point 4 to point 0,the shortest path might be like 4 -> 2 -> 1 -> 0, and what the formula node part do is trying to find out this "shortest path". Maybe you can give me some better advice of doing this, I have been thinking a better way to do it for about two months. I think I'm really not good at this.
    I try to do it all by labview ,but again I get a strange problem. This time the ep[i][j-1] doesn't get the correct value. In the first time i=0 j-1=0 ep[i][j-1] = 1,but the second time i = 0 j-1 = 1 ep[i][j-1] = 0. This makes the "ep[i][j-1]!=exit" get the incorrect boolean value. The ep[i][j-1] should be 2,not 0. I try to use highlight to find if I make any mistake, but I can't one.This is the input and I put the labview program in attached file (temp4.vi).
    Could you help me find out why this happened?
    Thanks for your help altenbach!
    由 normanshi 在 08-19-2006 10:06 PM 上編輯的訊息
    Attachments:
    temp4.vi ‏191 KB
    ep.jpg ‏10 KB
    input.jpg ‏9 KB

  • Formula Node variable assignment problems

    I have a formula node with the follwing:
    Inputs:E,X,T,PD,I
    OutputsK,PD
    The statement inside the formula node is:
    if (Eelse if (PD=1) if (E else if (E<=X) ;
    else PK=I, PD=1;
    The logic seems to be working the way I want, the problem is in the last else statement. PK is never assigned the value of I. however, PD is assigned the value of 1. There are no errors indicated.
    The source of the I input is the iteration # of the For loop where this formula node is located.
    Anyone see what I am missing??
    Thanks,
    Mike

    Mike,
    In comparisons, == should be used instead of =. This is a very common mistake, and a reason that forumla nodes should be avoided if possible (except of course for very long formulae that would require a lot of nodes.
    It looks like your code would be better represented with LabVIEW nodes instead of in a formula node (for readability - there is no performance difference.)
    Also, you may wish to reconsider using an Input variable that has the same name as an output variable. Try using PDi and PDo, or PD1 and PD2 instead.
    Good luck.

  • Formula Node or problem

    Hi,
    I'm having a problem using the formula node.
    The output variable is always 1, but I notice that if the code was:
    if(N != 1)
    L = 1;
    else
    L = 0;
    The program work ok.
    Thanks,
    Sílvia
    Attachments:
    1.png ‏5 KB
    1.png ‏5 KB

    Your screen shot shows if(N!=1||N!=2).  That is if N is not equal to 1 OR N is not equal to 2.  Well, since N can never be equal to 1 and 2 at the same time, of course the statemenet always evaluates to True.
    If N=0  True OR True = True
    If N=1  False OR True = True
    If N=2  True OR False = True
    If N=3  True OR True = True

  • Problema con formula Node

    Buen día,
    estoy trabajando con un programa que me ayude a leer el caudal de una bomba de agua, el problema que tengo es que la formula node no me genera ningun dato.
    Agradeceria su ayuda
    Adjunto los archivos
    Adjuntos:
    Pantallazo problema formula node.png ‏172 KB
    Prueba 4.vi ‏58 KB

    Hola alipio;
    Algunas recomendaciones para tu código;
    1. Trata de ocupar los datos apropiados; usas I32 y Double lo qu eocasiona puntos de coerción y hace que tu código sea menos eficiente
    2. No tiene caso tener conectada la misma salida a dos esstructuras de casos iguales; puedes en su lugar utilizar sólo una;
    3. Trata de no hacer dobleces inecesarios en tus cables
    4. En cuanto al fórmula node; x, g son entradas y h,y son salidas; por lo que x=h no tiene sentido.
    Si quieres emplear el valor de la iteración anterior, puedes también obtenerlo del shift register; algo así como en la imagen de abajo. 
    Ojo; el VI no esta completo pero puse parte de tu código ahí
    En el caso falso de arriba (donde estan los contadores) se iguala contador 2 a cero, al igual que en tu select)
    Si tienes duda de como usar estas funciones avísame y con gusto puedo pasarte las ligas de algunos tutoriales
    Exito en tu aplicacicón

  • If-then statement in formula node

    **Note - The attached file shows the current block diagram.
    I have a formula node inside a for loop. Inside the formula node I am trying to program the if-then statement:
    If T1<2.0E-5 OR T1>5.5E-4 THEN GOTO 3
    U7=U7+V
    I have 4 items I need help with:
    (1) Is 'II' the correct operator for 'OR'?
    (2) Is 'goto' an acceptable operator within LabVIEW?
    (3) 'U7' is building a 1D array. How do I need to define it? Is it simply 'int U7'? Also, I will add an output value named 'U7' on the formula node wall with an indicator wired to it from outside the for loop.
    (4) Is my use of the equal sign appropriate or do I need to use '=='?
    Thanks for the help.
    Philip
    Attachments:
    if-then_in_FN.jpg ‏18 KB

    Thanks for the help. I went ahead and rewrote the program so I could omit the 'goto's. Another problem that I am having is that I want 2 statements for 1 assignment:
    if (T1>=.002004 && T1<=.002584)
    B1=U
    A1=V;
    I want to assign both B1 and A1 values when the above condition is true. I tried a comma between the U and A1 but it doesn't work as well. Should I define A1 and B1 separately? Or would this create problems?
    if (T1>=.002004 && T1<=.002584)
    B1=U;
    if (T1>=.002004 && T1<=.002584)
    A1=V;
    Thanks,
    Philip

  • How do I get an array output on a Formula Node?

    My problem is simply that I cannot figure out how to get an output on a Formula Node to be an array. Documentation states that "you must declare local arrays and output arrays in the Formula Node" but doesn't say anything more than than. Attempts to put something like "float32 out[100];" for an array output called "out" fail.
    If anybody knows how you can do this or even knows if it is possible I would appriciate your help.
    Thanks,
    Naveen

    I found a typo in the formula node I was doing that was making the output not be an array. I don't think I was getting the error before but I was going to put together an example VI to attach here and I found it. So, thanks for your help even tho it was a stupid little mistake on my part.

  • "Eval Parsed Formula Node VI" does not return outputs in predefined order

    I make a data analysis program, where the data consists of some million events and each event has e.g. 4 channels and 1-5 hits on each channel. 
    I would like the user to select different expressions of these channels to give coordinates to plot in a 2D histogram (increment a bin in Intensity Graph), e.g. for some experiment you want to show x=ch1-ch2; y=ch1+ch2+ch3+ch4; while in another experiment you want x=ch1-123; y=123-ch2;
    There are other VIs that use static LabView-code for the normal things, but now after a few years of adding to this program I find that it would be quite good with a general plotter and let the user specify simple expressions like this. Also with the "normal" static plots, there is a need to filter out bad data and then it would be much simpler both to program and use if you could write text expressions with boolean logic to combine multiple filters. Making a LabView code and GUI that allows AND/OR/parenthesis combinations of expressions will be quite an effort and not very reusable.
    So, with the above motivation, I hope you see that it would make sense to have a useable string formula evaluator in LabView. I find some info about MathScript's user-defineable functions, but haven't managed to get MathScript working in LV2010 yet (maybe some licensing or installation issues, I think I had it in 8.6). But I think it would be possible to do most of what I want for the display-part (not the filtering) with the simpler Eval/Parse Formula Node VIs and suitable use of the limited variable name space. So I started testing, and found a quite annoying issue with how the evaulator works.
    To the parser, you are expected to send an array of output variable names. But then it ignores this array, and returns one output per assignment/semicolon in the formula, in the order of the formula text. Since the static parts of my program need to know what the output values mean (which of them is x and which is y), I would have to rely on the user not using any intermediate variable and defining x before y. The attached screenshot demonstrates the problem, and also that it has been solved by NI statff in the "Eval Formula Node VI" which does the appropriate array-searching to extract only the pre-defined outputs, in their expected order. But using that VI is about 100 times as slow, I need to pre-compile the formula and then only use the evaulator in the loop that runs over a million events.
    I don't know if I'll take the time to make my own tweks to the parsing stage (e.g. preparation of array-mapping to not have to repeat the search or maybe hacking the output list generated by the parser) or if I'll have to make it in a static Formula Node in the block-diagram (which supports more functions), so that the user has to run with development environment and stop the program to change the plotting function. But I wanted to share this trouble with you, in hope of improvments in future LabView versions or ideas from other people on how I could accomplish my aim. I have MATLAB-formula node possibility too, but is far as I have seen the only place the user could update the formula would then be in a separate .m file, which is re-read only when typing "clear functions" in the Matlab console window. (Having this window is also an annoyance, and perhaps the performance of calling Matlab in every iteration is not great.) 
    Besides this issue, it also seems very strange there is virtually no support for conditional expressions or operators in Formula Node evaulated formulas (called Mathematics VIs in the documentation). Maybe using (1+sign(a-b))/2 you can build something that is 0 when a<b and 1 when a>b, but it is not user friendly! Would it really be diffcult to add a function like iif(condition, return_value_if_true, return_value_if_false) to replace the unsupported "condition ? if_true : if_false" operator? Would it really be difficult to add support for the < <= >= > == || && operators? Although compiled to an assemply language, this can't exactly be difficult for a CPU.
    Attachments:
    LV script test.png ‏62 KB
    LV script test.vi ‏18 KB

    (1) You can put any kind of code inside an event structure with the limitation that it should be able to complete quickly and without user interaction.  For example a while loop for a newton-raphson method is fine, but an interactive while loop where the stop condition depends on user iteraction is not recommended. By default, event structures lock the front panel until the event completes, so you would not even be able to stop it.
    (2) Yes, you can do all that. LabVIEW has no limitation as a programming language. Use shift registers to hold data and state information, the manipulate the contents as needed.
    (3) I would recommend to use plain LabVIEW primitives instead of formula nodes. Show us your code so we can better see what it's all about. Obviously you have a mismatch betweeen scalars and arrays. It is impossible from the given information where the problem is.
    (4) Yes, look inside the nonlinear curve fit VI (you can open it an inspect the code!). One of the subVIs does exactly that. Just supply your model VI.
    LabVIEW Champion . Do more with less code and in less time .

  • Formula node

    Hi everyone.
    I have a problem with the formula node.
    I want to calculate the following  function:
    Ux=xdot+Omegat*(y-y0)+thetax
    where xdot, Omegat, y, thetax are all 1D arrays ( honestly these are waveforms but I convert these in arrays) while y0 is a constant. Also the output Ux has to be a 1D array.
    When I implement the formula in the appropriate box I receive a message about
    "array indexing indices".
    For more information I link my .VI.
    Some idea how to solve this task?
    Second question:
    Using the formula node is faster than realize all these operations in a
    different way?
    I ask it because I will need to include this .VI into 5
    different "for loops"?
    Thanks
    matomato
    Attachments:
    formula node.vi ‏87 KB

    Hi matomato,
    fastest is usually to use LabView primitives! See attachment...
    Edited: made another small change to your vi: changed y0 to DBL to avoid unneccessary datatype conversions!
    Message Edited by GerdW on 02-27-2008 05:11 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    formula node1.vi ‏87 KB

  • Formula node uInt32 overflow

    I'm having a weird behaviour in formula node. The overflow of unsigned integer operations simply doesn't match the results of standard LabVIEW blocks as shown in the attached picture.
    How can I deal with this problem? I need the behaviour of the block diagram. I could not do a right logical shift in unsigned integers in block diagram, so I'm using formula node (I could not figure out how to do it because I can't negate a unsigned value).
    I'm using LV2012SP1. Were there any changes in this behaviour in newer versions?
    Thank you.

    I found a problem in hexadecimal and octal numeric representations of the formula node. The picture illustrates the issue. Three variables are assigned with the same value but outputs different results.
    The hex and octal representations only work for half range of the 32 bits unsigned integer. When the value assigned gets beyond this limit the variable receives zero. This doesn't happen with a decimal value neither with 8 bits variables. Seems the problem doesn't only happen with overflow operations.

Maybe you are looking for