Timed loop in loop of producer/consumer

Hello!

I have a loop of producer/consumer LabVIEW program configuration to allow me to properly capture the images that are large enough (8MP) at about 14 frames per second (FPS). The program works very well when the consumer loop is a while 'loop' (recorded at 14fps without problem), but I wanted to do a loop timed, so that I can vary the FPS as requires it. A curiosity arises when I do that. Anywhere under 12 fps, the loop works very well and the data is saved correctly. However, when I bump it up to 13fps, the calculated consumer FPS goes haywire and starts to jump between 9 ~ and ~ 13fps (processing of data gets bogged down?). When I set the FPS at 14, the loop runs at a constant maximum 7 fps. Is there something I can do to remedy this situation?

I have attached my .VI

Thanks in advance!

Palanski,

Are you using LabVIEW Real-time? Loops clocked to a windows OS do really increase determinism more than a while loop with a wait until the next timer multiple. Before you change the loop of producer-consumer in order to include a while loop was programming works correctly? You can also vUtiliser the VI analyizer to see how long things take to run. I let the loop of consumer to the producer in the traditional game upward and change the FPS by controlling the timer to wait, after benchmarking your code, it should be done in the same way as you did for the timed loop

Tags: NI Software

Similar Questions

  • time synchronization in a loop of producer/consumer

    I wanted to save the loop producer once data within 4 seconds. But this is not possible due to the wait function in the loop of the producer. It records the data once in 5 secsonce in a loop of 4-5. When I cancel the wait function, the loop uses very high CPU. How can I avoid this problem of synchronization?

    Yes, in fact I ran your code and got the problem...

    You use two functions of timing (wait for ms and the time) in the same runing loop on a non-real time system (i.e. Windows)... And like its non-deterministic, this behavior is expected...!

    However if you want to generate and save (the last sample) at different rates... you must do in the different loops...
    Tell me that you already do this in the different loops... but in your implementation... execution of the lower loop is still controlled by the loop of producer.

    I've made some changes...

    -> Replaced QValerie with Notofier.

    -> Now, the time is part of the lower loop (loop of consumer).

  • export to spreadsheet - data 2 channels appear in alternation with loop of producer/consumer

    Hello

    I'm having trouble with the function "Export the waveform to the worksheet" - but it is not clear to me if the problem is with how I use the export feature or if I am wrong concatenating two waveforms of different modules of the series prior to export, or if my queue is wired incorrectly for producer-consumer loops.

    I use a hunts SMU-1073 with SMU-6361 and 4330 modules (tension and strain). I tried to change the example of the "entry analog cross synch" for use with a structure of producer-consumer (see VI below).

    The output of the worksheet contains a large part of the data in the string tension, followed by a smaller piece of data (with timestamp) strain, after which the alternate output data between data of tension and strain.

    Can anyone suggest where I could go wrong, or how I could solve this?

    Attachments do not work, so I'll try to post in an empty message directly after this post.

    Thank you

    Claire.

    That's what I thought.

    A number of wire.  -1 gives all the samples available in the buffer (which can be zero for some reason any).  A number will expect that there are many examples.  If the two readings can wait until they have both the amount of data requested.  This way, they will also have the same number of samples and be better aligned in the text file.

    Your loop will continue to run until you press stop or get an error.

  • Funky producer/consumer behavior

    If it's a weird thing...

    I have a loop of producer/consumer taken (especially) of the labview model is based.

    For some reason when I click on the button stop to stop the program, instead he wants to run through the case of default (shown in picture) a second time.  That is, I run the program, that my event, the event takes place through, I click the button stop, then the event goes smoothly once again and finally stops.

    In addition, there are 2 times in my program where I record data, in the beginning where I implemented headers, and after all the data is taken.  If I have the program stops after clicking on the stop button, but before the event through even once (there that while loop which is idling until I click on 'accept the level') if I abandon execution, then the previous run data not saved.  (Although the 1st write to spreadsheet.vi may be overwriting the previous run data, which might be the reason why he is absent).

    What I've done wrong, what makes my program run it twice?

    If you are relying on the destruction of the reference of the queue to stop the loop at the bottom, wrap the structure from the bottom case with another structure of case that starts on the Dequeue elements error - use cases existing in the State without error and any special in the case of the error and discontinuing treatment.

  • Convert single while loop with variable Timing literal to the producer consumer

    I have a controller for a biological system that updates every n minutes or every minute 2n, under certain conditions. My app has a synchronization controller calculates if the current iteration is n or 2n and feeds the output of this calculation in a loop of "Timing" VI in my all. If I understand correctly, this is similar to the issuance of an order of sleep() in a language similar to C and should be avoided. I'm refactoring my code and I heard that they are well suited for this kind of things. Here's how it should work:

    1. Loop begins at the time T, T is saved.
    2. Schedule controller runs and calculates if loop will get minutes 2n or n minutes. This controller will take a number of milliseconds to complete, so we are is more to time T.
    3. Now that the update interval (n or 2n, let's call it u) is known, the loop must until T +u fill.
    4. The PDC is executed, but a number of milliseconds to execute.
    5. The rest of the time until the next iteration of loop should produce the CPU for other processes.

    It sounds to me like it's the kind of a real-time system, although as long as we are in the minute of the original deadline, there will be nothing wrong.

    What the producer-consumer loop would look like? Assumed that the synchronization and the main order controller are separate from the VI.


  • Producer / consumer set loop of dynamic data item type

    Hey all,.

    I do a simple exercise of producer / consumer in a loop. In my loop of producer I audio Aqcuerir and in the loop of consumer I'm projecting on a chart

    Everything works as I had in mind, the only thing that bothers me is the way that I had to set the type of the element to the block "Get the tail" at the beginning.

    I knew no better way to get the kind of data that I used to just take an another "acquire its" Express VI and which hang. But that may not be the only way to get there, right?

    Note: I know that I might not need to use a producer / consumer design tend to do, but I need to get hold of technology for school work so I came with this exercise just to get a hang of it.

    Thanks in advance,

    Al.

    Al,

    You just need to feed the correct data type in this entry, which you did by getting the output of a second acquire its Express VI.

    You can also use the "Convert to Dynamic Data" function to do this.  When you drop to the bottom of the function, you will be asked to give the input type.  Tests I've done, it seems not to matter, but for example if you chose the entry to a single scalar type, you need to feed a digital constant (change to double type) in the entrance and use the output of dynamic data such as line item data.

    I don't like the dynamic data type because it is not very clear as to what it is.  Another thing you could do would be to use the "Convert from Dynamic Data" function to change the output of the VI of its acquisition to a different data type for more or less to avoid the original problem all together.

  • producer consumer loop run only once?

    Hello here

    In my VI, the loop of the producer seems to operate continuously, but the loop of consumer only run once.

    I did not use producer/consumer patterns before, could someone give me some ideas why this is happening?

    My code is attached.

    Thank you in advance.

    Faouzi

    It would be the wrong choice to use a structure of the event into the loop of the consumer.  As it is configured, you must generate a leave mouse or mouse event enter on the graph of waveform for the loop of consumer to complete its first iteration.

    Remove the structure of the event.  you don't need to update a chart.

  • Producer consumer with the third loop model

    Hello everyone and thank you for looking at this.

    I have a problem that I thought for a while now on the execution of a third loop in a design model of producer consumer (with events).

    I use this type of model for a UI and am happy with how it works. However if I want to add a continuis loop model to test for example how can I control the loop?

    In my example (see table), I use a local variable to run them (or stop) the test and the same to close the application.

    I don't know why, but this feels wrong to me. Is there a better way?

    Thanks in advance

    Chuck

    Nickelback says:

    Is the problem with the consumer loop only runs when it receives a message from producer loops event.

    Nothing says that you can't have a consumer loop enqueue States to itself.  Of course, this is more in a State Machine in queue with the possibility for another loop to the States of the queue.

  • Producer/consumer problem: several loops/queues

    Hello

    Please refer to my previous post ... http://forums.ni.com/t5/LabVIEW/What-is-the-best-way-to-switch-between-multiple-image-buffers/td-p/1 > for more on the subject. I was told to try a producer/consumer architecture, so I decided to go and do it.

    After doing much research, I come back to ask for help.  I decided to try to implement three loops. The reason for this is because I thought that the length of each loop synchronization can be controlled independently as it should. A single loop treats all user interactions.  A single loop treats data acquisition.  A single loop about the transformation.  I hope that this would help, but obviously made things much more complex.  I created a queue for each loop.  I didn't get the full project, but it seems that everything has run very well where I stopped.  However, one of my States I did not queue receive queue and I have no idea why or where coming.  There is an error in the variant data that says

    'status'-> TRUE
    'code'->-6
    'source'-> ' error: Invalid Args.

    However there is no error in wiring.  Also when this error is displayed, the random State fell through.

    The other weird thing is the number of items in the queue jumps very quickly when I do almost anything.  I don't know if it's common.

    Before I post pictures or whatever it is, I would have an idea about this error.

    Also, I think I saw this in a previous post about the BAU, but I would like to ask a question.  Attached are two photos.  Queue 1 is the way I put things in place.  Queue 2 is the way I saw things in place.  Can someone tell me if the queue 1 is the wrong approach and why?

    I realized what happened.  The other loop was not handled properly and sent the random State of the main loop.

  • Cannot terminate everything in a loop to the producer/consumer

    I have attached a simple vi which was built from the producer/consumer (events) model.  In vi I set up a counter.  I want to be able to complete the meter when you press the stop button.  This does not work as expected.  The meter goes to its full count before the program stops.  The vi works as expected when run in execution to highlight mode.  Cannot understand it.

    Thanks in advance.

    Race condition.  No matter what time something behaves differently with that highlight run it at full speed, and suspect it is a problem of synchronization due to a race condition.

    As soon as your producer loop has the command queued up, she is ready to handle the next event.  If you press the stop button, it is ready to deal quickly and the stem while the ends of the loop and Stop immediately gets back to false.  This probably happens before the loop of consumer has the opportunity to read the local variable of the button stop in the moment, it's true.  Have your consumer while loop redefine the Stop button to false instead ensuring consumer loop has a chance to see if it is true.

  • Producer consumer loop

    I'm constantly trying to read data from a file every 30 seconds, for example. Then use the data read to update all my indicators and LEDs on my front. Producer consumer architecture that is suitable for use?  someone at - it an example to follow?


  • Why the STOP button stops not timed loop.

    Hello world

    I had a rather complicated code launched against me. I had to change program action unique (and many other things) when ACQUIRING a button has been clicked making timed measurements. I was able to add the time... but I want the loop to stop once you click on the STOP button.

    I have attached a very simplified version of my code.

    So if you start and press the ACQUIRE the program generates random numbers (to simulate the measure) and records them with a device ID. The program stops once the total is for instance in the default settings after 20 sec.

    But it does not stop when you press the STOP button. MY QUESTION: why not?

    FOR INFO:

    In my actual code, there are 10 events instead of only 1.

    It doesn't have to stop immediately, inbetween iterations (because I already tried to include the timed stop Structure VI and it did not work either).

    I also used the execution to highlight, but it did not help me.

    Thank you for any help or suggestion!

    Lisa

    Lisa,

    First of all, thank you for explaining clearly what your problem and to present a simplified program.

    The problem with your program is very simple. The loop inside the structure of the event begins when the acquisition: Mouse Down event occurs, which seems to be what you wanted. The default condition for the case of the event is "front Lock (defer the treatment of the actions of the user) until the end of the occurrence of the event." This is controlled by a checkbox at the bottom of the evetn installation dialog box. What this means is that the stop button is not recognized until AFTER the event is complete.  BUT the case of the event cannot complete until the while loop stops.

    The Solution: Move the loop outside the case of the event.  Generally speaking, event must not contain any code that could take more than a few milliseconds to run and certainly should not depend on the user's other actions to complete.

    Look at the design of producer/consumer models (events) for advice.  Also learn how to use queues to pass data between loops rather than local variables.

    Lynn

  • Error of timing architecture producer/consumer

    Hello

    I use architecture of producer/consumer for the acquisition of measures of constraint by using several channels. Also, I am interested to write data all 1 minute given that the program should be run for a month. Currently, I get a 200279 error whenever I increase the time of 10 sec. To control the execution of the loop of producer, I use 'weight up to the next multiple ms' function. According to the error message, I tried to fix the samples to read without increasing the frequency of data acquisition, but I still get the same error.

    Thank you

    Piyush

    Your test3.vi was not included, so we do not know what is happening there.

    What is the rate of acquisition for your data acquisition task?  DAQ hardware do you use?

    Have you tried to increase the size of the buffer?  There is a property node that can define it.

  • Timed loop continues to turn after stop

    Only, I have seen this time, but thought I should ask about it.  After pressing the stop button, I was surprised that the diagnostic LED on the front panel of the main vi kept flashing.  With the performance highlighting ONE values showed that the timed loop was still running.  I checked the other 8 loops clocked subvis and they also ran. None of the methods Stop worked. Only stop LV and abandonment of the cRIO eliminated the problem.

    Run LV2014 SP1 on cRIO-9067 with dual-core ARM processor.  Windows 7 x 32.

    BTW: The function of the check LED VI scale does not work on this device.

    You must allow an order any to be able to stop your curls.  A simple global variable would work well here.

  • FPGA: Vs timed loop Timer?

    Hello

    I would like to create a FPGA loop that runs at a fixed rate. Whatever if I use a timed loop structure or a timer loop express VI into a regular while loop? Under what circumstances should I choose one over the other?

    I understand that the timer loop approach can cause the code in the loop run twice before calendar is established (but this isn't a problem for me here). Are there other differences in the two approaches?

    Thanks in advance.

    JKSH wrote:

    But my question was about the differences between the use of "multi-cycle" Timed loops and VI express loop timer.

    In a targeted FPGA VI, all call loops are single cycle timed loops (SCTL).  This means that all the code in a SCTL must run in a clock cycle, so there are a few types of nodes cannot be used in such a loop.  In a used while loop with a timer, you can use a wider range of features, but the loop will generally run much more slowly.

    These documents may be useful to learn how to use loops clocked on FPGA:

    Using loops of Cycle time unique to optimize the FPGA VIs

    Optimization of your screws of LabVIEW FPGA: running in parallel and Pipelining

Maybe you are looking for