08-17-2015 07:10 AM
Hi,
I am quite new to LabVIEW but I have a complicated program to create. Part of this requires a waveform to be generated from a spreadsheet of parameters, attached.
I have attached a graph of how the waveform looks. As you can see the various parameters relate to durations and amplitudes of the wave as well as the frequency and amplitude of the sine wave in the middle.
In addition to this the program must cycle through creating each waveform in succession as the values in the spreadsheet change for each different test.
I have managed to read the spreadsheet file, make an array from this and then i tried to index the array by row to send to a for loop which would run through each test but I don't know how to create the waveform from these values. I attempted to utilise the labView waveform generators to create individual sections of the wave but struggled.
Thanks for any help.
Solved! Go to Solution.
08-17-2015 07:39 AM
Look in the Signal Processing->Signal Generation palette. There are lots of functions there to generate your waveforms. You will need to generate each section of your waveform and the use Build Array to combine them into a single waveform.
08-17-2015 07:40 AM
Hi Parker,
I attempted to utilise the labView waveform generators to create individual sections of the wave but struggled.
And where's the VI you are struggling with?
Please attach your current attempt to handle this problem!
Btw. you should use Ramps and Sine pattern to generate your waveform.
Doesn't look that hard: generate each part and build up the waveform with AppendWaveforms. Don't forget to use the very same dt for each part of your waveform…
08-17-2015 08:03 AM
A Waveform is simply an array of floating point values representing an equally-spaced time series, expressed as a cluster that includes not only the array but the starting time and the time interval. Rather than use the Waveform Generators for this, it would seem to me to be much simpler to generate the array of points yourself.
You seem to be missing at least one Time point. The Time interval T2 has a ramp of duration T3, a sinusoid of specified frequency but unspecified number-of-cycles (hence an unspecified duration), and a second ramp, also of unspecified duration. Where is the sinusoid supposed to end? There may be another "missing" time as you don't specify how long the waveform remains at the final voltage. Finally, if you do divide T2 into three time intervals, T3, T4 (sinusoid) and T5 (rising ramp), you need to ensure that T3, T4, and T5 are all positive and non-zero (unless you want step functions), that T2 = T3 + T4 + T5 (an internal constraint), and that T4 is an integral multiple of F (assuming that is what you want). As a final remark, F, on your diagram, appears to be the period of the sinusoid, but the choice of F may cause some to think of "frequency", leading to potential confusion.
Bob Schor
08-17-2015 08:03 AM
This is what I have so far... I'm mostly struggling with how to connect my variables to the signal generators to create what I want
08-17-2015 08:22 AM
Hi Bob,
Thank you for your valid points and advice.
To give some more background info, I am converting an old program created with Agilent VEE OneLab which was previously used to create this waveform. I have just looked into this program and the previous programmer added a constant of 2.75s for the duration of the sine wave which fills in the missing time point. Why this wasn't added to the parameters I do not know. Additionally the previous program runs on a time of 21s per test which gives the final voltage time by simply running until the end of the test and the start of the next test. Finally, you are again correct with regards to the F variable confusion. F is in fact the frequency of the sinusoid, the author of the diagram has labelled this confusingly.
I also was thinking about simply generating the array of points myself but was unsure how to do this in labview from the parameters in the spreadsheet, do you have any suggestions?
Many thanks
08-17-2015 08:32 AM - edited 08-17-2015 08:32 AM
08-17-2015 09:51 AM
08-17-2015 11:08 AM
Combine Gerd and my suggestions. I had not used the Signal Generation Palette VIs before, but they do handle most of the "math" for you. The key step you need to decide is what interval to use for "dt", the time "quantum", usually the same as the sampling interval. Looking at your Waveform picture, you have a Pulse, a Ramp, a series of Sinusoids, another Ramp, and a final Pulse. When you look at an individual Palette, it has "dimensionless" parameters that you need to adjust for your particular situation.
Consider the ramp that has duration T3, starts at V1, and ends at V3. Assume your sampling interval is "dt". You would wire the Samples, End, and Start inputs to the Ramp Pattern by Samples function as follows:
Since you will be continuing from where you left off, I would think you would want to wire "exclude end?" to True (to avoid double points), but I might be wrong about this.
For the sinusoid, you need samples, amplitude, phase, and cycles. Samples is again the total duration of the sinusoid divided by dt. The amplitude is A, the phase is 180 (notice that your sinusoid starts negative), and cycles is however many cycles you want during the duration of the sinusoid. This sinusoid, however, will be around 0, so you'll need to add the constant offset V3 to the array.
Once you have assembled all of the parts of this complex waveform and have concatenated the resultant arrays, all that remains is to turn them into a proper Waveform. Drop a Build Waveform function on the Block Diagram, drag up its top edge one "click" to expose dt, and wire in dt and your array (to Y). You now have a proper waveform.
Bob Schor
08-18-2015 06:54 AM
Hi Bob, Gerd,
I have done as advised and made some progress. I added a new column to the input data for duration on sinewave and made rough changes to the graph to represent the new variable labels.
With this I appear to have working waveform generation for the ramps and sine wave but the pulse is giving me issues. The delay and width don't seem to perform how they do when I test a pulse signal generator individually. I have wired the delay to T0 to supposedly delay the start off the pulse then set the width to T1 to define the time the pulse stays at the high amplitude of V1. However this and the final pulse do not created the desired waveform when the VI is ran.
The wiring is extremely messy but if you can spot where I'm going wrong it would be greatly appreciated.