Where the models stop

How many straight lines a diode is

One drop-plus-resistance line fitted minimax over a decade of a diode's current is out by ±8.00 millivolts, and it is the same over every decade. Chain such segments over six decades, a nanoamp to a milliamp, and the error of each is a closed form in its current ratio alone. Minimax segments meet at their joins without being asked to, so the chain is a continuous piecewise-linear model for free. The error falls as the inverse square of the segment count: one segment is out by 132 mV, six by 8.00, eighteen by 0.94. A millivolt takes 18 segments and a tenth of one takes 56. A real junction needs more, 23 and 72, because recombination gives it an ideality near two over most of the range and each segment narrows by the square root of the local ideality.

Assumes: The one current a constant is right at · Every model has an edge

The straight line between two models put a drop plus a resistance between a constant seven tenths of a volt and the exponential. Fitted so that its worst error over a decade of current is as small as it can be, the line is out by ±8.00 millivolts, against ±29.76 for the best constant. Both numbers are the same over every decade, because a decade of a logarithm is the same shape wherever it is taken. That essay ended on the obvious extension. A model of one line is good over a decade, and a real circuit’s diode may see six. How many straight lines does it take to reach a stated accuracy over all of them?

Over a logarithm, neither model has a favourite decade. computed by solving, not by drawing. The worst error of the best constant drop and of the best drop-plus-resistance, fitted minimax over each decade of current in turn, for a pure exponential. Both are flat: ±29.76 mV for the constant and ±7.999 mV for the line at every decade, to a part in a thousand, with a ratio of 3.7207. The resistance the line fits is the only thing that moves, and it moves as one over the current — 6.61 MΩ at the bottom decade and 661 mΩ at the top.
Fig. 1 The best constant and the best drop-plus-resistance line fitted minimax over a sliding decade of a pure exponential’s current: ±29.76 mV and ±8.00 mV at every decade, because a decade of a logarithm is the same shape wherever it is taken.

The answer turns out to be a closed form, and it has a shape worth knowing before building a piecewise-linear model for a solver or a hand calculation: the number of segments grows as the square root of the accuracy wanted, and a real junction pays a further square root of its ideality.

Six segments, one error

Start where the earlier essay stopped, with one segment per decade. From a nanoamp to a milliamp is six decades, so six segments, each spanning a current ratio of ten, each fitted minimax on its own window with nothing to connect it to its neighbours.

6 straight lines over six decades of a diode: ±8.002 mV everywhere, and they meet at every joincomputed by solving, not by drawing. A pure exponential junction from a nanoamp to a milliamp, modelled by 6 drop-plus-resistance segments each spanning a current ratio of 10.00, each fitted minimax on its own window. The model's error swings between +8.002 mV and −8.002 mV in every segment, which is the closed form for that ratio, because a span of a logarithm is the same shape wherever it is taken. The dots are the joins: at each one the two neighbouring segments are off by the same amount in the same direction, so they meet, and the chain is continuous although no segment was asked to be.-10-505101n10n100n10µ100µ1mforward current (amperes)model's voltage minus the junction's (mV)segments6each spans×10.00 of currentworst error±8.002 mVlargest jump at a join0.053 µVsolved, then checked — 6 minimax fits, each on its own windowone error, repeated
Fig. 2 A pure exponential junction from a nanoamp to a milliamp, modelled by six drop-plus-resistance segments each spanning a factor of ten in current, each fitted minimax on its own window. The error swings between +8.002 and −8.002 mV in every segment. At every join the two neighbouring segments are off by the same amount in the same direction, so they meet, to 0.05 µV.

Every segment’s error swings between +8.00 and −8.00 mV, which is the single-decade number of the earlier essay repeated six times. That is the scale invariance again: a pure exponential’s voltage is a logarithm of its current, so a segment’s error depends only on the ratio of the currents at its ends, and six equal ratios give six equal errors.

The second thing the figure shows was not designed in. At every join the two neighbouring segments are off by the same amount, in the same direction, and so they meet, to within 0.05 µV, which is the precision of the fit. A minimax line on a curve that bends one way touches its worst error three times: at both ends of the window with one sign, and at one point inside with the other. The earlier essay found this equal-ripple shape for one decade. Two adjacent windows of the same ratio each end at the same error, so at the shared current they give the same voltage. The chain is a continuous piecewise-linear model although nothing asked it to be, and the continuity costs nothing in accuracy.

That matters for what the chain is for. A circuit solver iterating on a piecewise-linear diode needs the model to be continuous, or Newton’s method can bounce between two segments that disagree at their join. A chain of minimax segments with equal errors is continuous automatically, so the best chain for accuracy and the chain a solver can use are the same chain.

The closed form

