# Voltage doubler ebook Spice

Discussion in 'General Electronics Chat' started by keithostertag, Dec 13, 2012.

1. ### keithostertag Thread Starter Member

Oct 4, 2012
48
2

Near the top of the page, the first Spice example and graph. I've duplicated that netlist, but used a real diode model. Here is my netlist (ngspice notation):

Code ( (Unknown Language)):
1.  1 :
2.      2 : .global gnd
3.      4 : .model 1n4007 d(is=76.9p rs=42.0m bv=1.00k ibv=5.00u cjo=26.5p m=0.333 n=1.45 tt=4.32u)
4.      6 : c1 2 0 1000p
5.      7 : d1 1 2 1n4007
6.      8 : c2 4 1 1000p
7.      9 : d2 0 1 1n4007
8.     10 : v1 4 0 sin(0 5 1k)
9.     12 : .end
10.
using tran 0.01m 10m (just a little longer than the given example). Got the same graphs, no problem.

My question concerns the current through node 1. I plotted that and zoomed in to find that it is a triangle wave, 10uA peak, at about 50KHz.

Hmm. I'm thinking maybe the current is leakage from the diodes? But I can't explain the shape or frequency. Can someone tell me where that current is coming from and why that shape and frequency?

I'm new to Spice, so maybe I did something wrong?

Thanks,
Keith Ostertag

File size:
5.7 KB
Views:
59
2. ### Brownout Well-Known Member

Jan 10, 2012
2,375
998
Could be interaction between C1, C2, and junction capacitance of the diodes ( I'm sure that's being modeled ) At steady state, the output diode could be forward biased, switching on briefly as while C2 discharges into C1. The switching could be a result of interaction of the two diode's capaticances. Just guessing here.

3. ### keithostertag Thread Starter Member

Oct 4, 2012
48
2
Thanks Brownout.

I guess I should have done this before... more graphs/details.

Full graph of v1#branch using the generic diode model as in the tutorial:

http://www.strucktower.com/capturegeneric2.png

Full graph of v1#branch using the 1N4007 model:

http://www.strucktower.com/capturevd2.png

I am giving links instead of attaching as they are a little larger than allowed.

The current in node 1 in the generic model gradually diminishes in amplitude and frequency.

The current in the 1n4007 model is the triangle wave at 50KHz (before zooming in).

Can someone shed some light on what's going on with these?

Thanks,
Keith Ostertag

4. ### Ron H AAC Fanatic!

Apr 14, 2005
7,050
657
I ran the same sim, and, as I expected found nothing like the triangle you posted.
Current flows in branches. Voltage appears on nodes.
I don't get any voltage or current that looks like that, even without the 50kHz triangle.
Post your .asc file, so we can see the details of your simulation.

5. ### keithostertag Thread Starter Member

Oct 4, 2012
48
2
Hi Ron-

I think I have figured out what I did wrong.

As I zoomed in on the graph, I wasn't giving it enough steps to get an accurate curve. So the triangle shape is from not having enough points to plot.

I was plotting the curve for 10ms with a .01ms step as in the tutorial, but then zooming in to only a tiny section with the same step. Instead, I need to set much smaller steps for such a small section of the plot.

Not sure what asc files are. My netlist was posted. Here it is again:

Code ( (Unknown Language)):
1.
2.  1 :
3.      2 : .global gnd
4.      4 : .model 1n4007 d(is=76.9p rs=42.0m bv=1.00k ibv=5.00u cjo=26.5p m=0.333 n=1.45 tt=4.32u)
5.      6 : c1 2 0 1000p
6.      7 : d1 1 2 1n4007
7.      8 : c2 4 1 1000p
8.      9 : d2 0 1 1n4007
9.     10 : v1 4 0 sin(0 5 1k)
10.     12 : .end
11.
That is the same as in the tutorial but with a 1n4007 model instead of a generic model for the diodes.

I then run interactively:
Code ( (Unknown Language)):
1.
2. tran 0.01m 10m
3.
which is the same step as in the tutorial but with extended time (10ms rather than 5ms).

I then run interactively:
Code ( (Unknown Language)):
1.
2. plot v1#branch
3.
This gives the plot referred to above, at http://www.strucktower.com/capturevd2.png

Then I zoom in to just the last partial ms of the graph. That produced the triangle shapes due to not having enough points to plot. That is the equivalent of only about 50 points plotted. You can duplicate that and see the triangle effect if you do:

Code ( (Unknown Language)):
1.
2. tran .1m 10m 9m
3.
then plot the current through node 1, however you call it.

Code ( (Unknown Language)):
1.
2. tran .01u 10m 9m
3.
which calculates 10,000 points, I get a pretty smooth curve instead of a line of triangles.

I'm using ngspice, so the syntax is different than what you are using, but had nothing to do with that.

Thanks for responding,

Keith Ostertag

6. ### Ron H AAC Fanatic!

Apr 14, 2005
7,050
657
I suspected you had a sample time issue. Glad you were able to figure it out.