Parallel wait functions

Hi,
I’m struggeling with following: I have 8 equal devices, each performing an independent routine, so they will run asynchronous from each other, in parallel. As all devices perform the same task, I created a re-entrant vi. The time each device can spend on their routine depends on what the user has defined per device. The start of the routine is triggered by a user input. I thought to use a state machine to analyze the users input, followed by the corresponding device triggering. I would store the corresponding trigger in a variable . This variable will trigger the re-entrant vi outside the state machine (because I don’t want to block any further user input due to the wait-times in the routine). The question I have is, do I need to copy this for each of the 8 devices since all have wait steps inside? Or is there an elegant way, like a kind of case structure, but running several cases at the same time?
Hope I described the problem clear enough. Please don't shoot at me, since i just recently started with labiew.
Looking forward,
Pieter

I would recommend that you start your VIs dynamically. This will allow you to change the number of devices without requiring a code change. You can use the Start Asynchronous Call. I would also use queues or notifiers to communicate with your parallel tasks. You should probably look at the examples of the producer/consumer architecture.
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Similar Messages

  • Wait functionality in Workflow

    Hi Everyone,
    I was trying to implement the wait functionality in a workflow. I did the following.
    1) Changed the Node type to Relative Time and value to 1 minute.
    2) Changed the status to Timeout in the workflow for that Notification.
    3) In my pl/sql package, i have written as follows:
    IF (FUNCMODE IN ('TIMEOUT')) THEN
    WF_ENGINE.Background('WorkflowItemName', NULL, NULL, FALSE, TRUE, FALSE);
    RESULT := 'COMPLETE:APPROVE';
    END IF;
    Now, even after waiting for more than a minute, the notification is not going to the next level. Can anyone please give suggestions??
    Thank you
    Jim

    Hi,
    Let's start with the original post - you don't need to have anything in the code that performs differently in TIMEOUT mode, unless you want specific logic to fire when the timeout transition is taken. As you've found, you need to run the background engine for that item type in order to move the process on.
    You can perform whatever logic you want on the timeout transition. Sounds like you want to resend the notification to the original recipient and also to the next recipient at the same time (which could be problematic...). However, there are two ways that you could model this.
    1 - Timeout transition returns back to the original notification, so that notifies the original recipient. A parallel timeout transition determines the next recipient and then goes to a different (identical) notification. You then have two notifications open at the same time, so you need to include an "OR" activity so that only one of those can move the process onto the next step. This is not something that I would advocate.
    2 - Timeout transition goes to a new PL/SQL activity. In that activity, retrieve the current responder and the next one, and add them to an adhoc role. Then transition back to the notification, but send it to that adhoc role now. The question really is whether you accept a response from either of those recipients, or does one take precedence over the other? If you are accepting a response from either, then do not tick the "Expand Roles" checkbox, and the standard functionallity will process the first response that comes in. If not, then expand the roles and you will need to have a post notification function for the notification to determine what happens for each response.
    HTH,
    Matt
    WorkflowFAQ.com - the ONLY independent resource for Oracle Workflow development
    Alpha review chapters from my book "Developing With Oracle Workflow" are available via my website http://www.workflowfaq.com
    Have you read the blog at http://www.workflowfaq.com/blog ?
    WorkflowFAQ support forum: http://forum.workflowfaq.com

  • How to isolate the wait function to one part of the code

    I'm buildling an ecg montoring system along with programming an external stimulator using TTL pulses to work along side the information obtained from the ECG.The most important of  these features is the heart rate. However, whenever I activate my pulse trains in the code, the DAQmx Wait Until Done.vi function pauses everything in the code, including the part of my code that monitors the heart rate, which uses time to measure it. What I would like, is the wait function to only affect the pulse train generators without pausing anything else in the code. Is this possible? And if so how can I make it happen?
    I will attach my vi
    Solved!
    Go to Solution.
    Attachments:
    simulatejed.vi ‏130 KB

    Your problem is that everything is in the same loop.  So the longest operation is going to determine the loop rate (and therefore processing rate).  What you really need to do is separate your tasks into separate loops.  Use queues and/or notifiers to communicate your data and commands between loops.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • "Wait Function" swf works in Mac, Not in Windows

    Hi,
    I have got a Flash movie [swf file] that plays the intro
    part("Scene 1", 1) to ("Scene 1", 55), and then go to
    ("Scene 2", 1) smoothly in Mac environment. When I run the
    same swf movie in windows, it plays the intro part only and then
    stops. It does not go to Scene 2 at all.
    I am making use of a wait function in the actions.
    I changed 'frame number' ("Scene 2", 1) to 'label' ("Scene
    2", "start") and tested it again, but it still does not work in
    windows environment but runs smoothly in Mac.
    Kindly advise what is the problem exactly.

    It turns out I was wrong: this function did work. However, when I then saved the file as an SVG, Illustrator ignored the document proportions. To correct this, I had to set the export option preserveEditability = true (of all things ...). Apparently it's a feature of Illustrator CC to not include the document proportions in SVG files by default.

  • Issue in Wait function in APEXP workflow

    Hi Friends,
    I am working on APEXP R12 12.1.3 version
    Requirement: user expecting the email notification 48hr after summation of expense if he is not submitted the image.
    Customization I have done: I have used the standard Wait function after “wait for image receipt” node to wait the workflow for 48 and sending the notification. i am passing node attribute value as Relative Time :0.5
    Issue: Wait is not working user is getting the email notification immediately

    Appreciated  for the  response and thanks in advance

  • Why does that entire thread goes to sleep when we put a wait function in time critical loop?

    why does that entire thread goes to sleep when we put a wait function in time critical loop but not when it is not time critical

    Norbert B wrote:
    Ujjval,
    in a RT system, priorities have (in general) increased effect on the execution of the application.
    It is recommended that you only have a single task in your RT program at "time critical". If you have two task "time critical" (that means you are running into issues caused by your quoted "feature"), you have a flaw in your application architecture.
    Since LV 7.1, it is recommended to work with Timed Loops in order to prioritize tasks on a RT system. Timed Loops are executed on priorities between "time critical" and "above normal". Each Timed Loop will execute its content in a single thread in order to keep a good overview of the timing (like finished late [i-1]). Using those structures (and according settings) in a reasoned manner will prevent your RT system to run into priority issues.
    Ujjval Shah wrote:
    [...]also i would really appreciate if i can get more documentations regarding how LV creates threads and assigns subvis to them[...]
    You will have a real hard time to go into this very deep. This is the feature of LV: you can just use multithreading (multicores) without the needed knowledge of scheduling and load balancing. This makes LV programming in general very easy in comparison to e.g. ANSI C (in regard of multithreading). So creation of threads, distribution of tasks to the threads are abstracted and most often not visible to the programmer.
    There are some switches and levers you can "play around" in order to make LV to behave differently in this matter. But this most often requires  deep LV knowledge and cannot be explained in a simple posting.....
    hope this helps,
    Norbert 
    Amen to that!
    The question can not be fully answered without digging into the internals of the OS LV is run on because LV works with the OS and lets it do the scheduling.
    Yes that note applies to pre- LV 7 RT. When run under RT the ONE Time Critical loop was guarenteed to stay determinisitic.
    Since then the Timed Loop was introduced that allowed multiple levels of priority and later allowed us to assign which CPU the code would run on.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Is there a way to set up a 'dial string' with a 'wait' function?

    I'm trying to set up calling my work voicemail. On the blackberry i could set up a dial string with a wait function. So when i dialed the voicemail #, once it answered I could hit a button on the phone and it would send the next set of characters (in this case, my extension #), then wait again, and once I got my password prompt, i could again send the next characters (now my password). I can find the way to put in a pause...but it isn't enough and doesn't do what i want it to do. How can i do this on my iPhone?
    It really is important in that i don't want to have to enter these characters while i'm driving.

    Thanks for the reply....i've tried that and it's not doing what i want it to. Our VM sometimes has delays, so its impossible to predict home many pauses i need....really need a wait function.
    Thanks

  • Usage of WAIT function in Oracle Workflow

    Hi all,
    I am new to Oracle Workflow, I interested to learn about WAIT function, So I gone through the docs provided by Oracle. But I am not able to figure it out. Can any one explain me abuot WAIT function in 2 or 3 lines.
    Regards
    Prakash

    check these -
    Wait Activity (Oracle Workflow Developer's Guide)
    Oracle Workflow Developer's Guide
    Workflow Wait Function

  • Using the Wait function in while loops?

    Hi,
    I have a rather complicated top level VI with about 20 subVIs and the main VI has on big while loop around it and another smaller one inside, basically it runs rather slow and I have no idea how to set the wait function. I mean what factors should I consider..what would be the difference between setting it to 10 and 100 (besides the obvious 10ms vs 100ms)? I just want to increase the performance of the executable, so it is not that slow. Can you offer some hints as to what I need to take into consideration when determining my delay? And also, are while loops the only place that I should use the delay or are there other instances too?

    Adding waits is not a fix-all for slow running applications. Its just one thing that can be done to improve things. If you determine that a sub-vi is causing your problems then you need to find out exactly what that vi is doing to slow you down. If its because there is a loop inside it that is running constantly as fast as it can, then a delay in that loop may help. If that is not your problem then you need to look at other ways to boost performance. It sounds like you have alot of locals variables, each instance of a local variable makes a copy of the data that's in the control. If the controls/indicators that you have local variables of contain large amounts of data then you may be filling up memor
    y with copies of it.
    I suggest that you study the "Performance and Memory Management" chapter of the LabVIEW manual. This can found in the printed manual of the older versions, in the online manuals that install with 6i, or on NI's web site here: http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a9006ffe76/732cec772aa4fbe586256a37005541d3?OpenDocument , which is Application Note 168. This should give you some good ideas of what to look for to improve your performance.
    Hope this helps.
    Brian

  • Question about the Wait Function

    I wrote a VI to store the time stamps in a text file.
    I fond something strange in the text file (see the picture below).
    The time stamps weren't writen into the file every 10 ms! How could this happen? And how could I fix it and make the time stamp to be writen every 10ms?
    Thanks a lot!

    To further what was just said:
    The wait function will indeed wait 10ms, or near enough as I will soon explain.
    When used in a loop, the wait function will wait for 10ms AFTER the code inside the loop has been executed.
    Depending on your Operating System, and the speed of your PC, the code inside the loop could take several hundred milli-seconds to execute.
    So the total time for each loop iteration, and thus the time between file writes, will be (Xms + 10ms), where X is the time taken to execute the other code.
    Another thing to consider is that unless you are using a Real-Time OS, your Windows or Mac OS will not prioritise LabVIEW! The execution of your code must run alongside your virus scanner, email client, music player etc. etc. etc.
    As such, it is often asking too much to try to use labVIEW in accuracies of +/-1ms on the common desktop PC.
    As a final note: I cannot give facts on file writing, but just from my experience with LabVIEW a file write every 10ms is impractical as the write-to-file VI usually takes longer than 10ms to execute itself. Why not buffer up 10 writes/pieces of data/whatevers and then write them all to file at once? Whilst we are at it, why not buffer 100 pieces and then write them all at once?
    I have had this idea argued before, with people saying that if the system were to crash then the buffered up 100 reads would be lost. Remember guys: that labVIEWs write to file VI passes the data to the windows write buffer, and windows doesn't necessarily put it on disk straight away! That can only be guaranteed by closing the file reference or flushing the queue.
    Apologies, I have diverged.
    Rhys
    Applications Engineer
    National Instruments

  • Wait function problem

    Hi everyone,
    I am confused by wait function in LabVIEW. I have a while loop and the calculation time duration for each iteration is about 0.1ms without using wait funtion inside of the loop. However when I tried to add wait function and set the wait time to be 1ms, the average iteration duration became 5ms. Does it mean the iteration took 5ms to run each time? If it is the case, how did I get 0.1ms before using wait function? I also tried to add the wait time from 1 to10 and before 5 it gave me similar answer 5ms after 5 it give me the number I specified to it, so I think it works fine. I also attached my VI to it, I am using cRIO to run this VI so it wont work on the computer but the idea should be clear.
    Attachments:
    Untitled 4.vi ‏55 KB

    Hi Jeff,
    Thanks for your reply, basically this attached vi is only part of my code, and I would like to track the change of different variables on FP so I would like to have local variables inside of the loop instead of using shift register. The index constant is not necessary for sure, thanks for that info.
    However even I have made all the indicators to the outside and changed the array stuff into shift register it still gives me the same result, which is about 5 ms when applying wait function but about 0.1 ms without using it. This is quite unusual, and similar to the speed when i was using timed loop (5ms). 
    Also I am calling the objective function instead of using laview is because I would like to have easy maintenance for ppl not quite familiar with labview could understand the algorithm later on.
    Thanks again for the reply and hope to hear from u again.
    Best Regards
    Jeff·Þ·Bohrer wrote:
    OK First off lets introduce you to the concepts of arrays and a Shift Register:
    First, those index constants are not required-  Hit Ctrl+h- hover over the array index and hit detailed help the default is for each element you grow to increments so, with no index contstants, you get elements 0, 1, 2, ...n.
    Next, you only index them to feed them to indicator's local variables only to read them on the next iteration  a feedback node or shift register of type array of dbl would work so much better!  and, not require the UI Thread at all!  Really none of those controls or indicators are wired to the connector pane-  for debug use a probe!
    Most of the rest of your indicators can go away too, replaced by Shift registers.  (If I infer correctly you might need to show two elements on "Target Disp" but I have no idea what that library function call is)
    Essentially, you appear to trying to "C" your way into LabVIEW.  LabVIEW is a dataflow language-  hit the getting started material and online courses.

  • Cancelling a wait function

    I have this wait function applied to a frame:
    function wait() {
    stop();
    var myInterval = setInterval(function () {
    play();
    clearInterval(myInterval);
    }, 26*1000);
    wait();
    and I would like to cancel this wait function, when a button
    is clicked. This is a skip button that takes you to a frame label,
    but I need to somehow cancel that wait function or it still takes
    affect in the movie. Could someone help with the code that needs to
    be added?
    Thanks.

    clearInterval(myInterval);
    That is what is needed to cancel the interval. However your
    variable, myInterval, is internal to the wait function and I'm not
    sure if it will be available to the scope of whatever button you
    use to cancel it. So be sure to check the scope.

  • Setting the 'WAIT' function

    Hi,
    Can someone help me to set the wait function to 5 minutes ?
    Thanks In advance
    Eldad

    Set the Wait Mode attribute of the activity to Relative Time, and set the Relative Time attribute to the relative time interval
    you want, expressed in <days>.<fraction of days>.
    See: http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/workflow.920/a95265/std04.htm#index-Wait-activity---0
    Regards,
    Clara
    Hi,
    Can someone help me to set the wait function to 5 minutes ?
    Thanks In advance
    Eldad

  • WAIT function

    I'm trying to get the wait function to work for a simple notification. I have the relative time set really small to test the WAIT function works, but the procedures never get pas the wait function. Can anyone help me with this?
    wf_engine.setitemattrtext
              (itemtype => l_item_type
              ,itemkey => l_item_key
              ,aname => 'WAIT_MODE'
              ,avalue => 'RELATIVE');
    wf_engine.setitemattrnumber
              (itemtype => l_item_type
              ,itemkey => l_item_key
              ,aname => 'WAIT_RELATIVE_TIME'
    ,avalue => 0.0001);

    How are you using the activity?
    You have to do this:
    1. Drag and drop the standard WAIT into your process
    2. From the "Node Attributes" tab of the activity choose:
    "Wait Mode" to be "Relative Time"
    "Relative Time" to be from an "Item Attribute" and select your item attribute.
    You can set this item attribute anywhere in your workflow
    3. When the engine hits the wait activity the workflow will wait for that amount of time.
    Remember to run the background engine to process the workflow when the wait returns.
    Hope this helps
    Raja

  • Wait() function - just trying to understand the reasons behind

    Why the function wait() in Java requires the caller own the object�s monitor of the calling object
    thnx

    but why should only one thread at a time can own an
    object's monitor.Because otherwise how would you prevent concurrent access to shared resources? Every Object has a wait set, I think if concurrent access was allowed to this wait set you could get into all sorts of problems.

Maybe you are looking for

  • GS60 Ghost Pro 3k - Joining Windows DOMAIN

    Just got my new GS60-2PE laptop, reformatted and reinstalled Windows 8.1, and joined to the domain.  Things are working great, except every time I am outside the office it completely craps out -  nothing works, windows system32 services are not start

  • Should we Use cache seeding iBots to pre-cache the reports ?

    Hi Everyone, We have requirement from client to improve the performance of some reports.We have a very old RPD and it is really huge so we don't want to do much on database side for performance tuning. Will it be a good idea to use cache seeding iBot

  • How to detect the idle user????

    Hi all.... I wanna write a program(servlet or jsp) to detect the user's idle time(do not action from sometime). But I have no idea.Could someone give me a suggestion??? thanx alot....

  • Menu Bar Icons no longer showing, not able to switch on in control panel

    I had sleep problems with my MBP (http://discussions.apple.com/thread.jspa?threadID=2449728&tstart=0) and as such I did a combo update as this could possibly solve it. However, now all the control panel icons in the menu bar have gone (like the clock

  • Photo stream not syncing to other devices

    I have an iPhone, iPad and Macbook but can not get my photo streams to sync on all my devices. Example I have 5 different streams on my phone but they are not visible on my macbook and iPad