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).

Tags: NI Software

Similar Questions

  • 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

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

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

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

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


  • Producer consumer Start Trigger

    Short explanation: I use a party apparatus 3rd signal a TTL to use as my trigger early in my VI. My cDAQ and modules seem to have the ability to send a trigger start regardless, but I could not track down the how to do this in a system of producer/consumer.  I have an idea at the bottom of the long explanation.

    Long explanation:

    I am running a test system that monitors the pressure wave by an inflammation of the hydrogen/oxygen. The components are a cDAQ-9188 with modules 9222 (x 3 HAVE broadband), 9481 (x 2 relays), 9402 (x 1 i/o Module), 9221 ('Low' speed HERE).

    Based on the recommendations contained in this forum, I placed my DAQ in a producer/consumer architecture.

    At this point the system works for the most part, I still have some more things to add for all the information I want to collect. However, it records at high speed and the 9221 and the 9222 modules are synchronized. He collected reliable data to date successfully.

    When the system boots it will follow, but not save. I need to fill the structure tested with gas at a specific concentration before I switch on/registration. When I press the record button I have a TTL of the 9402 signal to my high-speed camera and I close a relay on a 9481 who engages in an ignition system. Ignition system takes a variable amount of time to load and shoot so I have a timer that leaves the TTL and the active relay for half a second.

    My problem and it is a small, comes up with the system monitoring and synchronization. In order to get the system to synchronize properly, I had to generate an external impulse in PFI0 to use as a trigger. I tried to assign the different clocks available as a trigger of the beginning, but I found myself with unsynchronized data.

    Is there a way to generate a pulse on my 9402 to use as a trigger? It feels stupid for me to use an external device, when I have something that can generate the signal that I need.

    Thinking about this post, I have solved my problem, at least in my head. I think I can move the output TTL VI (that I'll eventually change to DAQmx) in the loop of producer and move my statements true or false for the consumer in the form of a 1 d array loop in my queue to start recording. Probably more than that, but I can only learn by experimentation on the right?

    Thoughts? Recommendations?

    VI attached.

    You cannot generate a pulse with the 9402 himself. The pulse would be actually generated by the 9188. You must create a task of meter output to generate a pulse train. Try the attached example as a starting point to experiment with the meter.

    This Vi is for LabVIEW 2013, if you have an older version let me know and I'll try to convert.

  • Architecture feature producer consumer

    I was wondering if the loop of consumer in a producer consumer architecture works only when the loop of producer send him something, or he still works, even if it receives nothing from the loop of the producer?

    It depends on how you put in place. If you do not have a timeout on the dequeue, he'll sleep until he gets a message. If you have a time-out, it will run if the value of timeout is reached.

  • Programmatically change the number of producers in an architecture of producer/consumer

    Hi all

    I've got 3 momo SoMat I am streaming of data to 10 Hz. I plan on 3 producer loops and loop a consumer to treat.

    I am pretty sure when I show my customer that they want to increase the number of devices. This scuppers then the producer/consumer model unless I change by programming the number of producers and the rest of the architecture associated.

    Is there a way to do this or a better architecture?

    Phil

    As long as there is an ID any in your command of the queue, I do not see why your consumer cannot handle the producers as much as you need.  I would turn the producer code in a Subvi.  Make sure reentrant Subvi.  Then, you can call dynamically that VI as many times as you need, one for each instrument.

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

Maybe you are looking for

  • Trying to create a new tob is by '+' or cmd T, or work

    Until today, I was able to create a new tab using Firefox 30.0 (Mac o/s 10.9.3) without any problem. But today, I'm unable to do.Preferences/setting were unchanged. Any advice on this would be greatly appreciated. Thank youNeil McMurdo

  • What battery for Satellite L775-14 days?

    Hello I have a Toshiba Satellite L775-14 days (P/n PSK3WE-03R006FR).The original battery is PA3817U-1BRS, but I need to replace.Can I use a PA3817U-1BAS instead of the - 1BRS?What is the difference? Is there another compatible battery for my computer

  • Compaq Mini CQ10 800ST: upgrading RAM CQ10 800 ST

    Hello. I want to update my PC RAM from 1 GB to 2 GB. But it says that you can only use 1 GB for this PC. Is this good? http://support.HP.com/tr-TR/product/Compaq-mini-CQ10-PC-series/5082175/model/5116210/document/c02863...

  • Dialog box is not displayed in CC2014

    HelloThe dialog box is not displayed in CC2014, but previous versions, works very well for me. Associated codes are below, can you please guide me to solve this problem.showDialog()function showDialog() {}App.Selection = NothingEnum.NOTHING;app.findG

  • I want to insuscribe because I do not use of the applications. Thank you

    I want to insuscribe because I do not use of the applications. Thank you