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

Similar Messages

  • 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

  • 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

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

  • 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

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

  • 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

  • "Square" function in formula node

    The square(x) function in the formula node does not seem to work, can someone confirm, or give me some example syntax?
    LabVIEW 6.1, Win2K
    Certified LabVIEW Architect

    Hi Nadav, Sacha and Martin
    1. The Square Function is not Avilable in Base Package.
    2. The Square Function will not work in the Formula node. There are differences in using the Formula Node and Mathematics Parser. Please Look at attached file in .rtf format. This is Just a Copy of LV6.1 Help
    3. To Implement A Square(x) function Use "Eval Formula Node.vi" or Square(x) function as defined above.
    Please find Attached two implementations of Square(x) and differences as promised.
    Good Luck!!
    Mache
    Good Luck!
    Mache
    Attachments:
    Square_Function.vi ‏16 KB
    Square_Fucntion_2.vi ‏26 KB
    Differences_Between_the_Parser_in_the_Mathematics_VIs_and_the_Formula_Node.rtf ‏16 KB

  • Formula Node Calculation Issues

    I'm trying to make an array where the output is defined by the formula 25*(2^x) where x is the input variable, with integer iterations from 0 to 7.  To do this, I made an formula node and put it in a for loop.  Unfortunately the (^) symbol is not working right for the calculation.  I tested it simply with x^2 and this did not work, while having x*x returned the correct values.  Instead of outputting the correct values, it outputs seemingly random integers.  Anyone know why?  I am new to this software so I apologize if this this a common issue but I could not find help anywhere else.
    Solved!
    Go to Solution.

    If you use the numeric primitives rather than a formula node, craziness can be avoided (well, sometimes).
    Lynn

  • Atan2 equivalent in a Formula Node?

    Does anyone have an atan2 (2-input inverse arctangent) equivalent for use in a Formula Node? I was surprised to see that such a common function wasn't supported in Formula Nodes. Without it, my easily readable Formula Node equations get junked and become a nightmare of LabVIEW math symbols. Is there a way to call the atan2 VI (or any other VI for that matter) from within a Formula Node?

    Hello,
    You are correct, this function is not supported in Formula Nodes, and there is not a way to call VIs from formula nodes. However, the below solution might be what you need:
    Is this the correct definition of atan2:
    if y = atan2(a,b), then tan(y) = (a/b)
    If so, could we define a and b, and use the formula node function atan(a/b)? This may not be the most elegant solution, but it seems like it would do the trick with minimal headache. I attached a VI showing this idea.
    Hope this helps!
    Liz Fausak
    National Instruments
    Attachments:
    atan2FNode.vi ‏10 KB
    61atan2FNode.vi ‏10 KB
    60atan2FNode.vi ‏8 KB

  • 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

  • How to set pre-defined constants via FXML

    Does anymode know how to set a pre-defined constant like javafx.scene.control.Control.USE_PREF_SIZE via FXML when you create a node?
    Instead of using a fixed value like this
       <Label text="Last Name:" minWidth="100" />I would like to use one of the predefined sentinel values like this.
       <Label text="Last Name:" minWidth="USE_PREF_SIZE" />The above example does not seem to work and I have the feeling that this is currently not possible at all.

    How did you get that working? When I use the following file I only get a warning that "javafx" is not defined.
    Defining var A seems to work but it fails on var B. It seems to be impossible to access anything outside the
    java... hierarchy. Is there anything else you have to define?
    <?xml version="1.0" encoding="UTF-8" ?>
    <?language javascript?>
    <?import javafx.scene.*?>
    <?import javafx.scene.layout.*?>
    <?import javafx.scene.control.*?>
    <StackPane xmlns:fx="http://javafx.com/fxml" >
         <fx:script>
              var A = java.awt.Component.BOTTOM_ALIGNMENT;
              var B = javafx.scene.control.Control.USE_PREF_SIZE;
         </fx:script>
    </StackPane >   

Maybe you are looking for

  • Calling a REST webservice with pl/sql and parse XML

    Hi I hope someone is able to help me with this task. I'm newbie with Oracle APEX, have not developed advanced applications yet. A few days ago I installed one of the package application with customer and order. I want to integrate with online shoppin

  • Can't copy-paste images from Noteshelf in iOS6

    Hi, I use an app called Noteshelf (v7.0). In iOS5, I was able to copy-paste pictures from Noteshelf into other apps, such as Keynote (v1.7.1) or in an email. However, since I upgraded to iOS6, this doesn't work anymore. As the versions of Noteshelf a

  • Aperture 3 and Mobile User Accounts: Don't even think about it

    Hi all. This is more a warning to other with a similar setup than anything else. I use both a desktop mac and a portable. As so, and since I have a Mac Mini Server, my user is what Apple calls a "Mobile User". Basically what it does is this: it allow

  • Consumer Proxy Time Account ESS Timesheet

    Hi Folks, On the ESS timesheet, we have been facing a recurring Error message saying: "System error: No receiver could be determined". I've been looking over the whole web, found some hints about how to make this message disappear, and it seems that

  • Can I change the canvas colour on pages?

    I was trying to create a basic graphic, when I imported it to my chosen programme it had a white backround around the edge. I was wondering wether I could change the background from white to transpatent.