Stopping producer consumer loop at the same time

In my application I am using producer consumer architecture. In the producer loop, I am acquiring data, processing and outputting the result (feedback control system). Also in the same producer loop I am inputting all the data to a queue and then in the consumer loop I am writing data to a file. I have a stop control on the front panel and error from the queue and  error from the data acquisition all wired to OR gate to stop the while loop. ( I attached the picture of the code). Whenever I press stop form the front panel program wont completely stop. I think it is because consumer loop still running. Is there way to stop  the both loops at the same time. I tried creating local variable but it slows the program. Front panel stop control mechanical action is set to switch when released.
Attachments:
app.PNG ‏262 KB

In the consumer loop you should check the error after the Read Queue function.
TOn
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be!

Similar Messages

  • What is the best way to stop parallel loops at the same time, from any loop?

    If there is a vi with two or more parallel while loops, what would be a good method to simultaneously stop parallel loop execution, from any of the parallel loops? My intent was to try and do this without local variables, so I used notifiers. This seems like an ok method for two loops, but how about for n loops?
    In addition, my code has a flaw. I use an OR block to compare the stop status of each of the loops. This works fine most of the time, but if both loops are triggered to stop at the same time,the boolean result will be false, causing the loops to never stop. How can this be avoided?
    Thanks,
    Curt
    Attachments:
    parallel_loop_w-stop.vi ‏54 KB

    I think you have the right idea, notifiers are one of the better ways to stop parallel loops. You can simplify things by using 1 notifier for everything. I modified your VI to use 1 notifier, it will set the notifier to True ONLY if the loop is stopping, then it stops. The other loop will read the notifier status, and stop based on it the next time it executes.
    I also changed the second loop to stop and notify if it has an error (that is usually a good idea, especally if you have I/O or other things that can cause problems)
    I also changed the switch mechanical action, that will eliminate the problems for your second question.
    The VI's attached are written in Labview 7.0
    P.S. If you have 7.1, the Queues are polymorphic, meaning that the typecast operat
    ions are NOT needed!
    Attachments:
    parallel_loop_w-stop7_0.vi ‏45 KB

  • Time Division Multiplexing and Processing Different Loops at the same time

            Hi, I am new in Labview so you may find my questions too silly, sorry about that
    I want to design an interface to control the test&measurement devices remotely. I have two desks and there are several devices on these desks. The real problem is to use two different devices at the same time. To do this I heard that I can use time division multiplexing. But I couldn't find enough information about it in Labview. Another advice I heard was to use a matrice and hold the on/off state of the devices in this matrice. 
    Where should I start the design to create such a system? Do you have any advices? Thank you in advance.
    My basic GUI is attached.
    Attachments:
    InterfaceAli.zip ‏42 KB

    As Mike pointed out you cannot communicate in parallel on the GPIB bus - unless you have separate buses for each instrument - and that defeats the purpose of a bus. I am not sure about LXI.
    With regard to your VI:
    1. Do not use global variables to pass your data around.
    2. You should use the Array data type, not the Matrix data type. The Matrix data type in LabVIEW should only be used for matrix mathematical operations (linear algebra) which cannot be easily performed on the array data type. You have many more tools in LV to work with arrays.
    3. The Event structure needs to be in a parallel loop. This is basic data flow. If you do not understand this concept, get some training, either though the online tutorials or through a class.
    4. Use Value Changed events and place the button terminals inside the event case for that control.
    5. The parallel loops need to have a Wait or some other function which causes a delay. Otherwise, the first one to start executing could consume all available processor resources. These are called "greedy loops." 
    6. Use integer data types for case structure selector inputs. Floating point values are coerced to integers at the inputs. If the values resulted from calculations, unexpected rounding effects may occur, resulting in the wrong case being selected. In some cases using type defed enums may be even better. The underlying data is integer and the enum item names show up in the case selector labels, helping to document what the case does or why it was selected.
    7. Remove the timeout case from the event structure since it never executes. Also avoid Use Default if Unwired on the terminal with your matrix (array) data. You never have a situation where an empty array is appropriate.
    Before going any further with the program questions, you need to carefully define your requirements.  How many instruments will you have? How many can be active at one time? What kinds of communication between the program and the instruments is required? This includes commands to the instrument, data returned from the instrument, error handling, and timing requirements. What will be done with the data? Display, save to file, use to automatically control another device? What safety requirements or constraints need to be met? Once you have a good requirements document, then you can begin to determine what kind of program architecture is best suited to meet the needs.
    I suspect that you may be making some things much more complicated than they need to be while ignoring other important issues.
    Lynn

  • Can 2 while loops work at the same time?

    I have two while loops in my program; one reads data and the other does nothing until I hit stop on the first one. I want the first one to always run and the second to run off of the time constraint I have for it when I hit the start button. I am using a DAQ and transfering data from one while loop to the other. See attached file.
    Main questions:
    How to attach the start button?
    How to get the second loop to work with the first?
    Thank you
    Solved!
    Go to Solution.
    Attachments:
    2whlloopprgrm.vi ‏299 KB

    Your problem is that the loops have a data dependency.  If you want to run both loops at the same time, they can't have any wires running from one to the other.  Look into the Producer/Consumer architecture.  It uses queues to send data from one loop to the other.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Timed Loop in Producer/Consumer Loop

    Hello!
    I have a producer/consumer loop LabVIEW program setup to allow me to properly capture images that are quite large (8MP) at approximately 14 frames per second (FPS). The program works great when the consumer loop is a 'while loop' (records at 14fps no problem), but I wanted to make it into a timed loop, so that I may vary the FPS as required. An oddity arises when I do this. Anywhere below 12fps, the loop works fine and the data is recorded properly. However, when I bump it up to 13fps, the consumer calculated FPS goes haywire and starts jumping between ~9 and ~13fps (data processing gets bogged?). When I set the required FPS to 14, the loop executes at a steady 7FPS maximum. Is there something I can do to rectify this situation?
    I have attached my .VI
    Thanks in advance!
    Solved!
    Go to Solution.
    Attachments:
    ProcessSplitJPG-FPS.vi ‏100 KB

    Palanski,
    Are you using LabVIEW Real-Time? Timed loops in a windows OS don't really increase determinism more than a while loop with a wait until next multiple timer. Before you changed the producer consumer loop to include a while loop was the programming running correctly? You may also want to vuse the VI analyizer to see how long things are taking to run. I would leave the producer consumer loop in the traditional set up and change the FPS by controlling the wait timer, after benchmarking your code this should be done the same way as you have it for the timed loop
    Sam S
    Applications Engineer
    National Instruments

  • Run two vi at the same time

    I WANT TO HAVE A VI RUNNING (WHILE LOOP, COLLECTING DA DATA, OPERATING AN ACTIVE TEST, ETC.) AND WHILE THAT IS GOING ON, OPEN ANOTHER VI (FROM WITHIN THE MAIN PROGRAM) TO DO SOME SEPERATE FUNCTION (PRINT OUT A LOG REPORT, PREVIOUS TEST RESULTS, ETC.). BUT EVERY TIME I OPEN ANOTHER VI's WINDOW, THE MAIN PROGRAM WINDOW's WHILE LOOP STOPS LOOPING.
    I AM SURE IT IS JUST A SIMPLE SETTING, BUT SO FAR HAVE NOT BEEN ABLE TO FIND THE RIGHT SETTING OR AN EXAMPLE OF TWO VI LOOPING AT THE SAME TIME.
    THANK YOU FOR THE HELP.
    DOGFACE

    I HAVE ATTACHED A ZIPPED FILE CONTAINING TWO SAMPLE FILES (CARL1MAIN.VI AND CARL1SUB.VI) THAT SHOW WHAT I WAS TRYING TO DO. I HAVE BEEN USING TEST POINT AND HAVE RECENTLY SWITCHED OVER TO LABVIEW, SO I AM STILL LEARNING. I TOOK BOTH BASIC COURSES (AND SCHEDULING ADVANCED COURSES IN LABVIEW). BUT BECAUSE OF THE DIFFERENCES BETWEEN LABVIEW AND TEST POINT, I MIGHT BE STRUCTURING THIS WRONG.
    I AM OPEN TO ANY SUGGESTIONS.
    THANKS.
    Attachments:
    CARL1.zip ‏16 KB

  • Playing Music and Video at the same time

    I would like to play a song from my music collection and while it's playing, play a video that has no audio on it from the video collection.  When I try to do this, one shuts the other off.  I switched the behavior from default to showcase, still no luck.  Is there perhaps an app available on the appstore that anybody knows of that can play an audio on loop and a video on loop at the same time?  

    i found a fix for WoW
    Open the World of Warcraft folder on your hard drive (Default Folder: C:\Program Files\World of Warcraft).
    - Open the *** folder.
    - Open the Config.*** file using a text editor, like WordPad.
    Add the following line to the list if it doesn't exist:
    SET SoundOutputSystem "x"
    Set "x" to be 1 first, if it still occurs bump it to 2 and so on up to 4.
    you must restart WoW everytime you change the number.
    heres the link in the WoW forums.
    http://forums.worldofwarcraft.com/thread.html?topicId=28083078&sid=1

  • Flash SWF/HTML animation preview stops at the same time (around 9 minute mark) without reason. (CS5)

    I have a good sized animation that I am attempting to publish using CS5, but for some reason the animation always stops around the 9 minute mark.
    I don't have any actionscript telling the animation to stop at that particular point, and regardless of how I order my scenes, it always stops at the same time.
    Here is the only actionscript I have, and it's in the first scene:
    movieClip_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextScene);
    function fl_ClickToGoToNextScene(event:MouseEvent):void
        MovieClip(this.root).nextScene();
    My theory is that the animation is too big somehow, and Flash can only load up to a certain point.
    I haven't been able to find any documentation on such an issue so any help is greatly appreciated.
    Also, I'm using a TLF text, but it loads and displays properly in the animation.
    Cheers.

    Thanks for the response!
    There are 17483 in the main timeline across 9 scenes.
    I tracked down where the animation stops and it does seem the limit is 16000 regardless of ordering.
    What I tried to do was boil each scene down to a movie clip and play each one in the main timeline in one frame each.
    I have an actions layer in the main timeline with a stop(); in each frame for a movieclip.
    Then I have an actions layer in each movie clip with a MovieClip(parent).nextFrame(); and a MovieClip(parent).gotoAndStop(1); in the last one.
    For some reason that's not working though, it just loops through the first frame of each movieclip without playing any of them?
    Could you tell me how I could work around this limit/If I am approaching it the right way?

  • How do you stop multiple users executing the same calc script at the same time?

    We have an issue when  users uplaod a spreadsheet and then run a calc script. at one time we have multiple exectuions of the script running.
    This slows up the system and we have to go cancel all the executions and run it again.
    Can we stop this and put them on a queue, so only one execution of the calc happens at one time. Or stop multiple executions getting submitted at all.

    You could use EXCLUSIVECALC to stop more than one calc running at the same time, although this will apply to all applications on your server.  And it doesn't just stop the same calc being launched twice.  Easier than the alternatives I can think of though, if it works for you.

  • There is no audio output on my MBA in the system preferences-sound folder. Therefore no sound comes from my computer. At the same time this happened, any streaming video stopped playing after 11 seconds, as well as iTunes will not play any song. Help!?

    Hello everyone.
    i have a 15" MBA circa 2011 running Lion 10.7.5 and my sound has gone, There is a no sound circle on my volume display and in system preferences sound my options for output is empty. At the same time this happened I noticed 2 things: 1) itunes would not actually play any audio track and every video i streamed stopped after a few seconds (usually 11s) but not always.
    I have tried following some tips I have found online like going into MIDI and fixing the problem there, restarting in safe mode. Resetting with PRAM (or something that sounds like that).
    Does anyone have any insight on this? At this point i'm thinking it's time to reload Lion but I don't really know how to go about that without losing all of my files.
    Please Help
    Thanks

    Hello JaboorMBA2011,
    Thank you for using Apple Support Communities.
    For more information, take a look at:
    Troubleshooting issues with no audio from built-in speakers on Macs
    http://support.apple.com/kb/ts1574
    Have a nice day,
    Mario

  • How do you stop multiple Youtube videos from playing at the same time?

    As of a few days ago, when I click on a youtube video, as the commercial begins to play, you can begin to hear multiple/different commercials playing at the same time. After the commercials, the same issue occurs with the main video--multiple videos are being played at the same time and are not in sync. I've updated all my plug ins and have tried the suggestion posted in the forum provided in the link below in which someone else has expressed the same issue, but nothing has worked so far. Does anyone know what can be done?
    http://productforums.google.com/forum/#!topic/youtube/5Lnikma4UqM

    Are you loading those videos as Flash or HTML5? It is possible to prevent videos from playing until you click something with Flashblock for Flash or Stop Tube HTML5 for HTML5. You can also stop the commercials with Adblock Plus with an Easylist subscription.
    * https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/
    * https://addons.mozilla.org/en-US/firefox/addon/flashblock/
    * https://addons.mozilla.org/en-US/firefox/addon/stop-tube/

  • TS2755 keep receiving the same text message multiple times, at the same time of the night. How can I stop this?Thabnks

    Hi
    I keep on receiving the same text message multiple times and at around the same time each night. Any idea how I can stop this happening? The text messages are originating from to separate Saudi Arabian mobile numbers. Both these people are listed in my contacts so do you think if I delete their names it might stop the texts coming htrough each night?
    Cheers

    Deleting the people from your contacts will not stop the messages. Have you tried talking to the people and finding out if they're sending you messages? You could try contacting your carrier and finding out what blocking services they offer. However, theat would block all messages from those people.

  • Logic 10.0.07 keeps stopping recording at the same time every time

    Logic 10.0.07 keeps stopping recording at the same time every time 3.14!
    How can i get it to extend on recording time?
    Model Name: Mac Pro
      Model Identifier: MacPro6,1
      Processor Name: 6-Core Intel Xeon E5
      Processor Speed: 3.5 GHz
      Number of Processors: 1
      Total Number of Cores: 6
      L2 Cache (per Core): 256 KB
      L3 Cache: 12 MB
      Memory: 32 GB
      L3 Cache: 12 MB
      Memory: 32 GB
    Model Name:
      L3 Cache: 12 MB
      Memory: 32 GB
    Model Name: Mac Pro
      Model Identifier: Mac
      L2 Cache (per Core): 25
    Model Name: Mac Pro
      Model Identifier: MacPro
      L3 Cache: 12 MB
      Memory: 32
      L3 Cache: 12 MB
      Memory: 32 GB

    Do you have auto drop enabled? Look for a red bar at the top where the green cycle bar is. It will punch you out at the end of the red bar.

  • Recently my iPad3 and iPhone5 stopped synching automatically to iCloud. Around the same time I backed them both up to my Macbook Pro and installed the iOS6 update. Any thoughts or help is appreciated!

    Recently, I noticed that my iPhone5, iPad 3 and iPod Touch 4th Gen stopped backing up to the iCloud automatically despite ALL of them doing so previously, without a single problem. A few weeks ago I bought a Macbook Pro and I backed up all 3 devices to it a couple times (and they still backed up to the iCloud by themselves without a problem). A few days ago, I noticed that ALL 3 OF THEM stopped backing up to the iCloud automatically. Around the same time, I backed them up to my Mac and I also downloaded the iOS6 update. I'm not sure what is wrong. Has anybody else experienced this type of problem? I'm NOT very familiar with MAC computers as this is my first one and I've been learning a lot as I go. I don't know if I did something in the setting's of iTunes when I backed the devices up that could have caused the decives to stop backing up to the iCloud automatically. I did notice on my previous laptop (a Gateway) and on this one (the MacBook Pro) that on each device, I had to go into "Setting's" on each device and turn the "iCloud Backup" back to the  "On" position! That was right after I backed them up to each computer. I attempted to fix it yesterday by adjusting the setting's in iTunes, but nothing worked. If anyone can help, I would sincerely appreciate it. Thank you!!!

    Ok, I can try those things this afternoon. I have to leave now and won't be able to try for several hours. I'll let you know how things turn out. Thank you again. Also, I am not sure what DNS Setting's are regarding the router and how to change them. Thank you again for trying to help me with this. One side note. I noticed yesterday on another post regarding this topic, a man said he changed his iCloud email from one to another. I have two. One is and @me.com address and one is an @icloud.com address. I switched them around the other day. One device had @me.com as the one the email one be sent from (I think that was the phone) and I believe the iPad 3 had @iCloud.com as the other. Well, I switched them both to @icloud.com. In the post I mentioned a man said that he did that to his, and it worked. That was a few days ago and this was around the same time I began noticing the devices not synching to iCloud like they should. Right now I have for the iCloud email account (on both the iPhone and the iPad) @iCloud.com as the setting that any emails from that account would be sent from and the @me.com is also turned to the "On" position on both devices. I figured that if I'm sending an email from an iCloud account it should say "@iCloud.com" after it rather than "@me.com" after it. I just did that so everthing was the same on both devices and out of personal preference. No other reason really as I don't ever use the account to email anyone and have never given either address to anyone. Only Apple has them and they sent a couple things initially and I never receive anything on that account (for the most part). Ocasionally I get something from Apple and that's a rarity. I don't know if that may factor in at all or not. It did for one gentleman. Thank you randers4!

  • Hello. the last month i face a problem with youtube at my macbook. most videos stop playing after maybe 20 - 25 sec. the same time the time bar stops moving. could you help me solve the problem? thank you

    hello. the last month i face a problem with youtube at my macbook. most videos stop playing after maybe 20 - 25 sec. the same time the time bar stops moving. could you help me solve the problem? thank you

    hello. the last month i face a problem with youtube at my macbook. most videos stop playing after maybe 20 - 25 sec. the same time the time bar stops moving. could you help me solve the problem? thank you

