From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-13-2020 10:06 AM
Hi Guys.
I'm new in LabView and have a problem with sine wave generator using formula. Basically I want to generate the signal which will include start delay, specific number of cycle with specific frequency in sec, hold time and limitation of max and min signal e. g. starting at 0 for 2 sec then switching for 2 cycle of sine wave -> freq 2 sec and amplitude 5 limited in positive signal at 2 and then coming back to 0 for 3 sec -> hold time, and starting from beginning.
My problem is the sine wave not starting from zero but after Start Delay is jumping to some point where it will be when running from the beginning as a sine wave. I've attached the picture as a reference. There can be a problem with formula as well as I'm a mechanical engineer and first time touch with such a programing.
Can you please look at it and suggest how to solve that issue? In attached file there are cases where I've tested case "sine" and "step" where I've put a bit different solution. Both not working.
05-13-2020 10:33 AM - edited 05-13-2020 11:02 AM
If you need the sine wave to start at zero after the Start Delay, you need to subtract it from in the time parameter for the SIN input.
The chart shows the first point of the sine wave at exactly the location of the Start Delay. The chart shows a line connecting the previous point. If the first point was 0 as intended, there would not be any difference between the 2 points.
05-13-2020 01:00 PM - edited 05-13-2020 01:12 PM
I get the feeling that this all could be done with <20% of the current code. Can you attach your VI once more, but having typical default values in all controls so we can run it without having to guess. (Change all controls to reasonable values, select them all, edit..make current values default, save VI, attach it once more).
(Some controls seem to contain derived values most of the time. Shouldn't these be indicators instead? Some of your algorithm choices are weird. Why is the inner loop running more and more times, repeating calculations that have been done already earlier (unless controls change. Why is there no way to stop the outer loop? [sec] is not a frequency unit. And no, it does not start slighly before start delay. The point is exactly at the start. You see the linear interpolation where there are no points. That's fake.)
05-14-2020 04:29 AM
Hi.
Thanks for your replay. I'm attaching the VI with default values.
I will try to answer your questions as well:
1. All control values are adjustable to get as specific signal as I would like to get.
2. Inner loop is creating one full cycle i.e Start Delay + Number of cycle*Cycle time + Hold. If repeat push button is "on" it will repeat this sequence, if not it will stay to the end on DC value.
3. There wasn't stop button just because of testing purpose. I've add it now.
4. Of course [sec] is not a Freq unit, I've change the name now. Panel need to be very simple and intuitive so it is the time of 1 wave cycle.
Hope that will help to understand the problem.
Regards
05-15-2020 08:28 AM
Break out the Pencil and Paper, and answer the following questions:
Bob Schor
05-18-2020 02:55 AM
Hi,
Thanks for your answer and explanation.
If you know where is the issue can you help to implement what you already said? As said I'm a beginners and pretty didn't get your explanation playing with t=50? Function is done to permanently repeat the pattern so why to bother that?
Question is really simple. How to change the formula or add something to make it work correctly, means wave starting from beginning.
Regards
05-18-2020 08:18 AM
It's your formula. Get out a calculator (or simply write down, with pencil and paper, the formula, decide what the value is at t = 49.9 (I'm going from memory, here, since you haven't put in any effort, I'm just going to trust my memory and say I think I remember that it is 0 before t = 50, and may even at t = 50), then evaluate it at t = 50.1 (or 50.000001). Is it "near" zero? Do you know the meaning of a "continuous" function? Do you want a continuous function? Looking at your "before" and "after" t=50 function, what would you need to change to make it continuous?
If you have had an algebra class (maybe in high school), you should be capable (with pencil and paper) of writing down an Equation you could solve for Something. Now put that value of Something into your Equation ... [I'm not going to tell you "the answer" -- you need to learn to think and solve these problems yourself].
Bob Schor