LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

x axis time and THD plot+converting 1d array to dynamic data problem

Solved!
Go to solution

Hi everybody,

I uploaded a VI snippet to facilitate the response for you.

In this VI, I want to draw the curve of THD as a function of time. I found some problems to configure the time. I tried to put the absolute and the relative time but it is the same ( I have always a point in the midle of the curve). I can see the THD variable is changing but I am unable to put the time in the x -axis.

I have also another problem: I want to go across a for loop to make some manipulations ( I put an empty for loop). Then when I return from a 1D arry to dynamic data, I found NaN in the THD.

Please Can you help me to sort this out.

0 Kudos
Message 1 of 9
(4,189 Views)

You have no time data since you threw it away with the conversion to DBL. Dynamic data is just evil so if you want to retain timing information, convert to a waveform data type. You can easily get the Y array and convert back to a waveform with the Get Waveform Components and Build Waveform functions.

Message 2 of 9
(4,174 Views)

Thank you,

It is working now.

But I still find problem to see the graph. Actually, I did some changements then I clicked undo but I found the graph drawn just in the right side in the graph. I tried to change the autoscale but nothing happens. I observed this "bug" several times before. I do not know how to get rid of it.

Thanks.

0 Kudos
Message 3 of 9
(4,168 Views)

You need to post your code.

0 Kudos
Message 4 of 9
(4,164 Views)

Sorry for the delay,

You can find my code as snippet VI attached. You will see I have NaN in the THD.

Best regards,

0 Kudos
Message 5 of 9
(4,153 Views)

Just keep it simple in this case. Do not do any conversion from/to dynamic data and remove the for loop. Just wire the dynamic data straight through to the multiply.

Message 6 of 9
(4,138 Views)
Solution
Accepted by topic author ziedhosni

The Express VIs and the Dynamic Data Type (which Dennis correctly characterizes as evil) mask so much of what is going on.

 

Here is a modification of your VI which

1. Converts the DDT signals to a waveform immediately on coming from the Simulate Signal VI.

2. Extracts the array component for your log distortion.

3. Reconstructs the waveform to preserve timing information.

4. Uses the SINAD Analyzer.vi from the Signal Processing >> Waveform Measurements palette to get THD as a DBL scalar, not a mystery DDT.

5. Added Wait time control.

6. Added graphs to visualize signals. Added chart for THD visualization.

7. Added a clippler with a front panel control so the distortion can be changed significantly.

 

Lynn

 

Note when I saved this back to version 8, I got some warnings, so some things may not work correctly.

Message 7 of 9
(4,136 Views)

I don't know how can thank you Lynn. You helped me a lot. Your response is really professional and amazing.

Also, thanks for

0 Kudos
Message 8 of 9
(4,125 Views)

Both Dennis and I have been working with LabVIEW for many years.  The key is not so much how long but how smart you work.  Learn from your mistakes, take classes when you can, and learn from those who have already learned about it.  Some of the experts on the Forum are relatively new at LabVIEW programming.

 

Lynn

Message 9 of 9
(4,121 Views)