Producer/consumer vs Master/Slave of data loss
Hello users of Labview,.
I did experiment with vs p / M/S lately in the context of data aquistion. Many messages did appear (correct me if I'm wrong) that p/c is the correct architecture to if the data retention is desired, so that's what I tried to implement.
In the loop of producer, I've included 3 Assistant DAQ VIs (2AO, 1 HAVE), which generates data actively and which is being queued. I have 3 other loops of consumers, two of which are consumer 1) written loops of 2) outputs TDMS data of a chart 3) no producer: structure of the event, monitors changes to the user interface.
When I run data acquisition, the generated file are always half either acquire the half of the sample that I've specified regardless of the sampling rate. I also have a strange displayed graph (see image).
If I replace with a master/slave architecture, this seems to solve the problem.
So question is: anyone met with this kind of problems? Are there disadvantages to stick with M/S instead of p/c in terms of data loss?
I think I'm well done
You are not. Once an article is removed, he went. Since you have three loops made of the same queue, each loop will get ~1/3 of the data. If all the loops are to treat everything, then you want another line for each loop and meet the producer, write to each queue. You can also use a user event.
Tags: NI Software
I have NEITHER cDaq-9188 and its modules NI 9214 (thermocouple), NI 9203 (HAVE current) and NI 9263 (AO tension). I need to measure the temperature and pressure, and according to these data, I need a frequency converter to drive a compressor control. I've developed acquisition, analysis and recording program by the use of the state machine, the design of producer/consumer model and I have no doubt about their. They all work very well. Now, I need to add a control program in their. The problem is that I need to check the compressor with feedback from temperature data permanently, but I do not necessarily all the data acquired and permanently from the results of the analyses. For example, I need to record data once in 30 seconds. Which model desing should I use for this task?
Edit: I was not able to find examples of advanced program relevant to the design of master-slave model. If you know where to find them, could you write in this thread please?
The declarant buffer not data. Do only the queues. A new notification replaces the old value if she is ever read or not. You would be loss of data with the notifiers if the loop of consumers with a notification utility cannot keep up with the data that they fade.
What I show all the data buffers through the queue in the loop of the producer. The queue of the consumer removes all data and do stuff with him (such as logging) if the elapsed time is over. What is the problem with that? That is what for (imstuck) described in his message.
The other alternative is that you put the timer into the loop of the producer. Have the Boolean value TimehasElapsed drive a deal structure this place only the data if the time is over. In this case, only some data gets queued, and consumer loop removes all data as it gets and it opens a session.
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,
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.
I'm developing a HMI to receive data from a sensor.
Material sensor is built in my company and I have no flexibility with her. Only 2 RX & GND wires, no possibility of
The sensor send to an RS232 com port a string hex each 1 s, 10 s, 60 years or more and I can not know the frequency.
So, I scan each data bytes to the serial port and serial port with VISA Read 20ms. At the end of the string hex sent by the sensor
There is a stop character but I don't how to use it.
I use the model producer/consumer do not lose any data.
In fact, I read and concatain received data (with VISA READ) until I got the right number of bytes (because I know the size of)
the sent hexastring is 495 bytes).
But in the real work, I don't know the size of the data to be received by the sensor. (<500>500>
So, I want to use the character of endpoint to stop the loop of producer that contain VISA READ.
Should what special function or the property node I use to do this?
I've attached a screenshot of JPEG of my code.
PS: for the development of the VI, I simulate the sensor data with another PC that sent the hex string in loop
with the stop character.
CHRI = s = nour wrote:
But in the real work, I don't know the size of the data to be received by the sensor. (<500>500>
A method to read an unknown number of bytes: put just the bytes to the Port in the whole loop (not read). Place the output of bytes to the Port into a shift register and compare the latest iteration with the current. When the number stops change (current loop = last loop) then all bytes have arrived. Bail out of the loop so directly while reading VISA.
We know that in the models of master/slave and producer/consumer can send information of the master loop or a producer to the loop of the slave or the consumer. But what to get information of the loop of the slave/consumer back to the master/producer loop? I think it may return some sort of output or a message saying something like "I finished my work successfully. This can be done with local variables, but is it really a good idea? Is there another better way? In addition, in this case can I just use a sub - vi? I don't know that I always get the PARALLEL treatment offerred by master/slave and producer/consumer with a sub - vi.
You can use a notifier to send a return message. You can use a local variable, but unless you know what you are doing, you might encounter problems with race conditions.
Sub - VI have nothing to do with producer/consumer architectures. You can do a p/c with or without sub - VI. Sub - VI is a way to break the code in significant functional blocks.
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.
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.
Is it possible for me to use any type of data in a model of design producer consumer, without specifying specific data type?
what I mean is if there is a way to connect to a data type with which I can use any other type of data, not to mention that one that I have connected, and if not, how can I specify the data type for a number or any other data type, for use in a design of producer-consumer model?
You can make a part of your cluster of data a Variant. It will take any type of data. A common architecture for the producer/consumer is a cluster which is an enum and a Variant. The enum contains all possible "orders", you might want to send. The variant contains data that could be of any type.
Ungroup you in the consumer and get the enum and Variant. Attach the enum to a case structure. In the specific case, convert the variant type in a data type of regular LabVIEW and with it as you please.
I have a type of producer-consumer of application in which a single loop continuous waiting there and reads data from the card and another loop readings/backups of data. But besides a loop more trace data. The number of channels and real-time scanning is set by the user, the time it would take to save, view, and analyze each data block (an iteration of analog-to-digital reading) may vary according to different parameters.
I'm putting 'number of samples to get' big enough on analog/digital playback to the beginning so I don't get the overflow of queue. Now I would like to adjust automatically when the program is running so I understand any overflow from the queue and at the same time the data are not exposed in the huge chunks at a time. Someone did he do this kind of thing before? For now, the only idea I have is to read the number of items in the queue at all times and use a mathematical formula to increase or decrease the number of samples.
The number of items in the queue of streaming and using a mathematical formula to increase or decrease the number of samples is a good method. You can also use the decimate 1 D table function to display a smaller grouping your data if your problem is that you do not want to display huge chunks of data at the time.
Someone on this forum, in a separate last week discussion, suggested that I use the producer model consumer data acq. My ultimate goal is to acquire analog channels 1-4 continuous data, display graphical band style and save the data on the boot disk when the user presses the 'Start Saving' button (and will continue to display recorder cards). Economy will stop when the user presses the button "Stop Saving" but strip map will continue to operate.
My attempt to use the producer-consumer model is attached (LV 8.5 only). It does not work. I have not tried to implement for recording user controls - just trying to make simple continuous display and save (1 channel) at this stage, using this model. VI runs, but the graphic Strip is never updated with the actual data, and the data file that is saved has zero byte inside.
Looked at your code, and you are right. It won't work.
Take a look at this example:
The VI of the acquisition must be inserted in the loop of the producer. In addition, you must tell him how many samples for (otherwise, it will get 0).
First some background to the question (skip this paragraph if you are simply interested in the question). I'm relatively new to Labview, after only a few months of coding with Labview and LabVIEW Core 1. Being one of the only people in the company who now knows Labview I have been challenged with the creation of a relatively complex application that will perform a selected ten or to view different tests with customizable options, display, analyze and deliver and automate reports.
For the application I am writing I need a GUI with several screens (I achieve with tabs), initially I tried this code with the structures of the event within a machine to States (but as you probably know this was fundamentally flawed, that you can't put structures of the event within the structures of the case) (, or structures of the event), but from here, I spent several hours of searching the best alternatives.
So my Question is: would recommend to use a master-slave (with the structure of the event and the State of computer, respectively), or simply use to continually voting machine status?
(Keep in mind I'm going to use this as part of a larger facility of producer/consumer.)
Thanks in advance,
I use a case in my state machine specifically for checking to GUI events. It is usually a "Idle" State or a specific State to 'check events. I can also set the time-out programmatically by using a register shift, just in case I need to do a quick check (some small timeout) or wait for a user to press a button (timeout is - 1).
I am currently working with two instruments; an Agilent E3646A and a NI 6212 BNC. My goal is to have the 6212 continuously take measures according to predefined parameters while the E3646A parameters can be continuously updated. This combination simple instrument aims to help me learn the manual architecture; continuous measurement, output dynamic controls and instruments more will be added in the future.
I've already posted on a similar, but more complicated configuration (http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Split-second-lag-when-controlling-two-instrum... and was advised to try the producer consumer Architecture.) I found the documentation on the website (http://www.ni.com/white-paper/3023/en/, https://decibel.ni.com/content/docs/DOC-2431), searched the forums and built my own VI. While my first attempt at a producer consumer Architecture has solved some of the problems I had when I posted on the subject, however, new questions have been raised regarding the reading and adoption of the VI.
I am currently able to run the VI and update the settings on the device. Previously, I'd get a freeze while the instrument has been updated and could not switch settings until it was done. This has been resolved, although that reading updates only when a parameter has been updated, although it is outside the structure of the event. In addition, the Stop button does not in any context. I also got occasional mistakes on the part of Deqeue, but the major part of the sentence is error-200279 'A tried to read samples that are no longer available' to DAQmx Read. I realize that there is a problem in my loop of producer but have not been able to find a way to solve it.
This is my first attempt at a producer consumer Architecture and already I can see that it is a powerful tool. I read as much as I could and looked at examples, but should have some problems at the beginning. Would be very grateful of any advice so I can take full advantage of the architecture.
Hope to hear from you,
You're going to overflow this buffer, unless the events are generated faster than "sample rate/number of samples. Period. Nothing could be simpler.
You don't need a local to stop your curls.
Try something like this attachment. I simply moved the structure of the event in its own loop dedicated since it had nothing to do with acquiring data at all.
Data acquisition loop stops very well when you destroy the task and destrying the stops of power queue (sending the default values of the queue for the power control) for EXAMPLE, to ADD a group of setting 'Safe shutdown' to a 'package' and it wire to the Center terminal (Prototype).
Hi any person
I used the Vision Express to solve the problem of Patern Machine.
I want to put Assistant and Aquistion in 2 loop parallel. So I used the producer/consumer to transfer data
After running VI, I pressed the Stop button and I encountered this error
I think that getting the queue has a problem. I changed Image to Contant control and connect it to the data type of element. I think that this path is correct.
So, in case of error, it addressed to Coppy IMAQ in Assistant. So I think that I used the Comunication of the queue is not correct.
How can I solve this problem
You can see more detail in the following video: https://www.youtube.com/watch?v=i6FOQ2jypXc&feature=youtu.be
You should put the image process in the loop of the consumer and release it properly.
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?
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.
Another question completed for the pro:
I recently inherited the labview code that uses RT-FIFO for the transfer mechanism in the architecture of the producer consumer.
The code was first written in 3-4 years and is currently in LV8.6. It is possible that the reasons for the architectural decision no longer exists.
I am qualified using a producer consumer queued architecture,
I understand the RT-FIFO Architecture.
I started using an architecture based on events from the user.
(I have attached samples of each)
I also see the existence of a priority queue
Each method has its own capabilities and gaps, that hand, nobody knows the relative performance of each method.
(Assuming that the only process)
I would expect RT-FIFO to be faster, there seems to be a version of low characteristic of a standard queue.
What is the perfornace hit to use a coding user-friendly queue more
RT-FIFO description talks about commications between the time-critical and lower priority threads.
Until today, I thought that the queues had the same capacity.
I've included an event method that I commonly use for review by peers and help from other users...
It allows to:
1. several producers with different types of data
2. process 37 production order.
3 allows asynchronous verification of functional notifiers such as stop, start and abort.
4. in a system not real-time, it can include interactions of façade.
What I do not understand on this subject, that's what are overhead or thread priority changes that may occur using this architecture (it solves a lot of problems for me).
Thanks in advance,
Here's a KB article on some frequently asked questions about the RT FIFO: http://digital.ni.com/public.nsf/allkb/7AE7075AF1B2C58486256AED006A029F?OpenDocument
The more relevant question is #4, I posted below.
What is the difference between RT FIFO and queues?
Functionally, RT FIFO and LabVIEW queues are two pads of first in, first out. However, here are the main differences between them:
- RT FIFOs run deterministically in LabVIEW and evanescent code queues are not. This comes from the fact that queues use block calls during read/write to the resource shared, while RT FIFOs use non-blocking calls.
- RT FIFO are fixed size while queues develop when items are added to them.
- RT FIFOs will execute the code, even if there are input errors. They can (and will) produce new errors and spread the existing errors.
- Queues work with any type of data, while the data types that can be used with RT FIFOs are limited. Generally any type of data involving allocations of extra memory can be used with RT FIFOs to preserve determinism.
Let us know if you have persistent questions!
I want to trigger the loop of consumer in a producer consumer architecture, so that it can do what it should do, until he receives something new producer loop.
Can someone tell me please how to do this?
Thanks in advance!
If the Dequeue-1 item timeout entry turns off the timeout. That means he'll stay there forever until the data is available in the queue.
Maybe you are looking for
I (heart) Favorites 3 songs through Apple music and also added them to my following list upwards. I couldn't add to Playlist in time, b/c Apple asked me to turn on iCloud music library, and I wasn't ready to do. in any case, I thought that b/t, by cl
Have two iPads a 5.1.1(no original d'iOS en cours d'exécution mises à jour possibles) and an iOS iPad 2 Air 9.3.4. running two iPads, supposedly, access the same account iCloud. Need to get all the images of old new iPad iPad. Have failed miserably.
I sometimes buy Amazaon vinyl and am able to 'Autorip"downloaded versions of these LPs from their site. I also scan vinyl using the Audacity software. In the past, I've used balance but when I moved my iTunes library to a new HARD drive I found that
... (Ironically, it was a new version of firefox) in Firefox v4 Windows XP Professional. I have also already tried safe mode and have administrator privileges, it always says cannot delete because another program is using, even when no programs (incl
Very well. I have a HP DV2726ca the HARD drive was not. I have several external hard drives. I backed up my music folder and then just copied the contents of the folder this music in the new music folder. When I open iTunes I see not those exclamatio