When is best to use a formula node?

Hello:
I just started wondering when would be a good situation to use a formula node??. It's just to save space in the diagram if there's the need to create a complex arithmetic operation?? Wouldn't it be better to just use G??
Robst - CLD
Using LabVIEW since version 7.0

The only time I use a Formula Node is when I need to enter an equation (which is not very often).  Here's a VI I wrote just the other day that was simply faster to write, and probably easier to understand mathematically, than attempting to wire up the same thing.
-D
Message Edited by Darren on 02-09-2006 01:32 PM
Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman
Attachments:
formula_node.jpg ‏44 KB

Similar Messages

  • Can I use a formula node to start the execution of a case structure?

    Hi,
    I am working on editing a VI to make it much easier to understand (for colleagues and non LV users). For one reason or another, the VI's creators did not fully make use of the power of case structures and other structure types. In the application we need it for, the instrument cycles and repeats measurements on several objects. We are interested in measuring the motor currents for several motors in the system. As it stands now, for each sample object's run, there is a separate sub-vi diagram which displays its waveform trace and several indicators such as max current, time at max, etc. That code was contained within a T/F case structure and copied and pasted 20 plus times.... Obviously the vi became extrememly cluttered and needed a huge screen to see. The trigger for the current case structures is an EQUALS comparison between one input (which is the sample object counter; and this part I will likely leave unchanged since it makes a lot of sense already) and a constant which was defined 1 through 20+ for case. 
    I have since made one case structure and 20+ instances of that case and have labeled them (at the top selection box near the detent arrows) "1", "2", 3, etc. I am wondering if I can use a formula node to act as the "trigger" which sets each case structure running? I believe that a simple IF statement should work. Please see a snippet of my attempt at making this in C below.
    For the node, I defined X as the input and Y as the output. The input to the node, X, is connected to the sample object counter. The output, Y, is connected to the case selector of the case structure. My attempt at the code is below:
    int32 y
    For(x == 1)
       y = "1";
     For(x == 2)
       y = "2";
    etc, etc.
    Is that above code snippet correct? Do i need something like "ENDIF" or "end if" at the end? Does "y" have to be defined as "int32" or can it be something else?
    Thanks for the help!

    Is your formula node doing anything else besides what is shown?
    Why don't you just wire the value that is going into it at X directly into the selector of the case structure?
    Attachments:
    Example_VI_BD.png ‏2 KB

  • Using the Formula Node for PDA

    I get a compile error when I use C code inside the formula node. Is it possible to use C Code inside the formula node for PDA applications? Do I have to include any file while building the executable for the PDA

    Ok, I was able to successfully build an executable file without error. I attached the screen shots of your program in execution. Does this look like the desired result?
    I'm confused as to why I can build and run the program on my machine. I have LabVIEW 7.0 and Windows XP. What version of Windows and LabVIEW are you using? Also, are you getting the error window when you try to build an executable or when you attempt to run the VIs within LabVIEW?
    Regards,
    -Joe-
    Attachments:
    tutor.JPG ‏100 KB
    tutor2.JPG ‏122 KB
    detector.JPG ‏46 KB

  • How to use matlab program in formula node in labview?

    hi,
    i've got one equation of voltage regulation. so i did create program for that in matlab.and want to use it in formula node in labview.but i don't know how to do that.can someone please help me for that?
    regards
    bhavin

    If you have already written Matlab code it is easier to import it straight into a Mathscript node. If you use a Formula node you need to translate m- syntax to c-syntax which may take longer. Note that the Mathscript node
    may not support all the functions you used in Matlab so you may need to replace them with native LabVIEW functions. If you want to add inputs/outputs in your program you can just right-click on the border of the node to do that.
    These structures can be on the block diagram under Programming>> Structures.
    KostasB
    NI UK Applications Engineering
    Message Edited by KostasB on 05-28-2008 08:39 AM
    Attachments:
    mathscript-form node1.PNG ‏8 KB

  • Formula node- using C

    Hi there,
    I need to create a vector and for that I am using the formula node. I am doing that in C ( in which I really am a beginner) whereas in MATLAB the program some time runs some time it does not.
    Attached is the program,  the error list says:
     Error on line 3 is marked by a '#' character: "  int32  j; double# Rv[14]; Iv[14]; for "
    Can anyone help?
    thank you in advance
    Solved!
    Go to Solution.
    Attachments:
    sum.vi ‏8 KB

    You have 2 syntax errors on that line.  The proper term is not double but float64.  And separate the two arrays with a comma and not the end of statement semicolon.
    Make it look like this and the broken run arrow goes away.
    float64 Rv[14], Iv[14];

  • 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: Else if

    I want to use a formula node to make my code smaller.
    I'm comparing a sensor value and depending on the value i have 3 options.
    At the moment i get the error that labview thinks my 'Else if ' is a variabel instead of a command.
    am i doing something wrong? another option is to use a Case-structure but this code is allready in a case so i don't know if this could give trouble.
    thanks,
    Lars
    Attachments:
    Formula Node Error.png ‏53 KB

    Hi James,
    when you want to mix datatypes you go with an 1D array of cluster and unbundle instead of the 2nd IndexArray…
    Waiting for Christian to post with 1 compare function using a complex number that makes even your look big and a Rube
    My own idea:
    Just one comparison…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Formula node bitwise OR has a bug?

    Hello everyone,
    I am trying to do a bitwise OR with 32 bits in an formula node. It seems that the OR operation produces unexpected results if the most significant bit is set. For example if I do:
    0x00000000 OR 0xffffffff I would expect 0xffffffff. Instead I get 0x80000000. In binary this looks like:
    00000000000000000000000000000000  OR
    11111111111111111111111111111111  EQUALS
    10000000000000000000000000000000
    Please see the attached minimal example for comparison of some example values. The output with using blocks is exactly the one I would expect and is also included in the example.
    I am using Labview Version 14.0f1 on Windows 7 Professional.
    This might also be in connection with the following currently unresolved bug:
    48016
    3P7CBB4Q
    http://www.ni.com/product-documentation/52150/en/#48016_by_Category
    However that that bug is for unsigned int32 and the suggested workaround is to use signed 32 bit integer, which nevertheless fails in the provided example code.
    If someone could have a look and tell me if this is a bug or if I am misunderstanding somtheing that would be great. I am already starting to go crazy.
    Best regards and thanks in advance
    Saali
    Attachments:
    Minimal_Bug_example.vi ‏10 KB

    No, actually this bug is different from what is documented.The documented bug happens with uInt32 and the documentation specifically suggests to use Int32 as a workaround for the known bug:
    "2. Use signed 32-bit integers instead of unsigned 32-bit integers in the formula node."
    However this is exactly what fails in my case when I use OR. I thought this might be some valuable information for the people trying to fix that bug. (Which seems to be hard to find, as it has been around so long and screws up very basic operations.)
    It might also be that NI does not really care for that bug because most people don't use the formula node for basic bit arithmetic. Anyway, I just wanted to put the information out somewhere for the next person who has that problem to find. I  guess the lesson I learned from this conversation is don't trust the formual node to much for doing low-level bit stuff...
    Best regards
    Saali

  • Array output from formula node with input variable as array size

    Hi,
    I have created a formula node with an array output called al, but I get an error "you have connected a scalar type to an array with that type".
    I declare the output as follows..
    float64 al[len_as];
    where len_as is an scalar input to the formula node.
    It only works when I put a number as.
    float64 al[5];
    ,but I don't know beforehand how many elements I need, so I cannot use this.
    Please help! This is so stupid.
    Thanks

    Don't define your array in your formula node.
    Initialize the array as the size you want and pass it in as an input into the formula node.
    Are you sure you even need to use a formula node?  Can you implement your formula using all native LabVIEW functions?
    Message Edited by Ravens Fan on 10-07-2009 11:51 PM
    Attachments:
    Example_VI_BD.png ‏3 KB

  • Cannot Access Shortcut Menu for Adding Input/Output in Formula Node

    This is a wierd problem. I cannot access the shortcut menu in formula node. I right click the border, nothing happens. Anyone run into this before? Is there any other way to add inputs and outputs?
    I am running Vision Builder AI and want to use a formula node in my calculator tool.
    Solved!
    Go to Solution.

    As the saying goes, "when you hear hoofbeats, think horses and not zebras".  Let's get a few things out of the way.
    Is the VI in edit mode?
    Is autotool on?
    Drop a fresh FN on a New VI and try it again.
    The only other way I know to add/remove inputs is scripting, let's not go there.
    I have had a few issues with context menus, very few which persisted past a LV and/or computer restart, so I won't rule out a zebra just yet.

  • PV cell equation error in formula node

    Hi! I am currently building a PV system simulation in LabVIEW with maximum power point tracking, and I'm trying to make this VI work using the formula node but I can't run it due to an "array indexing problem". The VI is based on the LabVIEW's toolkit for IV characterization using the equation for the PV cell current. I added the XY graph to graph the current and voltage from the equation. I'm really new to LabVIEW, so any suggestion will be greatly appreciated. I  have attached the VI I'm building.
    Solved!
    Go to Solution.
    Attachments:
    eqn_based.vi ‏11 KB

    Hi spectre,
    the formula not cannot calc with arrays the way LabVIEW does:
    (Check for correct computation against given formula...)
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Array init in formula node

    I would like to cut and past in a list of comma seperated numbers and initialize an array of float32.  Something like this would work in C.
    float32 data[5] = {0,1,2,3,4};
    Labview does not like this syntax when using a formula node.  I have to do the following instead
    float32 data[5];
    data[0] = 0;
    data[1] = 1;
    What is the correct syntax for initializing arrays in lavview using a formula node.  I would be amazed if Labview does not have this basic functionality.
    thanks in advance
    jim bob

    labview_noob wrote:
    ttt, no one?
    Probably because we are using LabVIEW to get away from text based code.
    (I don't know if there is a syntax for the formula node, it's been too long. )
    If you have LabVIEW 8.0 or higher, you can use matlab like sytax in a mathscript node. Of course you could just paste your list into a string constant and get the values with "spreadsheet string to array".
    Message Edited by altenbach on 07-25-2007 12:24 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ArrayFormula.png ‏13 KB

  • Formula Node on PDA

    I'm using a formula node on Labview PDA and i have problem regarding multiplying double variable. If I multiply integer number (as double) everithing is OK.
    example 45*2 the results is 90.0
    If I multiply 2 fractional number the solution is wrong:
    example 45*2.5 the results is 112.0705032 and there is some strange features inserting the values inside the number control.
    I Attach the source code and the PDA executable (to convert Lat, Long coord. to UTM) in order to undestand the problem. I you remember that the same code work perfectly if the execution target is Labview for Windows.
    Best Regards
    Sergio Zanoli
    Attachments:
    Geo2UTM_standalone.vi ‏47 KB

    I checked the feature using a simple application on the PDA emulator and I could not replicate the error.
    I have attached the VI i worked with ..check if this helps.
    Attachments:
    Untitled.exe ‏332 KB

  • Formula Node - Embedded If statements

    Greetings,
    I would like to "embed" an if statement within an if statement using a formula node. The structure is as follows:
    if(x == y/2)
     y = 0;
     if(a < c && a > d)
      a = a - 1;
    For some reason when I run my code and both of the criteria for my if statments are true the formula node does not execute the a = a - 1.
    For example:
    a = -0.5
    c = 0
    d = -1
    Then 'a' should decrement to -1.5. However, when I run my code 'y' will reset to zero but 'a' will not decrement.
    Am I allowed to embed if statements within if statement using a formula node.
    Also, I am aware that I can accomplish this using other means but I would really prefer to use the formula node.
    Any help is greatly appreciated.
    Thanks.

    Threre is no problem with the formula as posted, you get -1.5 at the "a output" as expected.
    Of course if you want the original "a input" control to be modified with the new value, you would need to write the "a output" to it via a local variable.
    Still, I agree with GerdW that you are opening a can of worms here comparing DBLs for equality. This can very easily lead to unexpected results!
    Message Edited by altenbach on 03-16-2008 05:03 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    embeddedIF.vi ‏11 KB
    embeddedIF.png ‏11 KB

  • Hi, formula node

    Hi,
    I am confused now about the formula node. The labview begins with 0, so the angleP is from 0-1023, however, in the Mathscript the index begins with 1. So I should use index k not k-1. But when I use angleP(k) in the Mathscript, the errors says the indexs are out of bounds for the variable you specified cause angleP is from 0-1023.  So that is the problem--how to deal with the different index range problem.
    I tried to finish this mathematical problem in formula node but there is still error but I do not know where it is wrong. Can you help me to point out the problem in the formula node. Thanks.
    Huihui
    Attachments:
    21.vi ‏9 KB

    Hi,
    Thanks for your reply.
    The attach file 1 is the vi with Mathscript node. The quetion here is the Mathscript begins with 0 while the labview begins with 1. So I do not know how to get the first signal from angleP in the Mathcript. So I tried to use the formula node but there are still some errors. I changed the array expression with square bracket, see the attached file 2. The input signal is from 0-1023.
    For the problem of operating 1D array in 2D, I think it is ok cause I wanna produce a matrix with m 1D array with the length of 1024, m is the number of the rows and k is the number of the signal per row.
    What I wanna do is to get the magnitude and phase signal then do some mathematical calculation to get the real and imaginary parts.
    Thanks for your sincere help. I notcie that you are the kind person who replied my question before. 
    Huihui 
    Attachments:
    1.vi ‏327 KB
    21.vi ‏9 KB

