Question 1) We need to acquire data from two external instruments that sample at different rates, filter the data, add the time of the test and the operator who performed the test to the data, and then write it all to a file. Which design pattern should we use?
Answer: Producer-Consumer
Question 2) We've seen producer/consumer design pattern using one loop each. Will the same pattern work for multiple producers? Create 2 producer loops which generate one sine wave of frequency 1 Hz each, whose amplitudes can be controlled independently from the front panel. Both sets of data must be received by the consumer, which checks if either sine has exceeded the value 10.You can use the Design Pattern Template pre-existing in LabVIEW.
Answer:
Rules & Guidelines
Q1- Ans) Producer/consumer design pattern
Q2-Ans) Yes the same pattern work for multiple producers
answer1-- producer/consumer design pattern
answer2--making 2 producer is not possible so second part is invalid
answer 1 ---- producer/consumer
answer2----- making 2 producer is not possible......so second part is invalid of these question.........
1) Producer Consumer design pattern.
2)Yes, the same producer design consumer pattern will work for multiple producers.
1. answer ::: master/save pattern
2. answer :: no we can't make a vi consists of mutipe producers and one consumers
Q1. We can use Queue based Architecture for the task given.
Q2. answer is attached with this Comment
have used the local variable in the second producer loop.
pls arrange the session for wireless sensor application using labview....
1. Producer - consumer design pattern is most ideal for this situation. If multiple producers produce data at different rate, they can be buffered and processed by the consumer loop which may operate independantly at different rate without loss in any data in producer - consumer design.
2. The Block diagram and front panel for the problem is attached below.
1. It is recommended that "producer sonsumer" design pattern shall be the best architecture to execute this as it can handle multiple loops operating at different timings. The "queue " shall buffer the data ,sync the different loops and take care that no data gets lost lost.
2. yes, it is possible to have multiple producers.
Hi
We appreciate your attempt. In your VI you have declared two queues - one for each producer, and each queue has been individualy dequeued in the consumer loop which makes it a case of single Producer-Consumer. However what we expected was a single queue being updated by two producers. Which would make it a case of multiple producers. Kindly refer the solution posted.
Regards,
Jagriti R
Applications Engineer
gnshmrthy wrote:
Q1. We can use Queue based Architecture for the task given.
Q2. answer is attached with this Comment
have used the local variable in the second producer loop.
Hi
Appreciate your attempt. Your answer was quite close, however, you have taken the entire sine wave and converted it into a single dbl value which gets queued. The dequeing operation in the consumer will not yield a sine wave.
You should have fed the entire array into the queue instead of a single value (or a different sine generating function should have been used) Kindly refer the solution posted for more clarity.
Hoping to hear from you again next week.
Regards,
Jagriti R
Applications Engineer
Yeah this`s were I need to work on the new things very clearly, thanks for the question which is been asked every week of wednesday.