CPU efficiency​: formula node or Labview generic operations​?

Hello,
 ihave a big program which requires to calculate a lot of analog ramps with 10us step size, for a time of about 20sec. it leads to a calculation time wich reaches fast the few seconds!
i use a formula node in which the ramp function is defined. i could use all normal labview operations if the operation appear to be faster.
i have looked at the usual memory allocations, and could not find a big flaw
... And here's where I keep assorted lengths of wires...

Don't forget that there is also a "ramp pattern" tool in the signal generation palette.
I always like the experimental approach: The best advice would be to wire up a few alternative version and compare speed and memory use in a small benchmarking application.
How many such ramps are in memory at any given time? Does your code generate extra data copies? What is the datatype? An 20M Sample ramp of DBL is 160MB!
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • 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

  • Applying delay in formula node in labview

    hi every bod
    Solved!
    Go to Solution.

    If you have not done so yet, please go through the free on-line tutorials about LabVIEW.
    Rarely is the formula node the most appropriate way to write code in LV.  The native LV constructs may be a bit awkward at first for someone with a text-based programming background.  Once you learn to use dataflow and to recognize the functions by their icons, you may find that graphical programming can be both powerful and easy to read.  
    For delays use the Wait(ms) function found in the Timing palette.  If you need a delay in the middle of a calculation (which seems unlikely), you may need to split the calculation into two parts and put the Wait (ms) between the parts.  See the image below for one way to do this without any formula nodes.
    Lynn

  • Bug in Formula node under LabVIEW 2010

    appendix is my test project.
    there is a test.vi in the project.  The test.vi contains only a case structure with 5 SAME subdiagrams. Each subdiagram contains a formula mode. The formula code does some calculation with an 2d array of double.
    If i run the test.vi under LabVIEW 2010(or SP1), it may cause  LabVIEW 2010 corrupt occasionally. If I build application form the test.vi, and run the application ,the application will definitely corrupt.
    if I delete one subdiagram of the case structure , the test.vi and the application both run well.
    however, the same project works well under LabVIEW 2009.
    so is it a bug with LabVIEW 2010?
    Attachments:
    Test.zip ‏7 KB

    'corrupt' means the program exit unexpectedly without any warning or error message. it just disappeared and you can't find it in the 'process' tab of windows task manager after that.
    If LabVIEW corrupted, once i reopened it, there may be a error message dialog pop-uped before the LabVIEW interface appeared. The dialog said something wrong with 'undo.cpp'. I zipped the failure long to the appendix. I can't find any other error or warning message from LabVIEW or Windows ( I checked the Windows Event Viewer).
    If the built exe corrupted, There isn't any message for  LabVIEW or Windows neither.
    I tested the project on my own laptop with Windows XP(SP3) Chinese Version and NI PXI-8810 with Windows XP(SP3) English Version which is my target machine.
    Appendix also contain a exe build in my laptop. If I run the exe file, once I click the run button , it will corrupt. I wonder if it works the same on your computer.
    Thanks for your concern.
    Attachments:
    lvlog2011-05-13-23-23-35.zip ‏150 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

  • How do I determine array size in a formula node

    I am feeding an array into a formula node to perform an operation on. However the size of the array can be an arbitrary size. How can I determine its size to use for iterating through a for loop?
    I suppose that I could add another input that is fed with the array size from the array palate but I would like to know if it can be done inside the formula node itself.

    Your own advice is the only and best one.
    greetings from the Netherlands

  • 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

  • HELP: Run-time array dimension in LabVIEW formula node

    I need to dimension an array at run time within a formula node as follows:
    int32 i,N;
    N = sizeOfDim(inputArray,0);
    float64 outputArray[N];
    for (i = 0; i outputArray[i] = myfunction(inputArray[i]);
    However, LabVIEW complains "Formula Node: index list expected". On the
    other hand, if I say
    float64 outputArray[1000];
    LabVIEW is perfectly happy. But that's not what I need to do! Is there
    an alternative
    way of accomplishing my goal?
    BTW, I've tried calculating N outside the formula node and then
    presenting it as
    an input with the same results. I've got a bad feeling that run time
    array dimensioning
    just isn't allowed.
    TIA,
    Hugh

    Can't you just use the Initialize Array function outside the formula node and pass that instead?

  • Formula Node & Array Operations

    Hello,
    I'm trying to use the formula node to subtract the previous term from the current term (or the next term minus the current term), but I can't figure out how to
    use the array index to do it. 
    I've something along the lines of z_array[i+1]-z_array[i], but it only returns the difference of i+1-i....
    Please see the attached picture.
    Thank you,
    Solved!
    Go to Solution.
    Attachments:
    Formula node.JPG ‏23 KB

    That would be so easy to do in pure Lv code.
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • Labview. Writing an equation inside a formula node

    How would I write this equation chl= (4.9467*mv) - 0.3239 inside a formula node? Thanks
    Solved!
    Go to Solution.

    You don't even need a formula node. An expression node would suffice.
    LabVIEW Champion . Do more with less code and in less time .

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

  • 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

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

  • File Handling in formula node

    Hello All,
    I am trying to open a file and write some data to a file within the formula node. A declaration like
    file *in;
    produces this error:
    Formula Node:undefined variable.
    Error on line 1 is marked by a '#' character: "file# *out;"
    How does one do file I/O operations within the formula node?
    Thanks,
    KB

    Hello KB,
    it seems you are trying to write a LabView program by
    inserting C-code into a formula node... That's not the way it should be.
    As far as I know there is no way to open a file inside the formula node. (It's a "formula" node!) So you have to open the file with LabView for reading and/or writing. Use your prefered subVi from the file palette. Perhaps you have to convert the data to a format suitable for your formula node (like string to U8-array).
    In my experience it's better to use Labview-code instead of the formula node. In my programs a formula node was always slower than Labview code. So you should think about converting the C-style code to Labview.
    Best regards,
    GerdW
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

Maybe you are looking for

  • Can't message or FaceTime between ipad2 and iPod touch with same apple id

    Posted this on the iPad page also.  I got a ipad2, my husband loves it but too big and bulky, we get him the iPod touch tonight.  I set his up using the same apple id because we truly want to share everything, BUT want to be able to message and FaceT

  • PS Retraction from BPS

    Hi All, I am using the UPB_CI_PUSHBACK_PR function module to retract data to Project Systems. The goal is to move the PLAN data from BPS by WBS into PS transaction CJ40. I have followed the guidance of the well written 'BPS Retraction for Cost Cener

  • Time Capsule and Airport Express as separate network on route acting slow

    Wonder if anyone has any thoughts on this... I have a Time Capsule (current gen) with an Airport Express N (last gen) which I would like to connect to my current router and create a network that is separate from the router's own wireless network. Cur

  • Field that is not visible in my editing screen but showing in web preview. How to remove it?

    Hi Support, When I preview my form in web preview, I am seeing a field that is not visible in my editing screen. It starts at the left margin of the web preview and runs off the edge of the right side of the page. The form is also crashing when I att

  • Going live

    Hi all, I just wanted to ask you how do you upload the open items and starting account balances into the system. Thanks for your replies. D.