05-17-2010 04:22 PM
On the DAQmx timing block what does the source onboard clock mean. I am using USB6225 as my DAQ device and I didn't find any clockspeed for onboard clock on the manual for that device. Please need some help.
05-17-2010 08:11 PM
05-17-2010 10:27 PM
You did not attach any code.
A resource reserved error is mistake that many new users make and there have been numerous posts on the error. Did you do a search for the error code?
Hint: You CANNOT have multiple tasks for the same resource.
05-18-2010 01:26 AM
Sorry I have attached the vi now and I have couple of questions. What does the onboard clock in DAQmx timing signify. Is it better to
use the internal clock? I also have a seperate state in my stateflow where I convert the voltage from DAQ to pressure using slope and
offset. Performance wise will it make any difference if I use the linear scale with DAQmx driver instead me doing the scaling for all the
samples that I receive from 60 analog input channels. Thanks
05-18-2010 11:08 AM
First of all, you should clean up your diagram before you submit it here for review. All of the DAQ settings are on top of each other. It is impossible to follow the wiring unless I move things out of the way. How can you troubleshoot anything if you can't see the connections?
Next, your Current Channel control is a DBL. It should be I32. Change it.
The Onboard Clock IS the internal clock. In the DAQmx Timing function (Sample Clock), the rate input is the clock speed.
Instead of having two DAQmx channels in separate threads, it would be better to create one DAQmx task that contains both channels you want to use, provided that all settings for both channels are the same. This appears to be the case in your vi. Use the Create Task function and wire the output into the task input of DAQmx Create Channel. Then you don't have to worry about separate identical threads. You will have to change the read function to Multiple Channels Single Sample. Why are you using Single Sample when you have the number of samples per channel set to 10. If you want 10 samples, you need to selet Multiple Samples. Your output will be an array of 10 samples. If using Multiple Channels Multiple Samples, you can choose an output of 2D array. The first row will contain 10 samples for the first channel, and the second row is for the second channel. Use index array to separate them for processing.
05-18-2010 03:41 PM
Thanks for your reply and sorry about the mess in the vi. Your suggestion worked out pretty good for me except for one
different issue flow rate calculation.
When the pressure reaches >5psi I capture a instant of time using Gettimer_seconds.vi and converting to a double
precision float and store it in local variable, and when the pressure reaches >30psi I caputure an another instant in time
using the gettimer_seconds.vi and converting to double precision and store it in end time local variable. When
I reach max pressure (32psi) I do a calculation end time - start time/30 - 5.
1) Issue is I should get a consistent flow rate in all my channels because on my instrument when my solenoid valve
opens the pressure increases consistently acorss all channels. But when I read in labview I get 3 different no and there
is pattern it repeats. (533.34, 1600, 400.32). The tolerance band is +-100 but the output I am getting is more than that.
2) I am doing the same for vacuum and I get a consistent flow rate. The only difference is the trigger at which I capture
the time (-1psi(start time), -11psi(end time), -12psi(max)) . My flow rate in this case is no between 44.0 to 52.0. and its
consistent. Please need some help to figure out this issue.
05-18-2010 04:22 PM
Your original vi doesn't have any code to do what you describe. Please attach your new vi. How are your triggers defined?
05-18-2010 08:13 PM
Thanks for your help and I really appreciate it. I have attached the vi. Sorry that it is not modular programming for now
but will modify it as I test all my features. I tried to document it as much as I could just to make sure its somewhat easy to follow the diagram.
05-19-2010 11:28 AM
OMG! There is no way that I can troubleshoot such a monstrosity. Not meaning to cut you down, but this code is not maintainable. I wouldn't know where to start.
Most beginners start this way, try to fit everything on one block diagram that is 5 monitors high by 6 montiors wide (OK yours is a little smaller). Then they say they are going to clean it up once its working. Well after it is working, it is usually left alone. Also, the chances of making errors with this method is very high. Troubleshooting is a nightmare. The entire development time is astronomical.
The best way to start is to start making it modular from the very beginning. The little extra time spent in making subvis (modules) will pay for itself in the long run. Chances of making mistakes will be lessened by a great amount. Troubleshooting is much easier. Total development time is cut in half compared to your method.
You would do best to break this monster down into modules. You might even see your own mistake by doing this. Look at state machine architecture. This may be what you need to do.
Good luck.
05-19-2010 12:24 PM
This is already a subvi. My main VI has the producer-consumer architecture in a stateflow. I guess I have to do stateflow inside another stateflow. But the thing I dont understand is I use the same Gettime_seconds.vi for both vacuum and pressure cases and they are pretty much isolated as they write there outputs to different local variable. Vacuum flowrate remains pretty consistent but not the pressure. Any pointers or suggestion on how to break this down further. On my main vi I have the state flow with states as shown below(picks the current state from a queue) and a event loop to respond to user events.
1) Scan - scan all 60channels
2) Scale - scale them to convert voltage to pressure
3) check_threshold - subvi that was attached is called when the case is true (which happens when on one of the channel pressure increases from negative to positive. ie the trigger)
4) check_cycle - check to cycle the entire scan cycle for all the channels are done
5) continue scan state. and some more