The error of one segment over a current ratio kk can be written down. The best line is parallel to the chord across the window and halfway between the chord and the curve’s furthest point from it. For a logarithm, the chord’s slope is lnk/(k1)\ln k/(k-1) in units of the segment’s lower current, the furthest point is where the curve’s slope equals it, at x=(k1)/lnkx = (k-1)/\ln k, and the minimax error is half the gap there:

E(k)=nVT2[lnk1lnk1+lnkk1]E(k) = \frac{nV_T}{2}\left[\ln\frac{k-1}{\ln k} - 1 + \frac{\ln k}{k-1}\right]

For k=10k = 10 and an ideality nn of one at room temperature it gives 8.002 mV, the number the earlier essay found by searching. For a short segment, where kk is close to one, the bracket tends to (lnk)2/8(\ln k)^2/8, so the error is the thermal voltage times the square of the log of the ratio, divided by sixteen. That is the general fact that a short piece of any smooth curve is a parabola, and a line’s minimax error against a parabola is an eighth of its curvature times the square of its width, halved.

The error falls as the square of the segment count: 18 segments for a millivolt over six decades, 56 for a tenth of one. computed by solving, not by drawing. The worst error of a chain of equal-ratio minimax segments over six decades of a pure exponential, against the number of segments: the closed form (line), each measured by a minimax fit (dots), and the short-segment asymptote, the thermal voltage times the square of the natural log of each segment's current ratio over sixteen (dashed). One segment is out by 131.7 mV, six by 8.002 mV, eighteen by 0.9442 mV. Past a dozen the error falls with exponent −1.990 of the count, so each halving of the error costs 41 per cent more segments. A millivolt over six decades takes 18, a tenth of a millivolt 56.
Fig. 3 The worst error of a chain of equal-ratio minimax segments over six decades, against the number of segments: the closed form, each count checked by a minimax fit, and the short-segment asymptote (dashed). One segment is out by 131.7 mV, six by 8.002, eighteen by 0.944. Past a dozen the error falls with exponent −1.990 of the count. A millivolt takes 18 segments and a tenth of one 56.

Each of the twelve counts drawn was fitted minimax and agrees with the closed form to a part in a thousand. The chain’s error falls fast at first and then settles onto the inverse square of the count, with a fitted exponent of −1.990 from twelve to sixty-four segments. One segment across all six decades is out by 132 mV. Six are out by 8.00, twelve by 2.10, eighteen by 0.944, and sixty-four by 0.075.

The inverse square has a direct design consequence. Each halving of the error costs 41 per cent more segments, the square root of two. So a millivolt over six decades takes 18 segments, and a tenth of a millivolt takes 56, three times as many rather than ten. The scaling favours accuracy: going from a model good to a millivolt to one good to a hundred microvolts costs about three times the segments.

18 straight lines over six decades of a diode: ±0.9442 mV everywhere, and they meet at every join. computed by solving, not by drawing. A pure exponential junction from a nanoamp to a milliamp, modelled by 18 drop-plus-resistance segments each spanning a current ratio of 2.154, each fitted minimax on its own window. The model's error swings between +0.9442 mV and −0.9442 mV in every segment, which is the closed form for that ratio, because a span of a logarithm is the same shape wherever it is taken. The dots are the joins: at each one the two neighbouring segments are off by the same amount in the same direction, so they meet, and the chain is continuous although no segment was asked to be.
Fig. 4 The same six decades with eighteen segments, each spanning a factor of 2.154 in current: the error swings between +0.944 and −0.944 mV in every segment, and the joins still meet.

Eighteen segments look like the six, scaled down. Each spans a factor of 2.154 in current, a third of a decade, and swings between +0.944 and −0.944 mV, with the same three-point touch in each window and the same seamless joins. The shape of the error does not change with the count; only its size does, and the inverse square says by how much.

The count also scales directly with the range. Every segment of a given accuracy spans the same ratio of currents on an ideal junction, so three decades take half the segments of six and a single decade takes a sixth. A model that only has to cover a milliamp to ten milliamps, a decade, is good to a millivolt with three segments and to a tenth of one with ten. The six-decade figure is a worst case chosen because a diode in a real circuit, a detector or a log amplifier or a clamp, often does see that range, and because it is where the one-line model of the earlier essay was least adequate.

Straight lines on the other axes

These are not the straight lines of the straight lines, and where they are not the curve, and the difference is worth stating. A Bode plot’s asymptotes are straight on logarithmic axes, where a pole’s response really is two straight lines far from its corner, and the error is concentrated in one place, three decibels at the corner. A diode’s voltage is already a straight line against the logarithm of its current; a model straight on those axes would be exact with one segment. The segments here are straight on linear axes, voltage against current, because that is the form a resistor and a source take and the form a linear solve can use. Their error is spread evenly across every window, not concentrated at a corner, and it is the price of forcing a logarithm into a linear circuit, paid once for each segment.

