07-14-2011 04:05 AM
I have been trying to create a VI to carry out a simple linear traverse (up/down) with a probe attached that contains a thermocouple. I have the USB6008 to control the traverse which I have working using the attached VI. I have been taking readings from the thermocouples successfully using signal express and the NI9213. My problem is when I try to piece together the two, when I add in the thermocouple the stepper motor slows down drastically. As an aside I would like to generate a chart of the data (including past data not just the current iteration) of position against temperature (or the iteration of the FOR loop against temperature which is equivilant) and ideally output this data to a file so I can analyse the data in other software, Excel for instance, but I am struggling to get the chart working properly or add data into an array.
I have attached the VI with the thermocouple module included, this being the version which runs slowly (removing the thermocouple section will speed it up)
Any help or pointers would be great.
07-14-2011 07:46 AM
Looking at the VI you provided (which is always a code idea to include) it looks like part of the problem is the way you inserted the thermocouple code. Unless you are needing to change the thermocouples configuration parameters during the run there is no reason to create and clear the task every time through the loop. That just causes the PC to spend extra cycles creating/clearing the same task. You could have placed the create task before the loop execution and the clear task after the loop execution by using shift registers to connect every thing together. If you will look at the modified version of your VI that I have attached you will see what I mean.
That being said, with no more activity going on than you have specifed your should noticed little difference in your VI performance at the slower speed settings, unless there is a problem with the thermocouple task. Specifically, I am looking at the time out value passed to the temperature acquisition VI. With a 1 second timeout on that VI if there is a problem then your loop will have a minimum period of one second. Not knowing the full details of your hardware I can't be sure but I suggest you examine that.
Other improvements could be made if you took steps to decouple your motor drive signal generation from the thermocouple read. By this I mean using either a dual loop configuration or perhaps configuring the generation of the squarewave driviing the stepper motor to be produced by the USB6008 in a continuous manner rather than using a point by point method.
I hope this helps
07-15-2011 06:36 AM
Thanks for taking the time to reply. I only have LabView 9.0.1 available to me so I don't seem to be able to open the VI you attached, is there anyway you could save it so it is compatible? Sorry to be a pain!
I will look at that before asking other questions and see if that is any improvment. I was also wondering if you had any ideas in being able to store the iteration number and temperature so I can analyse the data elsewhere?
Many thanks again,
07-16-2011 12:33 PM
"Thanks for taking the time to reply."
Your Welcome. The interaction of the community is one of the great things about NI & LabVIEW, IMHO.
"I only have LabView 9.0.1 available to me so I don't seem to be able to open the VI you attached, is there anyway you could save it so it is compatible? Sorry to be a pain!"
No problem. I didn't think about that. I have back saved the modified version to LabVIEW 2009 so you should be able to open it now.
"I was also wondering if you had any ideas in being able to store the iteration number and temperature so I can analyse the data elsewhere?"
If you are looking to store the information in a file LabVIEW makes it very easy to do so. I suggest you open the Example Finder (available from the pull-down menu under Help>>Find Examples...) and search for file. This will bring up a number of examples showing the different ways you could save the data to a file. From these examples you can cut & paste code sections or even save them do a different file name (so you don't corrupt the example) and modify. This is a great way to find new/different solutions to a task.
Of course if all you are doing is going to a spreadsheet or other program to analyze the data I would point out that LabVIEW can perform the analysis for you if you program it to do so. Lookup analysis in the Example Finder to get some ideas. You can save the images of the data graphs to a file, and with the right tookit(s), generate full blown, ready to deliver reports.
I'll keep an eye out if you have more questions.
07-18-2011 03:40 AM
Thanks again. The version you modified now opens fine (it was what I tried to construct myself from your original description but for some reason when I did tried it wouldn't let me move the clear task out of the loop), it seems to be slightly quicker than my earlier version but still no where near the speed of the VI when the thermocouple section of code is removed. I was wondering if you had any pointers in constructing a new VI using a continious production of pulses as you earlier suggested? In the mean time I will try to decouple the system as you suggested as well and see how this performs, I am assuming that this just means popping the thermocouple section in its own loop.
07-18-2011 04:17 AM
I thought I would attach my updated version. I have put the temperature aquisition in a seperate loop, which inevitablely speeds up the pulsing mechanism again but means the temperature aquisition lags behind, I need these two processes to run hand in hand, as it is crucial I obtain the temperature at the relevant position. It seems then the aquisition of temperature itself is just slow, is there anyway I can speed this up?
On the plus side the saving to file now works well, thanks for the tips there.
07-18-2011 08:35 AM - edited 07-18-2011 08:36 AM
Sorry to keep adding posts, but just as a thinking out loud solution would it be possible to set up the VI so that the temperature is only acquired every 100 steps say, that would presumably speed things up but keep everything in sync. 2000 steps corresponds to roughly 1 cm of movement of my traverse so not taking temperature readings every iteration won't really affect my results. I have been trying to figure out ways to implement this idea but haven't found anything of use yet.