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.

Similar Messages

  • I need in Formula Node to assign to the variable value 4000000000!!! What kind of variable it should be???

    i've just tryed to write unsigned in32, but it does not understand 'unsogned'... But i need variable to be unsigned, because the max value = 4000000000... So, how can i solve this probleme???

    Hi,
    I don't see exactly what you're trying to do here.
    Where do you want to assign the variable 4000000000 to? If you want it as an
    input, just use a dbl, with only zeros behind the coma.
    Note that an integer is a number without any decimals. An integer in LabVIEW
    is this, but with an extra limitation that it can only be 32 bits... So a
    dbl can be an integer.
    If the input dbl is not an integer, use round, round to -inf or round to
    +inf to make it one. This can also be done if the output needs to be an
    integer.Inside the formula node floor(x), int(x), intrz(x) or ceil(x) can be
    used to make integers.
    I hope this is what you mean... I can't see any problems doing this.
    Regards,
    Wiebe.
    "DrON" wrote in message
    news:506500000008000000E
    [email protected]..
    > I need in Formula Node to assign to the variable value 4000000000!!!
    > What kind of variable it should be???
    >
    > i've just tryed to write unsigned in32, but it does not understand
    > 'unsogned'... But i need variable to be unsigned, because the max
    > value = 4000000000... So, how can i solve this probleme???

  • Eval Formula Node variable names

    I am using the Evaluate Formula node to allow programatic changes to formula
    in my data acquisiiton VI. Has anyone built any code to enable using full
    descriptive names as variables, instead of the a0 to z9 that this VI limits
    you to?

    You can replace full decriptive names with short names like a0...z9 using Substitute Variables.vi, which you will find at 'Mathmatics'->'Formula'->'Advanced Formula Analysis'.

  • BPEL Variable Assign Problem

    I had developed a Web Services with 2 methods:
    1, return XML data in string datatype
    2. return XML data in Element
    Both are work fine in normal web services invocation. However, when I try to invoke them in BPEL, I got trouble on them.
    For Method 1, I can succeed to call the web services and got the data back, but when I try to assign the XML to other variable (use the result xml xsd to create). It only assigned the whole XML data into the first element of XML such that I cannot further process the data by transformation.
    For Method 2, the BPEL enginee failure on compile the project as the enginee reported cannot regonize the "xsd:any" datatype in the invoking web services.
    any guys have idea about it? Thanks

    Hi,
    i had some problems too using xsd:any in the past.
    Check out xsd:anyType.
    A good article on this topic is:
    http://java.sun.com/developer/technicalArticles/xml/jaxrpcpatterns/index.html
    Greets Jens

  • Formula node forbid to run VI when undefined variable is used

    On all LabVIEW version, we can use Formula node to evaluate mathematical formulas.
    We can define input and output variable freely and calculate using some variety of formula.
    But when we use undefined variable as output, can execute VIs with no errors.
    We think it is a problem because when programmer makes a typo, they cannot notice the mistake.
    When undefined variable is used as output variable, LabVIEW should forbid to run VI.

    I think you are going to get the same (or similar) answers than to my suggestion(s) to make VI outputs potentially "required" and the same for some functions (built-in VIs):
    http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Allow-required-outputs-in-VIs/idc-p/3157058
    http://forums.ni.com/t5/LabVIEW-Idea-Exchange/quot-Function-terminal-not-connected-quot-detection-plus/idi-p/1858573
    In general, I agree with you, there is a potential for problems. Not really for the reason you are mentioning, because a typo will break the VI (unless you have two output variables with very similar names - unlike in your example - such as y and y0). But it could make for some frustrating debugging session.

  • Formula node output variable

    I have a formula node with an output variable. When i run my program the first time the output is correct. But when i run it after that, only the previous output value is displayed, the variable is not refreshing. It seems as if the value is copied into the memory and is not being updated. Is there a property for the output variable that must be changed?

    The formula node should update the output each time it is run. There is no property node for the ouputs.
    Ensure that (1) your inputs are actually changing as you expect - use a probe to confirm and (2) that the indicator you are looking at is wired to the output correctly.
    Post an example of the problem you're seeing if you still have a problem
    Tim

  • Formula node uotput variable

    If i use two different formula nodes with the same output and input variable names will the variables (scope) be the same? In the first formula node i define a variabe "int32 first ==0" then in a seperate node embedded in a for loop structure I write " if(first==0) first = chan;". That way the variable "first" is set equal to "chan" only once through all acquisitions of the for loop b/c "first " only equals 0 at the beginning of the loop. My problem is that after running the program more then once the value of "first" remains the same regardless of the new value of "chan".

    I believe that the variables are local to the formula nodes themselves.
    Therefore, in your first formula node, first is set to 0. In the second, if you don't define an initial value, it is assumed zero. So the first time through, it will get set to the value of chan. But the second time through, it already equals chan in the second formula node (not reset by the first formula node--they are separate variables). Therefore, it will never go to a new value of chan until it is reset to 0.
    Mark

  • 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

  • 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.

  • 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

  • How to difine global variable in Formula node?

    I want to access the same vailable in different formula nodes, so I need to define a global or external vailables? How can I do this?

    Formula Nodes are distinct environments from each other.  You will have to define the global constant in each node.  Or make it a variable and wire  your values to the variable input node on each of the formula nodes.

  • Extended precision variable declaratio​n in formula node?

    I'm looking for a way to define my variables inside my formula node as extended precision but everytime I attempt this, I get an error.  To my understanding, the declaration should be "long double" but it does not seem to work.  Anyone have any ideas?
    Greycat

    Thanks Dennis ... I guess sometimes it seems quicker to ask instead of looking... but then I found what you were referencing very quickly.  Just being lazy I suppose!!!  Anyway, thanks for the help.
    Greycat

  • 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

  • Static variable in Formula Node

    Hi,
    How do I declare and use a static int variable in a formula node?

    Hi splee,
                   You can look at Formulat node Syntax
    Thanks as kudos only

Maybe you are looking for

  • Text Import Options Menu Box

    I recently created a deck of cards in Illustrator for a design show. All the elements were created in Illustrator CS4 in different files. I started a new file and put the cards together printed and saved my file as usual. a week later I tried to open

  • Why are Symbian 'smartphones' not as smart as thei...

    I used to have a Nokia 6230i, which I was really pleased with – the operating system (S40) was pretty much a perfected evolution from what I used to have on my 5140, and before that, the 5210. Recently I was offered an 'upgrade' to the 6120 classic,

  • Upload interactive form and access field values in WD component

    Hi Experts, I want to upload a prefilled  interactive adobe form in my webdynpro component and then I want to read the values filled in the form in my webdynpro component. I don't want to display the interactive form in the WD component. Just need to

  • Pdf file stored as BLOB data type on Oracle

    I store PDF file as BLOB data type on Oracle. There are cases where I get multiple records from the database, that means I get multiple PDF files. They have to be merged and displayed on the web page. I tried CFContent which can display only one PDF

  • Cancelling Inspection Lots - In Process Lots 03 origin

    Hi, I have recently deployed the QM module of ECC 6 to interact with a LIMS system via QM-IDI interface as part of an overall ECC 6 implementation. I generate inspection lots in the following scenarios: 1. Goods Receipt from Purchase Orders 2. In pro