A real junction needs more

Everything so far is a pure exponential with an ideality of one. The logarithm is in the collector measured a real junction whose logarithm holds to one per cent over only 2.40 decades, because two conduction mechanisms and a series resistance share its terminals. Recombination gives it an ideality near two over the middle of its range, and the series resistance takes over at the top.

A millivolt over six decades takes 18 segments on an ideal junction and 23 on a real one. computed by solving, not by drawing. The fewest drop-plus-resistance segments that hold a stated worst error from a nanoamp to a milliamp, each segment stretched by bisection until its own minimax error reaches the tolerance: on a pure exponential (first curve) and on the two-mechanism junction with 0.6 Ω of series resistance (second curve). The line is the square-root law for the pure exponential, six decades times ln 10 times the square root of the thermal voltage over sixteen times the tolerance. At 10 mV the counts are 6 and 7; at 1 mV, 18 and 23; at 0.1 mV, 56 and 72. The real junction's excess, 29 per cent at the finest, comes from the decades where recombination gives it an ideality near two.
Fig. 5 The fewest segments that hold a stated worst error from a nanoamp to a milliamp, each segment stretched by bisection until its own minimax error reaches the tolerance, on a pure exponential and on the two-mechanism junction with 0.6 Ω of series resistance. The line is the square-root law. At 10 mV the counts are 6 and 7; at 1 mV, 18 and 23; at 0.1 mV, 56 and 72.

For a real junction the segments need not be equal, so the count is found greedily: starting at the bottom, each segment is stretched by bisection until its own minimax error reaches the tolerance, and the next begins where it ends. Stretching a window can never make its best line fit better, so the greedy chain is the shortest possible. On the pure exponential it reproduces the square-root law rounded up at every tolerance. On the real junction it needs more at every tolerance: 7 against 6 at ten millivolts, 23 against 18 at one, and 72 against 56 at a tenth, an excess of 29 per cent at the finest.

The excess is less than the 41 per cent a junction with an ideality of two everywhere would need, because only part of the six decades has an ideality near two. The error formula carries the ideality as a multiplier on the thermal voltage, so an ideality of two doubles each segment’s error at a given width, and holding the error fixed narrows each segment by the square root of two.

On a real junction each segment is narrowed by the square root of the local ideality: 0.246 decades where it is two, 0.342 where it would be one. computed by solving, not by drawing. The widths of the fewest 1 mV drop-plus-resistance segments on the two-mechanism junction from 100 nA to 100 mA, each drawn as a bar across the currents it covers, against the width the pure law predicts with the thermal voltage multiplied by the junction's local ideality at the segment's centre (line). Where recombination sets the ideality near two the segments are 0.246 decades wide, the prediction to within three per cent, against 0.342 for an ideal junction. At the top the series resistance straightens the curve and they widen to 0.332; there the local ideality is a resistance in disguise and the law no longer applies.
Fig. 6 The widths of the fewest 1 mV segments on the two-mechanism junction from 100 nA to 100 mA, as bars across the currents each covers, against the width the pure law predicts with the local ideality in place of one (dashed). Where the ideality is near two the segments are 0.246 decades wide, against a prediction of 0.243 and 0.342 for an ideal junction. At the top the series resistance straightens the curve and they widen to 0.332.

The widths show it segment by segment. Where recombination sets the local ideality within a few per cent of two, from about a hundred nanoamps to ten microamps, each millivolt segment is 0.246 decades wide, against 0.243 predicted from the local ideality and 0.342 for an ideal junction. The ratio is the square root of two to within the model’s precision. Above that the diffusion current takes over and the segments widen. At the top, where the series resistance begins to dominate, they reach 0.332 decades, because a resistance is a straight line and a drop-plus-resistance segment has a term for it. The local ideality computed there climbs above three, but that is a resistance appearing in a logarithmic slope, and the square-root law, which assumes a logarithm, stops applying.

So the count for a real part is an integral: each stretch of current costs segments in proportion to the square root of its local ideality, with a rebate where the series resistance straightens the curve. The constant that is a window found an ideality factor that is a derivative with a value at every current; here that derivative sets the density of the model directly.

Segments per decade

The law is easiest to carry as a density. On an ideal junction a segment good to an error EE spans a fixed number of decades, so the model needs a fixed number of segments per decade: ln10nVT/16E\ln 10\,\sqrt{nV_T/16E}. At room temperature that is 0.93 per decade for ten millivolts, 2.93 for one millivolt and 9.25 for a tenth of a millivolt. Where the ideality is two each of those is multiplied by 1.41, so a millivolt costs 4.1 segments per decade across the recombination region. A designer can then budget a model decade by decade: count the decades the circuit uses, look up the ideality in each, and add.