Maybe you are looking for

  • Desing requriment for processing the IDOC in real time

    hi Gurus, we have a requirement to design for processing the IDOC in real time i.e.all the IDOC must be store and process for give time line with out using BPPM tool.we have suggested to use cache storage or storing the files in file adapter. please

  • New features in SAP Solution Manager 4.0

    Hello Experts, Can anybody give me a good list of new additional features in SAP Solution Manager 4.0 with description and wt r the business benefits of implementing those features.Plz dont give marketplace pdf links as i hv checked it.any good Word

  • SQL Developer 1.5 having problems with JDK 6 Update 7

    I tried to open a table using SQL Developer 1.5 but connection timed out. when using SQL developer 1.2 i don't get any problems opening it. i have JDK 6 update 7 installed. the only problem with SQL Developer 1.2 is that i get a jdbc in the error log

  • Kernel Selection

    Hi I am installing SAP Netweaver 2004s in a new server where i need to install unicode system. My architecture is like this manner. System A --> AS ABAP System B --> AS Java BI javaEP but together there should be one database whether it is possible.

  • When are the first training sessions for BPC 7.0 planned?

    Hi, I know SAP will start it first ramp up version of SAP BPC as of june and the official release will be for beginning of 2009. But does anyone know when the training sessions of SAP BPC 7.0 will be availabe for its SAP partners? I can't find anythi