New Meyer implementation? #27
-
Hi, I'm currently working on implementing the mos1 model, and have reached the Meyer capacitance calculation. I was reading the Xyce code a bit, and I see a lot of mentions of "new meyer", along with statements like this Xyce/src/DeviceModelPKG/OpenModels/N_DEV_MOSFET1.C Lines 3278 to 3280 in b2cf826 Xyce/src/DeviceModelPKG/OpenModels/N_DEV_MOSFET1.C Lines 2401 to 2411 in b2cf826 Do you have an insights about this issue? How has Xyce's Meyer implementation evolved over the years, to solve what problems? I have spent a bit of time reading the ngspice source code, as well as reading "The Meyer Model Revisited: Why is Charge Not The When I was working on the "textbook" diode, initially I made a nonlinear charge-preserving capacitor that basically did but then found that's not at all what the diode does. So now I'm trying to understand what the mos1 capacitor fundamentally does, and what are useless/important convergence/preservation hacks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
So, I don't have time at the moment to give a detailed answer, but here's the best I can do quickly. Most modern MOSFET models implement their solution dependent capacitors by computing the charge on them directly. Then, the current is just the time derivative of the charge. The capacitance, when needed for whatever reason other than computing the charge, is simply the derivative of the charge with respect to V. The Meyer model (used in all the early SPICE2 MOSFET models level 1-6) instead computes the capacitance directly and tries to get at the charge from that. Computing charge as C*V at each time step in this way and then getting current from the derivative of charge would be wrong, and there would be charge-conservation violation as capacitance changes. So instead, what they're trying to accomplish is getting at charge by integrating CdV using an approximate method. If you use a basic trapezoid rule integral approximation, you compute the charge by adding in the little trapezoidal slice of the C-V curve between two time steps to the charge so far accumulated. If you work through the math, that involves averaging the last time step's computed Meyer capacitance with the newly computed one for this time step. It was this averaging that led to the early code making reference to "back-averaging" but the underlying purpose is to get at the integral of CdV. "Meyer back-averaging" is what Xyce developers called what they saw in SPICE's (basically uncommented) code back around 2000-2001, but it isn't what anyone else calls it. What it is is an attempt to implement a charge-conserving solution-dependent capacitance, and it is, as you note, a bit of a hack. That is all there is to it. This use of the history in this manner doesn't work with some of Xyce's analyses, such as the undocumented, incomplete MPDE analysis that you see referred to in the comments in our level-1 MOSFET. So there was an effort to try to figure out how to get around this computation of Meyer capacitance and the charges resulting from them in some other way. I do not believe a completely satisfactory alternate formulation was ever found, but the "new meyer" implementation was completely focused on trying to solve the Meyer problem in MPDE analysis and has no applicability outside of that. When Xyce's solution-dependent capacitor was implemented (which allows the C parameter of a capacitor to be a solution-dependent expression), we had to deal with the same mess, and you'll see that we do the same clumsy approximate integration to conserve charge. Later, we implemented the capacitor's "Q" parameter (which also allows a solution-dependent expression for the charge, and which HSPICE calls their "charge conservation formulation"). We did verify that our old implementation is equivalent to the new if the C expression given for the old formulation is the derivative with respect to V of the Q expression of the new formulation. The Xyce regression suite test "SOLN_DEP_CAP" tests this equivalence. Most modern MOSFET models have gotten away from doing capacitance the Meyer way, and directly compute the charge on the internal capacitors at each step, and when capacitance is needed just for output purposes, that charge is differentiated with respect to voltage. The "charge conservation" formulation of the capacitor device avoids the problem the same way. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
It is important to always consider the model from your book snippet that: and that charge must always be conserved. See from 6.2.1 (and other places): Rules, like the compatibility condition, apply: and must be carefully considered in any model. |
Beta Was this translation helpful? Give feedback.
So, I don't have time at the moment to give a detailed answer, but here's the best I can do quickly.
Most modern MOSFET models implement their solution dependent capacitors by computing the charge on them directly. Then, the current is just the time derivative of the charge. The capacitance, when needed for whatever reason other than computing the charge, is simply the derivative of the charge with respect to V.
The Meyer model (used in all the early SPICE2 MOSFET models level 1-6) instead computes the capacitance directly and tries to get at the charge from that. Computing charge as C*V at each time step in this way and then getting current from the derivative of charge would be wrong, a…