09-03-2019 08:54 PM
I'm attempting to implement a solution that was put forward at this link. I installed the DSC module to be able to access the Tag Channel functionality. When i test the top loop with a random number the error output on the Write Tag is '1026 bad reference'. Am I using the correct tag functionality that was proposed in the linked solution? Have more tag parameters been implemented in 2019 that didn't exist when @Bob_Schor posted the orig solution?
Thanks!
Ben
Solved! Go to Solution.
09-03-2019 09:59 PM
I'd be vary wary of this @Bob_Schor guy -- he has a reputation as a Channel Wire Enthusiast, which may blind him to some of their idiosynchracies (and there are a few ...).
Some comments:
So the question is, what are your Parallel Loops, what data need to flow between them, and how are the loops synchronized? This will determine which Channel Wire is appropriate for which task, and will suggest how to use them.
I have it on Good Authority that most non-trivial applications that Bob Schor has developed over the last 4 years have used a lot of Channel Wires (probably a dozen per applications). They have all been the "Vanilla" flavor, i.e. no "with Abort", "Ack" or (isn't there another option on some of them?). Most of them have been Messenger Channels, as he (I presume it's a "he") has grown fond of a Channel-version of the Queued Message Handler he calls the CMH (guess what "C" stands for). Some Producer/Consumer Loop pairs also use a Messenger Channel, particularly if the Consumer needs Initialization (which means that it gets an "Initialize" message, then a whole series of "Save" or "Plot" or "Average" Messages from the Main CMH containing in the Data part of the Message the Data to Save, Plot, or Average, i.e. the Data to "consume").
Some Producer/Consumer structures are much simpler -- a simple "Save All to Disk" is commonly done with a Stream, with the Consumer having a "On First Call" Case Statement inside its Consumer Loop that opens the Data File for writing when first called. Note that since the Producer will eventually send the Consumer the "Last Element?" flag set to True (if nowhere else, then when the Producer exits), the code to close the Data File can be placed after the Consumer exits (as it has its Last Element? flag wired to the While Loop's Stop indicator).
If you still have questions or need more help, Bob_Schor will probably be willing to look at your code (warning -- he won't look at a picture of a Block Diagram, some strange phobia, I guess, so attach the actual VI or VIs).
An Anonymous Channel Enthusiast
09-05-2019 01:32 PM
Thanks for the very detailed description, I'm still trying to absorb alot of it.
The parallel loops are reading cDAQ modules, one RS485 device, and a GPIB device (GPIB not implemented yet). I may try to combine the RS485 and GPIB loops and pipe the resulting data into the cDAQ loop using the channel writer. I haven't thought much about how the loops are synchronized, i don't have any wait timers on either of the data input loops. This kinda begs the question why have separate loops at all.
That didn't stop me from implementing something for the sake of understanding. To test i just wired in the random number generator to a tag Channel writer/reader. All I'm trying to do is pass in some status of the RS485 device, manipulate the data in the Analysis loop, and then write it to the same TDMS where the CDAQ data is getting logged. It seems like everything is working properly the way that I have thing setup, though i'm not sure about how the data is synched. I've attached a log file from a test that shows 322 pts collected. When i plot data from the Channel Writer (RS485 group, Untitled channel) against any of the other cDAQ channels they don't look synched. The same number of data points are listed for both groups of data but when i drag the cursor over any of the cDAQ data, but something seems up with synch between data points.
I've attached a vi and the tdms file for ACE (Anon Channel Enthusiast) to look at.
09-05-2019 01:42 PM
Actually went back and added a sequence around the tag Channel reader and the bundle just to follow-thru with the original solution. It didn't change anything with the way the data looks.
09-05-2019 01:47 PM
I have a feeling that the way I'm writing the data to the tdms file is the reason why i'm not data points synched up properly. Pretty sure that's outside the scope of this conversation.