10-07-2015 07:20 AM
How to add two virtual channels with 2 sample clocks as different sampling rates are required.
Solved! Go to Solution.
10-07-2015 07:47 AM
If you have a requirement, be sure to show it to the consultant that you hire.
If you are interested in suggestions for how to do it yourself, I have a few (which may suggest to you how to solve this problem yourself).
It looks, to me, as though you have three sets of measurements -- six channels of temperature, 14 channels of pressure, and two channels of force. This (strongly) suggests an array of 6, an array of 14, and an array of 2, possibly all combined into a cluster (of Temperature, Pressure, and Force/Load, mainly for "ease of transport through the Block Diagram"). Note that if you had an array, you could easily do the computations you show in what I assume is a very large, complex Formula node with two or three Numeric Functions (all of which are polymorphic and will take an Array as an input and gives an Array as an output). Much more compact, much easier to see (and "prove") that you are doing the exact same computation to all the Temperatures, for example, not to mention much easier to change the computation for all channels.
Are you trying to sample one Array using one set of parameters, and the other array using another set? Simple, simply define your channel sets to correspond to your array inputs and have three DAQmx lines going into the While loop (and three much-simpler lines within the loop, now being able to operate on the entire 2D array "all at once" without a Formula node).
Ooh, I overlooked the top DAQmx line -- NEVER, NEVER, NEVER (well, hardly ever) run a wire to the right side of a While loop and then bring it backwards to the input of an earlier VI. Help yourself and other viewers of your code by doing your very best to keep wires going strictly left-to-right (plus up and down), even if you need to make your Block Diagram a little wider. Note that you can compress the code in the top line into a 32-by-32 pixel rectangle -- it's called a sub-VI, with inputs Task In, Error In, (optionally Number of Samples), and ... wait a minute ... what is that "loop-looking" structure you have there? What are you doing? Never mind, bury it in a sub-VI, write good documentation as part of the sub-VI's Property (so when someone right-clicks on the sub-VI and asks for Help, they'll understand what this sub-VI does), create an Icon with at least a 3-line (short words) mnemonic Identifier so the purpose is clear. and Simplify Your Block Diagram.
You can/should replace the Frame Sequence with a State Machine (the Initialize State can have everything in the first two Frames included, the Execute State has the contents of the While Loop (but not the loop itself -- that's handled by the State Machine) and the code at the exit from the While loop in the Finalize State.
Bob Schor
10-07-2015 08:05 AM - edited 10-07-2015 08:12 AM
Whoa so much information thanks. Forget about the consultant, I am a student and learned Labview from youtube.
10-07-2015 08:08 AM
You seem to suggest that I should have in total 5 DAQ MX lines each for Temp., Pressure, Force, Fuel flow rate (counter) and RPM (which needs to be sampled at much higher rate than first three)
10-07-2015 08:09 AM
Can we have multiple sampling clocks with different sampling rates in a single VI?
10-07-2015 09:34 AM
@andy_kennaugh wrote:
You seem to suggest that I should have in total 5 DAQ MX lines each for Temp., Pressure, Force, Fuel flow rate (counter) and RPM (which needs to be sampled at much higher rate than first three)
Yes, precisely. Each is different, certainly has different settings (such as the channels you are sampling), may have different inputs (Volts, Temperature, etc), ranges, and sampling rates.
BS
10-07-2015 09:38 AM
@andy_kennaugh wrote:
Can we have multiple sampling clocks with different sampling rates in a single VI?
What do you mean by "sampling clock"? if you mean "sampling rate", sure, that is Task-specific information. Personally, I like to set up Tasks from within LabVIEW Project (New/Task), use that to set channels, clock origin, sampling rate, sampling mode (e.g. continuous), Max/Min (e.g. ±10v), scaling, etc), then wire a constant to the DAQmx Create Virtual Channels function, right-click the down-arrow on the constant, and choose the appropriate Task (which I save with a mnemonic name, such as "Acquire Temperature").
Bob Schor
10-07-2015 03:12 PM