06-16-2020 06:48 AM
Hello everyone,
I generate a signals using the daqmx-toolbox (AO-Voltage, Timing, Analog1DWfm_NChan_NSamp, Start). The signal is generated beforehand using the 'Waveform' datatype.
Now I want to change the signal as smooth as possible but I can only produce this two situations.
Situation 1:
Stopping the task - writing the new signal - Starting the task
The timeout generates problems on the device I am testing.
Situation 2:
Directly write in the existing and running task
This is even worse, since the signal is not produced correctly. When I only change the amplitude the signal is generated correctly. Only when the frequency is changed the phase seems to cut out.
Is there a standard/ good solution to change an output signal without such switching artifacts?
06-16-2020 06:54 AM
Hi sh,
@s.h._tech wrote:
Situation 2:
Directly write in the existing and running task
This is even worse, since the signal is not produced correctly. When I only change the amplitude the signal is generated correctly. Only when the frequency is changed the phase seems to cut out.
Is there a standard/ good solution to change an output signal without such switching artifacts?
Those "artifacts" only occur because you are outputting a fractional amount of periods of your sine wave (for situation 2). To avoid them you need to output full periods of the waveforms!
(Stopping and restarting the task will always create "artifacts" in the output signal, and should be avoided.)
06-16-2020 07:01 AM
The 'changed' signal is an array of Waveforms (1 full period of the changed signal). The signal is only committed when I press a button.
It has to do something with the changed frequency, and therefore the samples generated, since this does not happen when I change the amplitudes.
06-16-2020 07:14 AM
06-16-2020 07:42 AM - edited 06-16-2020 07:43 AM
I started from the 'Continous_Voltage_Generation' example.
The waveforms are generated using the 'Basic_Function_Generator.vi'
06-16-2020 11:35 AM
Without a whole lot more detail about your system, your DAQ device, the purpose of the app, other requirements & constraints, I can only give general & generic advice.
IF you are always looking to generate sine waves with 0 DC offset, then by far the most straightforward thing to do is what GerdW said in msg #2. Make sure you always write full periods of your sine wave. (Or generally, make sure they always end at the sample just before the next rising zero-crossing.)
If you need a much more general approach, I'd go with something like the following:
1. Take time to think about and create a spec for the max allowed rate-of-change for your AO signal. What rate of change will you consider "unsmooth?" Note that the max rate of change for a sine wave A*sin(2*pi*f*t) will be 2*pi*f*A. Your max allowed rate of change better be higher than *that* for your max anticipated sine wave freq and amplitude.
2. With this spec, you can use or make rate-limiter code. Whenever you generate a new waveform, it'll need to pass through your rate-limiter code before being written to the task with DAQmx Write. This will force all transitions to meet your "smoothness" criteria for rate of change.
Note that the rate-limiter code will need to maintain memory (unitialized shift register or feedback node) of where the previous waveform left off so it can do its job of blending over to the new waveform according to your definition of "smooth".
-Kevin P
06-17-2020 01:01 AM
My whole project entangled and I will need some time to create single Vi with the problem.
The approach with the zero crossing only would work with one signal. With multiple signals and a phase angle there would not be a common zero crossing. My signals also have a offset but that should not affect any change. The signal is also generated continously. How can I keep track of the position of the signal
For now I can test with a 4 channel function generator triggered via my RS232-card.
I will try to rebuild a simple Vi which demonstrates my problem. Usually I find some examples in the help, but I was unable to find a basic function generator for analog signals.
06-17-2020 02:18 AM
I created a Vi which demonstrates my problem. All Daqmx-Vi's are used exactly as I have implemented them in my project. When changing the frequency (even with multiple periods in the buffer) the signal is not generated correctly.
Changing the amplitude generates the signal correctly. My guess is that the samples generated and the timing is the same as the signal currently in the buffer.
06-17-2020 02:37 AM
Hi sh,
what's wrong with the signal shown in this image? It looks "continuously" without any steps/gaps…
@s.h._tech wrote:
Changing the amplitude generates the signal correctly. My guess is that the samples generated and the timing is the same as the signal currently in the buffer.
Again: how do you define the DAQmx task?
Do you try to change the samplerate when the task is running, when you guess "the timing is the same as the signal in the buffer"?
06-17-2020 02:49 AM
There are two different Sine waves in the signal (one with 100Hz and a few Periods with 200Hz). There should only be one frequency.
The Task is created via the 'AO-Voltage.vi'