I am trying to generate an analog profile as shown below. What would be the best way to approach in generating the same with user defined time inputs (i.e I would like the user to input the times shown in the x-axis).
I am intend to use this signal repeatedly to perform thermal cycling using a power supply controlled through an analog voltage (+- 10 V).
I tried using the append signal option by combing a triangle & square wave options. However with this option I am unabale to specify the appropriate user defined time using this approach.
A couple of questions for you:
Is this a signal you are attempting to define in LabVIEW? Also, what hardware will you be using to output the signal?
I have both these systems at my disposal. I Can use any one of them
The NI myDAQ doesn't support direct current output, only voltage output, but if you know your load in Ohms then you can use Ohm's Law to figure out what your voltage output should be to get the correct current. If you will need more than 2mA of current output, then you will need additional circuitry to allow higher current levels. So keep that in mind.
As for generating the waveform, one way to do it would be to build an array in stages using a state machine architecture, then have a finite voltage output task write the array. For example, let's say you want to have your analog output write values at 100 Hz (so a 3 second section of the signal would have 300 elements in the array). To build the array, I would suggest having states such as the following:
1) Ramp up.
2) Stay high.
3) Ramp down.
4) Stay low.
5) Ramp up 2.
6) Stay high 2.
7) Ramp down 2.
In each state, you will generate part of the array, and by concatenating all of these parts you will end up with your final array. The trickiest part will be generating your ramps, so here's a simple VI to get you started.
Does that help?
Here is one possible solution, you enter the points and the linear interpolation does the rest
Need some improvements since you still can make errors while entering the data (last point should match the first point, maybe enter only delta times so the resulting time array will be monotone, etc), and if the output array is used in a cyclic buffer you (maybe?) need to remove the last sample ?? Check it
Thank you for your response. I was able to generate a complete signal as per suggestion. I wanted to know how do send this concatenated signal as an analog output (Say 0-10V signal) using a myDAQ. How do I do it?.
Also should any cutomised analog ouput signal (like in the case here) should be a nX1 dimensional array for a Data acquisition system to accept it. Is this true?
You can output the data using DAQmx write, configured for Analog >> Single Channel >> Multiple Samples >> 1D DBL. If you open LabVIEW and go to Help >> Find Examples... it will open the example finder. Then open the folders to get to Hardware Input and Output >> Analog Generation >> Voltage >> Gen Mult Volt Updates-Int Clk.vi. This will show you how a general voltage output task is configured for outputting a waveform. You will need to change it to output your array in stead of the waveform data type (and also change the DAQmx Timing VI), but this should definitely get you started.
I used your suggestion and configured the general voltage output task for my custom signal. I have attached my VI here.
Though the code doent show any errors when excecuted, the signal is not passed as a input to my power supply. (My power supply can accept a 0-10V external signal).
I am not able to figure out if the DAQmx write part is correct in this case or not.
Can you give me any pointers here?.
You're close to success. You need to add a DAQmx Timing VI in between DAQmx Create Channel and DAQmx Write. Set the Sample Mode to "Continuous Samples," set Samples to Write to the length of your array that is input to DAQmx write, and the Sample Rate to the rate of your choosing (looks like you want 20 Hz). Then change the Auto-Start input of your DAQmx Write to "False."
I believe the problem is that the default timing is On Demand, but you didn't have a DAQmx Write after starting the task to "demand" that some samples be written. Using the DAQmx timing VI is usually the best way to go because it gives you explicit control over a number of factors.