LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Two while loops in parallel


@Yamaeda wrote:

Then you should only enque once. 🙂 You're limiting the wrong end of the process.

/Y


Exactly.  One of the points of the Producer/Consumer is to allow the processing go as fast as it can as long as there is data in the queue.  No data in the queue, then the consumer sleeps.  So if you only want to insert data once every X amount of time, then handle it on the producer side.  With the waits in the consumer, you are putting old data in the database and using up a bunch of memory as the queue continues to get more data in it.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 21 of 26
(1,652 Views)

I attached my vi, on this vi i'm using indicator on both consumer side and producer side. Producer side i'm executing for 1 sec interval and consumer side i'm executing for 5 sec interval. It seems to be working fine.

Basic need of me is i'm doing various operations like

1. DAQ via modbus tcp for 1 sec time interval and Transfer modbus data via mqtt at 1 sec interval.

2. I'm taking Min Max Average of Modbus data for 5mins of time interval.

3. Inject live data of modbus and average value into database at 5 min time interval.

4. I'm creating modbus server and send the live data to third party application for another important function.

These are my needs to be done using LabVIEW, and also i created logic for all these operations, all are working fine if they run in common time interval, i'm struck here how to use two varieties of time interval. Producer consumer concept is not my need, based on suggestions only i went for this concept.Please give me suitable idea to do these.

Thanks in advance

0 Kudos
Message 22 of 26
(1,631 Views)

@praveenrajk wrote:

Producer side i'm executing for 1 sec interval and consumer side i'm executing for 5 sec interval. It seems to be working fine.


No it is not.  Your queue is getting 5 elements for every dequeue.  So you are processing data at least 5 seconds old.  After 7 iterations, you are already processing data from 30 seconds ago.  If this is the setup you actually want, then Producer/Consumer is not what you really want.  You should really have a Master/Slave, which is pretty much the same thing but uses a Notifier instead.  Notifiers only hold the latest message, so you will lose any data you did not process between messages.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 23 of 26
(1,623 Views)

Thank you for your idea, i'm now working the same concept on master slave pattern but still, i'm not succeed, i don't know where i'm making mistake, help me to solve the problem.

 

I attached my master slave concept vi on this for your reference.

 

0 Kudos
Message 24 of 26
(1,609 Views)

What exactly is not working?  You need to be a lot more specific.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 25 of 26
(1,603 Views)

Sorry for that incomplete information, SQL injection is not processing other than that, all of them working perfectly.

0 Kudos
Message 26 of 26
(1,591 Views)