LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM to cosine (tdms)

Dear,

 

 

I'll briefly explain what we are trying to do. We need to convert the PWM signal (from our earlier recorded tdms file) to a cosine (of equal mean value). The PWM signals (with of course a variable duty cycle) were recorded on the invertor of a hybrid vehicle. I've been searching pretty much everywhere how we can solve this. Our own solution would be: differentiate the PWM signal, measure the pulse time (from the end of rising to the start of falling and opposite) and buffer these results in a table, so we can use them again. Then we would integrate the the positive pulses over one period and divide by the pulse time, so that we get the mean value that we require. Finally we should use this average value of the PWM as the average value for our cosine. Any suggestions how to solve this problem? I don't have that much experience with Labview yet, so I am still limited in knowing labview's functions. For example I haven't found a way to measure the pulse time or duty cycle of a non periodic signal. Thanks in advance, kind regards from Belgium, Jietse

0 Kudos
Message 1 of 4
(2,849 Views)

Hello,

 

I've made a very simple example program that shows how you can do several of the things you asked.

Did you want the cosine to have its RMS-values equal to (or proportionate with) the mean value of the PWM?

Or do you just want to add a DC bias to the cosine to have the mean values of both equal to eachother?

 

I've implemented a simplified version of the first one. If you want the second one then you just have to make some small adjustments.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 2 of 4
(2,828 Views)

 

I forgot to mention something important. The signals that we're using (that have been recorded from real life data) are captured in a TDMS file. I knew about the functions you've used in this VI, but as the PWM signals in the TDMS file contain a variable duty cycle, it won't work to use these measurement functions, as it only makes 1 measurement for the whole PWM signal instead of 1 measurement for each pulse. To answer your other question, it's indeed the RMS value of the PWM that should be equal to that of the cosine. I already thank you for your effort and hope you can help me out on finding the solution. Best regards, Jietse

0 Kudos
Message 3 of 4
(2,825 Views)

Hello,

 

I've changed the example code a bit and made something to help you get started.

Normally with PWM you know your base frequency and you also know the used sample rate (for the data acquisition). In this example i chose to "continuously" calculate the duty cycle over a time frame of about 2 periods of the PWM, so that you can be sure that always at least one duty cycle can be found inside the time frame.

 

With some  adjustments you can easily implement this for your own measurement file.

 

Message Edited by ThiCop on 03-18-2010 09:27 AM
Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 4 of 4
(2,807 Views)