07-12-2018 09:54 AM - edited 07-12-2018 10:12 AM
neesea,
Thanks, I'll start working on what you've described. I do want to get this working for one task at a time, especially when it comes to all the indicators and color change stuff on the front panel.
Do you think I should try and put the indicator color changing code in a subVI? Maybe that will make it easier to duplicate 64 times for each channel.
I think I do have these tasks saved in MAX correctly and I don't expect channel configuration to change. How do I use them directly in LV?
I just set this up based on "help" in LV
07-12-2018 10:31 AM
Like this?
07-12-2018 10:46 AM
Yep, that should work. If the task is already created and configured, there is no need to re-create it in your block diagram.
Next, change your DAQmx read function to "multiple channels, one sample". In this mode, it will output an array of data with the same length and order as the channels contained inside the task. If there's any question about what order that is, you can feed the task wire into a property node and retrieve the list of channels (which you can then convert to strings and use in your display, if desired).
Start by simply sending that data array to an indicator, to verify that you can see all 16(?) channels from that task. If that works, we'll go to the next step.
07-12-2018 11:11 AM - edited 07-12-2018 11:39 AM
Ok, this is much more simple than what was going on before. Should I be using a for loop instead of while?
16 channels verified and working
Ready for the next step!
07-12-2018 11:41 AM
Cool. You would only use a for loop if you knew exactly how many samples you wanted to record before you started. The while loop will just run as long as want it to (which I think is what you want).
First: remove the 100ms wait from your loop. The DAQmx read will automatically wait until there is a sample available (up to the timeout you specify). This will effectively limit your loop rate to match the sample rate defined for your task, so there is no need for an additional wait.
Next: processing. Use array min/max to get the max temperature value from the data array (is that what you needed to do? I forget).
Next: make it work for 4 tasks. We will change the single task wire over to an array of tasks, and modify each stage of the code to handle that array.
1) change the DAQmx task constant to an array and fill in the 4 tasks
2) put the DAQmx start task into a for loop and use auto-indexing tunnels for the purple wire. This will start each task one at a time.
3) put the DAQmx read into a for loop (read from each task one at a time). Include any task-specific processing such as array min/max in this loop. Use auto-indexing on the data output(s) to create array(s) of results. You might, for example, end up with a 2 dimensional array of temperatures (4 tasks by 16 channels) or a single 4-element array of maximum values.
4) put the DAQmx stop/close tasks into a for loop (close each task one at a time).
See if you can get that to work and display/process all 64 channels.
07-12-2018 12:03 PM
@neesea wrote:
First: remove the 100ms wait from your loop. The DAQmx read will automatically wait until there is a sample available (up to the timeout you specify). This will effectively limit your loop rate to match the sample rate defined for your task, so there is no need for an additional wait.
That only works if you are using hardware timing. The OP is not. They are reading 1 sample at a random time. So the 100ms wait is valid.
@neesea wrote:
3) put the DAQmx read into a for loop (read from each task one at a time). Include any task-specific processing such as array min/max in this loop. Use auto-indexing on the data output(s) to create array(s) of results. You might, for example, end up with a 2 dimensional array of temperatures (4 tasks by 16 channels) or a single 4-element array of maximum values.
I would do the Max/Min outside of the read FOR loop. The reason being that each task is likely to have a different number of channels. This makes a 2D array non-optimal. Instead, use the Concatenating tunnel. This will give you a 1D array for all of the channels (1 sample per channel). Now you can do all of the analysis with this single array.
07-12-2018 12:55 PM
Crossrulz,
Good point about timing. Keep the wait in there if you don't have hardware timing.
As far as output, it all depends on what OP is doing with the data. I assumed he wanted it organized by task, in which case Array of Cluster of Array might be one option to deal with the issue of differing channel counts. Using a concatenating terminal makes it harder to identify what task the channel came from. I think it just depends on what you want to do with the data.
07-12-2018 01:58 PM
neesea, Crossrulz
The amount of channels shouldn't change anytime in the near future. They are basically going to be 16 for each module at all times.
07-12-2018 02:00 PM - edited 07-12-2018 02:23 PM
neesea,
I want to get the min/max for each channel and show the max statically through the duration of the VI execution. I also want to show the current temperature of each channel as well as the max it had reached.
After messing around with the array indicators and bg colors it looks like I'm going to have to index the arrays into individual indicators to get the colors to change independently from each other?
07-12-2018 02:58 PM
@neesea
Here's where I'm kind of stuck. I can't seem to find out where to set the numeric bg color for the arrays.