The Frugalamp by OS

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Do you have .options plotwinsize=0 set? That turns off data compression, which is a must. Also, make sure you set up the maximum time step in your transient sim setup to a very small value.

The simulator isn't broken, it's just very fussy about FFT setup. This is one of the weak points of LTspice. The trick of using ".four" and reading the result in text form using "View, SPICE error log" sidesteps FFT setup, which is why I mentioned it a while back. Trying the FFT on a plain old voltage source is a great troubleshooting technique BTW.

Also, if you post your sim in .zip form the server will accept it.
 
Andy, have you used multisim, or other spice-based software.??
LT is nice, but multisim seems to have many more utilities.I
have read that all these windows GUI clones are based on
the old DOS SPICE simulation used in acedemia. Would not
their results be in the same "ballpark" as they use the same models and simulation engine.

I did disable all compression in LT and the results were a little
better, but a virtual signal generator should have NO
harmonic distortion :bigeyes: I have multisim 8 now and
have begun porting my designs to it.. it also has the board
utility and many more metering/FFT options available..
will post soon..
OS
 
ostripper said:
Andy, have you used multisim, or other spice-based software.??
LT is nice, but multisim seems to have many more utilities.I
have read that all these windows GUI clones are based on
the old DOS SPICE simulation used in acedemia. Would not
their results be in the same "ballpark" as they use the same models and simulation engine.

I haven't used Multisim, but I've tried a bunch of other ones (PSPICE, Circuitmaker, MicroCap, TopSpice and SuperSpice). Most of these were either demos or bootleg versions (ahem). All of these are based on the Berkeley SPICE code which is in the public domain. I guess it was originally used mostly under UNIX. Early on, PSPICE and HSPICE were the leaders in developing model extensions to allow the models to fit experimental data better. For example, one PSPICE extension to the standard BJT model is a parameter called NK. It allows fitting a rapid falloff of beta at high collector currents, which is pretty much impossible without this extension. I believe LTspice has implemented all PSPICE model extensions, but whether other simulators do this is unknown to me. Some of these simulators are thousands of dollars, and I'm paranoid about bootlegs because of the potential for viruses, trojans, etc. Plus I've worked out a way to export PADS netlists from LTspice and import them into the freware FreePCB, so I can go straight from the sim into layout. So I keep using LTspice.

I did disable all compression in LT and the results were a little better, but a virtual signal generator should have NO
harmonic distortion :bigeyes:

Unless you post your sim that shows the problem, then it will be very hard and time-consuming to track it down. How about posting the one that just uses a source? This site allows zip format, or you can rename it to file.asc.txt (just add the ".txt" extension).
 
Ah, you didn't define the maximum time step. Others' experience may vary, but I've had good luck specifying the maximum time step as the sine wave period divided by (number of FFT points - 1). This was based on some discussion in the LTspice Yahoo users' group. In the attachment, you'll see I defined the parameter "timestep" as follows:

.param timestep 1m/65535

Then, in the "maximum time step" field in the simulation setup dialog, I put this value in curly brackets to specify the maximum step size. This curly bracket notation is really useful for lots of things, because it allows setting simulation and component parameters with a variable, which you can then change with a ".STEP" directive.

Try this new one. Better?

Edit: I ran the FFT from 15m to 20m
 

Attachments

  • sine_gen.zip
    424 bytes · Views: 76
Oh, that's because SPICE tries for maximum efficiency by default. The default strategy is for SPICE to use non-uniform time steps. It senses when the waveforms are changing quickly, and uses small time steps there. When the waveforms are changing slowly, it uses longer time steps. So for a sine wave, the default is to have short time steps near the zero crossing, and longer time steps near the peaks. By picking a maximum time step to be way smaller than SPICE would ever choose if left to its own way, you're essentially forcing it to use uniform time steps. The FFT math assumes uniform time steps. If the simulator isn't using uniform time steps (which happens in its default mode of operation), SPICE must interpolate to get the uniform time steps the FFT wants. This interpolation causes distortion.
 
You can experiment by trying a different number of data points in the FFT. The default is 65536 in the "number of data point samples in time" combo box in the FFT setup dialog. You can try reducing this to 32768 or 16384, then changing the "timestep" variable as appropriate (1m/32767 or 1m/16383 respectively). Also, don't run the sim any longer than necessary.

The simple sine wave generator has no transient, so it won't show up the problem that occurs in amp simulations when you start the FFT at time zero, inadvertently including transients into the data. Just do the last five cycles or so. Don't be fooled by previous results where it was better to start at time zero. If the time steps aren't set up right, you'll get unpredictable results that sometimes point in the wrong direction of doing things.
 
That seem to have been the problem, jaycee will be glad ,too.
:) :)
Here is the corrected FFt , the first was done with .05v input..

An externally hosted image should be here but it was not working when we last tested it.


the next is just shy of clipping at 2.1v in /110v out (roughly 150W)

An externally hosted image should be here but it was not working when we last tested it.


A tad more H2 /3 not bad H5..
Thanks again, Andy... the sim master;)
OS
 
Also , thanks to the info you steered me to. (cordell fet amp)
I have a MUCH better amp.. here I have the gain plot of it..

An externally hosted image should be here but it was not working when we last tested it.


88db ruler flat (with 2pf lead comp. cap).. strange, without it
the 100db phase point intersects with the unity gain point
(isn't that what you said was desirable in an earier post)..

OS
 
Disabled Account
Joined 2007
Hi OS,
I'm a bit thrown by the plot you last posted, maybe Andy can shed some light: Here I posted an AC analysis of an amp. This is gain/phase over the operating range (and beyond). It shows that gain is relatively flat in the audio band as is the phase, yet the plot posted above is not like this at all. OS, did you measure the entire amp or part of it? Having more gain at low freq. doesn't seem right to me and phase would be best at zero, no?
Also, I read somewhere (my aching memory) that an amp is stable if it hits unity gain before it's phase swings 180*. Is this correct or have I over simplified?
 
Hi John,

What you're plotting is the amplifier's closed-loop gain ACL. This is related to the open-loop gain AOL and feedback factor B in the following way:

ACL = AOL/(1 + AOLB)

If one is unfortunate, the amp becomes an oscillator (infinite gain) when AOLB is -1, which makes the denominator of the expression above zero. The quantity AOLB is called the "loop gain". To determine how stable the amp is, it's customary to plot the loop gain AOLB vs. frequency. When its magnitude is 1 (0 dB), its phase should be far away from -180 deg. A figure of merit for this is called the phase margin. This is determined by finding the frequency for which the magnitude of the loop gain is 0 dB (called the "unity loop gain frequency" or ULG freq for short) and looking at its phase shift phi at that frequency. The phase margin is phi - (-180) = phi + 180. So if phi is -100 deg at the unity loop gain frequency, this means you have a phase margin of 80 degrees. It turns out that for typical amps that can be approximated as having two poles in their loop gain, a phase margin of less than 78 degrees gives overshoot in the small-signal square wave response.

In short, you are plotting ACL and OS is plotting AOLB.
 
Worry not john, when I modeled your abomination ,It followed
the rules outlined by andy quite well with ULG ..in fact almost the
same as FA3 but with a tad less gain at LF and a higher unity gain
freq. (2mhz). Set 2 points on your amp, one at the NFB return
of the LPT (A) and one at the OP (B)... then plot -(b)/ (a)..
you get my plot.... I will soon do this in multisim (I will use
both together to get a fair result)
Os
 
Disabled Account
Joined 2007
MJL21193 said:

I will have to learn how to do the same in Multisim.


And now I can:

ABOMINATION_L_G.png


So much fun...:)
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.