LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shaker control

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!

0 Kudos
Message 1 of 17
(2,417 Views)

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

0 Kudos
Message 2 of 17
(2,384 Views)

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:

  1. Idle (waits for user changing sine parameters and starting signal generation)
  2. Create sine pattern, then move to state 3.
  3. Initialize DAQmx hardware with parameters given at point 2.
  4. DAQmx signal generation active
  5. Release DAQmx hw, move to state 1.

There is some more info how to do signal regeneration here:

http://www.ni.com/product-documentation/3874/en/

 

Edit: and yes, what Bob wrote about the USB-6009 is the point, you need to use another HW for what you want.

0 Kudos
Message 3 of 17
(2,384 Views)

Maybe you want to install a sound card and work with that instead.  After all, it's an acoustic signal you are sending.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 17
(2,379 Views)

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

0 Kudos
Message 5 of 17
(2,328 Views)

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.

0 Kudos
Message 6 of 17
(2,297 Views)

@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?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 17
(2,287 Views)

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

0 Kudos
Message 8 of 17
(2,285 Views)

@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:

  1. Init task (start with some default values)
  2. Task running (this is an empty case, only monitoring for user reinit command, if so, move state 1!)
  3. Stop actual task, and move to reinit!
  4. Stop application

Voltage - Continuous Output_modified_v1_BD_1.png

 

Voltage - Continuous Output_modified_v1_BD_2.png

 

Voltage - Continuous Output_modified_v1_BD_3.png

 

Voltage - Continuous Output_modified_v1_BD_4.png

0 Kudos
Message 9 of 17
(2,274 Views)

There was some mistypo in the list:

 

So the states you could have:

  1. Init task (start with some default values)
  2. Task running (this is an empty case, only monitoring for user "reinit" command or "stop application" command, move to state 3 or 4; if no button is pushed, do nothing: re-insert "Task running" state into the shift register!)
  3. Stop actual task, and move to reinit!
  4. Stop application
0 Kudos
Message 10 of 17
(2,266 Views)