Calculator Collection | About the Calculator Series | Inside the Code | Home

Create Capacitor SPICE Model

Enter the parameters for your capacitor model and this page creates a SPICE model for you.

SPICE Circuit

cap model

Enter Parameters

C1 (F) Capacitance
R1 (ohms) Equivalent Series Resistance
fo (Hz) Resonant Frequency
R2 Parrallel (Leakage) Resistance

Enter Model Parameters

Subckt Name Name for SPICE subcircuit.
Precision (digits) Precision for moldel values.


L1 = 1/( (2*pi*fo)^2 * C1) Series Inductance.

To copy into text file, First Ctrl-A and Ctrl-C inside box above, then Ctrl-V into text file

Download / Basics

To run or modify on your PC, download a simple version of this file with image (*.zip).
For a quick tour of some JavaScript / HTML basics, check out Inside the Code.

SPICE Circuit

Try out your SPICE model in circuit using the capacitor model.


How do you get the SPICE subcircuit into the text box? Two steps make this possible. First, create the entire text by individually adding each line of the subcircuit to the variable "TextOut" using the "+=" operator. Second, when your text is complete, write TextOut into the text box named "myTextArea" as shown in the last line.

// write maco model to variable TextOut
TextOut += "****************************************" + "\n"
TextOut += "*  Capacitor SPICE Model\n"
TextOut += "*  Subckt Name: " + SubName + "\n"
TextOut += "****************************************" + "\n"
TextOut +=  "*" + "\n"

// Subckt name and nodes **************************
TextOut += ".SUBCKT " + SubName+ "     1   4" + "\n" 
// CAP MODEL***************************************
TextOut += "*   fo=" + fo + " Hz\n"
TextOut += "L1    1     2     " + L1 + "\n"
TextOut += "R1    2     3     " + R1 + "\n"
TextOut += "C1    3     4     " + C1 + "\n"
TextOut += "R2    3     4     " + R2 + "\n"
TextOut += ".ENDS\n"
// send to textArea
document.myForm.myTextArea.value = TextOut  


The text box was already used in a topic coverting the RC Filter Response vs.Time. Heres the "textarea".tag naming the area andf specifying the Rows and Cols.

<textarea name="myTextArea" rows="15" cols="50"></textarea>