How to call a subvi to run in background?

i have a timed loop which is gathering data and storing it in an array.  when the array reaches a certain size, i would like to store it to a file while continuing to process new data into the array quickly.  how can i pass the array to a file storage vi from within the loop without preventing the loop from continuing to iterate until the file access is complete?  in other words, i would like to pass the data out of the loop and have the loop continue to run at the same rate while the data is written to a file as a lower priority task.
thanks.
Ben.

Hi Ben,
      ...well, last-things first...
> if i call a subvi with an invoke node, i can set "wait until done" to false.... but then how do i pass the data?
Once you have a VI reference, you can us the "set Control Value" method to hand your array to the dynamically-called sub-VI, however...
What happens if the sub-vi doesn't finish by the time another 2D array is ready? (I know that's not supposed to happen, but what if?)
I think having a queue to which the entire 2D array is written as a single element would be better, and I doubt that launching a sub-vi and passing an array would be any more efficient than writing to an existing queue.  To be honest, I don't know whether the call to the sub-VI will pass the array by value or by reference.  If by value, then a copy is being created - why not create it in a queue?  If by reference, then you have two sections of code writing to the same buffer at the same time - opening the door for data-over-runs.
In the old days, code took a big performance-hit by using Globals this way - frequent writes/reads.  Your application seem to fit a "Producer/Consumer" paradigm - which is routinely implemented using queues.
With that much data, I'd be looking for ways to keep it in binary format for Excel - (LabVIEW uses a conventional binary representation for storing floats) - I'd be surprised if it isn't possible to keep it that way.
If anyone else has ideas to share, I'm happy to step aside.
bs05442 wrote:
here's a little more about my situation, and why i am not using a queue--
i am running two instances of the same dynamometer control application to allow a user to control a pair of dynos for tracked vehicle testing.  each instance of this vi is gathering status and measurement data off a CAN bus.  i want to log this data as well as (in the future) data from other control VIs running on the same computer.  so i set up a global variable to which each vi writes it's measurement data, and i have a logging application periodically (up to 100Hz) capture the status of the entire global as a new row in a 2D floating point array.  because i am adding a couple dozen elements each time the logger cycles, i did not want the performance hit of dynamically resizing the data structure to which i was storing the data, so i predfine the 2d array and then use an integer to store the index of the next row i want to write to.  the problem comes when i fill up the array (64k lines, the most that excel will process from a csv file)--i would like to store it to a file without inturrupting the logging, but the conversion from float to string plus the file access time takes up too much time to handle inside an iteration of my logging loop.  so i'd like to pass the array to another task which would take care of converting and storing it in the background.
i'm afraid if i store the data in a queue, the application might slow down once the queue gets too large, and i don't want to bog down the other control vis that are running on the same machine.  if i call a sub vi to write that data, the current loop iteration does not complete until the file write is done and i miss a few periods of data.  if i want to  use a seperate  loop to monitor the array size and perform the file access, i need to make the array available to both loops, which seems to require making it a hidden control on the front panel.... but then i have to access this large data structure via local variables, which will give me a huge memory hit, right?  so i think what i would really like to do is pass the entire contents of the array off all at once to another vi, then let that vi store the data in the background while the fast loop continues to begin filling up its array again.  if i call a subvi with an invoke node, i can set "wait until done" to false.... but then how do i pass the data?
thanks for any advice...
Ben.
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)

