The AM Forum
May 16, 2024, 03:11:52 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Calendar Links Staff List Gallery Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: PWM filter modeling - software to make this easier  (Read 4245 times)
0 Members and 1 Guest are viewing this topic.
steve_qix
Contributing
Member
*
Offline Offline

Posts: 2592


Bap!


WWW
« on: April 28, 2008, 03:41:00 PM »

Many people here have been using SwitcherCad for simulations of filters, etc.  One of the problems with the simulations is that the waveforms are static (not modulated), so characterizing the filters is difficult at best, so I wrote a program to generate a .PWL file, used by SwitcherCad as input.  The .PWL file contains a (long) series of modulated pulses.

So, for all you filter-simulation junkies !!

I have released my program to generate .PWL files.  This program will generate pulse width modulated waveforms, suitable for use in switchercad. NO GUARANTEES !!! But, it does appear to work correctly.  When you specify your independent voltage source in switchercad, specify a .PWL file as its input rather than a specific pulse width, etc.

The program features sine, square and triangular modulation waveforms. You can specify the modulation level, frequency, duty cycle (carrier level), switching frequency, anti-aliasing filtering level (the filter is poor, and will modify high audio frequency waveforms, but it does work), negative peak limiting level and a few other parameters.

This is a command line program which will run under all version of windows.

Copy the program to your hard drive, run it (usually done from a command line).  The output file defauilt name is pwl.txt, although you can specify your own file name.  Other command line arguments are also documented (type, at the command line, makepwl <return> and it will show you the arguments.  For those who are absolutely married to the Windows interface, use the start->run->makepwl.exe  (put makepwl where you can find it later!).

The program is here: http://www.classeradio.com/makepwl.exe

Please report any bugs, etc.  No guarantees on when I might get around to fixing them, but I've used the program a lot and it works very well.  Tongue

Here is a SwitcherCad simulation output (with the schematic).  I used the makepwl software (see above) to create the PWM signals used in this simulation.

The switchercad file is here: http://www.classeradio.com/filter_test.asc

The output looks like this:

Logged

High Power, Broadcast Audio and Low Cost?  Check out the class E web site at: http://www.classeradio.org
WA1GFZ
Member

Offline Offline

Posts: 11151



« Reply #1 on: April 28, 2008, 04:03:29 PM »

Steve, Why do you have D2 shorted? This does not match the configuration of the PWM and will modify results? I added the diodes in the files I sent you because I wanted to match the performance of the switch. I'll play with this tonight and report back. Net narks won't let me open you file here. fc
Logged
Steve - WB3HUZ
Guest
« Reply #2 on: April 28, 2008, 09:08:35 PM »

You can dump a Wave file into SwitcherCAD. It's very easy to make one as dynamic is you'd like.
Logged
WA1GFZ
Member

Offline Offline

Posts: 11151



« Reply #3 on: April 29, 2008, 02:31:41 PM »

Steve is the software man it works cool ......now to play.
Logged
WA1GFZ
Member

Offline Offline

Posts: 11151



« Reply #4 on: April 30, 2008, 08:58:33 AM »

Huz,
I wonder if you can point me to reading material on making pwl files. Steve QIX didn't know of any place to look and searching the web juse gets me password hack informatiion. Looking at Steve's filter there is ripple just past the peaks that can be tuned flat.
Logged
Steve - WB3HUZ
Guest
« Reply #5 on: May 13, 2008, 06:49:44 PM »

Yo Franko. Sorry for the delay. Haven't had much of a chance to log in here lately.

No need to mess with a PWL file.

Create your wave file with whatever software makes sense - audio editor or sig gen app. Save the Wave file (e.g. filename.wav) in the same directory as your SwCAD/LTSpice data files.

On your LTSpice schematic make your source an independent voltage source, V1. Make the value for V1

wavefile=.\filename.wav chan=0

That's it. Done.

Below is a simulation of the filter following the clipper stage in an Eico 730 modulator. As you can see, with 6 dB of clipping on real audio (me saying the famous AM test phrase yeeeaaaaaaa) as the input, the overshoot induced by the filter tends to make larger peaks than before the clipping. This is why using a clipper/filter on an AM rig generally sucks. It does nothing to reduce the peaks and just creates distortion. The impulse response of the simple lowpass filter is very poor.

I can send you the schematic file if you'd like.






* eico730filtervoice6dBclip.gif (8.98 KB, 1024x225 - viewed 310 times.)
Logged
WA1GFZ
Member

Offline Offline

Posts: 11151



« Reply #6 on: May 13, 2008, 07:45:00 PM »

We needed to get RTCA lightning waveforms into SWcad. Today one of the guys I work with made an excel file of the waveform based on the formula.....after we debated all the calculas we forgot. They we grabbed a kid to set us straight. Anyway we have it now. (WF2 formula was wrong at t0)
Yes an underdamped filter will cause overshoot and false positive peak distortion. An old German (SK) boss I had in the '70s set me straight and SWCad reminds me of his talent.
The best transient is a square wave for finding the effect of a step response but Steve's triangle wave shows it also if you look closely just past positive and negative peak.  The nice thing about a square wave is that is is a stable level after the transient. That is how a TDR works. Old Gunther Ritz did the TDR in his head right off the 545B screen. TNX for the ideas I'll pass it along to the guys at work. I did CS116, CS115 and now we have lightning. These are cool tools to keep everyone honest. Now to convince the power supply guys their filter tool doesn't work.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

AMfone - Dedicated to Amplitude Modulation on the Amateur Radio Bands
 AMfone © 2001-2015
Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.035 seconds with 18 queries.