11-02-2016 12:34 PM
Hi,
I want to feed a shaker I have in my lab with sinusoidal signal. The shaker 's amplifier accepts 0-5V signals and up to 6kHz.
My first attempt (attached VI), when run with a PXI6341 seems to work (the shaker moves at the desired frequency) but there's a beating below the controlled vibration that periodically appears. And moves the shaker so my clean section of the signal is between two consecutive beats (some seconds).
When run with a USB-6009 the shaker doesn't move at a constant frequency, it's like it's not able to handle the data.
Does anyone has ideas on how to solve these issues?
Thanks!
11-02-2016 01:40 PM
Because the USB 6009 has no buffer on its AO side, you need to send it every point over USB, which limits its update frequency to a few hundred Hz. It is not suitable for waveform generation, only for slowly-changing voltages.
Bob Schor
11-02-2016 01:47 PM - last edited on 11-27-2024 04:19 PM by Content Cleaner
You should not try to create the waveform at every iteration of that While loop. This creates some delays between two iterations, so introducing some jitters. I understand you want to have the feature that you can change the amplitude and frequency of tha signal. You still can do it, but use a State Machine instead: only re-create a new sine pattern when the user wants to change its properties. The state machine could have the following states:
There is some more info how to do signal regeneration here:
Edit: and yes, what Bob wrote about the USB-6009 is the point, you need to use another HW for what you want.
11-02-2016 01:59 PM
Maybe you want to install a sound card and work with that instead. After all, it's an acoustic signal you are sending.
11-03-2016 05:44 AM
Thanks Blokk, I'll change to a state machine and see if it improves.
@Bob, thanks I didn't know that about the USB-6009
11-03-2016 10:05 AM
Hi!
I am trying to build that state machine Blokk mentioned (it's my first state machine, please highlight any error). There's one thing I cannot understand, if I generate the signal without a while loop it only produces one iteration and comes back to the wait for user input case. If I do it to run indefinitely, and I use a while loop with the write VI I don't know how to go out the loop. I don't know if my question is clear.
11-03-2016 10:43 AM
@cobayatron wrote:Hi!
I am trying to build that state machine Blokk mentioned (it's my first state machine, please highlight any error). There's one thing I cannot understand, if I generate the signal without a while loop it only produces one iteration and comes back to the wait for user input case. If I do it to run indefinitely, and I use a while loop with the write VI I don't know how to go out the loop. I don't know if my question is clear.
You have the general idea of a state machine. Did you know that the next state can be conditonal? In other words, you can keep calling the same state over and over until a condition changes, then go to the next state. e.g., If X=0 then same state, else next state.
Which brings me to an observation on your state machine. Always call your states explicitly - in other words, no increment. What happens if you add a state in between?
11-03-2016 10:47 AM - edited 11-03-2016 10:52 AM
cobayatron,
What you are trying to do is very possible (I've done it). The PXI6341 will be perfectly adequate. You are even on the right track. While state machines are very powerful, the task you have described is way too simple and a state machine will only unnecessarily complicate the end solution.
What you need to do is set the DAQmx Write Regen Mode Property to not allow regeneration and then make sure that the waveform generation loop keeps up. If you are working in Windows, the jitter is going to kill you. I've only ever been truly successful with this sort of task in the RT environment.
Good Luck,
DR2
11-03-2016 11:34 AM
@dr2 wrote:cobayatron,
What you are trying to do is very possible (I've done it). The PXI6341 will be perfectly adequate. You are even on the right track, what you need to do is set the DAQmx Write Regen Mode Property to not allow regeneration and then make sure that the waveform generation loop keeps up. If you are working in Windows, the jitter is going to kill you. I've only ever been truly successful with this sort of task in the RT environment.
Good Luck,
DR2
No, I think he should use the opposite: allow regeneration! During the running task we do not need to change the amplitude and the frequency of the sine wave. So pre-create the sine wave, then start the signal generation. When the user wants to change freq/amplitude, just stop the actual task, re-config the new task with the new parameters, and good to go again, start the signal generation. This way is much easier than the "non-regeneration" mode. Unless if you need the feature to change parameters on the fly, but I do not think a few milisec "pause" during the task creation would make any problem with your shaker...
You need to fix a lot on that state machine, and to give you idea how to use signal regeneration AO with DAQmx, I refer to the example (use the example finder from the Help menu): "Analog Output\Voltage - Continuous Output.vi", see below the snippet based on this example having a very basic state machine.
So you have a state case where you start the task, then another state where you stop the actual task, and restart with the new frequency/amplitude params...
So the states you could have:
11-03-2016 12:15 PM - edited 11-03-2016 12:16 PM
There was some mistypo in the list:
So the states you could have: