04-25-2019 08:51 AM
Bob Schor
04-26-2019 12:06 PM
@Bob_Schor wrote:
Because of the Principle of Data Flow, LabVIEW can do things "in parallel", i.e. all three loops can run at the same time without explicit "clocking" (but all running at their own speed).
- Loop 1 is a Producer -- it is getting data from DAQmx (I'm assuming -- you failed to post code) and probably "wakes up" every 10 ms when data appear.
- Loop 2 is a "Consumer" -- it takes all of the data from Loop 1 and "does something with it" (but does it pretty fast, probably finishing within 10 ms.
- Loop 3 is a "Partial Consumer" -- it takes the current data from Loop 1, does a lot of processing, and doesn't worry about getting all of these data.
- To send data from Loop 1 to Loop 2, use a Queue, a loss-less means of transport between parallel loops.
- To send data from Loop 1 to Loop 3, use a Notifier, which is a "lossy" method of sending the "last" data put on the Notifier by the Producer.
One piece of Useful Information we get when you post your code is we can tell what version of LabVIEW you are using. You didn't post, you didn't mention it, so I won't tell you about Stream Channel Wires and Tag Channel Wires ...
Bob Schor
I didn't mention it at the time, but I'll be talking about "Using and Abusing Channel Wires" at NIWeek 2019 (Monday afternoon).
Bob Schor
04-26-2019 01:42 PM - edited 04-26-2019 01:47 PM
@darknesspic wrote:
After I verify my code carefully,
As others have said, there is no way for us to really judge the overall code architecture, but lots of things just scream "this is not good!".
For example:
04-30-2019 02:40 AM
Sorry for late response, I just busy on the job
I attached the code.
04-30-2019 06:52 AM
I have a few observations which will hopefully help to get you on the right path.
1. Instead of the local variable use a queue to pass your raw data to the other loop.
2. Why are you duplicating code and adding local variable to do so in your "Up counter and shift the data 0-6ch." code? Use a FOR loop with auto-indexing instead. I would do the same for the "Get time and average Ch0-5" code and your "Initail array to 0" code. You can put the data in the appropriate indicators after the loop.
3. You can use a single notifier to pass an array of data to the third loop - then index the array there.
4. No need to have a separate loop to plot data. Also, don't worry about changing to dynamic data - just feed the data directly.
5. Get rid of the stacked sequences.
There are lot's of other things, but this is a good start.