03-17-2016 12:40 PM
Ok, I will try it with loop.
At my side I've also find a solution.
Here it is:
03-17-2016 01:07 PM
That logic should work also. You are basically generating a wave for with N number of points (where N is the desired final number of points) and flattening the slopes to whatever was the last recorded value when the remainder of Mod 100 was zero.
Mine was generating a wave of N/100, and repeating each step of that wave for 100 times before moving onto the next wave.
The results should pretty much be the same, just getting to them from opposite directions.
03-17-2016 01:08 PM
@johnsold wrote:Pavel_47,
You have multiple threads going with very similar questions. Each time you make a little progress and then come up against a new obstacle, you start a new thread. While there is some merit in keeping each thread short and to a single topic, I think that you may be making things more difficult here because no one is sure just what has neen answered and what has not.
Please pick one thread, possibly this one, and specify your overall goal. Tell us what you are really trying to generate or measure, not so much what you have tried that did not work. For example give details about what the staircase sine wave should look like. What is the range of amplitudes? What is the range of step amplitudes? Does every step have the same amplitude or does it depend on sin(t)? What is the range of frequencies? How is the duration of each step related to the frequency? Do all steps have the same duration? Which parameters of this waveform are fixed and which can vary? How often can they change? If a parameter changes while generation is in process, does the waveform change immediately or at the end of the next complete cycle? What sampling rate or rates will be used? In one thread you had noise or a higher frequency sine wave superimposed on the stepped waveform. Is that a requirement or simuation of interference? If a requirement, then also specify all the parameters of the higher frequency signals.
What will you do with this signal after you get it generated?
After we have answers to these questions, we will have a much better idea of what you are trying to do and can then more likely give you useful advice on how to achieve it. Help us to help you by not making us pry information out bit by bit.
Lynn
Well, I thought that my posts aren't so similar and touch different aspects of design, that could be useful for other users.
This post concerns waveform generation, whereas previous one was on spectrum.
But, Ok, I agree, all of them concern the same setup.
Overall goal - is to debug calibration algorithm on PC before going to the lab and connect to devices.
Calibration algoritm must compensate residual magnetic field in 3 directions on our testbend (research experiment in magnetoptics)
3 compensation coils are controlled by NI DAQ.
The feedback (output from DUT ... or "input in LabVIEW") is provided by a signal from camera or photodiod.
The generic behavior of DUT is known, so I can model it in LabVIEW, but there is noise and spurious (e.g. 50Hz) that should be taken into account by calibration algorithm.
The noise and spurious behavior are unknown, that's why I have to develop some LabVIEW staff to remove them (without detriment to useful signal) for different scenarios.
Concerning all the parameters you enumerated, actually some of them aren't defined yet.
Is it so important to know them ?
Thanks
Pavel
03-17-2016 01:41 PM
Maybe it's just me, but what use is any waveform plot that plots the same datapoint 100 times in a row NO MATTER how much it might change. If I needed a staircase shaped waveform, I instantly think of an ATD (Analog to Digital) converter that switches to another 'staircase' level when the signal gets close to it. Then route it back through another DTA (Digital to Analog) converter to restore the signal. Because there's always a loss of precision in these circuits, you will get a staircase waveform back.
"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books
03-17-2016 02:05 PM
One-shot run Ok, but once in while loop, waveform is quickly saturated. So, some array management is necessary
03-17-2016 02:20 PM
@RavensFan wrote:That logic should work also. You are basically generating a wave for with N number of points (where N is the desired final number of points) and flattening the slopes to whatever was the last recorded value when the remainder of Mod 100 was zero.
Mine was generating a wave of N/100, and repeating each step of that wave for 100 times before moving onto the next wave.
The results should pretty much be the same, just getting to them from opposite directions.
It seems that in your solution the step length depends on frequency and cannot be defined independently. Am I right?
03-17-2016 02:41 PM
Of course. Everything is inter-related.
You had never defined why you thought your step should be 100 units long. You were just wondering why it wasn't. The lengths of the steps were all dependent on your software speed, which is pretty meaningless since the length of your step is going to depend on the hardware you will be using when you finally start collecting data. And only then it's a function between the update rate of the hardware that creates the signal versus the acquisition rate of the DAQ system you are using to acquire the signal.
You are saying you are trying to simulate something you are going to do in hardware, but you really haven't defined what that system is or what how the real world hardware is supposed to behave. Anything discussion up to now is pretty much an academic exercise.
Your step length can never be defined independently because it is all dependent on factors in your system you haven't defined.
03-18-2016 11:06 AM
I've explored your version attaching it to hardware (I've also slightly modified your code and included some benchmark measurement).
The generated staircase SIN were applied to AO0 of USB-6521, then using T cabled to AI0 of USB-6521 and to oscilloscope Tektronix TDS 2004C.
Here are 2 observations:
The 2nd point is more important than 1st: the exact value of step duration is not so important, whereas ripples could be a source of additional noise.
I've added some measurement staff - mean value, standard deviation and can see that they are far to be constant.
Additional remark concerning step duration measurement in the bottom while loop ... surprisingly it measures a value about 2 times greater than value that is observed in INP Waveform Chart (so before connect to indicator, I didvide it by 2)
So there are 4 different values of step duration, observed in this setup:
Regards
Pavel
P.S. STOP button stops only BOTTOM loop, not VI ... it's due to DAQ that still running. Correct ?
03-18-2016 12:19 PM
The steps are just fine in the top loop. The only possibility of a problem would be related to the regeneration mode of the analog output as to whether a packet of data falls at the correct timing interval after the previous packet of data was written. In other words, the time it takes to generate the next packet of waveform may be adding timing between the end of the last one going out and the start of the first sample of the newly generated waveform going out.
The problem with your bottom loop is your are just acquiring 1 sample at a time, so it you now back to just software timing of your acquired data.
I suggest looking through the DAQmx examples to find the most appropriate setup for both the input and output sides.
03-18-2016 02:25 PM
@RavensFan wrote:The steps are just fine in the top loop. The only possibility of a problem would be related to the regeneration mode of the analog output as to whether a packet of data falls at the correct timing interval after the previous packet of data was written. In other words, the time it takes to generate the next packet of waveform may be adding timing between the end of the last one going out and the start of the first sample of the newly generated waveform going out.
The problem with your bottom loop is your are just acquiring 1 sample at a time, so it you now back to just software timing of your acquired data.
I suggest looking through the DAQmx examples to find the most appropriate setup for both the input and output sides.
What about issue with STOP button. Is my supposition correct ?
Thanks