2pi constant in formula node

How do you use the 2pi constant inside a formula node? pi(2) and 2*pi do not work. Using labview 6i.

Sorry, I forgot to attach the VI.
Attachments:
2xPI.vi ‏7 KB

Similar Messages

  • Defining constants in formula node

    I apologize for the seemingly elementary level of this question, but nonetheless it continues to puzzle me. I am trying to enter several constants in a formula node and continually get the error message 'undefined variable' for the first defined. An example is shown below for the statement: 'CO = 192600;'
    Error on line 1 is marked by a '#' character: "CO# = 192600;
    I feel there is a problem with the way i am trying to define the constant (CO). Am I missing something? Since there are so many constants, I prefer to define the constants within the node instead of inputing on the border. Thanks in advance.
    Philip

    Alternatively, it is sufficient if you create an output terminal named CO in this case. No need to connect it, of course.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FormulaNode.gif ‏3 KB

  • NaN & Inf in Formula node

    Are there no NaN, Inf, -Inf constants in formula nodes? Typing for example "x = NaN;" doesn't work.
    I can generate them with 0/0, 1/0, -1/0 but it's not very elegant...

    If you want to put Inf or Nan in X and use it in another formula, you can do this.
    If you just want to put constants in X indicator or array, just wire them.
    Or maybe am I missing something ? what do you want to do ?
    hope this helps
    Message Edité par JDlabview le 06-17-2010 10:41 AM
    J.D.
    French Labview beginner
    N'oubliez pas de complimenter les bonnes réponses - Don't forget Kudos for good answers

  • 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

  • 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

  • Parenthesis in formula node

    I'm using the formula node and it appears that parenthesis don't work. Is this correct? What is the order of operations?
    The Formula Node Syntax page in the help is extremely brief and sparse, bordering on useless for anyone that doesn't already now what is going on. Is there a more thorough description of the Syntax anywhere?

    Thanks Dennis,
    The error is just an incorrect calculation.
    I put together a simple node and parenthesis did work. So something else must be amiss. I stripped down my VI and equation and made two formula nodes implementing the same equation with and without parenthesis. One gives an exponential decreasing curve, the other a constant array. Where is the error?
    Attachments:
    parenth_ex.vi ‏49 KB

  • Units with formula node

    hi,
    I have a little problem with the formula node. I am trying to multiply h (Planck constant) by c (speed of light), already defined in Labview. But i can't link them to the entries of a formula node because of the units.
    By the way, i have another problem which is that if I want to write 6.63E-34 for h, i have an error and i think that it comes from "E".
    Do you have any ideas ?
    Thank you for your time!
    Solved!
    Go to Solution.

    You can use the Convert Unit function to get a unitless number. You just need to enter the units of the constant in the Convert Unit function. For example, for Planck's constant:
    By the way, what is it that you're doing that you believe you need to use a formula node as opposed to just coding it in LabVIEW? Just curious.
    Message Edited by smercurio_fc on 07-01-2009 11:24 AM
    Attachments:
    Example_VI.png ‏3 KB

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

  • Shift Register while Indexing Arrays in Formula Node

    Hello, 
    I am having trouble using the formula node while indexing my two arrays.  I keep getting "NaN" for my output array. I believe the problem lies within my shift register.  My guess is that for the first calculation there is not a PreviousAngle so that is why it is giving me "NaN."  For the first index I would like the value of the PreviousAngle to be 0. I am new to LabView and unsure what to do.
    Thanks!
    Christian Seymour
    Solved!
    Go to Solution.
    Attachments:
    Complementary Filter.vi ‏21 KB

    The shift register should contain 0 by default since you are using a double [if uninitalized, the shfit register takes the default value of the data type.  In this case, the default Double is 0], but you should explicitly initalize the shift register to a default value in most cases.
    To do so, right click on the "previous angle" shift register and select "Create constant".  This will create a Double value of 0 to fill in the register for the first calculation.
    If you need a number other than 0 to start, you can just change this constant.
    **Note:  This is a good habit to have.  Shift registers retain value as long as the VI is in memory.  So if you run this more than once, it will have the value from the last execution automatically!  This is usually unintended behavior for new LabVIEW users -- however you can sometimes take advantage of this feature in some applications and make it intended behavior
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    If someone helped you out, please select their post as the solution and/or give them Kudos!

  • Sin(wt) function in formula node

    How to create a function in formula node and plot it for Vo vs t
    V = Vo * sin(wt)
    with frequency = 50Hz
    Vo = -350 to 350
    Nghtcwrlr
    ********************Kudos are alwayzz Welcome !! ******************

    Why a formula node? Just use plain LabVIEW!!!
    Your specifications seem odd and incomplete. What is the range of t you want? "Vo vs t" only makes sense if V=constant unless you want a 3D or intensity graph: V(Vo, t).
    Please clarify!
    LabVIEW Champion . Do more with less code and in less time .

  • 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

  • Dead loop in formula node

    Hi,
    I have encountered the following problem in a formula node. Everything seems simple and right. But there is no output and the loop goes on forever. The sizes of both input arrays are the same. Need your advice. Thanks.
    Rut
    Attachments:
    Algorithm.vi ‏11 KB

    Look, I am far out on a limb here, because I am not a C programmer. Whatever you're doing would make more sense from a FORTRAN point of view.
    The LabVIEW formula node uses BNF notation (check the help), which is in many ways C like. So the syntax for a FOR loop is:
    for ( InitExpression ; CondExpression ; LoopExpression ) Statement
    This means the loop iterates until "CondExpression" is true.
    Do a google search on "C For loop" and you might find for example pages like:
    http://www.hitmill.com/programming/cpp/forLoop.htm
    http://www.geocities.com/learnprogramming123/Clesson8Beginner.htm
    Your condExpression is "n1-1", which, during the execution of the node is a constant. For example if you array size is 50, n1-1=49, FOREVER! The condition is never true so the loop will never stop.
    I hope somebody more knowledgable will chip in at one point.
    LabVIEW Champion . Do more with less code and in less time .

  • Formula node with global variable

    Hi,
    I am tring to use formula node with global variables as an input and output,
    but this is where I see the SW hangs forever.
    By the way I am a novice to the labview.
    Can some give me hint why this is happening?
    Thank you in advance,
    Do
    Solved!
    Go to Solution.
    Attachments:
    formula_node_wGlobalInputOutput.JPG ‏281 KB

    Well, the first case of the two loops has a direct LabVIEW translation like this:
    However, just because that's the direct translation doesn't mean that's what you should be doing. In the formula node it seems as if you were copying elements from one array to another. Element-wise operation on arrays via loops can be quite inefficient in LabVIEW. Often one can operate in place with arrays, and an operation that would require two loops in a language like C would actually require no loops in LabVIEW. In fact, with the above example, even if you were to use loops, arrays can auto-index for-loops so you don't even need to wire the constants to the N terminals to tell the loop(s) how many times to run.
    Can you describe what you're trying to accomplish? There's likely to be a more natural way to do it in LabVIEW that would require no loops. Have you gone through the tutorials? You can also look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.

  • Formula Node Floor(x) Produces Different Result

    Hi, A search didn't find anything about the Floor(x) function, so... I'm using LabVIEW 6.0.2, and the Floor(x)function in a Formula Node seems to be producing different results depending on previous calculations. I've got the following 2 lines in a Formula Node:
    MSS = Ref / RefDiv;
    MDN = floor(RF / MSS);
    Ref is always 20.0M, RefDiv always 500.0, and for this calcualtion RF is always 1539.4, all numbers Double with 6 digits of precision. I generate an array of frequencies given a start, step, and frequency count. These frequencies then go to a subVI with a Formula Node that calculates the byte values to send to a couple PLLs.
    If Start = 70.1, Step = .025, and Count = 20, at frequency 70.2 the Floor function gives 38.485.
    If Start = 70.0, Step = .025, and Count = 20, at frequency 70.2 the Floor function gives 38.484.
    I've omitted some calc steps here, but I've verified the starting values in the subVI are the same in both cases. Why the result changes I'm hoping someone can tell me...
    Thanks,
    Steve

    I want to thank those involved again for their help. With ideas and hints from others I found a solution without scaling.
    In recap, what had bothered me was it *appeared* like the same subVI was giving correct results one time and incorrect results only randomly. While I understand binary fractional imprecision, I wasn't doing any looped calculations 100+ times or anything.
    I did some more checking though. The problem was indeed introduced by cumulative fractional addition. In this case 10 additions were enought to cause the error. Apparently, floor(71.199_94) produces 72.0. However, using a shift register and constant fraction to add an offset to produce an array introduces enough error in under 10 iterations to be a problem. By the time the loop got to what was supposed to be 72.0, it was actually 71.199_84 or something, enough to throw the floor function. Now I understand why the error occurred, and why it wasn't a problem before.
    I fixed this problem by changing the real frequency number to a I32 before introduction to the formula node. This corrected the error introduced by the fractional addition by forcing 71.199_84 to 72, instead of letting it propagate through the rest of the calculations. And it was a whole lot easier than changing all the VIs to allow scaling! Also, I prefer to know where and why the problem happened, instead of just scaling all my calcualtions. Maybe I can recoginse potential problems in the future.
    My boss wants to go back and look at his program to see if HPVee somehow bypassed the problem or if he did the calculations differently.
    Thanks again for the insight and help,
    Steve

  • Formula node for array

    hi
      i want to convert the values of an array using a different formula for each value in the array.     Can i use formula node for this?    if yes how
    if no then is there any other method except for extracting each one individually and converting?

    kunal227 wrote:
    there are 16 elements in the array and the number remains constant (actually they are temp values acquired by a fieldpoint hardware).
    the formula is a linear conversion (for example y = m*x + C) corresponding to the calibration curve of individual thermocouple connected to the fieldpoint hardware.   every thermocouple has a different calibration curve and hence every element in the array is converted using a different linear formula.
    All you need is an array of [m] and an array of [C], all the same size as your data arrray. No formula node needed.
    (I think that's what mikeporter had in mind above)
    Message Edited by altenbach on 07-24-2007 03:38 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    CorrectedArray.png ‏4 KB

Maybe you are looking for