10-19-2019 01:10 PM
Hi,
Greetings. I have attached 3 different codes here. 1st code is about pump on/off based EC level control of a fertilizer supply system. It works without any problem. 2nd one, DAQ system, where I can measure individual nitrogen, potassium, calcium, pH, and EC level of the same fertilizer control system. It also works without any problem. In the 3rd, I tried to merge the 1st and 2nd code. Although there is no error in the code, practically it doesn't work. Specifically, the fertilizer pump doesn't turn off after reaching the target EC level and the DAQ also doesn't work properly... Would anyone suggest to me, where is the problem, please?
Solved! Go to Solution.
10-20-2019 09:16 AM
The top loop uses "RMS" to get the value from an array. Perhaps you wanted the Mean instead?
I don't see anything immediately obvious about the bottom loop (which I think is what you're describing as "the DAQ"?). What exactly doesn't work?
If the problem is with the recording of data, it may be the Dynamic Data Type (blue wires) causing a problem. They always confuse me, because(/and so) I never use them - I would advise you to use other wire types and avoid the Dynamic Data Type. They have peculiar behaviour with arrays, with conversion, and they don't display enough information to know what's going on without a bunch of configuration panels (which is also a problem for e.g. the DAQ Assistant node).
10-25-2019 08:03 AM
Hello Mr. Cbutcher,
I have replaced the "RMS" into "Mean.vi". Now the code works. But still facing some problems in DAQ (Consumer loop). The data saving rate is not smooth. As you mentioned, it may occur due to the "Dynamic Data Type (blue wires)". I also tried to replace these wires by Double (DBL) type wire but failed to connect with "Write to Measurement File.vi" How can I change the wire type? Thanks in advance.
10-25-2019 09:31 AM
Unfortunately, you have chosen to use the Express VIs that NI designed many years ago to "hide" the (relatively-simple) learning process for acquiring and handling signals. They introduced the Dreaded DAQ Assistant (DDA) and its Evil Twin, the Dynamic Data Wire, which saves beginners a few hours of lectures or exercises learning about Waveforms, DAQmx (for which they developed wonderful tutorials), and File I/O.
So one "solution" to your problem, which will stand you in very good stead if you continue to learn/use LabVIEW, is to "learn more LabVIEW", specifically the use of Waveforms (for data files), DAQmx (to acquire Data), and File I/O (to write the data in a variety of formats, including text-based files like the "LabVIEW Measurement" (.lvm) format that the Express VI uses. In fact, if you look "under the hood", one of the first things that Write to Measurement Files does is to take the Signals Input (as a Dynamic Data Wire) and convert it (using Dynamic to Waveform Array) into an Array of Waveforms, converting the data to a SpreadSheet String, and ultimately writing it as a byte string of characters.
Bob Schor
10-25-2019 11:15 AM - edited 10-25-2019 11:16 AM
Hello Mr. Bob_Schor
Thanks for your guidelines. Actually, I am used to using express VIs. I have replaced the 'Write to Measurement File' into 'Write Delimited Spreadsheet'. Now I am facing 2 problems.
1. Does this vi has 'use next available filename' option? I mean auto-generation of another file during several tests...
2. I need a time column. Is it possible in this 'Write Delimited Spreadsheet.vi'?
Thanks in advance.
10-25-2019 11:45 AM
@Chowdhury_Milon wrote:
Hello Mr. Bob_Schor
Thanks for your guidelines. Actually, I am used to using express VIs. I have replaced the 'Write to Measurement File' into 'Write Delimited Spreadsheet'. Now I am facing 2 problems.
1. Does this vi has 'use next available filename' option? I mean auto-generation of another file during several tests...2. I need a time column. Is it possible in this 'Write Delimited Spreadsheet.vi'?
Thanks in advance.
1. No - but there is a VI that can do that for you! Create File with Incrementing Suffix VI
2. It isn't built-in, but you can generate this yourself, or if you have a waveform, then the dt and t0 are enough to define a time column. The waveform palette has VIs to create such an array if you want it explicitly written, e.g. Get Waveform Time Array VI (produces a timestamp array, but you could convert to doubles).
10-25-2019 12:23 PM
Hello Mr. Cbutcher & Mr. Bob-Schor
I am sorry. I have complicated the code. I can't understand which one would be better for me...
10-25-2019 01:27 PM
Here are some (what-I-hope-are-helpful) suggestions:
Some other things to consider:
Bob Schor