A boundary is a model and a tolerance found that most of the model boundaries it measured move as the square root of the error fraction a designer is willing to accept, because most models fail by a second-order term. The segment count is the same law in a different form. A segment fails by the curvature it leaves out, which is second order in its width, so the width it can have goes as the square root of the error allowed, and the number needed goes as the inverse square root. Asking a piecewise-linear model for ten times the accuracy costs a factor of 3.16 in its size, which is the same price the other second-order boundaries charge.

What a designer should take

A piecewise-linear diode good to a stated accuracy over six decades takes about 6ln10nVT/16E6\ln 10\,\sqrt{nV_T/16E} segments. That is 18 for a millivolt on an ideal junction and about a quarter more on a real one. Space them in equal current ratios for an ideal junction and closer together where the ideality is high for a real one. Fit each one minimax on its own window, and the chain will be continuous without constraint.

Whether that is a good model depends on what it is compared with. Against the constant drop of the one current a constant is right at, exact at one current and wrong everywhere else, even six segments are a large improvement. Against the exponential itself, which is one function evaluation and exact, a table of eighteen segments is an approximation that must be searched. Its value is in what can be done with it that cannot be done with the exponential: a hand calculation on a line, a solver that needs each piece to be linear, or a circuit analysed region by region. The count says how much of that convenience a stated accuracy leaves. At a millivolt it leaves a great deal: eighteen lines is a table a person can write on one page, and three of them cover any single decade a circuit is likely to be designed around.

The segments also inherit everything the fitted parameters mean. The resistance a slow curve cannot see showed that a resistance fitted to a real curve includes the junction’s own curvature, and each segment here has a resistance that is nothing but curvature: the logarithm’s slope across its window. Reading those resistances as the part’s series resistance would be wrong by the same mechanism.

How the numbers were obtained

Each segment is a minimax fit of a drop plus a resistance to the junction’s voltage on 161 to 401 logarithmically spaced currents, with the resistance found by golden section and the drop set to the midpoint of the residuals. The pure exponential is an ideal junction with a saturation current of 10⁻¹⁴ A at 300 K. The real junction is the same two-mechanism model as the earlier essays, diffusion and recombination currents with 0.6 Ω of series resistance, solved for its voltage at each current. The greedy counts bisect each segment’s upper end in log current, thirty-two iterations. The local ideality is the logarithmic slope of the voltage over a one per cent step either side of each segment’s centre, divided by the thermal voltage.

What it leaves out

Temperature. Every segment’s drop moves with temperature at about the rate two currents with one name measured for the forward voltage, while its resistance, being a slope of a logarithm, scales with absolute temperature. A table built at one temperature is out by the drift at another, and over a working range that drift is tens of millivolts, far larger than the segment error.

Segments that are not drop-plus-resistance. A model linear in the logarithm of current would be exact for a pure exponential with one segment. The drop-plus-resistance form is linear in current because that is what a circuit solver and a hand calculation can use, and its whole cost is the curvature this page counts.

The part’s own series resistance. The real junction here carries 0.6 Ω, which begins to straighten its curve only above a few milliamps, so most of the six decades never see it. A part with more resistance, or a circuit that runs the diode higher, moves the rebate down the range and makes the top segments wider still. Above the current where the resistance dominates a single segment is nearly exact, because the curve has become the thing the segment models.

And the reverse direction, which none of these segments covers.

Still open: the table across temperature, the arithmetic it saves, and the reverse segment

The table across temperature. Each segment’s drop and resistance have different temperature coefficients. Whether a table built at one temperature can be corrected by one shift of all its drops, or whether its breakpoints must move as well, decides whether a piecewise-linear model needs one table or one per temperature, and the answer depends on how the ideality varies with temperature in each region.

What a segment saves a solver. A table of eighteen segments is searched and evaluated with a multiply and an add, where the exponential is one function call and a Newton step that can overflow. Counting the iterations a solver takes to converge on each model, on a circuit that drives the diode across six decades, would price the piecewise model in the only currency a solver cares about.

The reverse segment. Below zero bias the junction conducts a generated current that the forward segments say nothing about. A single segment for it, a conductance fitted over the reverse voltages a circuit actually applies, would complete the model, and whether one segment is enough is set by how the generated current grows with the depletion width.

Part 7 on diode model

One argument about Diode model, and one of 7 essays on it so far, each part numbered by how much of the idea it assumes. What sits either side of it:

The objects named here

The third axis, after the field and the idea: the things themselves, and every essay that touches each one.

Bulk resistanceDesign tradeoffIdeality factorLinearisationModel rangePower law fit