01-15-2018 12:36 PM - edited 01-15-2018 12:38 PM
I was wrong, disregard
Ben
01-15-2018 12:39 PM
Ben,
I'm referring to the actual LabVIEW files/VI that the snippet comes from. When I drag the image into my VI, it shows up as an .PNG Image and I can't dig further into the code using LabVIEW to determine how each sub-vi is configured.
01-15-2018 12:43 PM
Yes, It looks like Bob posted a Snippet but it appears to be a png of a snippet.
Ben
01-15-2018 01:33 PM - edited 01-15-2018 01:35 PM
It is a VI snippet. But it shows a problem that was created when the forums were updated a year ago and they way it no longer handles images properly. Here is what you need to do.
1. Click on the image so it pops up the picture viewer.
2. Click on the download icon to save the file.
3. Open the browser's download directory and move the file to the desktop.
4. Drag the image file from the desktop to the block diagram.
What used to be a 1 or 2 step process has turned into a much longer process when the forums were "updated".
(See this thread. https://forums.ni.com/t5/Feedback-on-NI-Community/Snippets-are-broken/m-p/3660525#M14813)
01-15-2018 03:59 PM
Bob,
Thank you for the reply. Using some of the programming from your snippet, I was able to create arrays which contain the variables for my linear calibration equations. However, after testing the VI, I determined that the 4 linear equations defined by my arrays were not being transferred to the 4 voltage channels independently. From what I can tell, the VI is transferring a single calibration equation (I'm not sure which) to all four channels on my Create Channel sub-VI.
Some details about my application and the testing I've done so far:
-The four voltages I'm concerned with come from 4 identical pressure transducers with very similar (linear) calibration equations.
-In the attached VI, you will see that I have changed the y-intercepts and slopes for the calibration equations so that one channel should output a dramatically different output than the other three. I did this to test that each channel was getting it's own calibration equation independent of the other channels. Once I confirmed that, I was going to input real calibration constants to the arrays so the data coming out of the VI corresponded to real values. Unfortunately, I can't discern a difference between the data on channel 2 and the data on the other 3 channels. This leads me to believe that I've made an error in programming that is preventing the 4 equations from being applied to the 4 channels.
Can you tell what I'm doing wrong? VI attached.
Thanks a lot,
Dom
01-15-2018 07:58 PM
I'm wondering if the problem is that when you create the scale in each iteration, it is always called "Scale". Perhaps the 3rd setting of it is what sticks and applies to all 3 since they are all assigned to scale "Scale".
What if you call the scale "ScaleX" where X is 0, 1, 2 and is formatted from the i value of the For Loop.
01-17-2018 01:00 PM
I updated the VI to mimic the programming that Bob provided in his initial snippet, where the name of the scaling function changes with every iteration of the for loop. However, I'm still only getting one of the calibration equations to come through. Any other ideas? Update VI attached.
01-17-2018 02:26 PM - edited 01-17-2018 02:27 PM
Look again at Bob's code and observe he uses a "Create Task" BEFORE the For loop and uses the shift register to add the channels to his tasks. I suspect you are loosing your task because you are NOT wired from the Shift Register INSIDE the For loop as you add channels to the task.
Ben
01-17-2018 02:32 PM - edited 01-17-2018 02:39 PM
Also, the temperature and current tasks belong outside the For Loop because you don't want to create them 4 times. And the Channels for the Voltage should be an array of individual channels that are auto-indexed. Right now you are creating channel ai0 through ai3 on every iteration of the For Loop. I don't know what happens when you add a channel to a task that has already been added to a task, but I can certainly see how scale #4 is getting applied to all 4 channels in the last iteration of the loop.
The attached VI should be closer to what you want.
01-17-2018 06:26 PM
After a few modifications, it looks like the equations are coming through properly now. Thanks a lot!
I would also like to add calibration equations to the thermocouple channels. However, if you configure the DAQmx "Create Virtual Channel" VI to accept thermocouple data, there is no place for me to add scaling information like I have with the voltage. Is there a way to add scaling functions to thermocouple data?