Producer consumer loop only execute once?

Hello here,
In my VI, the producer loop seems working continuously, but the consumer loop only execute once.
I haven't used producer/consumer pattern before, could someone give me some ideas why this happens?
My code is in attachment.
Thank you in advance.
Yaqiong
Solved!
Go to Solution.
Attachments:
parallel - Copy.vi ‏72 KB

That would be the poor choice of using an event structure in the consumer loop.  As set up you must generate a mouse Leave or mouse enter event on Waveform Graph for the consumer loop to finish its first iteration. 
Delete the event structure.  you don't need it to update a graph.
Jeff

Similar Messages

  • Can anyone tell me what's wrong with my queue or producer consumer loop?

    A Labview engineer helped me with the overall structure of my program, necessitated by the fast data sample rate and post processing requirements. He recommended the producer/consumer loop and using one of the example files (Cont Acq graph voltage - int clk) to do the actual data acquistion. So I put together the loop and go my two channels of data acq going in the producer loop. However, nothing's getting picked up in the consumer loop and none of my data gets displayed over there.
    Anyone care to take a look at it and let me know what I'm doing wrong?
    Solved!
    Go to Solution.
    Attachments:
    P-C Yanmar Program.vi ‏296 KB

    Your Enque Element should be inside the while loop where you aquire the data.  As it is now, the data has to stop being aquired before you send the last set of aquired data.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Producer consumer loop for serial comms

    I have an application where I am trying to read and write to a serial port using a producer consumer loop.  My producer consumer loop seems to work fine until I put the serial comm VIs in the consumer loop.  Prior to that my event structure in the producer loop seems to work fine and all the controls on the front panel send commands into the queue and the expected reaction happens in the consumer loop.  When I put serial comm VIs into the consumer loop the application will read the serial port but none of the other controls on the front panel ever get any reaction from the consumer loop.  I am not sure if I am using the producer consumer loops correctly when using comms at the same time.  Any help would be appreciated!!
    I have attached the VI for your inspection.
    Attachments:
    pinger comms.vi ‏65 KB

    You could probably continue with your original architecture as well.  Just put the check for bytes at port in the Read case of the consumer loop.  As you said, it takes 1-2 seconds for the device to send data.  So the original architecture didn't work because you were queueing up 20 reads per second in the timeout case, but the consumer loop was taking up to a second for a single byte to come in.
    If you check for bytes in the consumer loop, if none are there, the Read case will end quickly and won't wait for that byte to come in.
    You should also probably increase the timeout of the event structure to 100-200 mseconds or even more.  The event structure would still respond instantaneously to user interface events.  And you would only be generating the timeout case a few times per second.  Which means when a byte comes in, it would probably be sitting there only 100 mseconds or so before you read it.  Unless you go click happy and generate lots of other  events not allowing the timeout case to run.

  • Producer consumer loop

    I have a Producer consumer loop that is  reading in data from a Excel File call sample1. There is a third party software that constantly writes data to the same excel file Sample1 every _ amount of seconds. Every time the Third party software writes it will over write the excel file data. So it may only be 5 columns and 3 rows.
    1. I need to make sure that there is not a conflict when the Third party software has the file locked to read and Labview is trying to read.
    2. I need to make sure  that if labview isn't reading and reading before the Third party software writes so basically i need some way of checking labview isnt reading the same data twice i need to make sure the file has been updated before it tries to read again. The problem comes in when you can't regulate the time that the third party software reads.
    Solved!
    Go to Solution.
    Attachments:
    VI snippet (2).png ‏123 KB

    I've had to write code for similiar applications.  It is tricky.
    Have a look at the .NET FileSystemWatcher.Changed Event.  This might be a good way to monitor what is happening with the file.
     Take a look at this post: http://forums.ni.com/t5/LabVIEW/My-First-Nugget-Directory-Changed-Event/m-p/1407552/highlight/true#M...
    "There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal

  • 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

  • Data delay in producer consumer loop?

    Hi,
    I've been creating an VI using producer consumer loop. In producer loop, every loop take 1000 samples at the rate of 40000/s(or 40000s/s devided by number of channels) and the consumer loop will average the data in a way corresponding to the "sampling rate" value on the front panel. The "sampling rate"represents the data rate on the chart and in the saved data file. If it's too slow,say 1 sample per second, then the producer loop will just wait for some time.
    So far the VI run smoothly, but there's one big problem. Each time I adjust the amplitude of input signal and the change doesn't show up on the chart untill several seconds later. When the "sampling rate" is really slow, the delay could be 1 minute! It's the first time I have ever used producer consumer loop and I 'm really confused of what causes this time delay.
    Could someone give me a hand with this?
    Thanks!
    Yaqiong
    Attachments:
    parallel.vi ‏73 KB

    You should consider further separating your tasks. For instance, the writing to file should be in its own task since file I/O can really cause delays in your processing. Also, I would separate your data processing (averaging) from the UI updates. The UI updates can be within a task that is using an event structure. It can get the data updates to update the chart but it can also quickly respond to the changes in your amplitude. I would also be very careful of the wait in your producer loop. This could starve the CPU.
    One last note. Your code could really benefit from a cleanup. Your coding style is quite a mess and it makes reading (and maintaining) your code much harder. For example, your code should generally read from left to right. Running wires backwards, having outputs on the left, lots of bends, etc all lead to messy code that is difficult to read.
    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

  • Basic Producer/Consumer loops for a newbie

    Labview neewbie here.
    I was looking at Producer Consumer loops.
    Can anybody give me a very basic explanation of how to set one up.
    I want to take readings from a HP 53131A counter and store them in an excel spreadsheet.
    I understand the part about labview slowing down as it opens the Excel file, and a seperate loop will help solve this.
    But I dont understad how to set up the Que function.
    Thanks.

    Multithreading will not make excell open faster but using concurrency you can have more than one operation operate ate different speeds.  The nice thing about the produce consumer model is that the if the consumer is slow or unreliable (freeses up) the producer doesnt care and will continue.  To use a queue is very simple, 1. create the queue, name it(optional) and give it a data type (ie int, array of floats ...)  in the produce loop use the enqueue vi to add items as needed to the queue, in the consumer dequeue these items (using a timeout = -1 the loop will wait for a new item and not consume resources)  the consumer can process the data acquired in the producer loop.
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • Synchronizing 2 graphs / producer-consumer loop stuck

    I have a pretty huge VI here, so I created a smaller one, which shows my problem.
    First thing is, the user has to set some parameters, before the VI is running. So, I created a sequence with a while loop. If the user hits the button, the loop ends. That works pretty well.
    In my huge VI I am doing data acquisition. The user hits the button in order to acquire data, checks the data and the data is saved when he hits the acquire button the next time.
    Next thing is, I have two graphs. When the user zooms one graph the scale of the other should be updated automaticaly. Therefor I created a loop with a event structure in it. If the user hits the button in order to acquire the next set of date, the loop ends. So far so good, this works pretty good as well.
    But now - if I zoom the graph before I hit the button in order to end the while loop, everything gets stuck. I don't know how to get rid of that behaviour.
    Please do not suggest anything like getting rid of the producer/consumer loop, since I specifficaly need everything that is in the VI for a certain purpose.
    If you need any additional information, please just ask. I hope my problem is described well enough so far.
    Attachments:
    zoomprob.vi ‏41 KB

    thanks for the response,
    the upper event structure will trigger the data acquisition process, so I don't want to have any time out value unless the user wants to start the acquisition process.
    the lower event structure will take care of the state when the acquisition is done, but the user wants to examine the aquired data. Using a longer time out will not be a disadvantage, but I think it will not solve the problem alone.
    At the moment everything works fine, if you use it how it is ment to be used. If you aquire data and then mess up with the graphs scale, everything is good. But if you try to manipulate the graph and then acquire data, it gets stuck. Apperently, that is not how it's ment to be used - but you know what users often do...
    Unfortunately the highlight execution is of no particular use. If I turn it on and manipulate the graphs scale, the vi gets stuck, but no specific process is shown in the code. Apperently it is waiting for a event, but it isn't triggered. So, beeing able to disable an event structure and enabling it later would solve the problem, for example.... I haven't found any solution for dealing with that, unfortunately...

  • Producer consumer loop array building

    Hello,
    I am trying to build an array in the consumer loop of a queued vi. This is the first time I have tried to use a producer-consumer structure since class many months ago. Each element is queued and sent to the consumer loop, and in that loop I want to build an array of the elements before I save it to disk. For some unknown reason I am having trouble accomplishing this. Usually I throw this stuff into a for loop, but here it isn't working.
    I am converting the random number to a string in the producer loop because when I build the real program I will be using strings.
    What am I missing?
    Tay
    Attachments:
    Loop test.vi ‏35 KB

    Just built your array in a shift register.
    (The error case is simply wired across.)
    Message Edited by altenbach on 05-16-2008 08:03 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    looptest.png ‏8 KB

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

  • Signed applet is only executed once

    Hi!
    Since the update to FF 3.6.14 (today I think), a signed applet which I developed myself and signed it with an official certificate, will only work for the first time called.
    On the first call, I am presented with the "Do you trust this?" JRE-question and on approval everything works fine.
    If I open the page once more, I get some SecurityException.
    Everything works fine in IE8 or Chrome...
    Any hints?
    regards
    Johannes

    https://bugzilla.mozilla.org/show_bug.cgi?id=629030

  • Foreach Loop only looping once

    Hi,
    Please be patient and bear with me, for I am new to SSIS packages.
    I am using SQL Server 2008 R2 to host the SQL Agent job and the SSIS package.
    I am using Visual Studio 2008 Professional Edition for designing the SSIS package. It is version 9.0.30729, Version 3.5 SP1.
    I am on a Windows 8 machine.
    My Foreach Loop Container seems to iterate only once when it should iterate numerous times, and this issue happens BOTH when I execute the SSIS package from within Visual Studio AND when I run a SQL Agent job to execute the SSIS package.
    For the solution within Visual Studio, I have False for the property Run64BitRuntime.
    In the SSIS pckg in Visual Studio, I have in the Variables pane a number of variables and these following variables pertain to my problem:
    Name: objRs      Scope: the name of the SSIS package     DataType: Object    Value: System.Object
    Name: txtVendorFamilyNumber   Scope: the name of the SSIS package  DataType: String   Value: 111111
    The value "111111" that I entered into the txtVendorFamilyNumber variable in the Variable Pane is NOT a realistic value as there are no vendor family numbers that have the value 111111. I will populate dynamically the real vendor family numbers
    from within the SSIS package.
    When I imported the SSIS package to SQL Server 2008 R2, via the ellipsis button for the Protection Level I chose the "Rely on server storage and roles for access control" choice.
    Concerning the flow of the SSIS package, going down within Visual Studio from the beginning of the flow of the SSIS package, eventually I have an Execute SQL Task. In its General tab, it has "1252" for CodePage property, "Full result set"
    for ResultSet property, "OLE DB" for ConnectionType property, "Direct input" for SQL Source Type property, "False" for BypassPrepare property, and the following for the SQLStatement property:
         select txtVendorFamilyNumber from tmpVendorFamily  where VendorID = (select min(VendorID) from tmpVendorFamily)
    In the tmpVendorFamily table on SQL Server 2008 R2, there are 379 rows of results for the SELECT statement above (starting with the values 100110, 100115, 100120, 100130, through the LAST row's value 106370.
    In the Parameter Mapping tab of the Execute SQL Task Editor, I have nothing. In the Expressions tab of the Execute SQL Task Editor, I have nothing.
    In the Result Set tab of the Execute SQL Task Editor, I have the value 0 for Result Name property and I have the value User::objRs as the value in the Variable Name property.
    This Execute SQL Task has a green arrow (Constraint evaluation operation, Success in Value drop down) to the Foreach Loop Container.
    In the Foreach Loop Editor, in the Collection tab, I have "Foreach ADO Enumerator" as the value in the Enumerator property. In the drop down for ADO Object Source Variable, I have chosen the User::objRs, and I have the radio button "Rows in
    the first table" selected.
    In the Foreach Loop Editor, in the Expressions tab, I have nothing.
    In the Foreach Loop Editor, in the Variable Mappings tab, I have "User::txtVendorFamilyNumber" for the Variable property and I have the value "0" for the Index property.
    So in the Foreach Loop, I first have a Script Task with the ReadOnly variable User::txtVendorFamilyNumber and with the ReadWrite variable User::TESTING_OnlyTesting that I created with a package scope, string datatype, and no default value. This Script Task
    has the following code for testing purposes:
    Dim strFullVerbiage As String
    strFullVerbiage = "The value is: "
    Dts.Variables("User::TESTING_OnlyTesting").Value = strFullVerbiage + Dts.Variables("User::txtVendorFamilyNumber").Value.ToString()
    Dts.TaskResult = ScriptResults.Success
    I have next in the Foreach Loop Container a Send Mail task. In the Expressions tab of the Send Mail Task Editor, I have for the Message Source property the following:
          @[User::TESTING_OnlyTesting]
    The remaining tasks (including FTP Tasks) in the Foreach Loop Container are disabled for now as I am trying to figure out why the Foreach Loop only iterates the FIRST time, only iterates once.
    When I run on SQL Server 2008 R2 the SELECT statement from the Execute SQL Task, I get 379 rows of results. The default value 111111 that I entered into the Variable Pane for the txtVendorFamilyNumber variable does NOT exist in any of these 379 rows of results.
    The 1st row of results has for the txtVendorFamilyNumber column the value 100110. Then the subsequent rows of results have the values 100115, 100120, 100130, et cetera, ending with the value 106370 in the last row of results.
    I imported the SSIS package into Integration Services on SQL Server 2008 R2. When I imported to Integration Services, in the Import Package editor for the Protection Level I chose the "Rely on server storage and roles for access control" choice
    because there are FTP Tasks and we needed to use this "Rely on server storage and roles for access control" choice.
    I created a SQL Agent job that executes this SSIS package.
    When I run the SQL Agent job, no error happens and I get only ONE email with the value 100110 for the vendor family number in it. I should get 379 emails total, the 2nd email showing 100115, the 3rd email showing 100120, et cetera.
    When I was testing while executing the SSIS package from within Visual Studio, I did NOT have the Send Mail task and I only had enabled one Script Task that had the ReadOnly variable User::txtVendorFamilyNumber and the following lines of code:
    MsgBox(CType(Dts.Variables("User::txtVendorFamilyNumber").Value, String))
    Dts.TaskResult = ScriptResults.Success
    Executing the SSIS package with only this Script Task enabled within the Foreach Loop Container, I would get the ONE message box showing 100110 but I would not get any message box for a SECOND ITERATION of the loop.
    Since my txtVendorFamilyNumber in the Variables Pane has the default hard-coded value 111111 that does NOT exist in the result set of the Execute SQL Task that feeds the Foreach Loop, and since the first and only email sent shows the value 100110 when I
    run the SQL Agent job that runs the SSIS package that is set up to send an email from within the Foreach Loop Container, the FIRST LOOP seems to run correctly and shows correctly the 1st value 100110 in the 379 rows of results that populate the Foreach Loop
    Container. Why does the Foreach Loop Container NOT loop more than once?
    Could anybody give me any suggestions as to what the problem might be?
    I thank you in advance for your consideration of my problem. I have been reading and reading on the Internet to try to find a solution but I have not solved yet my problem with the Foreach loop only iterating once.
    Thanks much to you.

    Gregarious greetings Arthur,
    I very much appreciate your reply.
    This morning I figured out my problem with the help of a fellow employee.
    In my original post higher up, I had typed about the SELECT statement in the Execute SQL Task that is just before the Foreach Loop Container and that populates the User::objRs, and this SELECT statement was in the old DTS package in an old ActiveX script
    task. The SELECT statement was in an old DTS package in an old ActiveX script task and I am creating a new SSIS package to replace the old DTS package so that we can move from the old version of SQL Server to a new SQL Server 2008 R2 server. Here is that
    SELECT statement:
     select txtVendorFamilyNumber from tmpVendorFamily  where VendorID = (select min(VendorID) from tmpVendorFamily)
    That SELECT statement above returns ONLY ONE result. I had not noticed it. That SELECT statement fills the objRs result set. The green arrow goes from the Execute SQL Task that has the SELECT statement down to the Foreach Loop Container that loops over the
    result set. Since the SELECT statement that fills the result set only has one row of results, the Foreach Loop only looped once.
    So for the Execute SQL Task that populates the result set User::objRs, I changed the SELECT statement to be the following:
    --In the Utilities DB, this tmpVendorFamily table
    --has only two columns named VendorID and txtVendorFamilyNumber.  
    SELECT DISTINCT txtVendorFamilyNumber
    FROM Utilities.dbo.tmpVendorFamily
    ORDER BY txtVendorFamilyNumber
    Now the Foreach Loop will loop 379 times since the SELECT statement immediately above yields 379 rows of results.
    So the Foreach Loop Container was fine. Its Collection tab has the "Foreach ADO Enumerator" for the Enumerator and has the "User::objRs" for the ADO Object Source Variable. Its Variable Mappings tab has "User::txtVendorFamilyNumber"
    for the Variable and has "0" for the Index.
    My problem was the SELECT statement in the Execute SQL Task that immediately precedes the Foreach Loop Container and that fills the User::objRs result set. The SELECT statement yielded only ONE row of results. When I corrected this morning that SELECT statement
    so that it correctly yields 379 rows of results, the Foreach Loop Container loops 379 rows.
    Thanks again for replying and trying to help. I very much appreciate it.
    I consider this thread that I created to be closed since I figured out this morning how I needed to correct the SELECT statement in the Execute SQL Task that fills the result set on which the Foreach Loop loops.
    Misko_Hviezdoslav   27-JAN-2015

  • Consumer loop slowing down producer loop

    Hi All,
    I'm currently using a PXI to send commands to a chip, then retrieve the results with a DAQ. This process loops to populate a 256x50 array of values.
    Each time the loop is fully populated, I want to display the result onto a 3D plot, using 3d plot lvclass and plot helper. I noticed through the profiler and using timing functions in the loop that the 3D plot would take ~200 ms to update. The array would fully populate in about 100ms, so tripling the time to update was kind of nasty.
    I put the 3d plot into a consumer loop and everything else in a producer loop. It works fine, I don't mind about dropped frames, but it was running at the same speed. Apparently whenever the consumer loop executed, it would freeze completely the producer loop.
    Why is this? It seems like this fellow had the same problem:
    http://forums.ni.com/t5/LabVIEW/Producer-Consumer-Loops-not-independent/td-p/1115665
    But he "solved" it by removing the graph altogether. As showing the graph updating in real time is critically important, I can't just chuck it.

    No, an action engine is sometimes called a LabVIEW 2 Style global. They are basically a VI with a while loop and an unitialized shift register. They are useful when passing large amounts of data since it does not get copied. Also if you have transformations that are made on the data it is a single self contained VI that has data and actions which can be performed on it. Today a LVOOP implementation would be prefered. At any rate, this is a non-reentrant VI which will cause blocking to occur if called from two or more loops at the same time.
    Out of curiosity, what type of graphics card do you have in the PC? Would a better graphics card help?
    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

  • Releasing Queue in Producer Consumer model

    I am having a VI which reads data from ethernet,writes to disk,processes and displays. Since lot of processing and displays are there, I am converting it to a Producer- Consumer model so that no data is lost.
    I am using 2 loops. IN the Producer I am doing the UDP read and Write to disk functions.and use the enqueing also.In the Consumer loop I am dequeing it and do all the processing and displays.My idea is to avoid any data loss in UDP reception and file writing.
    My confusion- where to use the release queue?from the Producer or Consumer ? In a third loop ? Should it be in a sequence structure ?
    How to set the loops stop conditions ?
    My requirements for stopping - when I press the stop button the program should stop completely(the Consumer loop should stop only after dequeing and processing all the data in the queue).  If i don't press the stop button the whole program should run continuously (if data does not arrive for some time it should wait without time out-i am using -1 for the time out condition in UDP read.)

    Here is the ultimate Producer-Consumer loop.  It queues a stop command when the stop button is pressed.  This ensures that every element is dequeued and processed before the bottom loop stops.  The last queue data to get processed is the stop command because after you press the stop button, the top loop stops enqueueing more elements. 
    If your data type is other than a string, you can create something to represent stop, like NaN for a numeric. 
    Notice the shift registers.  This is good practice.  Every loop starts with an error out of the previous loop.  If an error occurs, it is passed on to the next loop iteration.  Also, if an error occurs in the consumer loop, the loop stops.  It is good practice to put shift registers on the queue reference also, but not necessary in this case.  If you use a For loop, and the loop iterates 0 times, the output of the queue reference would be a null reference, and the Release Queue would not release the queue.  With While loops, they always iterate at least once, so it isn't necessary.  Its just good practice to make a habit of using shift registers so you don't forget when using For loops. 
    Notice also that the error in to the Release Queue is not wired.  If there were an error, the Release would not take place.  All errors are merged at the end to report exactly where an error occured.  A timeout is included in case an error prevents the stop command from being enqueued or dequeued.
    - tbob
    Inventor of the WORM Global
    Attachments:
    ProducerConsumer.vi ‏53 KB

  • How to end consumer loop

    I am using producer/ consumer pattern to separate data acquistion and processing. The consumer loop is much slower than the producer loop. If I put "release queue" outside of the producer loop to stop the consumer loop, the consumer loop can just run once. But I need consumer loop to run same times as producer loop. So I did not use the release queue to stop the consumer loop but used the error connecting with  "stop if true" in the consumer loop. The producer loop and consumer loop are in a sequence structure. It seems that the sequence contains producer/consumer loops can never finish to enter into the next sequence. I think that producer loop and consumer loop have all stopped because their iteration numbers stop increasing at certain time. But the vi can never go into the next sequence. So I am very confused about that. If I put "release queue" outside of the producer loop to stop the consumer loop, the vi can finish this sequence and go into the next sequence. Do anyone know how to solve the problem?

    Sophia,
    The idea of passing the stop command via the queue is that it will be at the end of the queue - after all the data.  The consumer loop will see the stop command after it processes all the earlier data. In this case it might be better called "End of Data" rather than "Stop." 
    The sequence structure is totally unnecessary.  Use dataflow to handle the initialization and  completion code.  The sequence structure will definitely proceed to the next frame when all the code within the current frame completes execution.  If the iteration counts have stopped increasing it may mean that the loops have stopped running or that the producer is blocked, waiting for something within it to finish so it can go to the next iteration.  It is also possible that the consumer loop has started an iteration but no data is in the queue.  Since the timeout is default at -1 the Dequeue will wait forever for data.
    Please look at the style guides.  Use left to right wiring and avoid hiding wires behind other objects.  Also try to keep the diagram to the size of one screen.
    Parallel loops should always have some kind of wait or delay to allow CPU resource sharing.  In the producer loop the data acquisition VI may provide that function.  In the consumer loop the easiest way to get a delay would be to change the Dequeue wait time to something other than -1.  You also should check the Dequeue Timed out? line if you use timeout for the delay.  If it is true, then the data is not valid and should not be analyzed in the for loop.
    You probably only see the last of the 10 spectra. Unless the datasets are rather large, the loop will probably run too fast to see the others.
    Lynn 

Maybe you are looking for