Simulate Pump-Charge Circuit

Hello, I try to simulate under Kicad V8.0.6 a Cockcroft-Walton Generator. To not start from scratch I try to use a circuit with CD40106 (already answered in this forum) and I get an error when interconnecting pins to this device for Spice simulation. Here spice result :


Schematic :

Any idea are welcome :thinking:
Osc.zip (12.7 KB)

You are using a model for a single inverter, you need to make a model for the whole package and then assign the model, see example below.

You are also missing the simulator gnd 0 (zero) in the library.

* hex inverters according to CD4049UB (unbuffered with simple inverter)
 
.SUBCKT CD4049UB_hex VCC 2 3 4 5 6 7 VSS 9 10 11 12 13 14 15 16

xinv1 3 2 VCC VSS CD4049UB
xinv2 5 4 VCC VSS CD4049UB
xinv3 7 6 VCC VSS CD4049UB
xinv4 9 10 VCC VSS CD4049UB
xinv5 11 12 VCC VSS CD4049UB
xinv6 14 15 VCC VSS CD4049UB

R1 13 0 1k
R2 16 0 1k



.SUBCKT CD4049UB vin vout vcc vss
* simple model

M1 vout vin vss vss CD4049N
M2 vout vin vcc vcc CD4049P

.MODEL CD4049P PMOS (LEVEL=3 VTO=-2.9 KP=2M GAMMA=3.97U
+ PHI=.75 RD=28.2 RS=45.2 IS=31.2F PB=.8 MJ=.46
+ CBD=148P CBS=177P CGSO=218N CGDO=182N CGBO=299N W=80U L=10U)
.MODEL CD4049N NMOS (LEVEL=3 VTO=2.1 KP=5M GAMMA=3.97U
+ PHI=.75 RD=4.2 RS=4.2 IS=31.2F PB=.8 MJ=.46
+ CBD=105P CBS=127P CGSO=156N CGDO=130N CGBO=214N W=40U L=10U)


.ENDS

.ENDS

Ok thank @janharm I download the spice model from TI website, I use (or want to use) 40106 not 4049, not understand “gnd 0” ?!!? sorry.
Following your suggestion, I duplicate the first cell like this :


Now simulation works :

So, after modification to complete Cockcroft-Walton Generator :


and sim :

Not really competitive, probably I miss something …

Nice the simulation works, I would expect that the generator should generate a high voltage. Note the inverters connect the output to 9V (when high) or 0V (when low) so the voltage vout will not rise above 9 Volts. In this sense the simulation is correct.

The simulation is correct, but your circuit is not a CW multiplier.

Thanks @RobK you’re right, in my mind it’s based on CW but it is close too a charge-pump, I don’t know how to name it?
The simulation fail probably due CD40106 simulation file not including good AC performance (which I don’t know how to add it). A classic CW uses an sinusoidal AC source, here the first door is used as an oscillator, others are used to “phase shift” the signal (Each cell invert previous) these out-of-phase signals are then used to control the different sections of diodes and capacitors. It is not the “classic” topology where only one AC signal fuels the entire waterfall. In other words, it is an implementation of load pump that uses serial inverters to provide clock signals (with phase alternation) to each “floor” of diodes/capacitors, rather than a single AC source as in the traditional CW. It is a clever method for generating load pump tensions without the need for multiple transformers or complex external clock sources. Probably we need to use a better diode model and Capacitor too? No idea …

I think what you are trying for is a Dickson charge pump:
image

I quickly simulated this in LTSpice (haven’t used KiCad for simulation yet, sorry) and this is what I get:

Excellent! I discover this circuit thanks to you! I’ll try to simulate this on Kicad (that use ngpice) to observe the same signal reaching 50V at the end! thanks to you :+1:

So, I try to simulate :


Not really the same, the voltage decrease :thinking:

Voltage does go up! After 4 pulses he has gained almost an extra volt.


The picture above is from:

And whenever I hear that name mentioned, I always wonder whether Crotchcraft Wally has an STD.

For further experiments, This forum has quite a lot of working simulations spread over different threads. Click on the link below for a search.

https://forum.kicad.info/search?q=simulation%20examples

Thank you @paulvdh for the link. It seems that Ngspice is more limited than LTspice at least for this type of representation. Even with simplified models of inverter and diodes it seems that the resolution with Ngspice confronts concerns of convergence and singular matrix. @RobK On your diagram I see a 10nS TD and a VHIGH = 9V Can you give the models you use for the inverter and the diodes? Perhaps they will work with Ngspice?
Here my new schematic :


Here sim-files for Inverter & Diode :
Invert-Std.lib (869 Bytes)
Simple-D.lib (36 Bytes)

I try to fix some values with the .options (It is not more conclusive)!
I get this message :

I’ve changed the Post Name to be more in phase with this subject.

Using the TI model for the inverter may have the disadvantage that according to the data sheet the output current may be less than 2.5 mA. You have to charge several capacitors, a multiple of 47nF, which would take a lot of time.

Creating an inverter like
E_RAW_IDEAL RAW_IDEAL VSS VALUE = {IF(V(IN) > V(VDD)/2, V(VSS), V(VDD))}
is not a good idea in my view. An inverter is always also an amplifier. The inverter above has an infinite amplification at input vdd/2, in other words the derivative which is used during matrix solving is infinite: an invitation for disaster.

Creating a time constant at the output has the same problem as discussed above: the output current is limited. So better add it at the input, which does not draw any current. You may then add a small output resistance of your choice.

My suggestion is:

.SUBCKT INVERTER_atan IN OUT VDD VSS
* R*C = 1u
Rin in in_int 1Meg
Cin in_int vss 1p
Rout out_int out 10
Binv out_int vss V = v(vdd, vss) * (0.5 + atan(-100* (v(in_int) - v(vdd,vss)/2)) / pi)
.ENDS

A diode for transient simulation, even the most simple one, should have junction a capacitance, e.g. cjo=20p.

I have not done your circuit, but a five stage ring oscillator (5 inverters in series with the final output fed back to the first input) using my inverter, which nicely oscillates during transient simulation, no extra options set.

When setting up the simulation (New analysis tab), it is wise to uncheck current and power measurement if not needed, sometimes another source of non-convergence.

“using my inverter, which nicely oscillates during transient simulation, no extra options set.”
Can you provide file?
I try this and unable to simulate with I get error like :


The new schematic is :

@vidalv, here a running set, I have put some inverters in parallel to have more drive (they need time to charge the capacitors).


I still do not understand pinning of the diodes I made a subckt to swap connection. I use the vpulse as supply and the 0 as gnd for spice. Hope it helps
oscillator.zip (81.3 KB)

Wahoo I am very impressed! Bravo @janharm for this job I just added .tran 500nS 5ms and offsets on Vodd and Veven to reseize traces. Nice job thank you for this beautiful simulation!