bjlobby1 wrote on Nov 11th, 2009, 4:24am:And one more thing. Spice utilizes numerical methods to solve the equations of the circuit. The picture of the Mosfet model in my mind was a subcircuit of basic elements ( R, L, C, V, I ). And I thought that spice formulates one equation for each of these elements and plugs it in a matrix which is then used as an input to a numerical method function. Do you have an idea, at the primitive level, of how spice uses this C file of the mosfet model in its numerical methods?
Your picture should be of few dependent current sources and some charge storage elements (the channel charge is non-linear, 4-terminal capacitor, and then there are the gate-overlap and diode caps also). The simulator sends the node voltages to the model, the model evaluates charges and currents (and the derivatives with respect to voltages, which are what go in the matrix) and sends them back to the simulator; the simulator then attempts to enforce KCL (and KVL) and uses the matrix of derivatives to solve for new voltages. Repeat until convergence.
Spice will have one row for each unknown, which is usually a node voltage (BSIM4 has some internal nodes). KCL is then checked by computing and adding up the currents from all the elements connected to the node.