Create Capacitor SPICE Model
Enter the parameters for your capacitor model and this page creates a SPICE model for you.
SPICE Circuit
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.
JavaScript
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
HTML
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>