How many straight lines a diode is
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?
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.
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 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 in units of the segment’s lower current, the furthest point is where the curve’s slope equals it, at , and the minimax error is half the gap there:
For and an ideality of one at room temperature it gives 8.002 mV, the number the earlier essay found by searching. For a short segment, where is close to one, the bracket tends to , 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.
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.
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.
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.
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 spans a fixed number of decades, so the model needs a fixed number of segments per decade: . 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 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
- The factor the expression leaves out design tradeoff, model range, power law fit
- The product that is not the third design tradeoff, model range, power law fit
- The resistance that bends the signal design tradeoff, linearisation, model range
- Two exponentials, and where they meet design tradeoff, ideality factor, model range
- A band rather than an edge design tradeoff, model range
- How wide a null is design tradeoff, model range