06-13-2023 06:21 PM
Hello Bob,
Thanks for the reply.
I tried to program it in the classical LabVIEW software. I have attached the .vi file. Could you please have a look? I do not have any error in the program but I don't find my desired result.
I have attached a picture of my desired modified sine wave. Hope it will help in understanding what I am actually looking for.
Thanks again.
Regards,
Muhammad
06-13-2023 09:05 PM
There is a saying "A Picture is Worth 1000 Words!". I told you how to create a waveform consisting of a sinusoid and a ramp.
But that is not what your picture shows. It shows a sinusoid, all right, but instead of being added to a ramp or triangle wave, the "plot" of the sinusoid is rotated by some number of degrees. This is a different problem! And it needs to be approached differently..
One question is "what do you want to do with this "signal". It is an interesting math problem -- suppose the ramp is very steep (almost vertical) -- you might have a situation where the X value changes almost-sinusoidally, while the Y component increases almost linearly, even though the line just wiggles back and forth in the X direction, something that "time" (which, for a Waveform, is also the X coordinate.
So a question is "Do you want to "draw" this waveform on an oscilloscope", i.e. have a function f(t) that at equally spaced values of t traces out the "tilted sinusoid" that you drew? Try to work out the math, where you solve for f(t) at equally spaced values of t. How's your math?
Bob Schor
06-14-2023 01:31 AM - edited 06-14-2023 01:32 AM
Hi mst,
@Muhammad_mst wrote:
First of all, the sine wave has a fixed amplitude 0.005718 V and frequency of 5 Hz. I need to ramp up this sine wave with respect to time. In that case, the ramp-up for each second would be 0.19 V. The experiment should be for a total duration of 5 seconds and ramp-up will continue throughout the 5 seconds.
Like this?
06-14-2023 06:33 AM
Hello GerdW,
Yes. Thats what I wanted!
Thanks a lot.
Is it possible to share the code? I greatly appreciate your help.
Regards,
Muhammad
06-14-2023 06:52 AM
Hi Muhammed,
@Muhammad_mst wrote:
Is it possible to share the code?
I didn't save that VI.
But in the end there are just two functions from SignalGeneration palette (Sine and Triangle waveform) and an Add…
06-14-2023 11:22 AM
Hello GerdW,
Thanks for your continuous help.
I have connected it with a USB DAQ device (NI USB 6003). I tried to generated the modified wave and get it in an oscilloscope. However, I do not find any signal in the oscilloscope, although I am getting the wave in the Front Panel.
Could you please help me? I have attached the .vi flie and a screen shot. Thanks.
Regards,
06-14-2023 01:47 PM - edited 06-14-2023 01:49 PM
Hi Muhammed,
@Muhammad_mst wrote:
I have connected it with a USB DAQ device (NI USB 6003). I tried to generated the modified wave and get it in an oscilloscope. However, I do not find any signal in the oscilloscope, although I am getting the wave in the Front Panel.
What's the point of the "1 iteration FOR loop"?
See this:
Do you get any errors from your VI?
Why was there a coercion dot at the DAQmxWrite function?
Did you connect the scope correctly?
And why do you stop the AO task immediatly after starting it? How many samples will be actually sent out of the device in this short moment of time???
06-14-2023 04:54 PM
Hello GerdW,
Thanks for your reply.
What is the function called and how to get it as I have red-circled in the screenshot of your last reply?
Actually my plan was to make a continuous ramp which will continue beyond 0.19V instead of using triangle function. But at the same time, the inclined sine wave will pass 0.19V in 5 seconds. I.e., it will continue to pass 0.38V in 10 seconds. When I add triangle function, the signal will decrease to go to zero from 0.19V in the next iteration, which is a kind of output I want to omit. Is there any other way like using ramp pattern instead of triangle function here?
In the last VI, I did not have any error and I have connected the oscilloscope properly. Even after that, I did not get any output in the oscilloscope. Why this is happening I do not understand.
I also do not know why there was a coercion dot at the DAQmxWrite function. I did not get any error or warning because of that.
In case of stop task.vi, I have seen writing programs in some exercises found in the internet. That is why, I put AO stop immediatly after starting it. With this short amount of time, 500 samples for 5 seconds would be enough for my case, I believe.
Thanks.
Best regards,
Muhammad
06-14-2023 09:25 PM
Muhammad,
Gerd showed you an image of the waveform I described to you, which is the sum of a ramp and a sinusoid. But what you "drew on a napkin" looked, to me, like a sinusoidal waveform (on an oscilloscope, say) when the paper (or 'scope) is tilted 30 degrees or so to the left. Notice that if you turn Gerd's image to the right so that the mean of the waveform runs horizontally, the shape you see is not a sine wave, but a slightly distorted sine wave. If that's what you want, do the following:
Bob Schor
06-15-2023 01:02 AM
Hi Muhammed,
@Muhammad_mst wrote:
What is the function called and how to get it as I have red-circled in the screenshot of your last reply?
When you want to access elements of a cluster you should use Unbundle(ByName)…
@Muhammad_mst wrote:
Actually my plan was to make a continuous ramp which will continue beyond 0.19V instead of using triangle function. But at the same time, the inclined sine wave will pass 0.19V in 5 seconds. I.e., it will continue to pass 0.38V in 10 seconds. When I add triangle function, the signal will decrease to go to zero from 0.19V in the next iteration, which is a kind of output I want to omit. Is there any other way like using ramp pattern instead of triangle function here?
Then you need to change either the Triangle waveform parameters - or simply use a plain ramp signal as described by Bob…
@Muhammad_mst wrote:
I also do not know why there was a coercion dot at the DAQmxWrite function. I did not get any error or warning because of that.
In case of stop task.vi, I have seen writing programs in some exercises found in the internet. That is why, I put AO stop immediatly after starting it. With this short amount of time, 500 samples for 5 seconds would be enough for my case, I believe.
You don't get warnings for coercion dots, but you are able to see them in your block diagram.
And you should know what they mean and handle accordingly (aka anticipate possible problems)!
Generic advice: Stopping a task immediately after starting it is very seldom a good idea…