I evaluate a diode's reverse recovery behavior.

Construct me with your device's specified reverse recovery time trr, reverse recovery charge Qrr, and maximum reverse current Irr_max, and then call the instance with two vectors (time, and drain-source current) from your simulated test circuit to get an SSE-equivalent fitness metric.

Not all datasheets specify total reverse recovery charge. If it's not known for your part, set Qrr to None.

Class Variable us_dt The difference (seconds) between actual and expected reverse recovery time that results in an SSE contribution of one. (Squared, so twice this time deviation will result in an SSE contribution of four.)
Class Variable us_Imax The % error deviation between peak reverse current and expected Irr_max that results in an SSE contribution of one. (Squared, so twice this % deviation will result in an SSE contribution of four.)
Class Variable us_lumpiness The lumpiness metric for the transition from max Ids to reverse recovery that results in an an SSE contribution of one. (Not squared in this case; twice this metric will result in an SSE contribution of two.) A really lumpy transition will have a metric around of around one, so us_lumpiness should be set to a small fraction of 1.0 if a lumpy transition bothers you.
Class Variable us_undershoot The fraction of negative spike current vs expected Irr_max that results in an SSE contribution of one. This addition to SSE is to strongly penalize for undershoot after reverse recovery. With the default setting and weight, a mere 10% undershoot adds 25 to the SSE. (Squared, so 20% of undershoot would then add 100 to the SSE.)
Class Variable us_charge The Coloumbs of error between total reverse charge deviating and expected Qrr that results in an SSE contribution of one.
Class Variable us_skew The difference (seconds) between the time of peak reverse current and half the expected reverse recovery time that results in an SSE contribution of one. This was intended to add a penalty as the reverse recovery curve starts to look increasingly unrealistic. But in many case you don't actually know what "realistic" looks like, so this is set to have very low impact.
Method __init__ Undocumented
Method find_zero_crossing If there is a point in the supplied vector X where one value is positive and the next value is zero or negative, returns the index for that point.
Method eval_Imax Locates the maximum current, returning the index where it occurs and the amperage.
Method eval_Q Adds SSE for the total reverse charge (computed from current values from index k0 to k1 in the supplied vector I) deviating from my Qrr expectation.
Method eval_lumpyTransition Adds SSE for lumpiness (due to excessive inductive ringing) in the transition from max current to reverse recovery.
Method eval_undershoot Adds an SSE penalty for the current in the supplied vector I going negative again after reverse recovery.
Method __call__ Call this with two Numpy vectors representing time and drain-source current Ids.

Inherited from GenericEvaluator:

Method worst_SSE Undocumented
Method setup Undocumented
Method V Undocumented
Method findFirstReally Undocumented
Method timeWhenGreater Returns a 2-tuple with (1) the index of the first element of supplied 1-D array X that is greater than scalar value Xk and (2) the time value at that index.
Method timeWhenLess Returns a 2-tuple with (1) the index of the first element of supplied 1-D array X that is less than scalar value Xk and (2) the time value at that index.
Method add_SSE Adds to my running SSE total the scaled square (unless notSquared set) of the difference between the two supplied scalars value and expected, multiplied by my weight.
Method evalTimeDiff Adds to my running SSE total the squared difference between (1) the interval t2-t1 and (2) the expected interval dtExpected.
Method result Returns my running SSE total and a 2-D Numpy array of goal points that will be plotted with the "x" symbol.
Method _resultFrom Adds k to my index k0 and, if the updated value is still a valid index for my time vector, returns it along with the time value at that index.
us_dt =
The difference (seconds) between actual and expected reverse recovery time that results in an SSE contribution of one. (Squared, so twice this time deviation will result in an SSE contribution of four.)
us_Imax =
The % error deviation between peak reverse current and expected Irr_max that results in an SSE contribution of one. (Squared, so twice this % deviation will result in an SSE contribution of four.)
us_lumpiness =
The lumpiness metric for the transition from max Ids to reverse recovery that results in an an SSE contribution of one. (Not squared in this case; twice this metric will result in an SSE contribution of two.) A really lumpy transition will have a metric around of around one, so us_lumpiness should be set to a small fraction of 1.0 if a lumpy transition bothers you.
us_undershoot =
The fraction of negative spike current vs expected Irr_max that results in an SSE contribution of one. This addition to SSE is to strongly penalize for undershoot after reverse recovery. With the default setting and weight, a mere 10% undershoot adds 25 to the SSE. (Squared, so 20% of undershoot would then add 100 to the SSE.)
us_charge =
The Coloumbs of error between total reverse charge deviating and expected Qrr that results in an SSE contribution of one.
us_skew =
The difference (seconds) between the time of peak reverse current and half the expected reverse recovery time that results in an SSE contribution of one. This was intended to add a penalty as the reverse recovery curve starts to look increasingly unrealistic. But in many case you don't actually know what "realistic" looks like, so this is set to have very low impact.
def __init__(self, trr, Qrr, Irr_max, N_channel, **kw):
def find_zero_crossing(self, X):

If there is a point in the supplied vector X where one value is positive and the next value is zero or negative, returns the index for that point.

If not, adds 3x my worst_SSE to my running SSE total.

def eval_Imax(self, I, k0=0):

Locates the maximum current, returning the index where it occurs and the amperage.

If Irr_max is defined (not zero or None), adds SSE for the maximum value in the supplied vector I deviating from my Irr_max expectation. The error is relative, not absolute. Adds a plot point with an x-value of time when the maximum value occurred and a y-value of Irr_max.

def eval_Q(self, I, k0, k1):

Adds SSE for the total reverse charge (computed from current values from index k0 to k1 in the supplied vector I) deviating from my Qrr expectation.

The total reverse charge is computed by calling timing.Q with a slice k0:k1 from my time vector and from I. My __call__ method finds the current's zero crossing (via a call to find_zero_crossing and sets the first index k0 to the sample that occurs then. It sets the last index k1 to the first sample that decays to below my Ids_full_down threshold after maximum I is reached.

Adds no plot points.

def eval_lumpyTransition(self, time, I, k0, k1):

Adds SSE for lumpiness (due to excessive inductive ringing) in the transition from max current to reverse recovery.

def eval_undershoot(self, I):

Adds an SSE penalty for the current in the supplied vector I going negative again after reverse recovery.

def __call__(self, time, Ids):

Call this with two Numpy vectors representing time and drain-source current Ids.

Returns (1) an SSE reflecting how closely that conforms with expected reverse-recovery behavior, and (2) a 2-D Numpy array of points to put "x" symbols at.

Timing calculations are referenced from a point t0 where Ids is no longer negative, i.e., when the body diode stops being forward biased. (That is the first plot point.)

API Documentation for pingspice, generated by pydoctor at 2021-09-18 08:41:11.