06-21-2011 04:32 PM - edited 06-21-2011 04:34 PM
Hi there,
I have a DAQ device that is responsible for driving an electromagnet. When starting the VI, it seems that there are three or more points of my
measurement data are not accurate as they have been taken before that field reaching its maximum and then sweeping up and down. In other words, I
supply 2V with 0.1 increment to the electromagent and the gauss meter is taking the measurement. The problem is that it takes the values somewhere
between zero and the maximum value which is about 50 mT. While it should read 50 mT for the first point, it takes 10 mT for the first, 35 mT for the second until it getting on with the DAQ output.
DAQ output (V): 2, 1.9, 1.8, 1.7, 1.6, 1.5, ...............
supposed field reading (mT): 50, 47, 43, 41, 39, 37,................
actual field reading: 10, 29, 43, 41, 37,.................
My question is how I can say to the measrement device to wait until the field reaching the desired value (max) and then start recording the data.
Any help in doing this will be really appreciated.
Many thanks
Solved! Go to Solution.
06-22-2011 04:31 AM
Well, current in coils behave like a inertial mass 😉 so you need some delay between changing the output voltage and reading the input voltage.
Take a closer look to the step response :
while capturing the both voltages with a high sampling rate (or a scope) apply a voltage step. Now measure the tau of your system ( coarse the time between the output step and the 67% end value of the input value. Use a timedelay > 5 times that tau ...
06-22-2011 07:10 AM - edited 06-22-2011 07:15 AM
Thank you very much Henrik for the points you made. Yes it is similar to an inertial mass. As an elementary user of labview, I'd like to ask you if you could show me your suggestion (to put a time delay between the output voltage and reading the input voltage.) in a simple VI. Also, I'm afraid I'm not
familiar with sampling rate but I assume my code is working with the default sampling rate.
Greetings from the UK.
06-22-2011 07:24 AM
three or more points of my measurement data are not accurate
What leads you to think those numbers are not accurate?
Remember the basic rules of electronics: Magnetic field is proportional to the current thru the coil. Current thru a coil (voltage across a capacitor) cannot change instantaneously. It's not just a good idea, it's the law.
If you step the voltage from 0 to 2 volts, The current will not change immediately.Therefore the field will not change immediately. Depending on the inductance, and the current supply characteristics, your field will build up over time.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
06-22-2011 08:25 AM - edited 06-22-2011 08:34 AM
Yes you are right that there is some physics behind. It might take time until the field stabilises but I don't want this to be shown in my data as it looks something funny. The intitial measured values are not desirable for this reason and would like my code to wait until the field reaching its maximum and then the measuement devices start recording.
Many thanks
06-22-2011 08:34 AM - edited 06-22-2011 08:39 AM
Take a look at the example codes provided (help-find examples- ...)
Build a simple state machine ( there is a tutorial for that, and a starting template too)
1-Init and setup devices
2-set output
3-wait
4-read value
5-get new value to set or leave
6-close device
instead of waiting a defined time you can read values and look for the difference (or standard dev, or ...) and define an acceplable threshold (and a timeout, so you don't wait forever if there is n too much noise 😉 )
Sorry, no time to help out (and no DAQmx device, only PXI-scope and PXI AWGs 😉 )
06-22-2011 09:04 AM
Thank you Henrik for your suggestions. I may try using the state machine but I'm still hoping that there is a simpler apporoach.
Many thanks indeed!
06-22-2011 09:09 AM
You haven't posted any code, so I don't know what you are doing.
Here's a thought:
Start the AO task (set +2 V)
Wait X mSec
Start the AI task (measurement)
Here's another thought:
Start the AO task and AI task, sampling at X Hz. (If timing accuracy is utmost, use a common trigger to start them both).
Read N samples
Delete first M samples from array read.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
06-22-2011 09:45 AM
Many thanks CoastalMaine for your help. I attached my code and I'd really appreciate if you could try the points you mentioned with it.
06-22-2011 09:52 AM
I'd really appreciate if you could try the points you mentioned with it.
Sorry, I have neither the hardware nor the time to try and run your code.
I gave you two options - did you try either one?
Blog for (mostly LabVIEW) programmers: Tips And Tricks