Similar Messages

  • How to DEBUG a function module running in background mode? Please help!

    Hi Experts,
       I am calling a function module in my ABAP code in background module using the following syntax:
      CALL FUNCTION 'YBBC2_CREATE_SNAPSHOT' IN BACKGROUND TASK
              TABLES
                itab_std_format_inv = itab_std_format_inv
                itab_snapshot_inv = itab_snapshot_inv.
            COMMIT WORK.
    If I put the breakpoint in the CALL FUNCTION line and execute the program, the debugger does not take me to the valled function module. This may be because I am running the function module as background task.
    I cannot comment this  "IN BACKGROUND TASK" statement as well since i am debugging in Quality system where I don't have change access.
    So how to DEBUG a function module running in background mode? Please help!
    Thanks
    Gopal

    Hi,
    You could try to use the following trick:
    (1) Put an endless loop into the coding of your function module where you want to start debugging, e.g.
      DATA:
        lx_exit_loop(1)     TYPE c.
      lx_exit_loop = ' '.
      DO.
        IF ( lx_exit_loop = 'X' ).
          EXIT.
        ENDIF.
      ENDDO.
    (2) Call your function module in background task
    (3) Call transaction SM50 and search for the background process.
    (3) Choose from menu Program/Mode -> Program -> Debugging
    Now you the debugger should bring you right to your endless loop. Set lx_loop_exit = 'X' in the debugger and continue (F5 or F6).
    <b>Reward points</b>
    Regards

  • How do i turn off programs running in background with current updated software?

    How do i stop the apps running in background on updated iphone software?

    Double-tap on the Home button. You will see a preview of the app above the actual icon. Slide the preview up to kill it.
    Please get the iPhone User Guide (For iOS 7 Software)Sep 19, 2013 - 23 MB.

  • Speed has slowed to nil  how do i delete all icons running in background?

    speed has slowed to nil. How do I delete all icons running in background?

    To close an app, drag the app up from the multitasking display.
    Double tap the home button and you will see apps lined up going left to right across the screen. Swipe to get to the app that you want to close and then swipe "up" on the app thumbnail to close it.
    this might help as well.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.

  • How to call methods from within run()

    Seems like this must be a common question, but I cannot for the life of me, find the appropriate topic. So apologies ahead of time if this is a repeat.
    I have code like the following:
    public class MainClass implements Runnable {
    public static void main(String args[]) {
    Thread t = new Thread(new MainClass());
    t.start();
    public void run() {
    if (condition)
    doSomethingIntensive();
    else
    doSomethingElseIntensive();
    System.out.println("I want this to print ONLY AFTER the method call finishes, but I'm printed before either 'Intensive' method call completes.");
    private void doSomethingIntensive() {
    System.out.println("I'm never printed because run() ends before execution gets here.");
    return;
    private void doSomethingElseIntensive() {
    System.out.println("I'm never printed because run() ends before execution gets here.");
    return;
    }Question: how do you call methods from within run() and still have it be sequential execution? It seems that a method call within run() creates a new thread just for the method. BUT, this isn't true, because the Thread.currentThread().getName() names are the same instead run() and the "intensive" methods. So, it's not like I can pause one until the method completes because they're the same thread! (I've tried this.)
    So, moral of the story, is there no breaking down a thread's execution into methods? Does all your thread code have to be within the run() method, even if it's 1000 lines? Seems like this wouldn't be the case, but can't get it to work otherwise.
    Thanks all!!!

    I (think I) understand the basics.. what I'm confused
    about is whether the methods are synced on the class
    type or a class instance?The short answer is; the instance for non-static methods, and the class for static methods, although it would be more accurate to say against the instance of the Class for static methods.
    The locking associated with the "sychronized" keyword is all based around an entity called a "monitor". Whenever a thread wants to enter a synchronized method or block, if it doesn't already "own" the monitor, it will try to take it. If the monitor is owned by another thread, then the current thread will block until the other thread releases the monitor. Once the synchronized block is complete, the monitor is released by the thread that owns it.
    So your question boils down to; where does this monitor come from? Every instance of every Object has a monitor associated with it, and any synchronized method or synchonized block is going to take the monitor associated with the instance. The following:
      synchronized void myMethod() {...is equivalent to:
      void myMethod() {
        synchronized(this) {
      ...Keep in mind, though, that every Class has an instance too. You can call "this.getClass()" to get that instance, or you can get the instance for a specific class, say String, with "String.class". Whenever you declare a static method as synchronized, or put a synchronized block inside a static method, the monitor taken will be the one associated with the instance of the class in which the method was declared. In other words this:
      public class Foo {
        synchronized static void myMethod() {...is equivalent to:
      public class Foo{
        static void myMethod() {
          synchronized(Foo.class) {...The problem here is that the instance of the Foo class is being locked. If we declare a subclass of Foo, and then declare a synchronized static method in the subclass, it will lock on the subclass and not on Foo. This is OK, but you have to be aware of it. If you try to declare a static resource of some sort inside Foo, it's best to make it private instead of protected, because subclasses can't really lock on the parent class (well, at least, not without doing something ugly like "synchronized(Foo.class)", which isn't terribly maintainable).
    Doing something like "synchronized(this.getClass())" is a really bad idea. Each subclass is going to take a different monitor, so you can have as many threads in your synchronized block as you have subclasses, and I can't think of a time I'd want that.
    There's also another, equivalent aproach you can take, if this makes more sense to you:
      static final Object lock = new Object();
      void myMethod() {
        synchronized(lock) {
          // Stuff in here is synchronized against the lock's monitor
      }This will take the monitor of the instance referenced by "lock". Since lock is a static variable, only one thread at a time will be able to get into myMethod(), even if the threads are calling into different instances.

  • How to call abap proxy at run time?

    hello frnds,
    i m working on a scenario in which whenever Invoice is saved in SAP R/3 at that time same data should go to Oracle DB. i m using ABAP proxy on SAP R/3 side and JDBC receicver adapter on oracle side of XI.
    so to post data i need to call ABAP Proxy whenever invoice is saved.. i have tried to find out save event for invoice but not able to get... can anybody tell me the solution that how i can call proxy at run time?
    thanx in advance.
    Regards,
    Hetal.....

    Hi Audumbar,
    Check these ...
    /people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies
    /people/siva.maranani/blog/2005/04/03/abap-server-proxies
    /people/vanita.thareja2/blog/2006/05/23/bpm-sending-message-asynchronously-and-getting-the-response-from-synchronous-system-using-abap-proxies
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy
    cheers,
    Prashanth
    P.S Please mark helpful answers

  • How to "Call by Reference" when running in RealTime (path does not work)

    I have a .vi which has been "uploaded" to a PXI chassis to run in RealTime.
    I have this feeling that one of my sub-vi's are not functioning properly. I have a sub-vi which "Opens a VI reference" to a .vi located on my Windows harddrive. But, when everything is setup in Realtime, it cannot locate this .vi anymore.
    I need to load a .vi dynamicaly, multiple times. Is there another way around it?

    Yes, that worked well. I had gotten it to work, but had not replied to this post to indicate my success. My actual problem had to do with me forcing a "close front panel". I had read in some other posts that you cannot modify front panels or other user-activity type of options when running real time. By removing the "FP Close" function, the call to the specific .vi worked great (and with the addition of the IP address for the opening of a local reference). Thanks again for all the input.

  • How to call a subvi with event controll?

    Hi:
         I got a control vi written extensively by front panel events. I want to use it as a subvi,  can I  fire  a  event trigger programmably by anyway?
    Thanks

    菊花烧饼 wrote:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=134729&query.id=80280#M134729
     I didn't sure waht you means,maybe the link have some help to you
    Really, it is ireelevant to this post, but very much needed for me, because I was searching for calling a .VIT dynamically.
    Thanks for that.
    BTW, what is your name ? It is showing 4 squares.
    But, I hope this is not your name.
    - Partha
    LabVIEW - Wires that catch bugs!

  • How to call multiple subvi?

    I am creating a menu panel where I can call and control each new sub vi I call. It is only allowing me to call one at a time. How do I go about doing this? I have placed the sub vi and an ok button in an event structure. I am a beginner as you can tell, so any help is appreciated.

    I hope the name isn't confusing you. LabVIEW is the server in this case, and is already set up in most cases. VI Server is just a general name for a set of technologies that allow you to automate LabVIEW VIs and LabVIEW as a whole. If you've ever used property nodes before, then you've already used VI Server and didn't know it.
    The idea here is that VI Server calls can be used to launch VIs. The VIs in question are located in the Application Control palette. You will want Open VI Reference (input a path to the VI), a few property nodes and invoke nodes, and finally Close Reference to release your resources when you're done, just like you would close a file when you're done.
    Here's an example of what I mean. Hope this helps! (This was written in LV 7.1)
    Jarrod S.
    National Instruments
    Attachments:
    Main Launcher.llb ‏65 KB

  • How to call category dimension in run logic

    hai all,
    i has an senario that i has to derive the category in datamanager prompt.
    i has to pass the value into the run logic
    how can i pass the catagory value which is derived in the datamanagar prompt to RUNLOGIC syntax
    can any one help me out...
    thanks,
    Rajesh

    Hello Rajesh,
    i'm not sure that I've understand your question, but if you want to pass the category from the package to the lgf file you must add a prompt instruction to the package f.e. PROMPT(SELECTINPUT,,,"Please select category",%CATEGORY_DIM%) and in the script logic refers to it using
    XDIM_MEMBERSET CATEGORY=%CATEGORY_SET% this works with all the dimensions, just substituting category with the other dimension names.
    Please refers to Script logic/Rules Keyword Reference/Special Keywords
    http://help.sap.com/saphelp_bpc70/helpdata/en/a6/69182aed2c4df78e3f7b9d586735ac/frameset.htm
    Kind regards
    Roberto

  • How to Debug a ABAP code running the background in Portal

    How can I debug a ABAP code running in the background while executing a transaction code through portal.
    e.g Presently I have to incorporate some checks in the portal. For that I know the function module where i need to put though checks. Now I want to know, how does the code during runtime. What values do we get in the function module. For this I need to get into the debugging mode while executing the portal.
    So how can we do that???

    Namit,
    it doesnot matter whether it is a standard funtion module or a custom one .check whether you are debugging for proper user(portal user and backend user are same) and check debugging is activated

  • How to make SAP Script/Macro run in background like xl macros

    Hi,
    I have a recorded sap script to run, but I can see all  the steps visible in the screen. Is there a  solution in SAP to set displayalerts or screenupdate as false like excel. I do not want the viewers to see the macro running in all steps. I tried iconify, but it works only for main screen, the child screen are still visible. Please help.
    Thanks
    Mercy

    Hello.
    In my knowledge there is no Option from SAP GUI Scripting.
    When you run this from VBA you can use USER32-API function
    Public Declare Function LockWindowUpdate Lib "user32" _
      (ByVal hwndLock As Long) As Long
    Call function via public Sub:
    Public Sub DisableScreenUpdating(xhWnd&)
      If xhWnd <> 0 Then LockWindowUpdate xhWnd
    End Sub
    Public Sub EnableScreenUpdating()
      LockWindowUpdate 0&
    End Sub
    And call this whenever you have a new handle during your script:
            Session.FindById("wnd[0]/usr/btn%_STAE1_%_APP_%-VALU_PUSH").Press
            DisableScreenUpdating Session.FindById("wnd[1]").Handle
            Session.FindById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,0]").Text = "DLFL"
            Session.FindById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]").Text = "INAC"
            Session.FindById("wnd[1]/tbar[0]/btn[8]").Press
            DisableScreenUpdating Session.FindById("wnd[0]").Handle
            Session.FindById("wnd[0]/usr/btn%_STRNO_%_APP_%-VALU_PUSH").Press
            DisableScreenUpdating Session.FindById("wnd[1]").Handle
            Session.FindById("wnd[1]/tbar[0]/btn[24]").Press
            Session.FindById("wnd[1]/tbar[0]/btn[8]").Press
    When your script is completed call
    EnableScreenUpdating
    Of course People can get nervous at it seems like nothing happen. May they kill this session as they think it´s crashed.
    Hope this help.
    Br, Holger

  • How do I turn off programs running in background

    With the upgrade to i0s 6, my ipad is using up battery quickly and I can't turn off the programs running in the background

    Double click the home button, touch and hold an app along the bottom until they all start to jiggle and get a red circle with a minus sign, touch each red circle and that app will be dismissed...do that for each app.

  • How do you allow illustrator to run in Background

    Has anyone else noticed recently when you're batching things through illustrator, it requires focus? I'm even simply batch opening a few files, and my illustrator won't continue opening unless it's in focus.

    Hello,
    Were you able to solve this issue? We have also have a main report with multiple sub reports. The sub reports' parameters are fed via the main report, yet we do not have the possibility of setting the null option in the main report.
    Thanks,
    Konrad

  • How to call a SM35 transaction and run in BDC report.

    Hi Experts,
    I knew that how to call a transaction but here, I've to call the SM35 transaction ,which have my BRS BDC recording, to run my session.
    Pls help me how to call the transaction and run/process the first session tab in the table control of SM35 window.
    thanks & regards
    sankar.

    Hi,
    Look up this example..here v have recorded one transaction & running it throough BDC report programming.
    report ZBDC_16JUL2008
           no standard page heading line-size 255.
    include bdcrecx1.
    DATA : BEGIN OF it_tab OCCURS 0,
             LIFNR(016),
             BUKRS(004),
             KTOKK(004),
             NAME1(035),
             SORTL(010),
             STRAS(035),
             PFACH(010),
             ORT01(035),
             LAND1(003),
             REGIO(003),
             SPRAS(002),
             TELF1(016),
             AKONT(010),
             FDGRV(010),
           END OF it_tab.
    start-of-selection.
    CALL FUNCTION 'UPLOAD'
    EXPORTING
      CODEPAGE                      = ' '
       FILENAME                      = 'D:\'
       FILETYPE                      = 'ASC'
      ITEM                          = ' '
      FILEMASK_MASK                 = ' '
      FILEMASK_TEXT                 = ' '
      FILETYPE_NO_CHANGE            = ' '
      FILEMASK_ALL                  = ' '
      FILETYPE_NO_SHOW              = ' '
      LINE_EXIT                     = ' '
      USER_FORM                     = ' '
      USER_PROG                     = ' '
      SILENT                        = 'S'
    IMPORTING
      FILESIZE                      =
      CANCEL                        =
      ACT_FILENAME                  =
      ACT_FILETYPE                  =
      TABLES
        data_tab                      = it_tab
    EXCEPTIONS
       CONVERSION_ERROR              = 1
       INVALID_TABLE_WIDTH           = 2
       INVALID_TYPE                  = 3
       NO_BATCH                      = 4
       UNKNOWN_ERROR                 = 5
       GUI_REFUSE_FILETRANSFER       = 6
       OTHERS                        = 7
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    perform open_group.
    LOOP at it_tab.
    perform bdc_dynpro      using 'SAPMF02K' '0105'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-KTOKK'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02K-LIFNR'
                                  it_tab-LIFNR.
    perform bdc_field       using 'RF02K-BUKRS'
                                  it_tab-BUKRS.
    perform bdc_field       using 'RF02K-KTOKK'
                                  it_tab-KTOKK.
    perform bdc_dynpro      using 'SAPMF02K' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-TELF1'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'LFA1-NAME1'
                                  it_tab-NAME1.
    perform bdc_field       using 'LFA1-SORTL'
                                  it_tab-SORTL.
    perform bdc_field       using 'LFA1-STRAS'
                                  it_tab-STRAS.
    perform bdc_field       using 'LFA1-PFACH'
                                  it_tab-PFACH.
    perform bdc_field       using 'LFA1-ORT01'
                                  it_tab-ORT01.
    perform bdc_field       using 'LFA1-LAND1'
                                  it_tab-LAND1.
    perform bdc_field       using 'LFA1-REGIO'
                                  it_tab-REGIO.
    perform bdc_field       using 'LFA1-SPRAS'
                                  it_tab-SPRAS.
    perform bdc_field       using 'LFA1-TELF1'
                                  it_tab-TELF1.
    perform bdc_dynpro      using 'SAPMF02K' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-VBUND'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPMF02K' '0130'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFBK-BANKS(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_dynpro      using 'SAPMF02K' '0210'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFB1-FDGRV'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=UPDA'.
    perform bdc_field       using 'LFB1-AKONT'
                                  it_tab-AKONT.
    perform bdc_transaction using 'FK01'.
    ENDLOOP.
    perform close_group.

Maybe you are looking for

  • How do I retrieve lost sounds and dialogues?

    I was cutting my picture. I saved the file after editing. when I wanted to open it I lost the sound. What is the mater with adobe CC????

  • Current period ?

    What is ment by "current period" ,I have seen in some of the scripts , is this reserved word for Essbase Calc Scripts. Script like ... FIX(Current period) Profit =sales-po-additional cost; ENDFIX

  • SHP2013 UPS Syncing with a Windows 2008 DC

    Time for another very specific question : Anyone else having issues syncing Sharepoint 2013 with another domain (with full trusts setup) when connecting to a domain controller running on Windows Server 2008? Little bit more detail: We are in AD fores

  • Why does my site load slower in firefox

    My websites, http://thedailymeditation.com and http://lifeandself.com take longer to load in firefox. Why?

  • Sum a distinct record

    Post Author: hamish_sco CA Forum: Formula Hi there, I wondered if anyone knows if it is possible to do the following;I have data columns for 'invoice number', 'amount' and 'amount paid'.There is some duplication in the data - an invoice can be paid i