Maybe you are looking for

  • Where is line item display order maintianed in document?

    Hello, I am creating a Sales Order using DIAPI. It has 5 line items. The LineNum value is sequencial starting from 0. If I open the order created using DIAPI in SBO UI and insert in the second row the LineNum sequence is broken.This item is shown wit

  • Solution Manager 3.2 Installation

    Hi, I am installing Solution Manager 3.2 on Windows Server 2003 and using MS SQL database.  During the installation of using SAPInst, the installation program asked for a KERNEL DVD location (a Label.ASC file).  I found one in my DVD/CD set which is

  • Is there Assisted Software for visually imparied Mac users?

    I was recently extolling the virtues and reliability of Mac to a visually imparied (blind) friend of mine. She is researching assisted software compatability with various devices and she has said there there does not appear to be such for Mac.

  • Displaying image inside iframe

    In the servlet,I have an image which is retrieved from database using BufferedOutputStream.I would like to display the same in my JSP iframe. <iframe name = "myInlineFrame" src ="SiServlet" width="100%" height="300" > </iframe> view The above code op

  • How DO I Stop The NFL

    I DL the NFL app during the preseason and then when the season started they wanted to start charging for it so I deleted. I keep getting the morning text message even thought I have TEXT to 4635 STOP and they just keep sending them, Does anyone know