LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding slope and creating lock signal

Hello,

 

I'm new to LabVIEW and I'm looking more for conceptual help than getting code, but I've attached my .vi in case anyone is curious as to what I'm asking for help with.

 

Below is an image of the signal I am collecting through a PCIe-6351 card. The white trace is what my analog output signal is (a ramp from -5V to 5V), and the red trace is my error signal being recorded from my system. From NI's support already, I've learned to move things into a state machine, but I need a bit on conceptual help on how to get there.

 

What I want to do is enable the system, sweep my analog output signal from -5V to 5V, and record my error signal (red trace). Once I've captured the error signal (what is circled in yellow), I want to lock on that slope and maintain my error signal to stay at zero by providing an appropriate analog voltage through a PID control loop.

 

1) Using DAQmx, how can I "find" the slope circled in yellow? The values for max and min will not always be the same, and the slope will vary, but the general shape will remain the same. How can I interpret the data to find this slope?

 

2) How can I determine the value of both analog signals at a given instance in time? For example, if I want to know what my white trace's value is when my red trace has a "peak"?  I have tried to create a VI with the analog inputs/outputs being synchronized, but I'm not quite sure I have done this correctly.

 

Any help would be very much appreciated.

 

Thanks!

 

 

Error_Signal.PNG

0 Kudos
Message 1 of 2
(2,800 Views)

Hi there,

 

The way that you can do to achived your goal is using the functions of the waveform palette (block diagram), and obtain the XY value of your signal and the try to get the ecuation to know the slop circled in yellow, you can aproximate the value with the linear formula Y= mX+b. For doing that you can use "WDT index channel DBL.vi" to take the signal that you want to analyze, the you can use "WDT Get Value XY DBL.vi" and make an array of those values to have in one column the timing values and in the other column Y value. If you want just to take just a specific values you can use "Get Wave form subset.VI" .

 

If you have some option about what the VIs do, you can press ctrl+H (a small windows is going to pop up) and put your mouse arrow into the VIs, and in the windows will be an explanation about it.

 

Also you may take a look of these files:

 

https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/menus/categories/signal-processing/wavefor...

 

https://www.ni.com/en/support/documentation/supplemental/06/timing-and-synchronization-features-of-n...

 

https://www.ni.com/en/support/documentation/supplemental/10/synchronization-explained.html

 

Regards

 

 

0 Kudos
Message 2 of 2
(2,662 Views)