04-26-2017 01:38 PM
I would like to know how to set the sample rate to an encoder using a myDAQ device.
I'm using DAQ Assistant in LabView and the only option available in "Timing Setting / Acquisition Mode" is "1 Sample (On Demand)". I'm geeting 1 second sample rate and I'm not sure if it's possible to control that. Thank you.
Solved! Go to Solution.
04-27-2017 02:29 PM
Hello thiago.barbosa.
When you configure a task to work On demand, your sample rate will be controlled by to loop timing (always bounded by the minimum period your loop can run in your computer). MyDAQ is able to return point faster than 1 sec period, maybe your problem is related to your code. Could you share it here?
04-27-2017 04:07 PM
Dear Plinio,
Thank you for your answer. Find attached my VI and a sample file with data generated using that VI.
I'm implementing a closed loop control of a linear actuator. Reading voltage e current with a USB-6009, reading encoder with myDAQ and sending controller output with myDAQ.
The setpoint signal (reference signal) is genereted by a Simulate Signal.
Regards!
04-28-2017 12:47 PM
I've found what it is causing this behaviour, you are using a task to acquire voltage and current timed to 100Hz and configured to acquire 100 samples each iteration, so you loop will take 1s to execute.
We recommend you to use the samples to read value 10 times less than your rate, so your loop will take 100 ms.
Do not use it more than 20 times less for windows, if so your loop timing will be lower than 50 ms which is not a good timing for windows.
05-02-2017 04:15 PM
In fact the acquisition setting has partially solved the problem. Following your instructions I could get samples at 50 or 100ms period (encoder and voltage/current). Thank you.
But I still get a problem in the "Simulate Signal" block. In the Timing Configuration, I'm not able to set "Sample per second (HZ)" and "Number of samples" to get the signal desired (frequency of 0,005Hz).
Do you have any idea how to help on that?
05-03-2017 12:09 PM - edited 05-03-2017 12:36 PM
Sure, I can help you, but first try to explain me what you are trying to do with the following code section (attached).
Maybe you are on the wrong path. As far as I've understood you are creating a sine setpoint to your control, right?
05-03-2017 12:39 PM - edited 05-03-2017 12:44 PM
Refers to the example below if you want to generate a point-by-point sine wave as a setpoint.
I've configured the express function as Number of samples: 1 and Sample rate: 10, so your iteration duration will be 100ms (it's not necessary the timing function, it was just to emphasize the timing value).
05-03-2017 12:48 PM
That's right. I'm trying to create a sine setpoint signal to my control (at very low frequencies / around 0.005 to 0.01Hz).
I wasn't able to open the Example.vi (I'm using LabView version 14.0). Is it possible to make it available in that version?
Thank you!
05-03-2017 12:51 PM
05-17-2017 12:29 PM
Sorry about the long delay to answer your last post (I was offline last two weeks). But I still having problems. And that’s interesting: following your recommendation to setup the express function (Number of samples: 1 and Sample rate: 10) in my PositionControl.vi I get a signal 10 times slower the expected!
The file attached shows the results I get from reading the process variable. This file ends at 14.5 seconds, but in practice it took 145 seconds to run that experiment.
Have any idea what’s happening?
Thank you again!